示例#1
0
 function show_list_form()
 {
     global $form_filtre_demande, $form_liste_demande;
     global $dbh, $charset, $msg;
     global $idetat, $iduser, $idempr, $user_input;
     global $date_debut, $date_fin, $id_type, $id_theme, $dmde_loc;
     //Formulaire des filtres
     $date_deb = "\n\t\t\t<input type='hidden' id='date_debut' name='date_debut' value='!!date_debut!!' />\n\t\t\t<input type='button' class='bouton' id='date_debut_btn' name='date_debut_btn' value='!!date_debut_btn!!' onClick=\"openPopUp('./select.php?what=calendrier&caller=search&date_caller=!!date_debut!!&param1=date_debut&param2=date_debut_btn&auto_submit=NO&date_anterieure=YES', 'date_debut', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"/>\n\t\t";
     $date_but = "\n\t\t\t<input type='hidden' id='date_fin' name='date_fin' value='!!date_fin!!' />\n\t\t\t<input type='button' class='bouton' id='date_fin_btn' name='date_fin_btn' value='!!date_fin_btn!!' onClick=\"openPopUp('./select.php?what=calendrier&caller=search&date_caller=!!date_fin!!&param1=date_fin&param2=date_fin_btn&auto_submit=NO&date_anterieure=YES', 'date_fin', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"/>\n\t\t";
     //Affichage de l'état en entete de page (si séléctioné)
     if ($idetat) {
         $form_filtre_demande = str_replace('!!etat_demandes!!', htmlentities(stripslashes($this->liste_etat[$idetat]['comment']), ENT_QUOTES, $charset), $form_filtre_demande);
     } else {
         $form_filtre_demande = str_replace('!!etat_demandes!!', "", $form_filtre_demande);
     }
     if ($date_debut && $date_fin) {
         $date_deb = str_replace('!!date_debut_btn!!', formatdate($date_debut), $date_deb);
         $date_but = str_replace('!!date_fin_btn!!', formatdate($date_fin), $date_but);
         $date_deb = str_replace('!!date_debut!!', $date_debut, $date_deb);
         $date_but = str_replace('!!date_fin!!', $date_fin, $date_but);
     } else {
         $date_lib = formatdate(today());
         $date_sql = date("Y-m-d", time());
         $date_deb = str_replace('!!date_debut_btn!!', $date_lib, $date_deb);
         $date_but = str_replace('!!date_fin_btn!!', $date_lib, $date_but);
         $date_deb = str_replace('!!date_debut!!', $date_sql, $date_deb);
         $date_but = str_replace('!!date_fin!!', $date_sql, $date_but);
     }
     if ($idempr) {
         $form_filtre_demande = str_replace('!!idempr!!', $idempr, $form_filtre_demande);
         $carac_empr = $this->getCaracEmpr($idempr);
         $nom = $carac_empr['nom'];
         $form_filtre_demande = str_replace('!!empr_txt!!', $nom, $form_filtre_demande);
     } else {
         $form_filtre_demande = str_replace('!!idempr!!', '', $form_filtre_demande);
         $form_filtre_demande = str_replace('!!empr_txt!!', '', $form_filtre_demande);
     }
     $form_filtre_demande = str_replace('!!user_input!!', htmlentities(stripslashes($user_input), ENT_QUOTES, $charset), $form_filtre_demande);
     $form_filtre_demande = str_replace('!!periode!!', sprintf($msg['demandes_filtre_periode_lib'], $date_deb, $date_but), $form_filtre_demande);
     $onchange = "onchange='this.form.act.value=\"search\";submit()'";
     $form_filtre_demande = str_replace('!!affectation!!', $this->getUsersSelector($onchange, true, false, true), $form_filtre_demande);
     $form_filtre_demande = str_replace('!!state!!', $this->getStateSelector($idetat, $onchange, true), $form_filtre_demande);
     $themes = new demandes_themes('demandes_theme', 'id_theme', 'libelle_theme', $id_type);
     $types = new demandes_types('demandes_type', 'id_type', 'libelle_type', $id_theme);
     $form_filtre_demande = str_replace('!!theme!!', $themes->getListSelector($id_theme, $onchange, true), $form_filtre_demande);
     $form_filtre_demande = str_replace('!!type!!', $types->getListSelector($id_type, $onchange, true), $form_filtre_demande);
     $req_loc = "select idlocation, location_libelle from docs_location";
     $res_loc = pmb_mysql_query($req_loc, $dbh);
     $sel_loc = "<select id='dmde_loc' name='dmde_loc' onchange='this.form.act.value=\"search\";submit()' >";
     $sel_loc .= "<option value='0' " . (!$dmde_loc ? 'selected' : '') . ">" . htmlentities($msg['demandes_localisation_all'], ENT_QUOTES, $charset) . "</option>";
     while ($loc = pmb_mysql_fetch_object($res_loc)) {
         $sel_loc .= "<option value='" . $loc->idlocation . "' " . ($dmde_loc == $loc->idlocation ? 'selected' : '') . ">" . htmlentities($loc->location_libelle, ENT_QUOTES, $charset) . "</option>";
     }
     $sel_loc .= "</select>";
     $form_filtre_demande = str_replace('!!localisation!!', $sel_loc, $form_filtre_demande);
     $p_perso = new parametres_perso("demandes");
     if (!$p_perso->no_special_fields) {
         $c = 0;
         $perso_ = $p_perso->show_search_fields();
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             if ($c == 0) {
                 $perso .= "<div class='row'>";
             }
             $perso .= "<div class='colonne3'><label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . "</label><div class='row'>" . $p["AFF"] . "</div></div>";
             $c++;
             if ($c == 3) {
                 $perso .= "</div>";
                 $c = 0;
             }
         }
         if ($c == 1) {
             $perso .= "<div class='colonne2'>&nbsp;</div><div class='colonne2'>&nbsp;</div></div>";
         } elseif ($c == 2) {
             $perso .= "<div class='colonne2'>&nbsp;</div></div>";
         }
     }
     $form_filtre_demande = str_replace("!!champs_perso!!", $perso, $form_filtre_demande);
     print $form_filtre_demande;
     $header_champs_perso = "";
     reset($p_perso->t_fields);
     $nb_cp_column = 0;
     while (list($key, $val) = each($p_perso->t_fields)) {
         $header_champs_perso .= "<th>" . htmlentities($val["TITRE"], ENT_QUOTES, $charset) . "</th>";
         $nb_cp_column++;
     }
     //Formulaire de la liste
     $req = self::getQueryFilter($idetat, $iduser, $idempr, $user_input, $date_debut, $date_fin, $id_theme, $id_type, $dmde_loc);
     $res = pmb_mysql_query($req, $dbh);
     $liste = "";
     if (pmb_mysql_num_rows($res)) {
         $parity = 1;
         while ($dmde = pmb_mysql_fetch_object($res)) {
             $dmde = new demandes($dmde->id_demande);
             if ($parity % 2) {
                 $pair_impair = "even";
             } else {
                 $pair_impair = "odd";
             }
             $parity += 1;
             $tr_javascript = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='" . $pair_impair . "'\" ";
             $action = "onclick=\"document.location='./demandes.php?categ=gestion&act=see_dmde&iddemande=" . $dmde->id_demande;
             //Ajout des éléments de retour vers la bonne liste
             if ($idetat) {
                 $action .= "&idetat=" . $idetat;
             }
             if ($iduser) {
                 $action .= "&iduser="******"&idempr=" . $idempr;
             }
             if ($user_input) {
                 $action .= "&user_input=" . $user_input;
             }
             if ($date_debut) {
                 $action .= "&date_debut=" . $date_debut;
             }
             if ($date_fin) {
                 $action .= "&date_fin=" . $date_fin;
             }
             if ($id_type) {
                 $action .= "&id_type=" . $id_type;
             }
             if ($id_theme) {
                 $action .= "&id_theme=" . $id_theme;
             }
             if ($dmde_loc) {
                 $action .= "&dmde_loc=" . $dmde_loc;
             }
             $action .= "'\"";
             // affichage en gras si nouveauté du côté des notes ou des actions
             $dmde->dmde_read_gestion = demandes::dmde_majRead($dmde->id_demande, "_gestion");
             if ($dmde->dmde_read_gestion == 1) {
                 $style = " style='cursor: pointer; font-weight:bold'";
             } else {
                 $style = " style='cursor: pointer'";
             }
             $liste .= "<tr id='dmde" . $dmde->id_demande . "' class='" . $pair_impair . "' " . $tr_javascript . $style . "  >";
             $carac_empr = $dmde->getCaracEmpr($dmde->num_demandeur);
             $nom_empr = $carac_empr['nom'];
             $nom_user = '';
             if (sizeof($dmde->users)) {
                 foreach ($dmde->users as $id => $user) {
                     if ($user['statut'] == 1) {
                         if ($nom_user) {
                             $nom_user .= "/ ";
                         }
                         $nom_user .= $user['nom'];
                     }
                 }
             }
             $liste .= "<td><img hspace=\"3\" border=\"0\" onclick=\"expand_action('action" . $dmde->id_demande . "','{$dmde->id_demande}', true); return false;\" title=\"\" id=\"action" . $dmde->id_demande . "Img\" name=\"imEx\" class=\"img_plus\" src=\"./images/plus.gif\"></td>";
             $liste .= "<td>";
             if ($dmde->dmde_read_gestion == 1) {
                 // remplacer $action le jour où on décide d'activer la modif d'état manuellement par onclick=\"change_read_dmde('dmde".$dmde->id_demande."','$dmde->id_demande', true); return false;\"
                 $liste .= "<img hspace=\"3\" border=\"0\" title=\"\" " . $action . " id=\"dmde" . $dmde->id_demande . "Img1\" name=\"imRead\" class=\"img_plus\" src=\"./images/notification_empty.png\" style='display:none'>\n\t\t\t\t\t\t\t\t<img hspace=\"3\" border=\"0\" title=\"\" " . $action . " id=\"dmde" . $dmde->id_demande . "Img2\" name=\"imRead\" class=\"img_plus\" src=\"./images/notification_new.png\">";
             } else {
                 // remplacer $action le jour où on décide d'activer la modif d'état manuellement par onclick=\"change_read_dmde('dmde".$dmde->id_demande."','$dmde->id_demande', true); return false;\"
                 $liste .= "<img hspace=\"3\" border=\"0\" title=\"\" " . $action . " id=\"dmde" . $dmde->id_demande . "Img1\" name=\"imRead\" class=\"img_plus\" src=\"./images/notification_empty.png\" >\n\t\t\t\t\t\t\t\t<img hspace=\"3\" border=\"0\" title=\"\" " . $action . " id=\"dmde" . $dmde->id_demande . "Img2\" name=\"imRead\" class=\"img_plus\" src=\"./images/notification_new.png\" style='display:none'>";
             }
             $liste .= "\n\t\t\t\t\t</td>\n\t\t\t\t\t<td {$action}>" . htmlentities($themes->getLabel($dmde->theme_demande), ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities($types->getLabel($dmde->type_demande), ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities($dmde->titre_demande, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities($dmde->workflow->getStateCommentById($dmde->etat_demande), ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities(formatdate($dmde->date_demande), ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities(formatdate($dmde->date_prevue), ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities(formatdate($dmde->deadline_demande), ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities($nom_empr, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities($nom_user, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td><span id='progressiondemande_" . $dmde->id_demande . "'  dynamics='demandes,progressiondemande' dynamics_params='img/img' >\n\t\t\t\t\t\t<img src=\"./images/jauge.png\" height='15px' width=\"" . $dmde->progression . "%\" title='" . $dmde->progression . "%' />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</td>";
             $perso_ = $p_perso->show_fields($dmde->id_demande);
             for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                 $p = $perso_["FIELDS"][$i];
                 $liste .= "<td>" . nl2br($p["AFF"]) . "</td>";
             }
             if ($dmde->num_notice) {
                 $liste .= "<td><a href='./catalog.php?categ=isbd&id={$dmde->num_notice}'><img border='0' align='middle' src='./images/notice.gif' alt='" . htmlentities($msg['demandes_see_notice'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['demandes_see_notice'], ENT_QUOTES, $charset) . "'></a></td>";
             } else {
                 $liste .= "<td></td>";
             }
             $liste .= "<td ><input type='checkbox' id='chk[" . $dmde->id_demande . "]' name='chk[]' value='" . $dmde->id_demande . "'></td>";
             $liste .= "</tr>";
             //Le détail de l'action, contient les notes
             $liste .= "<tr id=\"action" . $dmde->id_demande . "Child\" style=\"display:none\">\r\n\t\t\t\t<td></td>\r\n\t\t\t\t<td colspan=\"" . ($nb_cp_column + 13) . "\" id=\"action" . $dmde->id_demande . "ChildTd\">";
             $liste .= "</td>\r\n\t\t\t\t</tr>";
         }
         $btn_suppr = "<input type='submit' class='bouton' value='{$msg['63']}' onclick='this.form.act.value=\"suppr_noti\"; return verifChk(\"suppr\");'/>";
         //afficher la liste des boutons de changement d'état
         if ($idetat) {
             $states = $this->workflow->getStateList($idetat);
             $states_btn = $this->getDisplayStateBtn($states, 1);
         }
         $affectation_btn = "";
         if ($iduser == -1) {
             $affectation_btn = "<input type='submit' class='bouton' name='affect_btn' id='affect_btn' onclick='this.form.act.value=\"affecter\";return verifChk();' value='" . htmlentities($msg['demandes_attribution_checked'], ENT_QUOTES, $charset) . "' />&nbsp;" . $this->getUsersSelector();
         }
     } else {
         $liste .= "<tr><td>" . $msg['demandes_liste_vide'] . "</td></tr>";
     }
     $form_liste_demande = str_replace('!!header_champs_perso!!', $header_champs_perso, $form_liste_demande);
     $form_liste_demande = str_replace('!!btn_etat!!', $states_btn, $form_liste_demande);
     $form_liste_demande = str_replace('!!btn_attribue!!', $affectation_btn, $form_liste_demande);
     $form_liste_demande = str_replace('!!btn_suppr!!', $btn_suppr, $form_liste_demande);
     $form_liste_demande = str_replace('!!liste_dmde!!', $liste, $form_liste_demande);
     print $form_liste_demande;
 }
示例#2
0
 function show_list_form()
 {
     global $form_filtre_demande, $form_liste_demande, $base_path, $opac_url_base;
     global $dbh, $charset, $msg;
     global $idetat, $iduser, $id_empr, $user_input;
     global $date_debut, $date_fin, $id_type, $id_theme, $dmde_loc;
     global $opac_demandes_affichage_simplifie, $demandes_notice_auto_tpl;
     global $view;
     if (!$idetat) {
         $entete = "<th>" . $msg['demandes_etat'] . "</th>";
         $form_liste_demande = str_replace('!!entete_etat!!', $entete, $form_liste_demande);
     } else {
         $entete = "<th></th>";
         $form_liste_demande = str_replace('!!entete_etat!!', $entete, $form_liste_demande);
     }
     $onChange = "onchange=\"submit();\"";
     $form_liste_demande = str_replace('!!select_etat!!', $this->getStateSelector($idetat, $onChange, true), $form_liste_demande);
     $header_champs_perso = "";
     $p_perso = new parametres_perso("demandes");
     reset($p_perso->t_fields);
     while (list($key, $val) = each($p_perso->t_fields)) {
         if ($val["OPAC_SHOW"]) {
             $header_champs_perso .= "<th>" . htmlentities($val["TITRE"], ENT_QUOTES, $charset) . "</th>";
         }
     }
     //Formulaire de la liste
     $req = self::getQueryFilter($idetat, $iduser, $id_empr, $user_input, $date_debut, $date_fin, $id_theme, $id_type, $dmde_loc);
     $res = pmb_mysql_query($req, $dbh);
     $liste = "";
     $nb_news = 0;
     if ($nb_demande = pmb_mysql_num_rows($res)) {
         $parity = 1;
         while ($dmde = pmb_mysql_fetch_object($res)) {
             $dmde = new demandes($dmde->id_demande);
             if ($parity % 2) {
                 $pair_impair = "even";
             } else {
                 $pair_impair = "odd";
             }
             $parity += 1;
             $tr_javascript = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='" . $pair_impair . "'\" ";
             $action = "onclick=document.location='./empr.php?tab=request&lvl=list_dmde&sub=open_demande&iddemande={$dmde->id_demande}";
             //Ajout des éléments de retour vers la bonne liste
             if ($idetat) {
                 $action .= "&idetat=" . $idetat;
             }
             if ($iduser) {
                 $action .= "&iduser="******"&id_empr=".$id_empr;
             // 				}
             if ($user_input) {
                 $action .= "&user_input=" . $user_input;
             }
             if ($date_debut) {
                 $action .= "&date_debut=" . $date_debut;
             }
             if ($date_fin) {
                 $action .= "&date_fin=" . $date_fin;
             }
             if ($id_type) {
                 $action .= "&id_type=" . $id_type;
             }
             if ($id_theme) {
                 $action .= "&id_theme=" . $id_theme;
             }
             if ($dmde_loc) {
                 $action .= "&dmde_loc=" . $dmde_loc;
             }
             $action .= "'";
             // affichage en gras si nouveauté du côté des notes ou des actions
             $dmde->dmde_read_opac = demandes::dmde_majRead($dmde->id_demande, "_opac");
             if ($dmde->dmde_read_opac == 1) {
                 $style = " style='cursor: pointer; font-weight:bold'";
                 $nb_news++;
                 $demande_id_new = $dmde->id_demande;
             } else {
                 $style = " style='cursor: pointer'";
             }
             if ($demandes_notice_auto_tpl) {
                 if (self::is_notice_visible($dmde)) {
                     $link_noti = "<td><a href='" . $opac_url_base . "index.php?lvl=notice_display&id=" . $dmde->num_notice . "' alt='" . $msg['demandes_see_notice'] . "' title='" . $msg['demandes_see_notice'] . "'><img src='{$base_path}/images/mois.gif' /></a></td>";
                 } else {
                     $link_noti = "<td></td>";
                 }
             }
             $nom_user = '';
             if ($dmde->users) {
                 foreach ($dmde->users as $id => $user) {
                     if ($user['statut'] == 1) {
                         if ($nom_user) {
                             $nom_user .= "/ ";
                         }
                         $nom_user .= $user['nom'];
                     }
                 }
             }
             $liste .= "<tr class='" . $pair_impair . "' " . $tr_javascript . $style . ">";
             $liste .= "<td><img hspace=\"3\" border=\"0\" onclick=\"expand_action('action" . $dmde->id_demande . "','{$dmde->id_demande}', true); return false;\" title=\"\" id=\"action" . $dmde->id_demande . "Img\" name=\"imEx\" class=\"img_plus\" src=\"./images/plus.gif\"></td>";
             $liste .= "<td>";
             if ($dmde->dmde_read_opac == 1) {
                 $liste .= "<img hspace=\"3\" border=\"0\" onclick=\"change_read('read" . $dmde->id_demande . "','{$dmde->id_demande}', true); return false;\" title=\"\" id=\"read" . $dmde->id_demande . "Img1\" name=\"imRead\" class=\"img_plus\" src=\"" . get_url_icon('notification_empty.png') . "\" style='display:none'>\n\t\t\t\t\t\t\t\t<img hspace=\"3\" border=\"0\" onclick=\"change_read('read" . $dmde->id_demande . "','{$dmde->id_demande}', true); return false;\" title=\"\" id=\"read" . $dmde->id_demande . "Img2\" name=\"imRead\" class=\"img_plus\" src=\"" . get_url_icon('notification_new.png') . "\">";
             } else {
                 $liste .= "<img hspace=\"3\" border=\"0\" onclick=\"change_read('read" . $dmde->id_demande . "','{$dmde->id_demande}', true); return false;\" title=\"\" id=\"read" . $dmde->id_demande . "Img1\" name=\"imRead\" class=\"img_plus\" src=\"" . get_url_icon('notification_empty.png') . "\" >\n\t\t\t\t\t\t\t\t<img hspace=\"3\" border=\"0\" onclick=\"change_read('read" . $dmde->id_demande . "','{$dmde->id_demande}', true); return false;\" title=\"\" id=\"read" . $dmde->id_demande . "Img2\" name=\"imRead\" class=\"img_plus\" src=\"" . get_url_icon('notification_new.png') . "\" style='display:none'>";
             }
             $liste .= "</td>";
             if ($dmde->get_num_linked_notice()) {
                 $record_datas = record_display::get_record_datas($dmde->get_num_linked_notice());
             }
             if (!$opac_demandes_affichage_simplifie) {
                 $liste .= "\n\t\t\t\t\t<td {$action}>" . htmlentities($dmde->titre_demande, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities($dmde->workflow->getStateCommentById($dmde->etat_demande), ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities(formatdate($dmde->date_demande), ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities(formatdate($dmde->deadline_demande), ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities($nom_user, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<img src=\"{$base_path}/images/jauge.png\" height='15px' width=\"" . $dmde->progression . "%\" alt='" . $dmde->progression . "%' />\n\t\t\t\t\t</td>";
                 $perso_ = $p_perso->show_fields($dmde->id_demande);
                 for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                     $p = $perso_["FIELDS"][$i];
                     if ($p["OPAC_SHOW"]) {
                         $liste .= "<td>" . nl2br($p["AFF"]) . "</td>";
                     }
                 }
                 $liste .= "<td>";
                 if ($dmde->get_num_linked_notice()) {
                     $liste .= "\n\t\t\t\t\t\t<a href='" . htmlentities($record_datas->get_permalink(), ENT_QUOTES, $charset) . "' title='" . htmlentities($record_datas->get_tit1(), ENT_QUOTES, $charset) . "' >" . htmlentities($record_datas->get_tit1(), ENT_QUOTES, $charset) . "</a>";
                 } else {
                     $liste .= "&nbsp;";
                 }
                 $liste .= "\n\t\t\t\t\t</td>\n\t\t\t\t\t{$link_noti}\n\t\t\t\t\t";
             } else {
                 $liste .= "\n\t\t\t\t\t<td {$action}>" . htmlentities($dmde->titre_demande, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities($dmde->workflow->getStateCommentById($dmde->etat_demande), ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t<td {$action}>" . htmlentities(formatdate($dmde->date_demande), ENT_QUOTES, $charset) . "</td>";
                 $perso_ = $p_perso->show_fields($dmde->id_demande);
                 for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                     $p = $perso_["FIELDS"][$i];
                     if ($p["OPAC_SHOW"]) {
                         $liste .= "<td>" . nl2br($p["AFF"]) . "</td>";
                     }
                 }
                 $liste .= "<td>";
                 if ($dmde->get_num_linked_notice()) {
                     $liste .= "\n\t\t\t\t\t\t<a href='" . htmlentities($record_datas->get_permalink(), ENT_QUOTES, $charset) . "' title='" . htmlentities($record_datas->get_tit1(), ENT_QUOTES, $charset) . "' >" . htmlentities($record_datas->get_tit1(), ENT_QUOTES, $charset) . "</a>";
                 } else {
                     $liste .= "&nbsp;";
                 }
                 $liste .= "\t\n\t\t\t\t\t</td>\n\t\t\t\t\t{$link_noti}\n\t\t\t\t\t";
             }
             $liste .= "</tr>";
             //Le détail de l'action, contient les notes
             $liste .= "<tr id=\"action" . $dmde->id_demande . "Child\" style=\"display:none\">\n\t\t\t\t<td></td>\n\t\t\t\t<td colspan=\"13\" id=\"action" . $dmde->id_demande . "ChildTd\">";
             $liste .= "</td>\n\t\t\t\t</tr>";
             if ($dmde->etat_demande == 2) {
                 $etat_demande_validee++;
                 $demande_id_validee = $dmde->id_demande;
             }
             if ($dmde->etat_demande == 1) {
                 $etat_demande_a_valider++;
                 $demande_id_a_valider = $dmde->id_demande;
             }
         }
     } else {
         $liste .= "<tr><td>" . $msg['demandes_liste_vide'] . "</td></tr>";
     }
     /* plus demandé...
     		if($etat_demande_validee==1 && $view!="all" && !$etat_demande_a_valider){// une seule validée:
     			print "<script type='text/javascript'>document.location=\"./empr.php?tab=request&lvl=list_dmde&sub=open_demande&iddemande=".$demande_id_validee."&#fin\";</script>";
     			return;
     		}
     		if($etat_demande_a_valider==1 && $view!="all" && !$etat_demande_validee){// une seul à valider: 
     			print "<script type='text/javascript'>document.location=\"./empr.php?tab=request&lvl=list_dmde&sub=open_demande&iddemande=".$demande_id_a_valider."&#fin\";</script>";
     			return;
     		}
     		*/
     $form_liste_demande = str_replace('!!header_champs_perso!!', $header_champs_perso, $form_liste_demande);
     $form_liste_demande = str_replace('!!liste_dmde!!', $liste, $form_liste_demande);
     print $form_liste_demande;
 }
require_once $base_path . '/includes/templates/demandes.tpl.php';
require_once $base_path . '/classes/demandes.class.php';
require_once $base_path . '/classes/demandes_actions.class.php';
print "<script type='text/javascript' src='./includes/javascript/http_request.js'></script>\n<script type='text/javascript' src='./includes/javascript/demandes.js'></script>";
$demandes = new demandes($iddemande);
$demandes_action = new demandes_actions($idaction);
$demande_note = new demandes_notes($idnote, $idaction);
switch ($sub) {
    case 'save_action':
        demandes_actions::get_values_from_form($demandes_action);
        foreach ($demandes->allowed_actions as $key => $value) {
            if ($value['active'] && $demandes_action->type_action == $value['id']) {
                demandes_actions::save($demandes_action);
            }
        }
        demandes::dmde_majRead($demandes_action->num_demande, "_opac");
        $demandes->fetch_data($demandes_action->num_demande, false);
        $demandes->show_consult_form($demandes_action->id_action);
        break;
    case 'save_demande':
        demandes::get_values_from_form($demandes);
        demandes::save($demandes);
        $demandes->fetch_data($demandes->id_demande, false);
        $demandes->show_consult_form();
        break;
    case 'add_demande':
        $demandes->show_modif_form();
        break;
    case 'add_action':
        $demandes_action->type_action = $type_action;
        $demandes_action->num_demande = $iddemande;