public function get_modules_list() { $tri = array(); if (count(self::$modules_list) == 0) { $this->get_folders_list(); foreach ($this->folders_list as $module_name) { $module_class_name = "cms_module_" . $module_name; if (class_exists($module_class_name)) { //une histoire de hash dans les formulaires... $hash_var = $module_class_name . "_hash"; global ${$hash_var}; $size = count(${$hash_var}); self::$modules_list[$module_name] = $module_class_name::get_informations(); //c'est la même histoire... if ($size != count(${$hash_var})) { array_unshift(${$hash_var}, $module->get_hash()); } $tri[$module_name] = self::$modules_list[$module_name]['name']; } } // tri par nom asort($tri); $memo_modules_list = self::$modules_list; self::$modules_list = array(); foreach ($tri as $module_name => $name) { self::$modules_list[$module_name] = $memo_modules_list[$module_name]; } } return self::$modules_list; }
require_once "{$base_path}/includes/init.inc.php"; require_once $include_path . "/templates/cms.tpl.php"; require_once $class_path . "/autoloader.class.php"; $autoloader = new autoloader(); $autoloader->add_register("cms_modules", true); print " <script type='text/javascript' src='javascript/ajax.js'></script>"; print "<div id='att' style='z-Index:1000'></div>"; print $menu_bar; print $extra; print $extra2; print $extra_info; if ($use_shortcuts) { include "{$include_path}/shortcuts/circ.sht"; } echo window_title($database_window_title . $msg['cms_onglet_title'] . $msg[1003] . $msg[1001]); $modules_parser = new cms_modules_parser(); $managed_modules = $modules_parser->get_managed_modules(); $managed_modules_menu = ""; foreach ($managed_modules as $managed_module) { $managed_modules_menu .= "\n\t\t<li><a href='" . $managed_module['link'] . "'>" . htmlentities($managed_module['name'], ENT_QUOTES, $charset) . "</a></li>"; } $cms_layout = str_replace("!!cms_managed_modules!!", $managed_modules_menu, $cms_layout); switch ($categ) { case "build": $cms_layout = str_replace("!!menu_contextuel!!", $cms_build_menu_tpl, $cms_layout); break; case "pages": $cms_layout = str_replace("!!menu_contextuel!!", $cms_pages_menu_tpl, $cms_layout); break; case "editorial": $cms_layout = str_replace("!!menu_contextuel!!", $cms_editorial_menu_tpl, $cms_layout);
function order_cadres($cadres, &$cache_cadre_object) { //on retente de mettre de l'ordre dans tout ca... //init $ordered_cadres = array(); $cadres_dom = array(); $zone = ""; //on élimine ce qui n'est pas dans le dom (ou ne va pas l'être) for ($i = 0; $i < count($cadres); $i++) { if (!$zone) { $zone = $cadres[$i]->build_parent; } if (substr($cadres[$i]->build_obj, 0, strlen("cms_module_")) == "cms_module_") { $id_cadre = substr($cadres[$i]->build_obj, strrpos($cadres[$i]->build_obj, "_") + 1); $res = $this->manage_cache_cadres("select", $cadres[$i]->build_obj, "object"); if ($res["select"] == true) { if ($res["value"]) { $cadres_dom[] = $res["value"]; } } else { if ($cache_cadre_object[$cadres[$i]->build_obj]) { $obj = $cache_cadre_object[$cadres[$i]->build_obj]; } else { $obj = cms_modules_parser::get_module_class_by_id($id_cadre); $cache_cadre_object[$cadres[$i]->build_obj] = $obj; } if ($obj && $obj->check_conditions()) { $cadres_dom[] = $cadres[$i]; if ($obj->check_for_cache()) { $this->manage_cache_cadres("insert", $cadres[$i]->build_obj, "object", $cadres[$i]); } } elseif ($obj && $obj->check_for_cache()) { $this->manage_cache_cadres("insert", $cadres[$i]->build_obj, "object", ""); } } } else { if ($cadres[$i]->build_fixed || $this->dom->getElementById($cadres[$i]->build_obj)) { $cadres_dom[] = $cadres[$i]; } } } $cadres = $cadres_dom; //après ce petit tour de passe passe, il nous reste ques les éléments présent sur la page... $ordered_cadres[] = $this->get_next_cadre($cadres, $zone); $i = 0; $nb = count($cadres); while (count($cadres)) { $ordered_cadres[] = $this->get_next_cadre($cadres, $zone, $ordered_cadres[count($ordered_cadres) - 1]->build_obj); if ($i == $nb) { break; } $i++; } //le reste, c'est que l'on à jamais pu placer (perte de chainage via supression de cadres)... foreach ($cadres as $cadre) { $ordered_cadres[] = $cadre; } return $ordered_cadres; }