id_tache = $id_tache; } //formulaire spécifique au type de tâche function show_form ($param='') { global $base_path,$dbh, $charset, $msg; //paramètres pré-enregistré $liste_views = array(); if ($param['list_view']) { foreach ($param['list_view'] as $id_view) { $liste_views[$id_view] = $id_view; } } $conso = ($param["conso"] ? $param["conso"] : "1"); $date_deb = $param["date_deb"]; $date_fin = $param["date_fin"]; $date_ech = $param["date_ech"]; $requete = "SELECT id_vue, date_consolidation, nom_vue, comment FROM statopac_vues"; $res = mysql_query($requete, $dbh); $nb_rows = mysql_num_rows($res); //taille du selecteur if ($nb_rows < 3) $nb=3; else if ($nb_rows > 10) $nb=10; else $nb = $nb_rows; $select_view = ""; //liste des vues à consolider $form_task .= "
". $select_view ."
 
"; /*appui sur la fin de la méthode do_form de la classe stat_view*/ $form_task .= "





"; $btn_date_deb = ""; $btn_date_fin = ""; $btn_date_echeance = ""; if (!$date_deb) // -- si nouvelle tâche = pas de params pré-enregistrés $date_deb = strftime("%Y-%m-%d", mktime(0, 0, 0, date('m'), date('d')-1, date('y'))); $btn_date_deb=str_replace("!!date_deb!!",$date_deb,$btn_date_deb); $btn_date_deb=str_replace("!!date_deb_lib!!",formatdate($date_deb),$btn_date_deb); if(!$date_fin) $date_fin = today(); $btn_date_fin=str_replace("!!date_fin!!",$date_fin,$btn_date_fin); $btn_date_fin=str_replace("!!date_fin_lib!!",formatdate($date_fin),$btn_date_fin); if (!$date_ech) $date_ech = today(); $btn_date_echeance=str_replace("!!date_ech!!",$date_ech,$btn_date_echeance); $btn_date_echeance=str_replace("!!date_ech_lib!!",formatdate($date_ech),$btn_date_echeance); $form_task=str_replace("!!date_deb_btn!!",$btn_date_deb,$form_task); $form_task=str_replace("!!date_fin_btn!!",$btn_date_fin,$form_task); $form_task=str_replace("!!echeance_btn!!",$btn_date_echeance,$form_task); return $form_task; } function task_execution() { global $base_path, $dbh, $msg, $PMBusername; if (SESSrights & ADMINISTRATION_AUTH) { $parameters = $this->unserialize_task_params(); $conso = $parameters["conso"]; if ($conso == "2") { $date_deb = $parameters["date_deb"]; $date_fin = $parameters["date_fin"]; $date_ech = ""; $critere_title = $msg[stat_interval_consolidation]; $critere_title=str_replace("!!date_deb_btn!!",formatdate($date_deb),$critere_title); $critere_title=str_replace("!!date_fin_btn!!",formatdate($date_fin),$critere_title); } else if ($conso == "3") { $date_deb = ""; $date_fin = ""; $date_ech = $parameters["date_ech"]; $critere_title = $msg[stat_echeance_consolidation]; $critere_title=str_replace("!!echeance_btn!!",formatdate($date_ech),$critere_title); } else { $date_deb = ""; $date_fin = ""; $date_ech = ""; $critere_title = $msg[stat_last_consolidation]; } if ($parameters["list_view"]) { $ids_view = implode(",", $parameters["list_view"]); $rqt = "select id_vue, nom_vue FROM statopac_vues where id_vue in (".$ids_view.")"; $res = mysql_query($rqt, $dbh); $list_id_view = array(); $list_name_view = array(); while ($row = mysql_fetch_object($res)) { $list_id_view[] = $row->id_vue; $list_name_view[] = $row->nom_vue; } $this->report[] = "".$this->msg["stats_conso"]." ( ".$critere_title." )"; if (method_exists($this->proxy, "pmbesOPACStats_makeConsolidation")) { if ((count($list_id_view) > 0) && (count($list_name_view) > 0)) { $this->proxy->pmbesOPACStats_makeConsolidation($conso,$date_deb,$date_fin,$date_ech, $list_id_view); foreach ($list_name_view as $elem) { $this->report[] = "".$elem.""; } //mise à jour de la progression $this->update_progression(100); } else { $this->report[] = "".$this->msg["stats_select_view_unknown"].""; } } else { $this->report[] = "".sprintf($msg["planificateur_function_rights"],"makeConsolidation","pmbesOPACStats",$PMBusername).""; } } else { $this->report[] = "".$this->msg["stats_no_view"].""; } } else { $this->report[] = "".sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername).""; } } function make_serialized_task_params() { global $list_view, $conso, $date_deb, $date_fin, $date_ech; $t = parent::make_serialized_task_params(); if ($list_view) { foreach ($list_view as $id_vue) { $t["list_view"][$id_vue]=$id_vue; } } $t["conso"] = $conso; $t["date_deb"] = $date_deb; $t["date_fin"] = $date_fin; $t["date_ech"] = $date_ech; return serialize($t); } function unserialize_task_params() { $params = $this->get_task_params(); return $params; } }