function getMenuContent($S5row) { global $flexmv; //return "<li><a href='#'>".$row->name."</a></li>"; //silviu module code - start //$S5_menu_items_params = new JParameter( $S5row->params ); $S5_menu_items_params = new JRegistry(); if ($flexmv <= 2.5) { $S5_menu_items_params->loadJSON($S5row->params); } else { $S5_menu_items_params->loadObject($S5row->params); } $S5_load_mod = $S5_menu_items_params->get($flexmv <= 2.5 ? 's5_load_mod' : 'data.s5_load_mod'); $S5_subtext = $S5_menu_items_params->get($flexmv <= 2.5 ? 's5_subtext' : 'data.s5_subtext'); //retrieve the parent params //$S5_parent_items_params = new JParameter( $parent_params ); $s5_group_child = $S5_menu_items_params->get($flexmv <= 2.5 ? 's5_group_child' : 'data.s5_group_child', 0); $S5_mod_array_orig = $S5_menu_items_params->get($flexmv <= 2.5 ? 's5_position' : 'data.s5_position'); if (!is_array($S5_mod_array_orig)) { $S5_mod_array = array($S5_mod_array_orig); } else { $S5_mod_array = $S5_mod_array_orig; } //recreate the menu content with link on it //after that remove the link so the module content won't have link on it //$router = JSite::getRouter(); //$S5row->url = $router->getMode() == JROUTER_MODE_SEF ? 'index.php?Itemid='.$S5row->id : $S5row->link.'&Itemid='.$S5row->id; $S5row->url = $S5row->flink; if ($S5row->type == "separator") { $S5row->url = $S5row->link . 'javascript:;'; //$router->getMode() == JROUTER_MODE_SEF ? 'index.php?Itemid='.$pitem->id : $pitem->link.'javascript:;'; } $tmp = $S5row; //$iParams = new JParameter($tmp->params); $iParams = new JRegistry(); if ($flexmv <= 2.5) { $iParams->loadJSON($tmp->params); } else { $iParams->loadObject($tmp->params); } if ($iParams->get($flexmv <= 2.5 ? 'menu_image' : 'data.menu_image') && $iParams->get($flexmv <= 2.5 ? 'menu_image' : 'data.menu_image') != -1) { switch ($iParams->get($flexmv <= 2.5 ? 'menu_images_align' : 'data.menu_images_align', 0)) { case 0: $imgalign = 'float:left;'; break; case 1: $imgalign = 'float:right;'; break; default: $imgalign = 'float:left;'; break; } switch ($tmp->browserNav) { default: case 0: // _top $image = '<span class="s5_img_span"><img style="' . $imgalign . 'cursor:pointer" src="' . $iParams->get($flexmv <= 2.5 ? 'menu_image' : 'data.menu_image') . '" onclick="window.document.location.href=\'' . $S5row->url . '\'" alt="' . $S5row->alias . '" /></span>'; break; case 1: // _blank $image = '<span class="s5_img_span"><img style="' . $imgalign . 'cursor:pointer" src="' . $iParams->get($flexmv <= 2.5 ? 'menu_image' : 'data.menu_image') . '" onclick="window.open(\'' . $S5row->url . '\')" alt="' . $S5row->alias . '" /></span>'; break; case 2: // window.open $image = '<span class="s5_img_span"><img style="' . $imgalign . 'cursor:pointer" src="' . $iParams->get($flexmv <= 2.5 ? 'menu_image' : 'data.menu_image') . '" onclick="window.open(\'' . $S5row->url . '\')" alt="' . $S5row->alias . '" /></span>'; break; } /*if($tmp->ionly){ $tmp->name = null; }*/ } else { $image = null; } /* silviu add new funcitonality to 1.7 version * remove the menu title if param is set to 0 and menu image exists */ if ($iParams->get($flexmv <= 2.5 ? 'menu_image' : 'data.menu_image') && $iParams->get($flexmv <= 2.5 ? 'menu_image' : 'data.menu_image') != -1 && $iParams->get($flexmv <= 2.5 ? 'menu_text' : 'data.menu_text') == 0) { $S5row->title = ""; } switch ($tmp->browserNav) { default: case 0: // _top if (strstr($S5row->url, "#s5")) { if ($S5row->title != "") { $link_format = "<a href='#' onclick=\"s5_page_scroll('" . $S5row->url . "')\"><span class='s5_sub_a_span' onclick=\"s5_page_scroll('" . $S5row->url . "')\" >" . $S5row->title . "</span></a>"; if ($S5_subtext != "") { $parent_subtext_flex = "<span class='S5_subtext' onclick=\"s5_page_scroll('" . $S5row->url . "')\" >" . $S5_subtext . "</span>"; } else { $parent_subtext_flex = ""; } break; } } else { $link_format = "<a href='{$S5row->url}'><span class='s5_sub_a_span' onclick='window.document.location.href=\"{$S5row->url}\"'>" . $S5row->title . "</span></a>"; if ($S5_subtext != "") { $parent_subtext_flex = "<span class='S5_subtext' onclick='window.document.location.href=\"{$S5row->url}\"'>" . $S5_subtext . "</span>"; } else { $parent_subtext_flex = ""; } } break; case 1: // _blank $link_format = "<a href='{$S5row->url}' target='_blank' onclick='this.removeAttribute(\"href\")'><span class='s5_sub_a_span' onclick='window.open(\"{$S5row->url}\")'>" . $S5row->title . "</span></a>"; if ($S5_subtext != "") { $parent_subtext_flex = "<span class='S5_subtext' onclick='window.open(\"{$S5row->url}\")'>" . $S5_subtext . "</span>"; } else { $parent_subtext_flex = ""; } break; case 2: // window.open $attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes'; //.$this->_params->get('window_open'); // hrm...this is a bit dickey $link = $S5row->url; //str_replace('index.php', 'index2.php', $pitem->url); if ($S5_subtext != "") { $parent_subtext_flex = '<span class="S5_subtext" onclick="window.open(\'' . $link . '\',\'targetWindow\',\'' . $attribs . '\');return false;">' . $S5_subtext . '</span>'; } else { $parent_subtext_flex = ""; } $link_format = '<a href="' . $link . '" onclick="this.removeAttribute(\'href\')"><span class="s5_sub_a_span" onclick="window.open(this.href,\'targetWindow\',\'' . $attribs . '\');return false;">' . $S5row->title . '</span></a>'; break; } if (is_array($S5_mod_array) && !empty($S5_mod_array) && $S5_load_mod == '1') { if (is_array($S5_mod_array)) { //if($group == 1){ $s5_loaded_modules = array(); //get the module content first foreach ($S5_mod_array as $S5_position_value) { //get all the modules for this position $all_position_modules = S5JModuleHelper::getModules($S5_position_value); if (is_array($all_position_modules) && !empty($all_position_modules)) { foreach ($all_position_modules as $s5_position_module) { $s5_module_content = ""; //$module = S5JModuleHelper::getModule( 'mod_login', 'Login Form' ); if ($s5_position_module->module == 'mod_custom') { $s5_module_content = S5JModuleHelper::getModule('custom', $s5_position_module->title); } else { $s5_module_content = S5JModuleHelper::getModule(strtolower(substr($s5_position_module->module, 4, strlen($s5_position_module->module))), $s5_position_module->title); } $attribs['style'] = 'xhtml'; //$yj_load_mod ='LOAD MODULE OR MODULES HERE'; $s5_loaded_modules[] = S5JModuleHelper::renderModule($s5_module_content, $attribs); } } } //recreate the menu content with link on it //after that remove the link so the module content won't have link on it $S5row->title = "<span class='S5_submenu_item'>" . $image . $link_format; //display the subtext if ($S5_subtext != "") { $S5row->title .= $parent_subtext_flex; //"<div class='S5_subtext'>".$S5_subtext."</div>";//<br /> } $S5row->title .= "</span>"; //<br /> if (is_array($s5_loaded_modules) && !empty($s5_loaded_modules)) { //display the Joomla menu content $columns_group = $S5_menu_items_params->get($flexmv <= 2.5 ? 's5_columns' : 'data.s5_columns'); //display the child items grouped or not if ($s5_group_child == 0) { //not grouped means <ul><li>content</li></ul> $S5row->title .= "<ul style='float:left;'><li>"; // style='width:".$ul_width."%; } else { $S5row->title .= "<div class='S5_menu_module_parent_group'>"; // $S5row->name .= "<div class='S5_menu_module_parent'>"; $S5row->title .= "<div class='S5_menu_module_group'>"; } $k = 0; $all_loaded_modules = count($s5_loaded_modules); $rows_group = $columns_group > 0 ? ceil($all_loaded_modules / $columns_group) : 0; for ($i = 0; $i < $rows_group; $i++) { //check to see if we still have modules content to display if (!empty($s5_loaded_modules)) { $S5row->title .= "<div style='width:100%;'>"; for ($j = 0; $j < $columns_group; $j++) { if (isset($s5_loaded_modules[$k])) { if ($all_loaded_modules > $columns_group) { $content_cell_width = 100 / intval($columns_group); } else { $content_cell_width = 100 / intval($all_loaded_modules); } $S5row->title .= "<div style='float:left; width:" . $content_cell_width . "%;'>" . $s5_loaded_modules[$k] . "</div>"; //remove the displayed module content form the array unset($s5_loaded_modules[$k]); $k++; } //end if } //end for $S5row->title .= "</div><div style='clear:both;'></div>"; } //end if } //end for //display the child items grouped or not if ($s5_group_child == 0) { //not grouped means <ul><li>content</li></ul> $S5row->title .= "</li></ul>"; // style='width:".$ul_width."%; } else { $S5row->title .= "</div>"; $S5row->title .= "</div>"; } //}else{ // $S5row->title = ""; } //end if //} //new row to remove the link on the content if the content have module in it $S5row->module_content = 1; //$S5row->name = "<div class='S5_submenu_item'>".$S5row->name."</div>"; } else { //display the Joomla menu content $columns_group = $S5_menu_items_params->get($flexmv <= 2.5 ? 's5_columns' : 'data.s5_columns'); //recreate the menu content with link on it //after that remove the link so the module content won't have link on it $S5row->title = $image . $link_format; //display the subtext if ($S5_subtext != "") { $S5row->title .= $parent_subtext_flex; //"<div class='S5_subtext'>".$S5_subtext."</div>";//<br /> } $S5row->title .= "<div class='S5_menu_module_parent_group'>"; // $S5row->name .= "<div class='S5_menu_module_parent'>"; $S5_module_to_load = $S5_mod_array; $S5_module_to_load2 = S5modMainMenuHelper::getModule($S5_module_to_load); $module_menu_content = trim(S5JModuleHelper::renderModule($S5_module_to_load2, array('style' => "xhtml"))); if (isset($S5_mod_with[0]) && $S5_mod_with[0] > 0) { $S5row->title .= "<div class='S5_menu_module' style='width:" . $S5_mod_with[0] . "px;'>" . $module_menu_content . "</div>"; } else { $S5row->title .= "<div class='S5_menu_module'>" . $module_menu_content . "</div>"; } $S5row->title .= "</div>"; //$S5row->name = str_replace(array('<ul>', '</ul>'), '', $S5row->name); //$S5row->name = str_replace(array('<li>', '</li>'), '', $S5row->name); //$S5row->name = str_replace(array('<p>', '</p>'), '', $S5row->name); //$S5row->name = preg_replace("/<ul(.*)>/", "", $S5row->name); //$S5row->name = preg_replace("/<li(.*)>/", "", $S5row->name); //$S5row->name = preg_replace("/<p(.*)>/", "<br />", $S5row->name); //new row to remove the link on the content if the content have module in it $S5row->module_content = 1; $S5row->title = "<span class='S5_submenu_item'>" . $S5row->title . "</span>"; } } else { $temp = ""; //$row->name = $links[$links_id]; if ($S5_subtext != "") { //display the subtext $temp = $image . $link_format . $parent_subtext_flex; //<br /> } else { //$temp = "<div>".$image.$row->name."</div>"; $temp = $image . $link_format; } $S5row->title = $temp; //$row->name."\n"."<div class=\"subtext\">".$text."</div>"; //new row to remove the link on the content if the content have module in it $S5row->module_content = 0; $S5row->title = "<span class='S5_submenu_item'>" . $S5row->title . "</span>"; } //silviu module code - end return $S5row->title; }
/** * Checks if a module is enabled * * @param string The module name * * @return boolean */ public static function isEnabled($module) { $result = S5JModuleHelper::getModule($module); return !is_null($result); }