aff_cart_titre()); if($sub == 'action') { if ((($action=="form_proc")||($action=="add_item"))&&((!$elt_flag)&&(!$elt_no_flag))) { error_message_history($msg["caddie_no_elements"], $msg["caddie_no_elements_for_cart"], 1); exit(); } } switch ($action) { case 'form_proc' : $hp = new parameters ($id) ; if($sub == 'action') { $hp->gen_form(static::get_constructed_link($sub, $quelle, 'add_item', $idcaddie, "&id=$id&elt_flag=$elt_flag&elt_no_flag=$elt_no_flag")); } else { if($sub == 'pointage') { $action_in_form = 'pointe_item'; } else { $action_in_form = 'add_item'; } $hp->gen_form(static::get_constructed_link($sub, $moyen, $action_in_form, $idcaddie, "&id=$id")); } break; case 'pointe_item': $model_class_name = static::get_model_class_name(); print $model_class_name::show_actions($idcaddie,static::$object_type); if (caddie_procs::check_rights($id)) { $hp = new parameters ($id) ; $hp->get_final_query(); echo "
".$hp->final_query."
"; $myCart->pointe_items_from_query($hp->final_query); } print pmb_bidi($myCart->aff_cart_nb_items()); break; case 'add_item': $model_class_name = static::get_model_class_name(); print $model_class_name::show_actions($idcaddie,static::$object_type); //C'est ici qu'on fait une action if (caddie_procs::check_rights($id)) { $hp = new parameters ($id) ; $hp->get_final_query(); print "
".$hp->final_query."
"; switch ($sub) { case 'collecte': print pmb_bidi($myCart->add_items_by_collecte_selection($hp->final_query)); break; case 'action': if (!explain_requete($hp->final_query)) die("

".$hp->final_query."

".$msg["proc_param_explain_failed"]."

".$erreur_explain_rqt); $myCart->update_items_by_action_selection($hp->final_query); break; } } print $myCart->aff_cart_nb_items(); if($sub == 'action') { echo "
"; if ($gestion_acces_active==1) { echo " "; } echo " ", " ", " get_idcaddie().",'".htmlentities(addslashes($myCart->name),ENT_QUOTES, $charset)."')\" />", confirmation_delete("./catalog.php?categ=caddie&sub=gestion&action=del_cart&quoi=&idcaddie="); } break; default: print $myCart->aff_cart_nb_items(); switch ($sub) { case 'pointage': $action_in_list = 'pointe_item'; break; case 'collecte': $action_in_list = 'add_item'; break; default: print $cart_choix_quoi_action; $action_in_list = 'add_item'; break; } if($sub == 'action') { print caddie_procs::get_display_list_from_caddie($idcaddie, 'categ=caddie&sub='.$sub.'&quelle='.$quelle); } else { print caddie_procs::get_display_list_from_caddie($idcaddie, 'categ=caddie&sub='.$sub.'&moyen='.$moyen, 'SELECT', $action_in_list); } break; } } else { static::get_aff_paniers($sub, $quelle, $moyen); } } public static function proceed_transfert($idcaddie=0, $idcaddie_origine=0) { global $msg; global $action; global $elt_flag, $elt_no_flag; global $bull_not, $bull_dep; $idcaddie += 0; $idcaddie_origine += 0; if($idcaddie) { $myCart = static::get_object_instance($idcaddie); switch ($action) { case 'transfert': print pmb_bidi($myCart->aff_cart_titre()); print $myCart->aff_cart_nb_items(); aff_paniers($idcaddie, "NOTI", static::get_constructed_link('action', 'transfert')."&idcaddie_origine=$idcaddie", "transfert_suite", $msg["caddie_select_transfert_dest"], "", 0, 0, 0,true); break; case 'transfert_suite': $idcaddie_origine = caddie::check_rights($idcaddie_origine) ; if ($idcaddie_origine) { $myCartOrigine = static::get_object_instance($idcaddie_origine); // procédure d'ajout print pmb_bidi($myCartOrigine->aff_cart_titre()); print $myCartOrigine->aff_cart_nb_items(); // le caddie d'origine est BULL, le caddie destination est NOTI, il fait afficher le choix de notice de bulletin ou notices de dépouillement if ($myCart->type=='NOTI' && $myCartOrigine->type=='BULL') $aff_choix_dep = true; else $aff_choix_dep = false; print $myCart->get_choix_quoi_form(static::get_constructed_link('action', 'transfert', 'transfert_final', $idcaddie)."&idcaddie_origine=$idcaddie_origine", static::get_constructed_link('action', 'transfert'), $msg["caddie_choix_transfert"], $msg["caddie_bouton_transferer"], "", $aff_choix_dep); print pmb_bidi($myCart->aff_cart_titre()); print $myCart->aff_cart_nb_items(); } break; case 'transfert_final': $idcaddie_origine = caddie::check_rights($idcaddie_origine) ; if ($idcaddie_origine) { $myCartOrigine = static::get_object_instance($idcaddie_origine); print pmb_bidi($myCart->aff_cart_titre()); print $myCart->aff_cart_nb_items(); if ($myCart->type=='NOTI' && $myCartOrigine->type=='BULL') { // cas du transfert depuis caddie de BULL vers caddie de notices if ($bull_not) { // transfert des notices de bulletin if ($elt_flag) { $liste = $myCartOrigine->get_cart("FLAG") ; foreach ($liste as $cle => $object) { $myCart->add_item($object, $myCartOrigine->type) ; } } if ($elt_no_flag) { $liste = $myCartOrigine->get_cart("NOFLAG") ; foreach ($liste as $cle => $object) { $myCart->add_item($object, $myCartOrigine->type) ; } } } if ($bull_dep) { // transfert des notices de dépouillement if ($elt_flag) { $liste = $myCartOrigine->get_cart("FLAG") ; foreach ($liste as $cle => $object) { $myCart->add_item($object, $myCartOrigine->type, "DEP") ; } } if ($elt_no_flag) { $liste = $myCartOrigine->get_cart("NOFLAG") ; foreach ($liste as $cle => $object) { $myCart->add_item($object, $myCartOrigine->type, "DEP") ; } } } } else { // on est dans le cas "normal" if ($elt_flag) { $liste = $myCartOrigine->get_cart("FLAG") ; foreach ($liste as $cle => $object) { $myCart->add_item($object, $myCartOrigine->type) ; } } if ($elt_no_flag) { $liste = $myCartOrigine->get_cart("NOFLAG") ; foreach ($liste as $cle => $object) { $myCart->add_item($object, $myCartOrigine->type) ; } } } $myCart->compte_items(); // procédure d'ajout echo "

".$msg['empr_caddie_menu_action_apres_transfert']."

"; print $myCart->aff_cart_nb_items(); } break; default: break; } } else { static::get_aff_paniers('action', 'transfert'); } } public static function proceed_barcode($idcaddie=0, $sub='', $action_prefix='') { global $msg; global $action; global $form_cb_expl; global $begin_result_expl_liste_unique; global $alert_sound_list; //used outside if($idcaddie) { $myCart = static::get_object_instance($idcaddie); print pmb_bidi($myCart->aff_cart_titre()); switch ($action) { case 'add_item': case 'pointe_item': $form_cb_expl=trim($form_cb_expl); $item_info = $myCart->get_item_info_from_expl_cb($form_cb_expl); if($action == 'add_item') { if ($item_info->expl_ajout_ok) $res_ajout = $myCart->add_item($item_info->expl_id,"EXPL"); else $res_ajout = $myCart->add_item_blob($form_cb_expl,"EXPL_CB" ); $myCart->compte_items(); } else { $res_ajout = $myCart->pointe_item($item_info->expl_id,"EXPL", $form_cb_expl, "EXPL_CB" ); } print $myCart->aff_cart_nb_items(); // form de saisie cb exemplaire print get_cb_expl($msg["caddie_".$action_prefix."_expl"], $msg[661], "./catalog.php?categ=caddie&sub=".$sub."&moyen=douchette&action=".$action_prefix."_item&idcaddie=$idcaddie"); if ($item_info->expl_ajout_ok) { if ($res_ajout==CADDIE_ITEM_OK) { print "
".$msg["caddie_".$myCart->type."_".($action_prefix == 'add' ? 'added' : $action_prefix)]."

"; print $begin_result_expl_liste_unique; print pmb_bidi(print_info($item_info->stuff,0,1)); } if ($res_ajout==CADDIE_ITEM_NULL) { print "
".$msg['caddie_item_null']."

"; $alert_sound_list[]="critique"; } if ($res_ajout==CADDIE_ITEM_IMPOSSIBLE_BULLETIN) { print "
".$msg["caddie_".($action_prefix == 'add' ? '' : $action_prefix.'_')."item_impossible_bulletin"]."

"; $alert_sound_list[]="critique"; } if ($res_ajout==CADDIE_ITEM_INEXISTANT) { print "
$form_cb_expl : ".$msg['caddie_'.$action_prefix.'_inconnu_panier']."

"; $alert_sound_list[]="critique"; } } else print "
".$item_info->message_ajout_expl."

" ; break; default: print $myCart->aff_cart_nb_items(); // form de saisie cb exemplaire print get_cb_expl($msg["caddie_".$action_prefix."_expl"], $msg[661], "./catalog.php?categ=caddie&sub=".$sub."&moyen=douchette&action=".$action_prefix."_item&idcaddie=$idcaddie"); break; } } else { static::get_aff_paniers($sub, '', 'douchette'); } } public static function proceed_edition_export_noti($idcaddie=0, $mode="simple") { global $msg, $charset; global $elt_flag , $elt_no_flag, $notice_tpl; $idcaddie += 0; if($idcaddie) { $myCart = static::get_object_instance($idcaddie); $fname = "bibliographie.doc"; header('Content-Disposition: attachment; filename="'.$fname.'"'); header('Content-type: application/msword'); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0,pre-check=0"); header("Pragma: public"); print ''.$msg['print_title'].''; switch ($mode) { case 'advanced': print $myCart->get_list_caddie_content_ui()->get_display_export_noti_list(); break; case 'simple': default: $contents=afftab_cart_objects ($idcaddie, $elt_flag , $elt_no_flag, $notice_tpl); print $contents; break; } print ''; } } public static function print_prepare($idcaddie_new=0) { global $msg, $base_path; global $object_type, $item, $current_print, $aff_lien, $boutons_select; global $bannette_id; global $selected_objects, $include_child, $pager; if(!$object_type) $object_type = 'NOTI'; print ""; print "

" . $msg["print_cart_title"] . "

\n"; print "
"; //Affichage de la sélection des paniers $requete = "select caddie.*,count(object_id) as nb_objects, count(flag=1) as nb_flags from caddie left join caddie_content on caddie_id=idcaddie group by idcaddie order by type, name, comment"; $resultat = pmb_mysql_query($requete); $ctype = ""; $parity = 0; $script_submit = ''; $print_cart = array(); while ($ca = pmb_mysql_fetch_object($resultat)) { if ($idcaddie_new && ($idcaddie_new != $ca->idcaddie)) continue; if (!empty($idcaddie_new) && ($idcaddie_new == $ca->idcaddie)) { $script_submit = ""; } $ca_auth = explode(" ", $ca->autorisations); $as = in_array(SESSuserid, $ca_auth); if (($as !== false) && ($as !== null)) { if ($ca->type != $ctype) { $ctype = $ca->type; $print_cart[$ctype]["titre"] = "" . $msg["caddie_de_" . $ca->type] . "
"; } if (!trim($ca->caddie_classement)) { $ca->caddie_classement = classementGen::getDefaultLibelle(); } $print_cart[$ctype]["classement_list"][$ca->caddie_classement]["title"] = stripslashes($ca->caddie_classement); $parity = 1 - $parity; if ($parity) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" "; if(!isset($print_cart[$ctype]["classement_list"][$ca->caddie_classement]["cart_list"])) { $print_cart[$ctype]["classement_list"][$ca->caddie_classement]["cart_list"] = ''; } $print_cart[$ctype]["classement_list"][$ca->caddie_classement]["cart_list"].= pmb_bidi(" "); $link = "print_cart.php?action=print&object_type=" . $object_type . "&idcaddie=" . $ca->idcaddie . "&item=$item¤t_print=$current_print"; $print_cart[$ctype]["classement_list"][$ca->caddie_classement]["cart_list"].= pmb_bidi("" . $ca->name . ""); if ($ca->comment) { $print_cart[$ctype]["classement_list"][$ca->caddie_classement]["cart_list"].= pmb_bidi("
(" . $ca->comment . ")"); } $print_cart[$ctype]["classement_list"][$ca->caddie_classement]["cart_list"].= pmb_bidi(" " . $ca->nb_flags . "" . $msg['caddie_contient_pointes'] . " / $ca->nb_objects $aff_lien "); } } if (!isset($pager) && !$selected_objects) $pager = 0; elseif (!isset($pager)) $pager = 2; if (!isset($include_child)) $include_child = 0; if (!isset($selected_objects)) $selected_objects = ''; print "  
 
 
 "; print ""; print "

$boutons_select 
"; print "
"; print pmb_bidi("
" . $msg['caddie_add_search'] . "
"); if (count($print_cart)) { foreach ($print_cart as $key => $cart_type) { ksort($print_cart[$key]["classement_list"]); } 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"]); $contenu = ""; foreach ($cart_type["classement_list"] as $keyBis => $cart_typeBis) { $contenu.=gen_plus($key . $keyBis, $cart_typeBis["title"], "" . $cart_typeBis["cart_list"] . "
", 1); } print gen_plus($key, $cart_type["titre"], $contenu, 1); } } print ""; if($bannette_id) { print ""; } if($selected_objects) { print ""; } $boutons_select = ''; if (count($print_cart)) { $boutons_select = ""; } $boutons_select.= " "; $object_type = "NOTI"; print "

$boutons_select 
"; print "
"; print $script_submit; } public static function print_cart() { global $msg; global $object_type; global $nb_per_page_search, $page; global $idcaddie; $environement = $_SESSION["PRINT_CART"]; if(!$object_type) $object_type = 'NOTI'; if(!empty($environement['bannette_id'])){ $requete = "SELECT notice_id FROM bannette_contenu join notices on notice_id = num_notice where num_bannette='".$environement['bannette_id']."' order by index_sew"; } elseif ($environement["TEXT_QUERY"]) { if (count($environement["TEXT_LIST_QUERY"])) { foreach($environement["TEXT_LIST_QUERY"] as $query) { @pmb_mysql_query($query); } } $requete = $environement["TEXT_QUERY"]; if ($_SESSION["tri"]) { $sort = new sort('notices', 'base'); //$requete = $sort->appliquer_tri($_SESSION["tri"], $requete, "notice_id"); if ($nb_per_page_search) { //$requete .= " LIMIT ".$page*$nb_per_page_search.",".$nb_per_page_search; $requete = $sort->appliquer_tri($_SESSION["tri"], $requete, "notice_id", $page * $nb_per_page_search, $nb_per_page_search); } else { $requete = $sort->appliquer_tri($_SESSION["tri"], $requete, "notice_id", 0, 0); } } if (!$environement["pager"]) { $p = stripos($requete, "limit"); if ($p) { $requete = substr($requete, 0, $p); } } } else { switch ($environement["SEARCH_TYPE"]) { case "extended": $sh = new search(); $table = $sh->make_search(); $requete = "select " . $table . ".* from $table"; if ($_SESSION["tri"]) { $sort = new sort('notices', 'base'); if ($nb_per_page_search) { $requete = $sort->appliquer_tri($_SESSION["tri"], $requete, "notice_id", $page * $nb_per_page_search, $nb_per_page_search); } else { $requete = $sort->appliquer_tri($_SESSION["tri"], $requete, "notice_id", 0, 0); } if (!$environement["pager"]) { $p = stripos($requete, "limit"); if ($p) { $requete = substr($requete, 0, $p); } } } else { $requete .= ",notices where notices.notice_id=$table.notice_id"; global $search; if(count($search) > 1) { $requete .= " order by index_serie, tnvol, index_sew"; } if ($environement["pager"]) { $requete.=" limit " . $nb_per_page_search * $page . ",$nb_per_page_search"; } } break; case "cart": $requete = "select object_id as notice_id from caddie_content"; if ($_SESSION["tri"]) { $requete.=" where caddie_id=" . $idcaddie; $sort = new sort('notices', 'base'); if ($nb_per_page_search) { $requete = $sort->appliquer_tri($_SESSION["tri"], $requete, "notice_id", $nb_per_page_search * ($page - 1), $nb_per_page_search); } else { $requete = $sort->appliquer_tri($_SESSION["tri"], $requete, "notice_id", 0, 0); } if (!$environement["pager"]) { $p = stripos($requete, "limit"); if ($p) { $requete = substr($requete, 0, $p); } } } else { $requete.= ",notices where notices.notice_id=caddie_content.object_id and caddie_id=" . $idcaddie; $orderby = " order by index_sew"; if ($environement["pager"]) { $requete.=$orderby . " limit " . ($nb_per_page_search * ($page - 1)) . ",$nb_per_page_search"; } } break; case "expl": $sh = new search(true, "search_fields_expl"); $table = $sh->make_search(); if ($environement["pager"]) { $limit = "limit " . ($nb_per_page_search * $page) . ",$nb_per_page_search"; } $requete = "select expl_id as notice_id from $table " . $limit; $object_type = "EXPL"; break; default : $sh = new searcher_records_tab($environement["FORM_VALUES"]); $notices = $sh->get_result(); $requete = "select notice_id from notices where notice_id in ($notices)"; break; } } if (!isset($environement['selected_objects'])) { $environement['selected_objects'] = array(); } if ($environement["caddie"]) { $message = ''; foreach ($environement["caddie"] as $environement_caddie) { $c = new caddie($environement_caddie); $nb_items_before = $c->nb_item; $resultat = @pmb_mysql_query($requete); print pmb_mysql_error(); while (($r = pmb_mysql_fetch_object($resultat))) { if ($environement["pager"] != 2 || in_array($r->notice_id, $environement['selected_objects'])) { if ($environement["include_child"]) { $tab_list_child = notice::get_list_child($r->notice_id); if (count($tab_list_child)) { foreach ($tab_list_child as $notice_id) { $c->add_item($notice_id, $object_type); } } } else { $c->add_item($r->notice_id, $object_type); } } } $c->compte_items(); $message.=sprintf($msg["print_cart_n_added"] . "\\n", ($c->nb_item - $nb_items_before), $c->name); } print ""; } else { print ""; } $_SESSION["PRINT_CART"] = false; } public static function set_session() { global $current_print, $caddie, $pager, $include_child, $msg; global $bannette_id; global $selected_objects; if($bannette_id) { $_SESSION["PRINT_CART"] = array(); $_SESSION["PRINT_CART"]["caddie"]=$caddie; $_SESSION["PRINT_CART"]["pager"]=$pager; $_SESSION["PRINT_CART"]["include_child"]=$include_child; $_SESSION["PRINT_CART"]["bannette_id"]=$bannette_id; if($selected_objects) { $_SESSION["PRINT_CART"]["selected_objects"]=explode(',', $selected_objects); } echo ""; } elseif ($_SESSION["session_history"][$current_print]) { if($_SESSION["session_history"][$current_print]["NOTI"]){ $_SESSION["PRINT_CART"]=$_SESSION["session_history"][$current_print]["NOTI"]; } else if ($_SESSION["session_history"][$current_print]["EXPL"]) { $_SESSION["PRINT_CART"]=$_SESSION["session_history"][$current_print]["EXPL"]; } $_SESSION["PRINT_CART"]["caddie"]=$caddie; $_SESSION["PRINT_CART"]["pager"]=$pager; $_SESSION["PRINT_CART"]["include_child"]=$include_child; if($selected_objects) { $_SESSION["PRINT_CART"]["selected_objects"]=explode(',', $selected_objects); } echo ""; } else { echo ""; } } } // fin de déclaration de la classe caddie_controller