Esempio n. 1
0
 function getMenuContent($S5row)
 {
     //return "<li><a href='#'>".$row->name."</a></li>";
     //silviu module code - start
     $S5_menu_items_params = new JParameter($S5row->params);
     $S5_load_mod = $S5_menu_items_params->get('s5_load_mod');
     $S5_subtext = $S5_menu_items_params->get('s5_subtext');
     $S5_subtext_def = $S5_menu_items_params->get('s5_subtext_def');
     //retrieve the parent params
     //$S5_parent_items_params = new JParameter( $parent_params );
     $s5_group_child = $S5_menu_items_params->get('s5_group_child', 0);
     $S5_mod_array_orig = $S5_menu_items_params->get('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;
     }
     $tmp = $S5row;
     $iParams = new JParameter($tmp->params);
     // Handle SSL links
     $iSecure = $iParams->def('secure', 0);
     if ($iParams->get('menu_image') && $iParams->get('menu_image') != -1) {
         switch ($iParams->get('menu_images_align', 0)) {
             case 0:
                 $imgalign = 'align="left"';
                 break;
             case 1:
                 $imgalign = 'align="right"';
                 break;
             default:
                 $imgalign = 'align="left"';
                 break;
         }
         $image = '<span class="s5_img_span"><img src="' . JURI::base(true) . '/images/stories/' . $iParams->get('menu_image') . '" ' . $imgalign . ' alt="' . $S5row->alias . '" /></span>';
         /*if($tmp->ionly){
         		 $tmp->name = null;
         	 }*/
     } else {
         $image = null;
     }
     //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();
     if ($S5row->type != "url" && $S5row->type != "separator") {
         $S5row->url = $router->getMode() == JROUTER_MODE_SEF ? $S5row->link . '&Itemid=' . $S5row->id : $S5row->link . '&Itemid=' . $S5row->id;
         //$S5row->url = $S5row->link;
         $S5row->url = JRoute::_($S5row->url, true, $iSecure);
     } else {
         if ($S5row->type == "url") {
             $S5row->url = $S5row->link;
             //$router->getMode() == JROUTER_MODE_SEF ? 'index.php?Itemid='.$S5row->id : $S5row->link.'';
         } else {
             if ($S5row->type == "separator") {
                 $S5row->url = $S5row->link . 'javascript:;';
                 //$router->getMode() == JROUTER_MODE_SEF ? 'index.php?Itemid='.$S5row->id : $S5row->link.'javascript:;';
             } else {
                 $S5row->url = $router->getMode() == JROUTER_MODE_SEF ? $S5row->link . '&Itemid=' . $S5row->id : $S5row->link . '&Itemid=' . $S5row->id;
                 //$S5row->url = $S5row->link;
                 $S5row->url = JRoute::_($S5row->url, true, $iSecure);
             }
         }
     }
     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 = S5ModuleHelper::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 = S5ModuleHelper::getModule( 'mod_login', 'Login Form' );
                         if ($s5_position_module->module == 'mod_custom') {
                             $s5_module_content = S5ModuleHelper::getModule('custom', $s5_position_module->title);
                         } else {
                             $s5_module_content = S5ModuleHelper::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[] = S5ModuleHelper::renderModule($s5_module_content, $attribs);
                     }
                 }
             }
             switch ($tmp->browserNav) {
                 default:
                 case 0:
                     // _top
                     $link_format = '<a href="' . $S5row->url . '">' . $S5row->name . '</a>';
                     if ($S5_subtext != "") {
                         $S5row->name .= "<span onclick='window.document.location.href=\"{$S5row->url}\"' class='S5_subtext'>" . $S5_subtext . "</span>";
                         //<br />
                     }
                     break;
                 case 1:
                     // _blank
                     $link_format = '<a href="' . $S5row->url . '" target="_blank">' . $S5row->name . '</a>';
                     if ($S5_subtext != "") {
                         $S5row->name .= "<span onclick='window.open(\"{$S5row->url}\\)' class='S5_subtext'>" . $S5_subtext . "</span>";
                         //<br />
                     }
                     break;
                 case 2:
                     // window.open
                     $attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes';
                     //.$this->_params->get('window_open');
                     if ($S5_subtext != "") {
                         $S5row->name .= "<span onclick='window.open(\"{$S5row->url}\\), " . $attribs . "' class='S5_subtext'>" . $S5_subtext . "</span>";
                         //<br />
                     }
                     // hrm...this is a bit dickey
                     $link = str_replace('index.php', 'index2.php', $S5row->url);
                     $link_format = '<a href="' . $link . '" onclick="window.open(this.href,\'targetWindow\',\'' . $attribs . '\');return false;">' . $S5row->name . '</a>';
                     break;
             }
             //recreate the menu content with link on it
             //after that remove the link so the module content won't have link on it
             $S5row->name = "<span class='S5_submenu_item'>" . $image . $link_format;
             //display the subtext
             $S5row->name .= "</span>";
             //<br />
             if (is_array($s5_loaded_modules) && !empty($s5_loaded_modules)) {
                 //display the Joomla menu content
                 $columns_group = $S5_menu_items_params->get('s5_columns');
                 //display the child items grouped or not
                 if ($s5_group_child == 0) {
                     //not grouped means <ul><li>content</li></ul>
                     $S5row->name .= "<ul style='float:left;'><li>";
                     //  style='width:".$ul_width."%;
                 } else {
                     $S5row->name .= "<div class='S5_menu_module_parent_group'>";
                     //	$S5row->name .= "<div class='S5_menu_module_parent'>";
                     $S5row->name .= "<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->name .= "<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->name .= "<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->name .= "</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->name .= "</li></ul>";
                     //  style='width:".$ul_width."%;
                 } else {
                     $S5row->name .= "</div>";
                     $S5row->name .= "</div>";
                 }
             } else {
                 //$S5row->name = "";
             }
             //end if
             //}
             //$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->name = "<div class='S5_submenu_item'>".$S5row->name."</div>";
         } else {
             //display the Joomla menu content
             $columns_group = $S5_menu_items_params->get('s5_columns');
             switch ($tmp->browserNav) {
                 default:
                 case 0:
                     // _top
                     $link_format = '<a href="' . $S5row->url . '">' . $S5row->name . '</a>';
                     if ($S5_subtext != "") {
                         $S5row->name .= "<span onclick='window.document.location.href=\"{$S5row->url}\"' class='S5_subtext'>" . $S5_subtext . "</span>";
                         //<br />
                     }
                     break;
                 case 1:
                     // _blank
                     $link_format = '<a href="' . $S5row->url . '" target="_blank">' . $S5row->name . '</a>';
                     if ($S5_subtext != "") {
                         $S5row->name .= "<span onclick='window.open(\"{$S5row->url}\\)' class='S5_subtext'>" . $S5_subtext . "</span>";
                         //<br />
                     }
                     break;
                 case 2:
                     // window.open
                     $attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes';
                     //.$this->_params->get('window_open');
                     if ($S5_subtext != "") {
                         $S5row->name .= "<span onclick='window.open(\"{$S5row->url}\\), " . $attribs . "' class='S5_subtext'>" . $S5_subtext . "</span>";
                         //<br />
                     }
                     // hrm...this is a bit dickey
                     $link = str_replace('index.php', 'index2.php', $S5row->url);
                     $link_format = '<a href="' . $link . '" onclick="window.open(this.href,\'targetWindow\',\'' . $attribs . '\');return false;">' . $S5row->name . '</a>';
                     break;
             }
             //recreate the menu content with link on it
             //after that remove the link so the module content won't have link on it
             $S5row->name = $image . $link_format;
             //display the subtext
             $S5row->name .= "<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(S5ModuleHelper::renderModule($S5_module_to_load2, array('style' => "xhtml")));
             if (isset($S5_mod_with[0]) && $S5_mod_with[0] > 0) {
                 $S5row->name .= "<div class='S5_menu_module' style='width:" . $S5_mod_with[0] . "px;'>" . $module_menu_content . "</div>";
             } else {
                 $S5row->name .= "<div class='S5_menu_module'>" . $module_menu_content . "</div>";
             }
             $S5row->name .= "</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->name = "<span class='S5_submenu_item'>" . $S5row->name . "</span>";
         }
     } else {
         $temp = "";
         //$row->name = $links[$links_id];
         $window_case = "";
         switch ($tmp->browserNav) {
             default:
             case 0:
                 // _top
                 $link_format = '<a href="' . $S5row->url . '">' . $S5row->name . '</a>';
                 $window_case = "same";
                 break;
             case 1:
                 // _blank
                 $link_format = '<a href="' . $S5row->url . '" target="_blank">' . $S5row->name . '</a>';
                 $window_case = "new";
                 break;
             case 2:
                 // window.open
                 $attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes';
                 //.$this->_params->get('window_open');
                 $window_case = "new_attrib";
                 // hrm...this is a bit dickey
                 $link = str_replace('index.php', 'index2.php', $S5row->url);
                 $link_format = '<a href="' . $link . '" onclick="window.open(this.href,\'targetWindow\',\'' . $attribs . '\');return false;">' . $S5row->name . '</a>';
                 break;
         }
         if ($S5_subtext != "") {
             //display the subtext
             if ($window_case == "new") {
                 $temp = $image . $link_format . "<span onclick='window.open(\"" . $S5row->url . "\")' class='S5_subtext'>" . $S5_subtext . "</span>";
                 //<br />
             } else {
                 if ($window_case == "new_attrib") {
                     $temp = $image . $link_format . "<span onclick='window.open(\"" . $S5row->url . ", " . $attribs . "\")' class='S5_subtext'>" . $S5_subtext . "</span>";
                     //<br />
                 } else {
                     $temp = $image . $link_format . "<span onclick='window.document.location.href=\"{$S5row->url}\"' class='S5_subtext'>" . $S5_subtext . "</span>";
                     //<br />
                 }
             }
         } else {
             //$temp =  "<div>".$image.$row->name."</div>";
             $temp = $image . $link_format;
         }
         $S5row->name = $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->name = "<span class='S5_submenu_item'>" . $S5row->name . "</span>";
     }
     //silviu module code - end
     return $S5row->name;
 }
Esempio n. 2
0
 /**
  * Checks if a module is enabled
  *
  * @access	public
  * @param   string 	$module	The module name
  * @return	boolean
  */
 function isEnabled($module)
 {
     $result =& S5ModuleHelper::getModule($module);
     return !is_null($result);
 }