18 require_once SQ_CORE_PACKAGE_PATH.
'/designs/design_areas/menu/design_area_menu_recursive/design_area_menu_recursive.inc';
37 public $arrow_width = 4;
43 public $arrow_height = 6;
60 $value = strtolower($value);
64 $value = (int) $value;
66 trigger_localised_error(
'CORE0177', E_USER_WARNING, $name);
72 return parent::setAttrValue($name, $value);
86 $use_blanks = !$this->
attr(
'show_stalks');
90 $this->
printVar(
'settings.class', Array());
91 $cell_class =
' class="'.ob_get_contents().
'"';
98 <td'.$cell_class.
' style="vertical-align: top;"><img alt="" src="';
100 echo
'<',
'?php echo $blank_src; ?',
'>';
102 echo
'<',
'?php echo (($'.$this->attr(
'id_name').
'_current_setting == \'current\') ? $stalk_prefix.\'arrow.png\' : $blank_src); ?',
'>';
105 echo
'" width="'.$this->arrow_width.
'" height="'.$this->
attr(
'min_height').
'" /></td>';
106 $arrow_contents = ob_get_contents();
112 if ($asset_contents = $this->
attr(
'asset_contents')) {
113 $this->_tmp[
'outputting_asset_section'] = TRUE;
114 foreach ($asset_contents as $item) {
117 unset($this->_tmp[
'outputting_asset_section']);
121 <td'.$cell_class.
' style="width: 100%; vertical-align: top; text-align: '.$this->
attr(
'alignment').
';'.(($this->
attr(
'word_wrap')) ?
'' :
' white-space: nowrap;').
'">'.ob_get_contents().
'</td>
126 if ($this->
attr(
'ellipsis_length') > 0) {
127 echo
'require_once SQ_FUDGE_PATH.\'/general/general.inc\';';
130 $unwanted_types = $this->
attr(
'unwanted_asset_types');
131 $all_type_codes = Array();
132 foreach ($unwanted_types as $type) {
134 $all_type_codes = array_merge($all_type_codes, $GLOBALS[
'SQ_SYSTEM']->am->getTypeDescendants($type, TRUE));
137 $unwanted_types = $all_type_codes;
141 function '.$this->attr(
'id_name').
'_recursive_fn($level, $parentid, $'.$this->
attr(
'id_name').
'_base_url, $depth=Array())
143 global $RECURSIVE_MENU_ASSET_LINEAGE;
146 $blank_src = sq_web_path(\'lib\').\'/web/images/blank.gif\';
147 $stalk_prefix = sq_web_path(\'data\').\'/'.$this->data_path_suffix.
'/\';
149 // The indenting level, stalk on/off
151 $depth_count = count($depth);
153 $'.$this->
attr(
'id_name').
'_lineage_assetid = (empty($RECURSIVE_MENU_ASSET_LINEAGE[$level + 1])) ? 0 : $RECURSIVE_MENU_ASSET_LINEAGE[$level + 1][\'assetid\'];
154 $'.$this->
attr(
'id_name').
'_lineage_setting = (count($RECURSIVE_MENU_ASSET_LINEAGE) - 1 == $level + 1) ? \'current\' : \'hierarchy\';
155 $'.$this->
attr(
'id_name').
'_urls = $GLOBALS[\'SQ_SYSTEM\']->am->getAssetURL(array_keys($GLOBALS[\'MENU_DATA\']['.$this->
_safeStringLiteral($this->
attr(
'id_name')).
'][$parentid]), $'.$this->
attr(
'id_name').
'_base_url);
157 # pre_echo("Lineage Setting : $'.$this->
attr(
'id_name').
'_lineage_setting");
158 # pre_echo("Lineage Assetid : $'.$this->
attr(
'id_name').
'_lineage_assetid");
159 $num_kids = count($GLOBALS[\'MENU_DATA\'][\''.$this->
attr(
'id_name').
'\'][$parentid]);
161 foreach ($GLOBALS[\
'MENU_DATA\']['.$this->
_safeStringLiteral($this->
attr(
'id_name')).
'][$parentid] as $'.$this->
attr(
'id_name').
'_row) {
163 $end = ($i == $num_kids);';
165 if (!empty($unwanted_types)) {
166 $unwanted_types_literal_array =
'Array("'.implode(
'", "', $unwanted_types).
'")';
168 if (in_array($'.$this->attr(
'id_name').
'_row[\'type_code\'], '.$unwanted_types_literal_array.
')) continue ;';
172 // if not live, we have to get the proper object, sorry
173 if (((int) $'.$this->attr(
'id_name').
'_row[\'status\'] & SQ_STATUS_LIVE) == 0) {
174 $'.$this->
attr(
'id_name').
'_obj = $GLOBALS[\'SQ_SYSTEM\']->am->getAsset($'.$this->
attr(
'id_name').
'_row[\'assetid\'], $'.$this->
attr(
'id_name').
'_row[\'type_code\']);
176 unset($'.$this->
attr(
'id_name').
'_obj);
178 $'.$this->
attr(
'id_name').
'_current_setting = ($'.$this->
attr(
'id_name').
'_lineage_assetid == $'.$this->
attr(
'id_name').
'_row[\'assetid\']) ? $'.$this->
attr(
'id_name').
'_lineage_setting : \'normal\';
179 # pre_echo("CURRENT SETTING : ".$'.$this->
attr(
'id_name').
'_current_setting);
181 <div style="text-align: '.$this->attr(
'alignment').
';">
182 <table cellpadding="0" cellspacing="0" border="0" width="100%">
186 if ($this->
attr(
'alignment') ==
'right') {
187 echo $asset_contents;
190 if ($this->
attr(
'indent')) {
192 if ($this->
attr(
'alignment') ==
'right') {
193 echo $arrow_contents;
201 if ($this->
attr(
'alignment') ==
'left') {
203 for ($j = 0; $j < $depth_count; $j++) {
207 for ($j = $depth_count - 1; $j >= 0; $j--) {
215 echo
' style="vertical-align: top;"><img alt="" src="<',
'?php echo $blank_src; ?',
'>" width="'.$this->attr(
'indent').
'" height="'.$this->
attr(
'min_height').
'" /></td>';
221 if ($depth[$j] && !($end && ($j == $depth_count - 1)))
222 echo \' style="vertical-align:top; background-image:url(\', $stalk_prefix, \'stalk.png); background-repeat: repeat-y;"\';
224 ?',
'>><img alt="" src="<',
'?php
225 if ($j != $depth_count - 1) {
226 echo $blank_src.\'"\';
228 echo $stalk_prefix, \'endbranch.png"\';
230 echo $stalk_prefix, \'branch.png"\';
233 ?',
'> width="'.$this->attr(
'indent').
'" height="'.$this->
attr(
'min_height').
'" /></td>';
238 }//end for depth count
242 if ($this->
attr(
'alignment') ==
'left') {
243 echo $arrow_contents;
248 if ($this->
attr(
'alignment') ==
'left') {
249 echo $asset_contents;
263 $recurse_condition =
'$'.$this->attr(
'id_name').
'_current_setting != \'normal\'';
266 if ($this->
attr(
'min_num_levels') > 0) {
267 $recurse_condition =
'$level < '.($this->attr(
'min_num_levels') + $this->
attr(
'level') - 1).
' || '.$recurse_condition;
270 if ($this->
attr(
'max_num_levels') > 0) {
271 $recurse_condition =
'$level < '.($this->attr(
'max_num_levels') + $this->
attr(
'level') - 1).
' && ('.$recurse_condition.
')';
274 if (('.$recurse_condition.
') && !empty($GLOBALS[\'MENU_DATA\']['.$this->
_safeStringLiteral($this->
attr(
'id_name')).
'][$'.$this->
attr(
'id_name').
'_row[\'assetid\']])) {
275 if ($end) $depth[$depth_count - 1] = false;
276 '.$this->
attr(
'id_name').
'_recursive_fn($level + 1, $'.$this->
attr(
'id_name').
'_row[\'assetid\'], $'.$this->
attr(
'id_name').
'_urls[$'.$this->
attr(
'id_name').
'_row[\'assetid\']], $depth);
281 }//end '.$this->
attr(
'id_name').
'_recursive_fn()
296 if ($this->
attr(
'show_stalks') && $this->
attr(
'indent') && $this->
attr(
'min_height')) {
299 return parent::_printInitCode();
313 $bg_colour = $this->
attr(
'stalk_bg_colour');
314 $fg_colour = $this->
attr(
'stalk_fg_colour');
316 $w = $this->
attr(
'indent');
317 $h = $this->
attr(
'min_height');
324 $direction = ($this->
attr(
'alignment') ==
'left') ?
'right' :
'left';
326 $image_path = $this->data_path_public;
330 require_once SQ_FUDGE_PATH.
'/general/file_system.inc';
331 require_once SQ_FUDGE_PATH.
'/colour/colour.inc';
333 if (!create_directory($image_path))
return FALSE;
335 $transparent = FALSE;
336 if (trim($bg_colour) ==
'') {
346 foreach (Array(
'stalk',
'arrow',
'branch',
'endbranch') as $image_name) {
349 $img = ImageCreate(($image_name ==
'arrow') ? $this->arrow_width : $w, $h);
350 $bg = ImageColorAllocate($img, $bg_rgb[
'r'], $bg_rgb[
'g'], $bg_rgb[
'b']);
351 $fg = ImageColorAllocate($img, $fg_rgb[
'r'], $fg_rgb[
'g'], $fg_rgb[
'b']);
353 if ($transparent) ImageColorTransparent($img, $bg);
355 if ($image_name ==
'branch' || $image_name ==
'endbranch' ) {
356 if ($direction ==
'left') {
363 ImageFilledRectangle($img, $x1, floor($h / 2), $x2, floor($h / 2), $fg);
366 if ($image_name ==
'branch' || $image_name ==
'stalk' ) {
367 ImageFilledRectangle($img, floor($w / 2), 0, floor($w / 2), $h - 1, $fg);
370 if ($image_name ==
'endbranch') {
371 ImageFilledRectangle($img, floor($w / 2), 0, floor($w / 2), floor($h / 2), $fg);
374 if ($image_name ==
'arrow') {
375 if ($direction ==
'left') {
376 $x1 = $this->arrow_width - 1;
382 $y1 = floor($h / 2) - ($this->arrow_height / 2);
387 $x1 + ($multiplier * ($this->arrow_width - 1)),
388 $y1 + ($this->arrow_height / 2),
390 $y1 + $this->arrow_height,
392 ImageFilledPolygon($img, $points, 3, $fg);
395 ImagePng($img, $image_path.
'/'.$image_name.
'.png');