17 require_once SQ_INCLUDE_PATH.
'/asset.inc';
42 $this->_ser_attrs = TRUE;
43 $this->
Asset($assetid);
61 require_once SQ_CORE_PACKAGE_PATH.
'/system/system_asset_fns.inc';
62 if (!system_asset_fns_create_pre_check($this)) {
65 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
66 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
68 if ($linkid = parent::create($link)) {
69 if (!system_asset_fns_create_cleanup($this)) {
75 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
77 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
80 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
96 return $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($this->
type(),
'name');
149 if (!SQ_IN_LIMBO)
return $null;
151 if (is_null($asset))
return $null;
157 if (!is_null($layout))
return $layout;
160 $type_code = $asset->type();
161 $layouts = $this->
attr(
'layouts');
165 if (!isset($layouts[$type_code]) || (!empty($screen) && !isset($layouts[$type_code][$screen]))) {
172 if (empty($layouts[$type_code]))
return $null;
177 foreach ($layouts[$type_code] as $screen => $assetid) {
178 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid,
'layout');
179 if (is_null($asset))
continue;
180 $layout[$screen] = $asset;
182 if (empty($layout))
return $null;
184 if (!isset($layouts[$type_code][$screen])) {
188 if (!empty($layouts[$type_code][$screen])) {
189 $layout = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($layouts[$type_code][$screen],
'layout');
209 $layouts = $this->
attr(
'layouts');
210 $ancestor_type_code =
'';
212 $ancestors = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAncestors($type_code, FALSE);
213 foreach ($ancestors as $type) {
214 if (isset($layouts[$type])) {
215 if (!empty($screen) && !isset($layouts[$type][$screen])) {
218 $ancestor_type_code = $type;
222 return (!empty($ancestor_type_code)) ? $ancestor_type_code : NULL;
239 if (is_null($asset))
return FALSE;
245 if ($layout)
return TRUE;
247 $type_code = $asset->type();
248 $layouts = $this->
attr(
'layouts');
249 if (!isset($layouts[$type_code][$screen])) {
255 if (!isset($layouts[$type_code][$screen])) {
283 $layout_def =
'layout::'.$asset->type().
'::'.$screen;
284 $layouts = $asset->getLookupValues(TRUE, $layout_def);
285 $url = preg_replace(
'|^https?://|',
'', $asset->getURL());
287 if (!empty($layouts)) {
289 if (isset($layouts[$url][$layout_def][
'value']) && !empty($layouts[$url][$layout_def][
'value'])) {
290 $layout = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($layouts[$url][$layout_def][
'value']);
293 if (is_null($layout)) {
316 $layout = $asset->getLookupValues(TRUE,
'layout::'.$asset->type().
'::'.$screen);
318 if (!empty($layout))
return TRUE;