Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
design_area_metadata.inc
1 <?php
18 require_once SQ_CORE_PACKAGE_PATH.'/designs/design_area/design_area.inc';
19 
32 {
33 
34 
41  function __construct($assetid=0)
42  {
43  parent::__construct($assetid);
44 
45  }//end constructor
46 
47 
57  protected function _printPaintingCode()
58  {
59  echo '<', '?php'."\n";
60  $field_name = $this->attr('metadata_field');
61  if (empty($field_name)) {
62  // printing all metadata
63  echo '
64  $contextid = $GLOBALS[\'SQ_SYSTEM\']->getContextId();
65  $metadata_default_name = \'metadata.php\';
66  $metadata_basename = ($contextid === 0) ? \'metadata.php\' : \'metadata.\'.$contextid.\'.php\';
67  if (file_exists($ASSET->data_path.\'/\'.$metadata_basename)) {
68  require($ASSET->data_path.\'/\'.$metadata_basename);
69  } else if (file_exists($ASSET->data_path.\'/\'.$metadata_default_name)) {
70  require($ASSET->data_path.\'/\'.$metadata_default_name);
71  }
72  ';
73  } else {
74  // printing a specific field
75  echo '
76  $METADATA_MANAGER = $GLOBALS[\'SQ_SYSTEM\']->getMetadataManager();
77  $metadata_field_value = $METADATA_MANAGER->getMetadataFieldValues($ASSET->id, Array('.var_export($field_name, TRUE).'));
78  echo array_get_index($metadata_field_value, '.var_export($field_name, TRUE).', \'\');
79  ';
80  }
81  echo '?', ">\n";
82  return TRUE;
83 
84  }//end _printPaintingCode()
85 
86 
87 }//end class
88 ?>