18 require_once SQ_CORE_PACKAGE_PATH.
'/designs/design_area/design_area.inc';
43 parent::__construct($assetid);
60 if ((substr($name, 0, 10) ==
'condition_') && ($name !=
'condition_data')) {
63 $data_key = substr($name, 10);
65 $condition_data = $this->
attr(
'condition_data');
66 $condition_data[$data_key] = $value;
67 return parent::setAttrValue(
'condition_data', $condition_data);
69 return parent::setAttrValue($name, $value);
85 $condition = $this->
attr(
'condition');
86 $condition_data = $this->
attr(
'condition_data');
87 $condition_data[
'id_name'] = $this->
attr(
'id_name');
88 $id_name = $this->
attr(
'id_name');
89 $cond_var_name =
'$'.$this->attr(
'id_name').
'_condition_result';
91 $GLOBALS[\'SQ_SYSTEM\']->am->includeAsset(\'condition_'.$condition.
'\');
92 $
'.$id_name.'_condition_data =
'.var_export($condition_data, TRUE).';
93 '.$cond_var_name.' = condition_
'.$condition.'::evaluate($ASSET, $
'.$id_name.'_condition_data);
';
97 }//end _printInitCode()
109 protected function _printPaintingCode()
111 $then = $this->attr('then_contents
');
112 $else = $this->attr('else_contents
');
113 $cond_var_name = '$
'.$this->attr('id_name
').'_condition_result
';
117 if (
'.$cond_var_name.') {
120 // the multiple echo statements are required to get content to print at line 1,
121 // character 1 of the potential output (i.e. the DocType). Otherwise, it may get
125 foreach ($then as $index => $element) {
126 $this->_printContentItemCode($element);
128 echo '<
', '?php ;
'."\n";
130 echo 'echo \
'\';
'."\n";
133 echo '}
else {
'."\n";
137 foreach ($else as $index => $element) {
138 $this->_printContentItemCode($element);
150 }//end _printPaintingCode()
159 public function canBeCached()
175 public function getProtectedAttrs()
177 $attrs = parent::getProtectedAttrs();
178 $attrs[] = 'condition_data
';
181 }//end getProtectedAttrs()