18 require_once SQ_CORE_PACKAGE_PATH.
'/report/report.inc';
19 require_once SQ_CORE_PACKAGE_PATH.
'/interfaces/bridge/bridge.inc';
44 $this->_ser_attrs = TRUE;
45 parent::__construct($assetid);
58 if (!isset($this->_tmp[
'getAssetMapLinks'])) {
60 $am = $GLOBALS[
'SQ_SYSTEM']->am;
61 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
63 $report_path = $this->data_path.
'/report.xml';
64 if (!is_file($report_path))
return Array();
67 $root =
new SimpleXMLElement($report_path, LIBXML_NOCDATA, TRUE);
68 }
catch (Exception $e) {
74 foreach ($root->asset as $result) {
75 if (is_null($result->attributes()->type_code)) {
81 'assetid' => (String) $result->attributes()->assetid,
82 'short_name' => (String) $result->attributes()->short_name,
83 'name' => (String) $result->attributes()->name,
85 'type_code' => (String) $result->attributes()->type_code,
86 'status' => (String) $result->attributes()->status,
88 'link_type' => SQ_LINK_TYPE_1,
90 'sort_order' => $sort_order,
100 $this->_tmp[
'getAssetMapLinks'] = $links;
104 return $this->_tmp[
'getAssetMapLinks'];
132 public function getLinks($assetid, $link_types, $type_code=
'', $strict_type_code=TRUE, $side_of_link=
'major', $sort_by=NULL, $dependant=NULL, $exclusive=NULL)
134 assert_equals($assetid, $this->
id,
'The Safe Trash Report can only get its own links');
135 if ($dependant || $exclusive) {
139 if (!isset($this->_tmp[
'getLinks'])) {
141 $am = $GLOBALS[
'SQ_SYSTEM']->am;
142 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
143 $report_path = $this->data_path.
'/report.xml';
144 if (!is_file($report_path))
return Array();
147 $root =
new SimpleXMLElement($report_path, LIBXML_NOCDATA, TRUE);
148 }
catch (Exception $e) {
154 foreach ($root->asset as $asset) {
155 if (is_null($asset->attributes()->type_code)) {
162 'minorid' => (String) $asset->attributes()->assetid,
164 'link_type' => SQ_LINK_TYPE_1,
165 'minor_type_code' => (String) $asset->attributes()->type_code,
166 'sort_order' => $sort_order,
167 'is_dependant' =>
'0',
168 'is_exclusive' =>
'0',
175 $this->_tmp[
'getLinks'] = $links;
179 return $this->_tmp[
'getLinks'];
197 public function getParents($assetid, $type_code=
'', $strict_type_code=TRUE)
199 assert_equals($assetid, $this->
id,
'The Safe Trash Report can only get its own links');
225 public function getChildren($assetid, $type_code=
'', $strict_type_code=TRUE, $dependant=NULL, $sort_by=NULL)
227 assert_equals($assetid, $this->
id,
'The Safe Trash Report can only get its own links');
266 if (isset($this->_tmp[
'allowed_asset_map'])) {
267 return $this->_tmp[
'allowed_asset_map'];
270 $wanted_types = $this->
attr(
'types');
271 if (empty($wanted_types))
return Array();
273 $allowed_asset_map = Array();
274 foreach ($wanted_types as $allowed_parent_type => $inherit) {
275 if (trim($allowed_parent_type) ==
'') {
277 }
else if (!$inherit) {
278 $allowed_asset_map[$allowed_parent_type] = $allowed_parent_type;
280 $descendants = $GLOBALS[
'SQ_SYSTEM']->am->getTypeDescendants($allowed_parent_type, TRUE);
281 foreach ($descendants as $allowed_type) {
282 if (!isset($allowed_asset_map[$allowed_type])) {
283 $allowed_asset_map[$allowed_type] = $allowed_parent_type;
289 $this->_tmp[
'allowed_asset_map'] = $allowed_asset_map;
290 return $allowed_asset_map;
316 public function countLinks($assetid, $side_of_link=
'major', $link_types=0, $type_code=
'', $strict_type_code=TRUE, $ignore_linkid=0)
355 public function getAsset($shadowid, $type_code=
'', $mute_errors=FALSE)