cms_build_env['lvl'] || $this->cms_build_env['search_type_asked'] || $this->cms_build_env['input'] == "empr.php" || $this->cms_build_env['input'] == "askmdp.php" || $this->cms_build_env['input'] == "subscribe.php" ){ if(!$this->id){ $this->parameters['selectors'][] = array( 'id' => 0, 'name' => "cms_module_common_selector_lvl" ); } } return parent::get_form(); } public function check_condition(){ global $lvl; global $search_type_asked; global $mode; $selector = $this->get_selected_selector(); $values = $selector->get_value(); $test = array("empr","askmdp","subscribe"); //on regarde si on est sur la bonne page... if(in_array(basename($_SERVER['SCRIPT_FILENAME'],".php"),$test) && in_array(basename($_SERVER['SCRIPT_FILENAME'],".php"),$values)){ return true; }else if($search_type_asked && is_array($values) && in_array($search_type_asked,$values)){ return true; // Dans le cas qui suit, on veut seulement s'assurer que la variable n'est pas en POST mais bien GET }else if(!isset($_GET['search_type_asked']) && is_array($values) && in_array($lvl,$values)){ //sur la page if($lvl == "index" || $lvl == ""){ if (!$search_type_asked){ return true; } }else{ return true; } }else if(!isset($_GET['search_type_asked']) && !empty($search_type_asked) && $search_type_asked == "simple_search"){ if(in_array("simple_search", $values) || (!empty($mode) && in_array("simple_search_mode_".$mode, $values))) { return true; } } //on est encore dans la fonction, donc la condition n'est pas vérifiée! return false; } }