18 require_once SQ_CORE_PACKAGE_PATH.
'/designs/design_areas/menu/design_area_menu_type/design_area_menu_type.inc';
43 parent::__construct($assetid);
58 $ignore_permissions = $this->
attr(
'ignore_permissions') ?
' , TRUE' :
' , FALSE';
61 if (is_null($parent_menu) || $parent_menu->attr(
'show_subs') ==
'on_current') {
64 $majorids =
'Array((int) $ASSET_LINEAGE[$'.$this->attr(
'id_name').
'_level][\'assetid\'])';
65 if ($this->
attr(
'root_node') == 0) {
67 if (isset($ASSET_LINEAGE[$'.$this->attr(
'id_name').
'_level])) {
68 $'.$this->
attr(
'id_name').
'_assetids = menu_get_assets(\''.$this->
attr(
'id_name').
'\', Array((
int) $ASSET_LINEAGE[$
'.$this->attr('id_name
').'_level][\
'assetid\'])'.$ignore_permissions.
');
70 $'.$this->attr(
'id_name').
'_assetids = Array();
73 }
else if ($this->
attr(
'root_node') != 0 && $this->
attr(
'level') == 0) {
75 echo
'$'.$this->attr(
'id_name').
'_assetids = menu_get_assets(\''.$this->
attr(
'id_name').
'\', Array((
int)
'.$this->attr('root_node
').')
'.$ignore_permissions.');
';
79 $
'.$this->attr('id_name
').'_assetids = menu_get_assets(\
''.$this->
attr(
'id_name').
'\', $
'.$parent_menu->attr('id_name
').'_assetids
'.$ignore_permissions.');
84 $sub_menu = $this->getSubMenu();
85 if (!is_null($sub_menu)) {
87 if (!empty($
'.$this->attr('id_name
').'_assetids)) {
89 $sub_menu->printDataCollection();
95 }//end printDataCollection()
107 protected function _printInitCode()
109 if ($this->attr('root_node
') != 0 && $this->attr('level
') == 0) {
113 $within_site = FALSE;
114 $menu_
'.$this->attr('id_name
').'_lineage = Array();
117 foreach ($ASSET_LINEAGE as $i => $asset_lineage) {
118 if ($asset_lineage[\
'assetid\'] == '.$this->
attr(
'root_node').
') {
119 $menu_'.$this->
attr(
'id_name').
'_lineage = array_slice($ASSET_LINEAGE, $i);
125 // get the lineage from the site asset to the specified root node
127 $root_node = $GLOBALS[\'SQ_SYSTEM\']->am->getAsset('.$this->
attr(
'root_node').
');
128 $root_url = $root_node->getURL(current_url());
129 $root_url = str_replace(Array(\'http://\', \'https://\'), \'\' , $root_url);
130 $root_lineage = $GLOBALS[\'SQ_SYSTEM\']->am->getLineageFromURL(null, $root_url);
132 // extract the relevant lineage, and overwrites it with the original
133 if (!empty($root_lineage)) {
134 foreach ($root_lineage as $i => $info) {
135 if ($info[\'assetid\'] == '.$this->
attr(
'root_node').
') {
136 $menu_'.$this->
attr(
'id_name').
'_lineage[0] = $root_lineage[$i];
143 if (!empty($menu_'.$this->
attr(
'id_name').
'_lineage)) {
144 $original_lineage = $ASSET_LINEAGE;
145 $ASSET_LINEAGE = $menu_'.$this->
attr(
'id_name').
'_lineage;
150 parent::_printInitCode();
152 if ($this->
attr(
'root_node') != 0 && $this->
attr(
'level') == 0) {
155 // restore the asset lineage so that other menus are not affected
156 if (!empty($menu_'.$this->attr(
'id_name').
'_lineage)) {
157 $ASSET_LINEAGE = $original_lineage;
178 if ($this->
attr(
'root_node') != 0 && $this->
attr(
'level') == 0) {
181 if (!empty($menu_'.$this->attr(
'id_name').
'_lineage)) {
182 $original_lineage = $ASSET_LINEAGE;
183 $ASSET_LINEAGE = $menu_'.$this->
attr(
'id_name').
'_lineage;
188 parent::_printPaintingCode();
190 if ($this->
attr(
'root_node') != 0 && $this->
attr(
'level') == 0) {
193 // restore the asset lineage so that other menus are not affected
194 if (!empty($menu_'.$this->attr(
'id_name').
'_lineage)) {
195 $ASSET_LINEAGE = $original_lineage;