$model_types) if(in_array($object_type, $model_types)) { return $model_name; } } //formulaire spécifique au type de tâche public function show_form ($param=array()) { global $msg; $types = static::get_types(); if(isset($param['scheduler_caddie_type']) && $param['scheduler_caddie_type']) { $scheduler_caddie_type = $param['scheduler_caddie_type']; } else { $scheduler_caddie_type = $types['caddie'][0]; } if(isset($param['scheduler_caddie_action']) && $param['scheduler_caddie_action']) { $action = $param['scheduler_caddie_action']; } else { $action = ''; } if(isset($param['scheduler_caddie_list']) && $param['scheduler_caddie_list']) { $list = $param['scheduler_caddie_list']; } else { $list = array(); } $form_task = "
"; $form_task .= $this->get_display_actions($scheduler_caddie_type, $action); $form_task .= "
".static::get_display_caddie_list($scheduler_caddie_type, $list)."
"; return $form_task; } public static function get_display_caddie_row($caddie_instance, $valeur=array(), $list=array()) { global $msg; $display= " "; $display.= "".$valeur['name'].""; if ($valeur['comment']){ $display.= "
(".$valeur['comment'].")"; } $display.= ""; $display.= $caddie_instance->aff_nb_items_reduit(); return $display; } public static function get_display_caddie_list($object_type='', $list=array()) { global $msg; global $PMBuserid; global $charset; $display = ''; $model_class_name = static::get_model_class_name_from_object_type($object_type); $liste = $model_class_name::get_cart_list($object_type); if (!empty($liste)) { $parity = array(); foreach ($liste as $cle => $valeur) { $rqt_autorisation=explode(" ",$valeur['autorisations']); if (array_search ($PMBuserid, $rqt_autorisation)!==FALSE || $valeur['autorisations_all'] || $PMBuserid==1) { $myCart = new $model_class_name(); $myCart->nb_item=$valeur['nb_item']; $myCart->nb_item_pointe=$valeur['nb_item_pointe']; $myCart->type=$valeur['type']; $print_cart[$myCart->type]["titre"]="".$msg["caddie_de_".$myCart->type]."
"; if(!trim($valeur["caddie_classement"])){ $valeur["caddie_classement"]=classementGen::getDefaultLibelle(); } if(!isset($parity[$myCart->type])) $parity[$myCart->type] = 0; $parity[$myCart->type]=1-$parity[$myCart->type]; if ($parity[$myCart->type]) $pair_impair = "even"; else $pair_impair = "odd"; $tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" "; $print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["titre"] = stripslashes($valeur["caddie_classement"]); if(!isset($print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["cart_list"])) { $print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["cart_list"] = ''; } $print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["cart_list"] .= "".static::get_display_caddie_row($myCart, $valeur, $list).""; } } //Tri des classements foreach($print_cart as $key => $cart_type) { ksort($print_cart[$key]["classement_list"]); } // affichage des paniers par type foreach($print_cart as $key => $cart_type) { //on remplace les clés à cause des accents $cart_type["classement_list"]=array_values($cart_type["classement_list"]); foreach($cart_type["classement_list"] as $keyBis => $cart_typeBis) { $display.=gen_plus($key.$keyBis,$cart_typeBis["titre"],"".$cart_typeBis["cart_list"]."
",0); } } } else { $display .= $msg[398]; } return $display; } public function get_display_caddie_selector_row($caddie_instance, $valeur=array()) { $display = $valeur['name']; if ($valeur['comment']){ $display.= "(".$valeur['comment'].")"; } $display.= " ".strip_tags($caddie_instance->aff_nb_items_reduit()); return $display; } public function get_display_caddie_selector($object_type='') { global $msg; global $PMBuserid; global $charset; $display = ''; $model_class_name = static::get_model_class_name_from_object_type($object_type); $liste = $model_class_name::get_cart_list($object_type); if (!empty($liste)) { foreach ($liste as $valeur) { $rqt_autorisation=explode(" ",$valeur['autorisations']); if (array_search ($PMBuserid, $rqt_autorisation)!==FALSE || $valeur['autorisations_all'] || $PMBuserid==1) { $myCart = new $model_class_name(); $myCart->nb_item=$valeur['nb_item']; $myCart->nb_item_pointe=$valeur['nb_item_pointe']; $myCart->type=$valeur['type']; $print_cart[$myCart->type]["titre"]="".$msg["caddie_de_".$myCart->type]."
"; if(!trim($valeur["caddie_classement"])){ $valeur["caddie_classement"]=classementGen::getDefaultLibelle(); } $print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["titre"] = stripslashes($valeur["caddie_classement"]); if(!isset($print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["cart_list"])) { $print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["cart_list"] = ''; } $print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["cart_list"] .= ""; } } //Tri des classements foreach($print_cart as $key => $cart_type) { ksort($print_cart[$key]["classement_list"]); } $display .= ""; } else { $display .= $msg[398]; } return $display; } public static function get_actions() { global $msg; return array( 'caddie' => array( 'collecte' => array( 'selection' => $msg['caddie_menu_collecte_selection'] ), 'pointage' => array( 'selection' => $msg['caddie_menu_pointage_selection'], 'panier' => $msg['caddie_menu_pointage_panier'], 'raz' => $msg['caddie_menu_pointage_raz'] ), 'action' => array( 'supprpanier' => $msg['caddie_menu_action_suppr_panier'], 'selection' => $msg['caddie_menu_action_selection'], 'supprbase' => $msg['caddie_menu_action_suppr_base'], 'reindex' => $msg['caddie_menu_action_reindex'] ) ), 'empr_caddie' => array( 'collecte' => array( 'selection' => $msg['empr_caddie_menu_collecte_selection'] ), 'pointage' => array( 'selection' => $msg['empr_caddie_menu_pointage_selection'], 'panier' => $msg['empr_caddie_menu_pointage_panier'], 'raz' => $msg['empr_caddie_menu_pointage_raz'] ), ), 'authorities_caddie' => array( 'collecte' => array( 'selection' => $msg['caddie_menu_collecte_selection'] ), 'pointage' => array( 'selection' => $msg['caddie_menu_pointage_selection'], 'panier' => $msg['caddie_menu_pointage_panier'], 'raz' => $msg['caddie_menu_pointage_raz'] ), 'action' => array( 'supprpanier' => $msg['caddie_menu_action_suppr_panier'], 'selection' => $msg['caddie_menu_action_selection'], 'supprbase' => $msg['caddie_menu_action_suppr_base'], 'reindex' => $msg['caddie_menu_action_reindex'] ) ) ); } public static function get_actions_selector($object_type='', $action='') { global $msg; $selector = ""; return $selector; } public function get_choix_quoi_content($action_what) { global $msg; return "
param['scheduler_caddie_action_elt_flag']) && $this->param['scheduler_caddie_action_elt_flag'] ? "checked='checked'" : "")." value='1'> ".(($action_what=="supprbase" || $action_what=="supprpanier") ? " 
param['scheduler_caddie_action_elt_no_flag']) && $this->param['scheduler_caddie_action_elt_no_flag'] ? "checked='checked'" : "")." value='1'> ".(($action_what=="supprbase" || $action_what=="supprpanier") ? " 
"; } public function get_action_form($object_type='', $action='') { $this->get_property_task_bdd(); $action_form = ''; if($action) { $exploded_action = explode('|||', $action); $action_model_class_name = $exploded_action[0]; $action_type = $exploded_action[1]; $action_what = $exploded_action[2]; $myCart = new $action_model_class_name(); switch ($action_type) { case 'collecte': switch ($action_what) { case 'selection': $action_form .= $this->get_choix_quoi_content($action_what); $action_form .= $this->get_display_procs_list($object_type, 'SELECT'); break; } break; case 'pointage': switch ($action_what) { case 'selection': $action_form .= $this->get_choix_quoi_content($action_what); $action_form .= $this->get_display_procs_list($object_type, 'SELECT'); break; case 'panier': $action_form .= $this->get_choix_quoi_content($action_what); $action_form .= $this->get_display_caddie_selector($object_type); break; case 'raz': //No sub form break; } break; case 'action': switch ($action_what) { case 'supprpanier': $action_form .= $this->get_choix_quoi_content($action_what); break; case 'selection': $action_form .= $this->get_choix_quoi_content($action_what); $action_form .= $this->get_display_procs_list($object_type); break; case 'supprbase': $action_form .= $this->get_choix_quoi_content($action_what); break; case 'reindex': $action_form .= $this->get_choix_quoi_content($action_what); break; } break; } } return $action_form; } protected function get_display_actions($object_type='', $action='') { $display = "
".static::get_actions_selector($object_type, $action)."
 
".$this->get_action_form($object_type, $action)."
"; return $display; } public function make_serialized_task_params() { global $scheduler_caddie_type; global $scheduler_caddie_action; global $scheduler_caddie_action_elt_flag; global $scheduler_caddie_action_elt_no_flag; global $scheduler_caddie_action_elt_flag_inconnu; global $scheduler_caddie_action_elt_no_flag_inconnu; global $scheduler_caddie_action_by_caddie; global $scheduler_caddie_list; global $scheduler_proc; $t = parent::make_serialized_task_params(); $t['scheduler_caddie_type'] = $scheduler_caddie_type; $t['scheduler_caddie_action'] = $scheduler_caddie_action; $t['scheduler_caddie_action_elt_flag'] = (int) $scheduler_caddie_action_elt_flag; $t['scheduler_caddie_action_elt_no_flag'] = (int) $scheduler_caddie_action_elt_no_flag; $t['scheduler_caddie_action_elt_flag_inconnu'] = (int) $scheduler_caddie_action_elt_flag_inconnu; $t['scheduler_caddie_action_elt_no_flag_inconnu'] = (int) $scheduler_caddie_action_elt_no_flag_inconnu; $t['scheduler_caddie_action_by_caddie'] = (int) $scheduler_caddie_action_by_caddie; $t['scheduler_caddie_list'] = $scheduler_caddie_list; $t['scheduler_proc'] = $scheduler_proc; $t['scheduler_proc_options'] = array(); if($t['scheduler_proc']) { $exploded_action = explode('|||', $scheduler_caddie_action); $table = (!empty($exploded_action[0]) ? $exploded_action[0] : 'caddie_procs'); $hp = new parameters ($t['scheduler_proc'], $table); $t['scheduler_proc_options'] = $hp->make_serialized_parameters_params(); } return serialize($t); } public static function is_for_cart($object_type, $requete) { if (preg_match("/CADDIE\(([^\)]*)\)/",$requete,$match)) { $m=explode(",",$match[1]); $as=array_search($object_type,$m); if (($as!==NULL)&&($as!==false)) return true; else return false; } else return false; } // affichage du tableau des procédures public function get_display_procs_list($object_type, $type='ACTION') { global $msg,$charset; global $PMBuserid; $model_class_name = static::get_model_class_name_from_object_type($object_type); $proc_class_name = $model_class_name.'_procs'; $display = "
".$msg['caddie_select_proc']."
"; if ($PMBuserid!=1) $where=" and (autorisations='$PMBuserid' or autorisations like '$PMBuserid %' or autorisations like '% $PMBuserid %' or autorisations like '% $PMBuserid') "; else $where=""; $query = "SELECT idproc, type, name, requete, comment, autorisations, parameters FROM ".$proc_class_name::$table." WHERE type='".$type."' $where ORDER BY name "; $result = pmb_mysql_query($query); $display .= "
"; $n_proc = 0; if($result) { $display .= "
"; if(isset($this->param['scheduler_proc']) && $this->param['scheduler_proc']) { if (isset($this->param['scheduler_proc_options']) && is_array($this->param['scheduler_proc_options'])) { foreach ($this->param['scheduler_proc_options'] as $aparam=>$aparamv) { if (is_array($aparamv)) { foreach ($aparamv as $sparam=>$sparamv) { global ${$sparam}; ${$sparam} = $sparamv; } } else { global ${$aparam}; ${$aparam} = $aparamv; } } } $hp = new parameters ($this->param['scheduler_proc']); $display .= $hp->get_content_form(); } $display .= "
"; } if ($n_proc==0) { switch ($type) { case 'ACTION': $display .= $msg["caddie_no_action_proc"]; break; case 'SELECT': $display .= $msg["caddie_no_select_proc"]; break; } } $display .= "
"; return $display; } }