Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
design_area_declared_vars.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 
56  public function attr($name)
57  {
58  if (empty($this->vars['declared_vars']['value'][$name])) {
59  return parent::attr($name);
60  } else {
61  return $this->vars['declared_vars']['value'][$name]['value'];
62  }
63 
64  }//end attr()
65 
66 
75  protected function _printPaintingCode()
76  {
77 
78  }//end _printPaintingCode()
79 
80 
87  public function getDeclaredVarAttributes()
88  {
89  $attrs = Array();
90  foreach ($this->vars['declared_vars']['value'] as $name => $data) {
91  $type = basename($data['type']); // just to make sure they aren't attempting to be a bit tricky
92  // do include,so it doesn't die if it ain't there
93  require_once SQ_ATTRIBUTES_PATH.'/'.$type.'/'.$type.'.inc';
94  $attr_class = 'Asset_Attribute_'.$type;
95  if (!class_exists($attr_class)) {
96  trigger_localised_error('CORE0146', E_USER_WARNING, $type, $name);
97  continue;
98  }
99  $attrs[$name] = new $attr_class(0, $data['value']);
100  $attrs[$name]->name = $name;
101  }
102 
103  return $attrs;
104 
105  }//end getDeclaredVarAttributes()
106 
107 
116  public function mergeParentDeclaredVars(Array $parent_attrs)
117  {
118  $current_attrs = $this->attr('declared_vars');
119  foreach ($parent_attrs as $id => $value) {
120  if (isset($current_attrs[$id])) {
121  $parent_attrs[$id] = $current_attrs[$id];
122  }
123  }
124  $this->setAttrValue('declared_vars', $parent_attrs);
125 
126  }//end mergeParentDeclaredVars()
127 
128 
129 }//end class
130 ?>