Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
soap_api_asset_service.inc
1 <?php
18 require_once SQ_PACKAGES_PATH.'/web_services/api/soap_api/soap_api.inc';
19 require_once SQ_PACKAGES_PATH.'/web_services/api/soap_api_file_retrieval_service/soap_api_file_retrieval_service.inc';
20 require_once SQ_LIB_PATH.'/html_form/html_form.inc';
21 
33 class Soap_Api_Asset_Service extends Soap_Api
34 {
35 
36 
43  function __construct($assetid=0)
44  {
45  parent::__construct($assetid);
46 
47  }//end constructor
48 
49 
57  public function getFunctionList()
58  {
59  return Array(
60  'CreateAsset' => '1',
61  'CloneAsset' => '1',
62  'GetAllStatuses' => '1',
63  'GetAsset' => '1',
64  'GetAssetFromURL' => '1',
65  'GetAssetTypeAttribute' => '1',
66  'GetAssetTypeDescendants' => '1',
67  'GetAssetsInfo' => '1',
68  'GetAttributeValuesByName' => '1',
69  'GetAssetAvailableKeywords' => '1',
70  'GetAssetAvailableStatuses' => '1',
71  'GetAssetWebPaths' => '1',
72  'GetAssetURLs' => '1',
73  'GetPageContents' => '1',
74  'SetAttributeValue' => '1',
75  'SetTag' => '1',
76  'SetAssetStatus' => '1',
77  'SetAssetWebPaths' => '1',
78  'TrashAsset' => '1',
79  'LoginUser' => '1',
80  'GetUserIdByUsername' => '1',
81  );
82 
83  }//end getFunctionList()
84 
85 
109  function CreateAsset($request)
110  {
111  $request_info = (Array) $request;
112  $parentid = array_get_index($request_info, 'ParentID', '');
113  $type_code = array_get_index($request_info, 'TypeCode', '');
114  $type_code = strtolower($type_code);
115  $asset_name = array_get_index($request_info, 'Name', '');
116  $link_type = array_get_index($request_info, 'LinkType', '1');
117  $link_value = array_get_index($request_info, 'LinkValue', '');
118  $sort_order = array_get_index($request_info, 'SortOrder', -1);
119  $is_dependant = array_get_index($request_info, 'IsDependant', '0');
120  $is_exclusive = array_get_index($request_info, 'IsExclusive', '0');
121  $file_content = array_get_index($request_info, 'FileContentBase64', '');
122  $file_name = array_get_index($request_info, 'FileName', '');
123  $attributes = array_get_index($request_info, 'AttributeInfo', Array());
124 
125  $parent_asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($parentid);
126 
127  $GLOBALS['SQ_SYSTEM']->am->includeAsset($type_code);
128  $object_name = str_replace(' ', '_', ucwords(str_replace('_', ' ', $type_code)));
129  $asset = new $object_name();
130 
131  if(isset($attributes->AttributeName)) {
132  // Set single attribute value
133  $asset->setAttrValue($attributes->AttributeName, $attributes->AttributeValue);
134  }
135  else {
136  // Set attribute values for the new asset
137  foreach ($attributes as $attribute_info) {
138  $attribute_info = (Array) $attribute_info;
139  $asset->setAttrValue($attribute_info['AttributeName'], $attribute_info['AttributeValue']);
140  }
141  }
142 
143  $request_info['asset'] = $parent_asset;
144 
145  $link_info = Array (
146  'asset' => $parent_asset,
147  'name' => $asset_name,
148  'link_type' => $link_type,
149  'value' => $link_value,
150  'sort_order' => $sort_order,
151  'is_dependant' => $is_dependant,
152  'is_exclusive' => $is_exclusive,
153  );
154 
155 
156  // Create a file asset
157  $type_ancestors = $asset->getTypeAncestors(FALSE);
158  if(!empty($file_name) && !empty($file_content) && (in_array('file', $type_ancestors) || $type_code === 'file')) {
159  $tmp_file_name = Soap_Api_File_Retrieval_Service::getRandomFilename($file_name);
160  // We are going to write to the Matrix Data tmp dir
161  $destination_file = SQ_DATA_PATH.'/temp/'.$tmp_file_name;
162  while (file_exists($destination_file)) {
163  sleep(1);
164  $tmp_file_name = Soap_Api_File_Retrieval_Service::getRandomFilename($file_name);
165  }//end if
166  file_put_contents($destination_file, base64_decode($file_content));
167  require_once SQ_FUDGE_PATH.'/general/file_system.inc';
168  $file_type = get_file_type($file_name);
169  $info = Array (
170  'name' => $file_name,
171  'type' => $file_type,
172  'tmp_name' => $destination_file,
173  'non_uploaded_file' => TRUE,
174  'error' => 0,
175  'size' => filesize($destination_file),
176  );
177  $asset->_tmp['uploading_file'] = 1;
178  $asset->setAttrValue('title', $asset_name);
179  $linkid = $asset->create($link_info, $info);
180 
181  // Remove the tmp file before we return
182  if (file_exists($destination_file)) {
183  unlink($destination_file);
184  }//end if
185 
186  }
187  // Create a normal asset
188  else {
189  // Not all assets have 'name' attribute, e.g. user asset
190  if (isset($asset->vars['name']) && ($asset_name != '')) {
191  $asset->setAttrValue('name', $asset_name);
192  }
193  $linkid = $asset->create($link_info);
194  }
195 
196 
197  if ($linkid) {
198  return Array (
199  'CreateMessage' => 'Asset was created successfully. Link id #'.$linkid,
200  'NewAssetID' => $asset->id,
201  'LinkID' => $linkid,
202  );
203  }//end if
204 
205  throw new SoapFault('Server', 'Unable to create asset');
206 
207  }//end CreateAsset()
208 
209 
223  function GetAsset($request)
224  {
225  $request_info = (Array) $request;
226  $assetid = array_get_index($request_info, 'AssetID', '');
227  if (!empty($assetid)) {
228  $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
229  $asset_xml = '';
230 
231  if (!is_null($asset)) {
232  foreach ($asset->vars as $attr_name => $attr_info) {
233  if ($attr_info['type'] == 'password') {
234  unset($asset->vars[$attr_name]);
235  }
236  }
237  $asset_xml = self::objectToXML($asset);
238  }//end if
239 
240  return Array (
241  'GetAssetResult' => $asset_xml,
242  );
243  } else {
244  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
245  }//end else
246 
247  }//end GetAsset()
248 
249 
258  private static function objectToXML($object)
259  {
260  $object_xml = NULL;
261  foreach ($object as $key => $value) {
262  // apply xml element naming rules
263  $key = preg_replace('/\s+/', '', $key);
264  if (empty($key)) continue;
265  if(preg_match('/^xml$/i', $key)) continue;
266  if (is_numeric($key)) {
267  $key = '_'.$key;
268  }
269 
270  if (empty($value)) {
271  $object_xml .= '<'.$key.' />';
272  } else {
273  $object_xml .= '<'.$key.'>';
274  if (is_array($value) || is_object($value)) {
275  $object_xml .= self::objectToXML($value);
276  } else {
277  $object_xml .= '<![CDATA['.$value.']]>';
278  }//end else
279  $object_xml .= '</'.$key.'>';
280  }//end else
281  }//end foreach
282  if (is_object($object)) {
283  $root_element_name = get_class($object);
284  $object_xml = '<'.$root_element_name.'>'.$object_xml.'</'.$root_element_name.'>';
285  }//end if
286 
287  return $object_xml;
288 
289  }//end if
290 
291 
306  function GetAssetURLs($request)
307  {
308  $request_info = (Array) $request;
309  $assetid = array_get_index($request_info, 'AssetID', '');
310  $root_path_id = array_get_index($request_info, 'RootPathAssetID', '');
311 
312  if (!empty($assetid)) {
313  if (!empty($root_path_id)) {
314  $root_path_url = $GLOBALS['SQ_SYSTEM']->am->getAssetURL($root_path_id);
315  $assetUrls = $GLOBALS['SQ_SYSTEM']->am->getAssetURL($assetid, $root_path_url);
316  return Array (
317  'GetAssetURLsResult' => Array($assetUrls),
318  );
319  } else {
320  $urls_info = $GLOBALS['SQ_SYSTEM']->am->getURLs($assetid);
321  $urls = Array();
322  foreach ($urls_info as $info) {
323  $protocol = '';
324  if ($info['http'] == '1') {
325  $urls[] = 'http://'.$info['url'];
326  }//end if
327  if ($info['https'] == '1') {
328  $urls[] = 'https://'.$info['url'];
329  }//end if
330  }//end foreach
331  return Array (
332  'GetAssetURLsResult' => $urls,
333  );
334  }//end else
335  } else {
336  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
337  }//end else
338 
339  }//end GetAssetURLs()
340 
341 
356  function GetAssetFromURL($request)
357  {
358  $request_info = (Array) $request;
359  $url = array_get_index($request_info, 'URL', '');
360  if (!empty($url)) {
361  $pattern = '#(http://|https://|^)#';
362  $url_split = preg_split($pattern, $url, -1, PREG_SPLIT_DELIM_CAPTURE);
363  $protocol = rtrim($url_split[1], '://');
364  $main_url = $url_split[2];
365 
366  $asset = $GLOBALS['SQ_SYSTEM']->am->getAssetFromURL($protocol, $main_url, TRUE, TRUE);
367  $asset_xml = '';
368  if (!is_null($asset)) {
369  $asset_xml = self::objectToXML($asset);
370  }//end if
371  return Array (
372  'GetAssetFromURLResult' => $asset_xml,
373  );
374  } else {
375  throw new SoapFault('Server', 'The URL must not be empty');
376  }//end else
377 
378  }//end GetAssetFromURL()
379 
380 
395  function GetAssetAvailableStatuses($request)
396  {
397  $request_info = (Array) $request;
398  $assetid = array_get_index($request_info, 'AssetID', '');
399  if (!empty($assetid)) {
400  $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
401  $statuses = $asset->getAvailableStatii();
402  $return_statuses = Array();
403  $i = 0;
404  foreach ($statuses as $status_val => $description) {
405  $return_statuses[$i]['StatusValue'] = $status_val;
406  $return_statuses[$i]['StatusDescription'] = $description;
407  $i++;
408  }//end foreach
409 
410  return Array (
411  'GetAssetAvailableStatusesResult' => $return_statuses,
412  );
413  } else {
414  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
415  }//end else
416 
417  }//end GetAssetAvailableStatuses()
418 
419 
436  function SetAttributeValue($request)
437  {
438  $request_info = (Array) $request;
439  $assetid = array_get_index($request_info, 'AssetID', '');
440  $attr_name = array_get_index($request_info, 'AttributeName', '');
441  $attr_val = array_get_index($request_info, 'AttributeValue', '');
442  if (!empty($assetid) && !empty($attr_name) && !empty($attr_val)) {
443  $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
444  $GLOBALS['SQ_SYSTEM']->am->acquireLock($assetid, 'attributes');
445  $asset->setAttrValue($attr_name, $attr_val);
446  $asset->saveAttributes();
447  $GLOBALS['SQ_SYSTEM']->am->releaseLock($assetid, 'attributes');
448 
449  $GLOBALS['SQ_SYSTEM']->am->forgetAsset($asset);
450  $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
451  $new_val = $asset->attr($attr_name);
452 
453  return Array (
454  'SetAttributeValueResult' => $new_val,
455  );
456  } else {
457  throw new SoapFault('Server', 'Please make sure to provide AssetID, AttributeName and AttributeValue');
458  }//end else
459 
460  }//end SetAttributeValue()
461 
462 
477  function TrashAsset($request)
478  {
479  $request_info = (Array) $request;
480  $assetid = array_get_index($request_info, 'AssetID', '');
481  if (!empty($assetid)) {
482  $already_in_trash = $GLOBALS['SQ_SYSTEM']->am->assetInTrash($assetid, TRUE);
483 
484  $GLOBALS['SQ_SYSTEM']->am->acquireLock($assetid, 'all');
485  if ($already_in_trash) {
486  throw new SoapFault('Server', 'Asset is already in trash');
487  } else {
488  $result = $GLOBALS['SQ_SYSTEM']->am->trashAsset($assetid);
489  if ($result) {
490  $del_asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
491  $del_asset->updateLookups();
492  $GLOBALS['SQ_SYSTEM']->am->forgetAsset($del_asset);
493  }
494  }//end else
495  $GLOBALS['SQ_SYSTEM']->am->releaseLock($assetid, 'all');
496 
497  return Array (
498  'TrashAssetResult' => $result,
499  );
500  } else {
501  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
502  }//end else
503 
504  }//end TrashAsset()
505 
506 
524  function CloneAsset($request)
525  {
526  // There is a know issue here while executing a long request, if the number of clones are too many
527  // then the client will timeout as the server is still processing the request, the way to fix it is
528  // to increase the default_socket_timeout in php.ini from 60(secs) to which ever threshold needed.
529 
530  $request_info = (Array) $request;
531  $assetid = array_get_index($request_info, 'AssetID', '');
532  $new_parent_id = array_get_index($request_info, 'NewParentID', '');
533  $clone_num = array_get_index($request_info, 'NumberOfClone', 1);
534  $new_position = array_get_index($request_info, 'PositionUnderNewParent', -1);
535  $link_type = array_get_index($request_info, 'LinkType', 1);
536  if (!empty($assetid) && !empty($new_parent_id)) {
537  $hh = $GLOBALS['SQ_SYSTEM']->getHipoHerder();
538  $running_vars = Array (
539  'assets' => Array (
540  $assetid => Array (
541  'number_of_clones' => 1,
542  ),
543  ),
544  'to_parent_assetid' => $new_parent_id,
545  'to_parent_pos' => $new_position,
546  'link_type' => $link_type,
547  'value' => '',
548  );
549 
550  $all_errors = Array();
551  for ($i = 0; $i < $clone_num; $i++) {
552  // Need to reset the running vars again as it is passed by reference to the hipo job
553  $running_vars_copy = $running_vars;
554  $errors = $hh->freestyleHipo('hipo_job_clone_assets', $running_vars_copy);
555 
556  $all_errors += $errors;
557  }//end for
558  if (empty($all_errors)) {
559  $result = 'Asset Cloned';
560  return Array (
561  'CloneAssetResult' => $result,
562  );
563  } else {
564  throw new SoapFault('Server', 'Unable To Clone Asset');
565  }
566 
567  } else {
568  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
569  }//end else
570 
571  }//end CloneAsset()
572 
573 
589  function GetAssetTypeAttribute($request)
590  {
591  $request_info = (Array) $request;
592  $type_code = array_get_index($request_info, 'TypeCode', '');
593  $details = array_get_index($request_info, 'AttributeDetail', Array ('name', 'type'));
594 
595  if (!is_array($details)) $details = Array($details);
596  //need to group by 'name' field so make sure its first.
597  if (!in_array('name', $details)) {
598  array_unshift($details, 'name');
599  } else {
600  if (count($details) == 1){
601  $details = Array ('name', 'type');//need atleast two so we can still group by 'name'.
602  } else if ($details[0] != 'name'){
603  $details = array_diff($details, Array('name'));
604  array_unshift($details, 'name');
605  }
606  }
607 
608  if (!empty($type_code)) {
609  $attribute_details = $GLOBALS['SQ_SYSTEM']->am->getAssetTypeAttributes($type_code, $details);
610  $i = 0;
611  $final_attribute_results = Array();
612  foreach ($attribute_details as $attribute_name => $attribute_type_info) {
613  $final_attribute_results[$i]['AttributeName'] = $attribute_name;
614  if (isset($attribute_type_info['attrid'])) {
615  $final_attribute_results[$i]['AttributeID'] = $attribute_type_info['attrid'];
616  }//end if
617  if (isset($attribute_type_info['type_code'])) {
618  $final_attribute_results[$i]['AttributeTypeCode'] = $attribute_type_info['type_code'];
619  }//end if
620  if (isset($attribute_type_info['type'])) {
621  $final_attribute_results[$i]['AttributeType'] = $attribute_type_info['type'];
622  }//end if
623  if (isset($attribute_type_info['owning_type_code'])) {
624  $final_attribute_results[$i]['AttributeOwningTypeCode'] = $attribute_type_info['owning_type_code'];
625  }//end if
626  if (isset($attribute_type_info['parameters_type_code'])) {
627  $final_attribute_results[$i]['AttributeParametersTypeCode'] = $attribute_type_info['parameters_type_code'];
628  }//end if
629  if (isset($attribute_type_info['parameters_val'])) {
630  $final_attribute_results[$i]['AttributeParametersValue'] = $attribute_type_info['parameters_val'];
631  }//end if
632  if (isset($attribute_type_info['default_type_code'])) {
633  $final_attribute_results[$i]['AttributeDefaultTypeCode'] = $attribute_type_info['default_type_code'];
634  }//end if
635  if (isset($attribute_type_info['default_val'])) {
636  $final_attribute_results[$i]['AttributeDefaultValue'] = $attribute_type_info['default_val'];
637  }//end if
638  if (isset($attribute_type_info['description'])) {
639  $final_attribute_results[$i]['AttributeDescription'] = $attribute_type_info['description'];
640  }//end if
641  if (isset($attribute_type_info['is_admin'])) {
642  $final_attribute_results[$i]['AttributeIsAdmin'] = $attribute_type_info['is_admin'];
643  }//end if
644  if (isset($attribute_type_info['uniq'])) {
645  $final_attribute_results[$i]['AttributeUnique'] = $attribute_type_info['uniq'];
646  }//end if
647  $i++;
648  }//end foreach
649 
650  return Array (
651  'GetAssetTypeAttributeResult' => $final_attribute_results,
652  );
653  } else {
654  throw new SoapFault('Server', 'Type code is not valid. Please provide a valid type code');
655  }//end else
656 
657  }//end GetAssetTypeAttribute()
658 
659 
665  function GetAssetTypeDescendants($request)
666  {
667  $request_info = (Array) $request;
668  $typecode = array_get_index($request_info, 'TypeCode', '');
669  if (!empty($typecode)) {
670  $descendantTypes = $GLOBALS['SQ_SYSTEM']->am->getTypeDescendants($typecode);
671 
672  return Array (
673  'GetAssetTypeDescendantsResult' => $descendantTypes,
674  );
675  } else {
676  throw new SoapFault('Server', 'TypeCode is not valid. Please provide a valid TypeCode');
677  }//end else
678 
679  }//end GetAssetTypeDescendants()
680 
681 
688  function GetAssetsInfo($request)
689  {
690  $request_info = (Array) $request;
691  $assetids = array_get_index($request_info, 'AssetIDs', '');
692  $attr_names = array_get_index($request_info, 'FinderAttributes', '');
693  $root_assetid = array_get_index($request_info, 'RootNode', '');
694 
695  if (!is_array($attr_names)) {
696  $attr_names = Array($attr_names);
697  }//end if
698  if (!is_array($assetids)) {
699  $assetids = Array($assetids);
700  }//end if
701 
702  if (!empty($assetids) && !empty($attr_names)) {
703  $assetsInfo = Array();
704  if (in_array('children', $attr_names) === TRUE) {
705  foreach ($assetids as $assetid) {
706  $links = $GLOBALS['SQ_SYSTEM']->am->getLinks($assetid, SQ_SC_LINK_BACKEND_NAV, '', TRUE, 'major', NULL, NULL, NULL, 'sort_order');
707  $assetsInfo[$assetid]['AssetChildren'] = Array();
708  foreach ($links as $link_info) {
709  $assetsInfo[$assetid]['AssetChildren'][] = $link_info['minorid'];
710  }//end foreach
711  }//end foreach
712  }//end if
713 
714  $type_codes_ancestor = array();
715 
716  $info_results = $GLOBALS['SQ_SYSTEM']->am->getAssetInfo($assetids);
717  foreach ($info_results as $assetid => $result) {
718  if (in_array('lineage', $attr_names) === TRUE) {
719  $treeids = NULL;
720  if (!empty($root_assetid)) {
721  $root_links = $GLOBALS['SQ_SYSTEM']->am->getLinks($root_assetid, SQ_LINK_TYPE_1, '', TRUE, 'minor');
722  foreach($root_links as $link) {
723  $treeid_info = $GLOBALS['SQ_SYSTEM']->am->getLinkTreeid($link['linkid']);
724  $treeid = $treeid_info[$link['linkid']][0];
725  $treeids[] = $treeid;
726  }//end if
727  }//end if
728 
729  $lineages = $GLOBALS['SQ_SYSTEM']->am->getLinkLineages($assetid, 0, $treeids);
730  $lineages_result = array();
731  foreach ($lineages as $lineage_info) {
732  $lineage_details = array();
733  $lineage_details['LinkID'] = $lineage_info['linkid'];
734  $lineage_details['LinkType'] = $lineage_info['link_type'];
735  $order = 0;
736  foreach ($lineage_info['lineage'] as $parentid => $parent_name) {
737  $one_lineage = array();
738  $one_lineage['AssetID'] = $parentid;
739  $one_lineage['AssetName'] = $parent_name;
740  $one_lineage['Order'] = $order;
741  $lineage_details['Lineage'][] = $one_lineage;
742  $order++;
743  }//end foreach
744  //$lineage_details['Lineage'] = $lineage['lineage'];
745  $lineages_result[] = $lineage_details;
746  }//end foreach
747  $assetsInfo[$assetid]['AssetLineage'] = $lineages_result;
748  }//end if
749 
750  if (isset($type_codes_ancestor[$result['type_code']]) === TRUE) {
751  $ancestor = $type_codes_ancestor[$result['type_code']];
752  } else {
753  $ancestor = array_pop($GLOBALS['SQ_SYSTEM']->am->getTypeAncestors($result['type_code'], FALSE));
754  $type_codes_ancestor[$result['type_code']] = $ancestor;
755  }//end if
756 
757  $assetsInfo[$assetid]['AssetType'] = $result['type_code'];
758  $assetsInfo[$assetid]['AssetTypeAncestor'] = $ancestor;
759 
760  $assetsInfo[$assetid]['AssetName'] = $result['name'];
761  if ($ancestor !== 'file') {
762  if (isset($result['short_name']) === TRUE) {
763  $assetsInfo[$assetid]['AssetName'] = $result['short_name'];
764  }//end if
765  }//end if
766 
767  $assetsInfo[$assetid]['AssetID'] = $assetid;
768  }//end foreach
769 
770  return Array (
771  'GetAssetsInfoResult' => array_values($assetsInfo),
772  );
773  } else {
774  throw new SoapFault('Server', 'Please provide assetids and finder attributes.');
775  }//end else
776 
777  }//end GetAssetsInfo()
778 
779 
795  function GetAssetAvailableKeywords($request)
796  {
797  $request_info = (Array) $request;
798  $assetid = array_get_index($request_info, 'AssetID', '');
799  $type_code = array_get_index($request_info, 'TypeCode', '');
800 
801  if (!empty($assetid) || !empty($type_code)) {
802  if(!empty($assetid)) {
803  $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
804  $keywords = $asset->getAvailableKeywords();
805  }
806  else if (!empty($type_code)) {
807  $object_name = str_replace(' ', '_', ucwords(str_replace('_', ' ', $type_code)));
808  $GLOBALS['SQ_SYSTEM']->am->includeAsset($object_name);
809  $dummy_asset = new $object_name();
810  $keywords = $dummy_asset->getAvailableKeywords();
811  unset($dummy_asset);
812  }
813 
814  return Array (
815  'GetAssetAvailableKeywordsResult' => array_keys($keywords),
816  );
817  } else {
818  throw new SoapFault('Server', 'Asset ID or Type Code is not valid. Please provide a valid Asset ID or Type Code');
819  }//end else
820 
821  }//end GetAssetAvailableKeywords()
822 
823 
838  function GetAssetWebPaths($request)
839  {
840  $request_info = (Array) $request;
841  $assetid = array_get_index($request_info, 'AssetID', '');
842  if (!empty($assetid)) {
843  $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
844  $web_path = $asset->getWebPaths();
845  return Array (
846  'GetAssetWebPathsResult' => $web_path,
847  );
848  } else {
849  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
850  }//end else
851 
852  }//end GetAssetWebPaths()
853 
854 
861  function GetPageContents($request)
862  {
863  $request_info = (Array) $request;
864  $assetid = array_get_index($request_info, 'AssetID', '');
865  $root_path_id = array_get_index($request_info, 'RootNodeID', '');
866  if (!empty($assetid)) {
867  $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
868  $descendantTypes = $GLOBALS['SQ_SYSTEM']->am->getTypeAncestors($asset->type());
869  if (in_array('page', $descendantTypes)) {
870  $root_path_url = $GLOBALS['SQ_SYSTEM']->am->getAssetURL($root_path_id);
871  $pro_asset_url = $GLOBALS['SQ_SYSTEM']->am->getAssetURL($assetid, $root_path_url);
872  $asset_url = preg_replace('/http[s]?:\/\//i', '', $pro_asset_url);
873  $web_paths = $asset->getWebPaths();
874  $final_path = array_pop($web_paths);
875  foreach ($web_paths as $path) {
876  $pattern = '/\/'.$path.'$/';
877  preg_match($pattern, $url, $matches);
878  if (!empty($matches)) {
879  $final_path = $path;
880  break;
881  }//end if
882  }//end foreach
883 
884  $layout_id = $GLOBALS['SQ_SYSTEM']->am->getValueFromURL($asset_url, 'paint_layout::system::frontend');
885  ob_start();
886  $asset->printBodyWithPaintLayout($layout_id);
887  $content = ob_get_contents();
888  ob_end_clean();
889 
890  // The remaining keywords, just clean them up because they didnt get replaced.
891  $GLOBALS['SQ_SYSTEM']->replaceKeyword($content);
892  return Array (
893  'PageContent' => $content,
894  'PageURL' => $pro_asset_url,
895  'PageWebPath' => $final_path,
896  );
897  } else {
898  throw new SoapFault('Server', 'This asset is not of type page');
899  }//end if
900 
901  } else {
902  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
903  }//end if
904 
905  }//end GetPageContents()
906 
907 
924  function GetAttributeValuesByName($request)
925  {
926  $request_info = (Array) $request;
927  $assetids = array_get_index($request_info, 'AssetIDs', '');
928  $attr_name = array_get_index($request_info, 'AttributeName', '');
929  $type_code = array_get_index($request_info, 'TypeCode', '');
930  if (!empty($assetids) && !empty($attr_name) && !empty($type_code)) {
931  if (is_string($assetids) === TRUE) $assetids = array($assetids);
932  $attribute_values = $GLOBALS['SQ_SYSTEM']->am->getAttributeValuesByName($attr_name, $type_code, $assetids);
933  $final_attribute_values = Array();
934  $i = 0;
935  foreach ($attribute_values as $assetid => $attribute_value) {
936  $final_attribute_values[$i]['AssetID'] = $assetid;
937  $final_attribute_values[$i]['AttributeValue'] = $attribute_value;
938  $i++;
939  }//end foreach
940  return Array (
941  'GetAttributeValuesByNameResult' => $final_attribute_values,
942  );
943  } else {
944  throw new SoapFault('Server', 'Make sure to provide AssetIDs, Attribute Name, and Asset Type Code');
945  }//end else
946 
947  }//end GetAttributeValuesByName()
948 
949 
968  function SetTag($request)
969  {
970  $request_info = (Array) $request;
971  $assetid = array_get_index($request_info, 'AssetID', '');
972  $thesaurus_id = array_get_index($request_info, 'ThesaurusID', '');
973  $tag_name = array_get_index($request_info, 'TagName', '');
974  $weight = array_get_index($request_info, 'Weight', '1');
975  $cascade = array_get_index($request_info, 'CascadeTagChange', 0);
976  if (!empty($assetid)) {
977  $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
978  $tag_manager = $GLOBALS['SQ_SYSTEM']->getTagManager();
979  $restrict_tag_source = $tag_manager->attr('restrict_tag_source');
980  $tagging_thesaurus = $tag_manager->attr('thesaurus');
981  if ($restrict_tag_source) {
982  if ($thesaurus_id != $tagging_thesaurus) {
983  throw new SoapFault('Server', 'Tag Source Restriction is enabled. The provided thesaurus can not be used to tag.');
984  }//end if
985  }//end if
986 
987  $thesaurus = $GLOBALS['SQ_SYSTEM']->am->getAsset($thesaurus_id);
988  $tag_id = $thesaurus->getTermIdByName($tag_name);
989 
990  if ($cascade) {
991  $hh = $GLOBALS['SQ_SYSTEM']->getHipoHerder();
992  $tag_vars = Array();
993  $tag_vars[] = Array (
994  'tag_id' => $thesaurus_id.':'.$tag_id,
995  'action' => 'add',
996  'weight' => $weight,
997  );
998  $vars = Array (
999  'assets' => Array (
1000  $asset->id => Array (
1001  'type_code' => $asset->type(),
1002  ),
1003  ),
1004  'tag_changes' => $tag_vars,
1005  );
1006  $errors = $hh->freestyleHipo('hipo_job_edit_tags', $vars);
1007  } else {
1008  $errors = $tag_manager->setTag($assetid, $thesaurus_id.':'.$tag_id, $weight);
1009  if ($errors) $errors = NULL;
1010  }//end else
1011 
1012  if (empty($errors)) {
1013  return Array (
1014  'SetTagResult' => TRUE,
1015  );
1016  } else {
1017  throw new SoapFault('Server', 'Unable to tag asset');
1018  }//end else
1019  } else {
1020  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
1021  }//end else
1022 
1023  }//end SetTagByName()
1024 
1025 
1034  function GetAllStatuses($request)
1035  {
1036  // We are not asking for any input, we are just going to return all the status in the system
1037  require_once SQ_INCLUDE_PATH.'/general_occasional.inc';
1038  $status_names = get_status_names();
1039  $return_statuses = Array();
1040  $i = 0;
1041  foreach ($status_names as $status_val => $description) {
1042  $return_statuses[$i]['StatusValue'] = $status_val;
1043  $return_statuses[$i]['StatusDescription'] = $description;
1044  $i++;
1045  }//end foreach
1046  return Array (
1047  'GetAllStatusesResult' => $return_statuses,
1048  );
1049 
1050  }//end GetAllStatus()
1051 
1052 
1061  function LoginUser($request)
1062  {
1063  $request_info = (Array) $request;
1064  $username = array_get_index($request_info, 'Username', '');
1065  $password = array_get_index($request_info, 'Password', '');
1066 
1067  $auth_folder = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('authentication_folder');
1068  if (is_null($auth_folder)) {
1069  trigger_localised_error('SYS0249', E_USER_ERROR);
1070  return;
1071  }
1072  $auth_systems = $auth_folder->getAuthSystems();
1073  // try each auth system in order to see if we can load a user asset
1074  $user = NULL;
1075  $user_status = NULL;
1076  foreach ($auth_systems as $systemid) {
1077  $system = $GLOBALS['SQ_SYSTEM']->am->getAsset($systemid);
1078  if (is_null($system)) continue;
1079  $user = $system->authenticateUser($username, $password);
1080  if (!is_null($user)) $user_status = $user->status;
1081  // check that the user exists AND that it can login
1082  // (ie. it is not yet live, or has been locked)
1083  if (!is_null($user) && $user->canLogin()) {
1084  $GLOBALS['SQ_SYSTEM']->loginUser($user);
1085  break;
1086  }//end if
1087  }
1088 
1089 
1090  if ($user === NULL) {
1091  // We couldn't find a user to login as.
1092  return Array (
1093  'SessionID' => '',
1094  'SessionKey' => '',
1095  );
1096  }
1097 
1098 
1099  $session_id = session_id();
1100  $session_key = $GLOBALS['SQ_SYSTEM']->getUniqueSOAPSessionKey();
1101  $_SESSION['activated'] = 0;
1102 
1103  return Array (
1104  'SessionID' => $session_id,
1105  'SessionKey' => $session_key,
1106  );
1107 
1108  }//end LoginUser()
1109 
1110 
1119  function GetUserIdByUsername($request)
1120  {
1121  $request_info = (Array) $request;
1122  $username = array_get_index($request_info, 'Username', '');
1123 
1124  $auth_folder = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('authentication_folder');
1125  if (is_null($auth_folder)) {
1126  trigger_localised_error('SYS0249', E_USER_ERROR);
1127  return;
1128  }
1129  $auth_systems = $auth_folder->getAuthSystems();
1130 
1131  // try each auth system in order to see if we can load a user asset
1132  $user = NULL;
1133  foreach ($auth_systems as $systemid) {
1134  $system = $GLOBALS['SQ_SYSTEM']->am->getAsset($systemid);
1135  if (is_null($system)) continue;
1136 
1137  $user = $system->locateUser($username);
1138  if (!is_null($user)) break;
1139  }
1140 
1141 
1142  if (is_null($user)) {
1143  $assetid = '';
1144  } else {
1145  $assetid = $user->id;
1146  }
1147 
1148  return Array('AssetID' => $assetid);
1149 
1150  }//end GetUserIdByUsername()
1151 
1152 
1169  function SetAssetStatus($request)
1170  {
1171  $request_info = (Array) $request;
1172  $assetid = array_get_index($request_info, 'AssetID', '');
1173  $status = array_get_index($request_info, 'StatusValue', '');
1174  $dependants_only = array_get_index($request_info, 'DependantsOnly', TRUE);
1175 
1176  if (!empty($assetid)) {
1177  $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
1178  $statuses = $asset->getAvailableStatii();
1179 
1180  if(!isset($statuses[$status])) {
1181  throw new SoapFault('Server', $status.' is not a valid status of the asset');
1182  }
1183 
1184  $running_vars = Array (
1185  'assetid' => $assetid,
1186  'new_status' => $status,
1187  'dependants_only' => $dependants_only,
1188  );
1189 
1190  $hh = $GLOBALS['SQ_SYSTEM']->getHipoHerder();
1191  $errors = $hh->freestyleHipo('hipo_job_edit_status', $running_vars);
1192  if (empty($errors)) {
1193  return Array (
1194  'SetAssetStatusResult' => TRUE,
1195  );
1196  } else {
1197  throw new SoapFault('Server', 'Unable to set asset status');
1198  }//end else
1199  } else {
1200  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
1201  }//end else
1202 
1203  }//end SetAssetStatus()
1204 
1205 
1220  function SetAssetWebPaths($request)
1221  {
1222  $request_info = (Array) $request;
1223  $assetid = array_get_index($request_info, 'AssetID', '');
1224  if (!empty($assetid)) {
1225  $path = array_get_index($request_info, 'Path', Array());
1226  if(!is_array($path)) $path = Array($path);
1227  $addRemaps = array_get_index($request_info, 'AddRemaps', TRUE);
1228 
1229  $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
1230  $result = $asset->saveWebPaths($path, $addRemaps);
1231  return Array (
1232  'SetAssetWebPathsResult' => $result,
1233  );
1234  } else {
1235  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
1236  }//end else
1237 
1238  }//end SetAssetWebPaths()
1239 
1240 
1247  public static function getComplexElements($func_list=Array())
1248  {
1249  $asset_type = self::getArgType('AssetType', 1, 1);
1250  $asset_types = self::getArgType('AssetType', 0, 'unbounded');
1251  $attribute_info = self::getArgType('AttributeInfo', 0, 'unbounded', TRUE);
1252  $attribute_detail = self::getArgType('AttributeDetail', 0, 'unbounded', TRUE);
1253  $attribute_properties = self::getArgType('AttributeProperty', 0, 'unbounded', TRUE);
1254  $attribute_values_by_name_result = self::getArgType('AttributeValueInfo', 0, 'unbounded', TRUE);
1255  $keywords = self::$string_optional_unbounded;
1256  $statuses_des_val = self::getArgType('StatusDescription', 0, 'unbounded', TRUE);
1257  $asset_finder_info = self::getArgType('AssetFinderInfo', 0, 'unbounded', TRUE);
1258  $urls = self::$string_optional_unbounded;
1259  $link_type = self::getArgType('LinkType', 0, 1);
1260  $asset_info = self::getArgType('AssetInfo', 0, 1);
1261 
1262  $complex_types = Array (
1263  'CreateAsset' => Array (
1264  'CreateAsset' => Array (
1265  'TypeCode' => $asset_type,
1266  'Name' => self::$string_optional,
1267  'ParentID' => self::$string_non_optional,
1268  'LinkType' => $link_type,
1269  'LinkValue' => self::$string_optional,
1270  'SortOrder' => self::$int_optional,
1271  'IsDependant' => self::$string_optional,
1272  'IsExclusive' => self::$string_optional,
1273  'FileName' => self::$string_optional,
1274  'FileContentBase64' => self::$string_optional,
1275  'AttributeInfo' => $attribute_info,
1276  ),
1277  'CreateAssetResponse' => Array (
1278  'NewAssetID' => self::$string_optional,
1279  'CreateMessage' => self::$string_optional,
1280  ),
1281  ),
1282  'GetAsset' => Array (
1283  'GetAsset' => Array (
1284  'AssetID' => self::$string_non_optional,
1285  ),
1286  'GetAssetResponse' => Array (
1287  'GetAssetResult' => self::$string_optional,
1288  ),
1289  ),
1290  'GetAssetURLs' => Array (
1291  'GetAssetURLs' => Array (
1292  'AssetID' => self::$string_non_optional,
1293  'RootPathAssetID' => self::$string_optional,
1294  ),
1295  'GetAssetURLsResponse' => Array (
1296  'GetAssetURLsResult'=> $urls,
1297  ),
1298  ),
1299  'GetAssetFromURL' => Array (
1300  'GetAssetFromURL' => Array (
1301  'URL' => self::$string_non_optional,
1302  ),
1303  'GetAssetFromURLResponse'=> Array (
1304  'GetAssetFromURLResult' => self::$string_optional,
1305  ),
1306  ),
1307  'GetAssetAvailableStatuses' => Array (
1308  'GetAssetAvailableStatuses' => Array (
1309  'AssetID' => self::$string_non_optional,
1310  ),
1311  'GetAssetAvailableStatusesResponse'=> Array (
1312  'GetAssetAvailableStatusesResult' => $statuses_des_val,
1313  ),
1314  ),
1315  'SetAttributeValue' => Array (
1316  'SetAttributeValue' => Array (
1317  'AssetID' => self::$string_non_optional,
1318  'AttributeName' => self::$string_non_optional,
1319  'AttributeValue' => self::$string_non_optional,
1320  ),
1321  'SetAttributeValueResponse'=> Array (
1322  'SetAttributeValueResult' => self::$string_optional,
1323  ),
1324  ),
1325  'TrashAsset' => Array (
1326  'TrashAsset' => Array (
1327  'AssetID' => self::$string_non_optional,
1328  ),
1329  'TrashAssetResponse' => Array (
1330  'TrashAssetResult' => self::$boolean_optional,
1331  ),
1332  ),
1333  'CloneAsset' => Array (
1334  'CloneAsset' => Array (
1335  'AssetID' => self::$string_non_optional,
1336  'NewParentID' => self::$string_non_optional,
1337  'NumberOfClone' => self::$int_optional,
1338  'PositionUnderNewParent'=> self::$int_optional,
1339  'LinkType' => $link_type,
1340  ),
1341  'CloneAssetResponse' => Array (
1342  'CloneAssetResult' => self::$string_optional,
1343  ),
1344  ),
1345  'GetAssetTypeAttribute' => Array (
1346  'GetAssetTypeAttribute' => Array (
1347  'TypeCode' => $asset_type,
1348  'AttributeDetail' => $attribute_detail,
1349  ),
1350  'GetAssetTypeAttributeResponse'=> Array (
1351  'GetAssetTypeAttributeResult' => $attribute_properties,
1352  ),
1353  ),
1354  'GetAssetTypeDescendants' => Array (
1355  'GetAssetTypeDescendants' => Array (
1356  'TypeCode' => $asset_type,
1357  ),
1358  'GetAssetTypeDescendantsResponse'=> Array (
1359  'GetAssetTypeDescendantsResult' => $asset_types,
1360  ),
1361  ),
1362  'GetAssetsInfo' => Array (
1363  'GetAssetsInfo' => Array (
1364  'AssetIDs' => self::$string_optional_unbounded,
1365  'FinderAttributes' => self::$string_optional_unbounded,
1366  'RootNode' => self::$string_optional,
1367  ),
1368  'GetAssetsInfoResponse' => Array (
1369  'GetAssetsInfoResult' => $asset_finder_info,
1370  ),
1371  ),
1372  'GetAssetAvailableKeywords' => Array (
1373  'GetAssetAvailableKeywords' => Array (
1374  'AssetID' => self::$string_optional,
1375  'TypeCode' => self::getArgType('AssetType', 0, 1),
1376  ),
1377  'GetAssetAvailableKeywordsResponse'=> Array (
1378  'GetAssetAvailableKeywordsResult' => $keywords,
1379  ),
1380  ),
1381  'GetAttributeValuesByName' => Array (
1382  'GetAttributeValuesByName' => Array (
1383  'AssetIDs' => self::$string_optional_unbounded,
1384  'TypeCode' => $asset_type,
1385  'AttributeName' => self::$string_non_optional,
1386  ),
1387  'GetAttributeValuesByNameResponse'=> Array (
1388  'GetAttributeValuesByNameResult' => $attribute_values_by_name_result,
1389  ),
1390  ),
1391 
1392  'GetAssetWebPaths' => Array (
1393  'GetAssetWebPaths' => Array (
1394  'AssetID' => self::$string_non_optional,
1395  ),
1396  'GetAssetWebPathsResponse'=> Array (
1397  'GetAssetWebPathsResult' => self::$string_optional_unbounded,
1398  ),
1399  ),
1400  'SetTag' => Array (
1401  'SetTag' => Array (
1402  'AssetID' => self::$string_non_optional,
1403  'ThesaurusID' => self::$string_non_optional,
1404  'TagName' => self::$string_non_optional,
1405  'Weight' => self::$string_optional,
1406  'CascadeTagChange'=> self::$string_optional,
1407  ),
1408  'SetTagResponse' => Array (
1409  'SetTagResult' => self::$boolean_optional,
1410  ),
1411  ),
1412  'GetAllStatuses' => Array (
1413  'GetAllStatuses' => Array (
1414 
1415  ),
1416  'GetAllStatusesResponse' => Array (
1417  'GetAllStatusesResult' => $statuses_des_val,
1418  ),
1419  ),
1420  'SetAssetStatus' => Array (
1421  'SetAssetStatus' => Array (
1422  'AssetID' => self::$string_non_optional,
1423  'StatusValue' => self::$string_non_optional,
1424  'DependantsOnly' => self::$boolean_optional,
1425  ),
1426  'SetAssetStatusResponse' => Array (
1427  'SetAssetStatusResult' => self::$boolean_optional,
1428  ),
1429  ),
1430  'GetPageContents' => Array (
1431  'GetPageContents' => Array (
1432  'AssetID' => self::$string_non_optional,
1433  'RootNodeID' => self::$string_optional,
1434  ),
1435  'GetPageContentsResponse'=> Array (
1436  'PageContent' => self::$string_non_optional,
1437  'PageURL' => self::$string_optional,
1438  'PageWebPath' => self::$string_optional,
1439  ),
1440  ),
1441  'LoginUser' => Array (
1442  'LoginUser' => Array (
1443  'Username' => self::$string_non_optional,
1444  'Password' => self::$string_non_optional,
1445  ),
1446  'LoginUserResponse'=> Array (
1447  'SessionID' => self::$string_non_optional,
1448  'SessionKey' => self::$string_non_optional,
1449  ),
1450  ),
1451  'GetUserIdByUsername' => Array (
1452  'GetUserIdByUsername' => Array (
1453  'Username' => self::$string_non_optional,
1454  ),
1455  'GetUserIdByUsernameResponse'=> Array (
1456  'AssetID' => self::$string_non_optional,
1457  ),
1458  ),
1459  'SetAssetWebPaths' => Array (
1460  'SetAssetWebPaths' => Array (
1461  'AssetID' => self::$string_non_optional,
1462  'Path' => self::$string_optional_unbounded,
1463  'AddRemaps' => self::$boolean_optional,
1464  ),
1465  'SetAssetWebPathsResponse'=> Array (
1466  'SetAssetWebPathsResult' => self::$boolean_optional,
1467  ),
1468  ),
1469  );
1470 
1471  $complex_types_available = parent::getComplexElements($complex_types);
1472 
1473  return $complex_types_available;
1474 
1475 
1476  }//end getComplexTypes();
1477 
1478 
1485  public static function getComplexTypes($func_list=Array())
1486  {
1487  $lineages_details = self::getArgType('LineagesDetails', 0, 'unbounded');
1488  $lineage = self::getArgType('Lineage', 0, 'unbounded');
1489  $complex_types = Array (
1490  'CreateAsset' => Array (
1491  'AttributeInfo' => Array (
1492  'AttributeName' => self::$string_non_optional,
1493  'AttributeValue' => self::$string_non_optional,
1494  ),
1495  ),
1496  'GetAllStatuses' => Array (
1497  'StatusDescription' => Array (
1498  'StatusValue' => self::$string_optional,
1499  'StatusDescription' => self::$string_optional,
1500  ),
1501  ),
1502  'GetAttributeValuesByName' => Array (
1503  'AttributeValueInfo' => Array (
1504  'AssetID' => self::$string_non_optional,
1505  'AttributeValue' => self::$string_optional,
1506  ),
1507  ),
1508  'GetAssetTypeAttribute' => Array (
1509  'AttributeProperty' => Array (
1510  'AttributeName' => self::$string_non_optional,
1511  'AttributeID' => self::$string_optional,
1512  'AttributeType' => self::$string_optional,
1513  'AttributeOwningTypeCode' => self::$string_optional,
1514  'AttributeParametersTypeCode' => self::$string_optional,
1515  'AttributeParametersValue' => self::$string_optional,
1516  'AttributeDefaultTypeCode' => self::$string_optional,
1517  'AttributeDefaultValue' => self::$string_optional,
1518  'AttributeDescription' => self::$string_optional,
1519  'AttributeIsAdmin' => self::$boolean_optional,
1520  'AttributeUnique' => self::$boolean_optional,
1521  ),
1522  ),
1523  'GetAssetsInfo' => Array (
1524  'AssetFinderInfo' => Array (
1525  'AssetID' => self::$string_non_optional,
1526  'AssetType' => self::$string_optional,
1527  'AssetTypeAncestor' => self::$string_optional,
1528  'AssetName' => self::$string_optional,
1529  'AssetChildren' => self::$string_optional_unbounded,
1530  'AssetLineage' => $lineages_details,
1531  ),
1532  'LineagesDetails' => Array (
1533  'LinkID' => self::$string_non_optional,
1534  'LinkType' => self::$string_non_optional,
1535  'Lineage' => $lineage,
1536  ),
1537  'Lineage' => Array (
1538  'AssetID' => self::$string_non_optional,
1539  'AssetName' => self::$string_non_optional,
1540  'Order' => self::$int_non_optional,
1541  ),
1542  ),
1543  );
1544 
1545  $complex_types_available = parent::getComplexElements($complex_types);
1546 
1547  return $complex_types_available;
1548 
1549  }//end getComplexTypes()
1550 
1551 
1558  public static function getSimpleRestrictedTypes($func_list=Array())
1559  {
1560  $asset_types_info = $GLOBALS['SQ_SYSTEM']->am->getAssetTypes(TRUE, TRUE);
1561  $asset_types = Array();
1562  foreach ($asset_types_info as $asset_type_info) {
1563  $asset_types[] = $asset_type_info['type_code'];
1564  }//end foreach
1565 
1566  $asset_status = Array (
1567  SQ_STATUS_ARCHIVED,
1568  SQ_STATUS_UNDER_CONSTRUCTION,
1569  SQ_STATUS_PENDING_APPROVAL,
1570  SQ_STATUS_APPROVED,
1571  SQ_STATUS_LIVE,
1572  SQ_STATUS_LIVE_APPROVAL,
1573  SQ_STATUS_EDITING,
1574  SQ_STATUS_EDITING_APPROVAL,
1575  SQ_STATUS_EDITING_APPROVED,
1576  );
1577 
1578  $attribute_details = Array (
1579  'attrid',
1580  'type_code',
1581  'owning_type_code',
1582  'name',
1583  'type',
1584  'uniq',
1585  'parameters_type_code',
1586  'parameters_val',
1587  'default_type_code',
1588  'default_val',
1589  'description',
1590  'is_admin',
1591  );
1592 
1593  $common_types = Array (
1594  'LinkType' => Array (
1595  'restriction_base' => 'string',
1596  'enumeration' => Array (
1597  '1', '2', '4', '8'
1598  ),
1599  ),
1600  );
1601 
1602 
1603  $simple_restricted_types = Array (
1604  'CreateAsset' => Array (
1605  'AssetType' => Array (
1606  'restriction_base' => 'string',
1607  'enumeration' => $asset_types,
1608  ),
1609  'CreditCardNumber' => Array (
1610  'restriction_base' => 'string',
1611  'pattern' => '\d{3}-\d{2}-\d{4}',
1612  ),
1613  'LinkType' => $common_types['LinkType'],
1614  ),
1615  'CreateLink' => Array (
1616  'LinkType' => $common_types['LinkType'],
1617  ),
1618  'GetAssetTypeAttribute' => Array (
1619  'AttributeDetail' => Array (
1620  'restriction_base' => 'string',
1621  'enumeration' => $attribute_details,
1622  ),
1623  ),
1624  'SetAssetStatus' => Array (
1625  'StatusValue' => Array (
1626  'restriction_base' => 'string',
1627  'enumeration' => $asset_status,
1628  ),
1629  ),
1630  );
1631 
1632  $simple_restricted_types_available = parent::processSimpleRestrictedTypes($simple_restricted_types);
1633 
1634  return $simple_restricted_types_available;
1635 
1636  }//end getSimpleRestrictedTypes()
1637 
1638 
1639 }//end class
1640 ?>