예제 #1
0
 function show_consult_form($last_modified = 0)
 {
     global $idetat, $iduser, $idempr, $user_input;
     global $date_debut, $date_fin, $id_type, $id_theme, $dmde_loc;
     global $form_consult_dmde, $charset, $msg, $dbh, $demandes_init_workflow, $form_consult_linked_record;
     global $pmb_type_audit, $opac_demandes_no_action, $opac_demandes_allow_from_record;
     $form_consult_dmde = str_replace('!!form_title!!', htmlentities($this->titre_demande, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!sujet_dmde!!', htmlentities($this->sujet_demande, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!etat_dmde!!', htmlentities($this->workflow->getStateCommentById($this->etat_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_dmde!!', htmlentities(formatdate($this->date_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_butoir_dmde!!', htmlentities(formatdate($this->deadline_demande), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!date_prevue_dmde!!', htmlentities(formatdate($this->date_prevue), ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!progression_dmde!!', htmlentities($this->progression . '%', ENT_QUOTES, $charset), $form_consult_dmde);
     for ($i = 0; $i < sizeof($this->users); $i++) {
         if ($i == sizeof($this->users) - 1) {
             $users .= htmlentities($this->users[$i]['nom'], ENT_QUOTES, $charset);
         } else {
             $users .= htmlentities($this->users[$i]['nom'], ENT_QUOTES, $charset) . " / ";
         }
     }
     $carac_empr = $this->getCaracEmpr($this->num_demandeur);
     $nom = $carac_empr['nom'];
     $cb = $carac_empr['empr_cb'];
     $nom_emprunteur = "";
     if (SESSrights & CIRCULATION_AUTH) {
         $nom_emprunteur = "<a href=\"circ.php?categ=pret&form_cb={$cb}\" >" . htmlentities($nom, ENT_QUOTES, $charset) . "</a>";
     }
     $form_consult_dmde = str_replace('!!demandeur!!', $nom_emprunteur ? $nom_emprunteur : $nom, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!attribution!!', $users, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!iddemande!!', $this->id_demande, $form_consult_dmde);
     $form_consult_dmde = str_replace('!!theme_dmde!!', htmlentities($this->theme_libelle, ENT_QUOTES, $charset), $form_consult_dmde);
     $form_consult_dmde = str_replace('!!type_dmde!!', htmlentities($this->type_libelle, ENT_QUOTES, $charset), $form_consult_dmde);
     if ($opac_demandes_allow_from_record && $this->num_linked_notice) {
         $record_datas = record_display::get_record_datas($this->num_linked_notice);
         $form_consult_dmde = str_replace('!!form_linked_record!!', $form_consult_linked_record, $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record!!', htmlentities($record_datas->get_tit1(), ENT_QUOTES, $charset), $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record_id!!', htmlentities($this->num_linked_notice, ENT_QUOTES, $charset), $form_consult_dmde);
         $form_consult_dmde = str_replace('!!linked_record_link!!', htmlentities($record_datas->get_permalink(), ENT_QUOTES, $charset), $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!form_linked_record!!', "", $form_consult_dmde);
     }
     //Champs personalisés
     $perso_aff = "";
     $p_perso = new parametres_perso("demandes");
     if (!$p_perso->no_special_fields) {
         $perso_ = $p_perso->show_fields($this->id_demande);
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             if ($p["AFF"] && $p["OPAC_SHOW"]) {
                 $perso_aff .= "<br />" . $p["TITRE"] . " " . nl2br($p["AFF"]);
             }
         }
     }
     if ($perso_aff) {
         $form_consult_dmde = str_replace("!!champs_perso!!", $perso_aff, $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace("!!champs_perso!!", "", $form_consult_dmde);
     }
     if (self::is_notice_visible($this)) {
         $link_noti = "<a href='" . $opac_url_base . "index.php?lvl=notice_display&id=" . $this->num_notice . "' alt='" . $msg['demandes_see_notice'] . "' title='" . $msg['demandes_see_notice'] . "'><img src='{$base_path}/images/mois.gif' /></a>";
     } else {
         $link_noti = "";
     }
     $form_consult_dmde = str_replace('!!icone!!', $link_noti, $form_consult_dmde);
     //construction de l'url de retour
     $params_retour = '';
     if ($idetat) {
         $params_retour .= "&idetat=" . $idetat;
     }
     // 		if($iduser){
     // 			$params_retour.="&iduser="******"&idempr=".$idempr;
     // 		}
     if ($user_input) {
         $params_retour .= "&user_input=" . $user_input;
     }
     if ($date_debut) {
         $params_retour .= "&date_debut=" . $date_debut;
     }
     if ($date_fin) {
         $params_retour .= "&date_fin=" . $date_fin;
     }
     if ($id_type) {
         $params_retour .= "&id_type=" . $id_type;
     }
     if ($id_theme) {
         $params_retour .= "&id_theme=" . $id_theme;
     }
     if ($dmde_loc) {
         $params_retour .= "&dmde_loc=" . $dmde_loc;
     }
     if ($params_retour) {
         $form_consult_dmde = str_replace('!!params_retour!!', htmlentities(stripslashes($params_retour), ENT_QUOTES, $charset), $form_consult_dmde);
     } else {
         $form_consult_dmde = str_replace('!!params_retour!!', "", $form_consult_dmde);
     }
     if (sizeof($this->users) && $demandes_init_workflow !== "2" && !$opac_demandes_no_action) {
         $listActionButton = '&nbsp;' . $msg['demandes_action_type_add'] . '&nbsp;';
         if (sizeof($this->allowed_actions)) {
             foreach ($this->allowed_actions as $key => $actionType) {
                 if ($actionType['active'] == 1) {
                     $listActionButton .= "<input type='button' class='bouton' value='" . htmlentities($actionType['comment'], ENT_QUOTES, $charset) . "' onClick=\"document.location='./empr.php?tab=request&lvl=list_dmde&sub=add_action&type_action=" . $actionType['id'] . "&iddemande={$this->id_demande}'\" />";
                 }
             }
         }
         if ($listActionButton) {
             $form_consult_dmde = str_replace('!!add_actions_list!!', $listActionButton, $form_consult_dmde);
         } else {
             $form_consult_dmde = str_replace('!!add_actions_list!!', "", $form_consult_dmde);
         }
     } else {
         $form_consult_dmde = str_replace('!!add_actions_list!!', "", $form_consult_dmde);
     }
     $modify_button = "";
     foreach ($this->workflow->object_states_by_id as $key => $value) {
         //id d'etat de demande par défaut
         if ($this->workflow->object_workflow['STARTSTATE'][0]['value'] == $value && $key == $this->etat_demande) {
             $modify_button = "<input type='button' class='bouton' value='" . $msg['demandes_modify'] . "' onClick=\"document.location='./empr.php?tab=request&lvl=list_dmde&sub=add_demande&iddemande={$this->id_demande}'\" />";
         }
     }
     $form_consult_dmde = str_replace('!!demande_modify!!', $modify_button, $form_consult_dmde);
     if (sizeof($this->users) && $demandes_init_workflow !== "2") {
         //Liste des actions
         $this->fetch_data($this->id_demande, false);
         if ($this->etat_demande == 4 || $this->etat_demande == 5) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande);
         } elseif ($last_modified) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $last_modified);
         } elseif ($this->last_modified) {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $this->last_modified->id_action);
         } else {
             $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande);
         }
     }
     if ($this->etat_demande == 1 && !sizeof($this->actions) && $this->dmde_read_opac == 1) {
         demandes::demande_read($this->id_demande, true, "_opac");
         $this->fetch_data($this->id_demande, false);
     }
     print $form_consult_dmde;
 }
예제 #2
0
 /**
  * Retourne le tableau des relations enfants
  * @return array
  */
 public function get_relations_down()
 {
     if (!isset($this->relations_down)) {
         global $relation_typedown, $dbh;
         if (!$relation_typedown) {
             $relation_typedown = new marc_list("relationtypedown");
         }
         $this->relations_down = array();
         $query = "select num_notice, relation_type from notices_relations where linked_notice = " . $this->id . " order by relation_type asc, rank asc";
         $result = pmb_mysql_query($query, $dbh);
         if ($result && pmb_mysql_num_rows($result)) {
             while ($parent = pmb_mysql_fetch_object($result)) {
                 if (!isset($this->relations_down[$parent->relation_type]['label'])) {
                     $this->relations_down[$parent->relation_type]['label'] = $relation_typedown->table[$parent->relation_type];
                 }
                 $this->relations_down[$parent->relation_type]['children'][] = record_display::get_record_datas($parent->num_notice);
             }
         }
     }
     return $this->relations_down;
 }