Exemple #1
0
 static function show_dialog($notes, $num_action, $num_demande, $redirect_to = 'demandes_actions-show_consultation_form')
 {
     global $form_dialog_note, $dbh, $msg, $charset, $id_empr;
     $form_dialog_note = str_replace('!!redirectto!!', $redirect_to, $form_dialog_note);
     $form_dialog_note = str_replace('!!idaction!!', $num_action, $form_dialog_note);
     $form_dialog_note = str_replace('!!iddemande!!', $num_demande, $form_dialog_note);
     $dialog = '';
     if (sizeof($notes)) {
         foreach ($notes as $idNote => $note) {
             //Utilisateur ou lecteur ?
             if ($note->notes_type_user === "1") {
                 $side = 'note_opac';
             } elseif ($note->notes_type_user === "0") {
                 $side = 'note_gest';
             }
             $dialog .= '<div class="' . $side . '" id="note_' . $note->id_note . '">';
             $dialog .= '<div class="btn_note">';
             if ($note->prive) {
                 $dialog .= "<input type='image' src='" . get_url_icon('interdit.gif') . "' alt='" . htmlentities($msg['demandes_note_privacy'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['demandes_note_privacy'], ENT_QUOTES, $charset) . "' onclick='return false;'/>";
             }
             if ($note->rapport) {
                 $dialog .= "<input type='image' src='" . get_url_icon('info.gif') . "' alt='" . htmlentities($msg['demandes_note_rapport'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['demandes_note_rapport'], ENT_QUOTES, $charset) . "' onclick='return false;'/>";
             }
             if ($note->notes_read_opac) {
                 $dialog .= "<input type='image' src='" . get_url_icon('notification_new.png') . "' alt='" . htmlentities($msg['demandes_note_vue'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['demandes_note_vue'], ENT_QUOTES, $charset) . "' onclick='return false;'/>";
             }
             $dialog .= ' </div>';
             $dialog .= "<div>";
             $dialog .= '<div class="entete_note">' . $note->createur_note . ' ' . $msg['381'] . ' ' . formatdate($note->date_note) . '</div>';
             $dialog .= '<p>' . $note->contenu . '</p>';
             $dialog .= '</div>';
             $dialog .= '</div>';
             demandes_notes::note_read($note->id_note, true, "_opac");
         }
         $dialog .= '<a name="fin"></a>';
     }
     // Annulation de l'alerte sur l'action dépliée après lecture des nouvelles notes si c'est la personne à laquelle est affectée l'action qui la lit
     demandes_actions::action_read($num_action, true, "_opac");
     // Mise à jour de la demande dont est issue l'action
     demandes_actions::action_majParentEnfant($num_action, $num_demande, "_opac");
     $form_dialog_note = str_replace('!!dialog!!', $dialog, $form_dialog_note);
     return $form_dialog_note;
 }
 static function show_dialog($notes, $num_action, $num_demande, $redirect_to = 'demandes_actions-show_consultation_form', $from_ajax = false)
 {
     global $dbh, $msg, $charset;
     global $content_dialog_note, $form_dialog_note, $js_dialog_note;
     if ($from_ajax) {
         $dialog_note = $content_dialog_note;
         $form_name = "liste_action";
     } else {
         $dialog_note = $js_dialog_note . $form_dialog_note;
         $form_name = "modif_notes";
     }
     $dialog_note = str_replace('!!redirectto!!', $redirect_to, $dialog_note);
     $dialog_note = str_replace('!!idaction!!', $num_action, $dialog_note);
     $dialog = '';
     if (sizeof($notes)) {
         foreach ($notes as $idNote => $note) {
             //Utilisateur ou lecteur ?
             if ($note->notes_type_user === "1") {
                 $side = 'note_opac';
             } elseif ($note->notes_type_user === "0") {
                 $side = 'note_gest';
             }
             $dialog .= '<div class="' . $side . '" id="note_' . $note->id_note . '">';
             $dialog .= '<div class="btn_note">';
             if ($note->prive) {
                 $dialog .= "<input type='image' src='./images/interdit.gif' alt='" . htmlentities($msg['demandes_note_privacy'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['demandes_note_privacy'], ENT_QUOTES, $charset) . "' onclick='return false;'/>";
             }
             if ($note->rapport) {
                 $dialog .= "<input type='image' src='./images/info.gif' alt='" . htmlentities($msg['demandes_note_rapport'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['demandes_note_rapport'], ENT_QUOTES, $charset) . "' onclick='return false;'/>";
             }
             if ($note->notes_read_gestion) {
                 $dialog .= "<input type='image' onclick=\"change_read_note('note_" . $note->id_note . "','{$note->id_note}','" . $num_action . "','" . $num_demande . "', true); return false;\" title=\"\" id=\"note_" . $note->id_note . "Img1\" name=\"imRead\" class=\"img_plus\" src=\"./images/notification_empty.png\" style='display:none'>\n\t\t\t\t\t\t\t\t<input type='image' onclick=\"change_read_note('note_" . $note->id_note . "','{$note->id_note}','" . $num_action . "','" . $num_demande . "', true); return false;\" title=\"\" id=\"note_" . $note->id_note . "Img2\" name=\"imRead\" class=\"img_plus\" src=\"./images/notification_new.png\">";
             } else {
                 $dialog .= "<input type='image' onclick=\"change_read_note('note_" . $note->id_note . "','{$note->id_note}','" . $num_action . "','" . $num_demande . "', true); return false;\" title=\"\" id=\"note_" . $note->id_note . "Img1\" name=\"imRead\" class=\"img_plus\" src=\"./images/notification_empty.png\" >\n\t\t\t\t\t\t\t\t<input type='image' onclick=\"change_read_note('note_" . $note->id_note . "','{$note->id_note}','" . $num_action . "','" . $num_demande . "', true); return false;\" title=\"\" id=\"note_" . $note->id_note . "Img2\" name=\"imRead\" class=\"img_plus\" src=\"./images/notification_new.png\" style='display:none'>";
             }
             $dialog .= "<input type='image' src='./images/cross.png' alt='" . htmlentities($msg['demandes_note_suppression'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['demandes_note_suppression'], ENT_QUOTES, $charset) . "' \n\t\t\t\t\t\t\t\tonclick='if(confirm_delete_note()) {!!change_action_form!!document.forms[\"" . $form_name . "\"].act.value=\"suppr_note\";document.forms[\"" . $form_name . "\"].idnote.value=\"{$note->id_note}\";} else return false;' />";
             // affichage de l'audit des notes seulement si nécessaire
             $audit_note = new audit(16, $note->id_note);
             $audit_note->get_all();
             if (sizeof($audit_note->all_audit) > 1) {
                 $dialog .= "<input type='image' src='./images/historique.gif'\n\t\t\t\t\tonClick=\"openPopUp('./audit.php?type_obj=16&object_id={$note->id_note}', 'audit_popup', 700, 500, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes'); return false;\" title=\"" . $msg['audit_button'] . "\" value=\"" . $msg['audit_button'] . "\" />";
             }
             if (!$note->notes_read_gestion && !$note->notes_type_user) {
                 $req = "select  demande_note_num from demandes where demande_note_num='" . $note->id_note . "'";
                 $res = pmb_mysql_query($req, $dbh);
                 if (pmb_mysql_num_rows($res)) {
                     $color_img = "red";
                 } else {
                     $color_img = "blue";
                 }
                 $dialog .= "<a href=\"javascript:change_demande_end('note_" . $note->id_note . "','{$note->id_note}','" . $num_action . "','" . $num_demande . "', true);\" ><i  id='note_" . $note->id_note . "Img3' class='fa fa-file-text-o fa-2x' style='color:{$color_img}' alt='" . htmlentities($msg['demandes_note_demande_end'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['demandes_note_demande_end'], ENT_QUOTES, $charset) . "' ></i></a>";
             }
             $dialog .= ' </div>';
             $dialog .= "<div onclick='!!change_action_form!!document.forms[\"" . $form_name . "\"].act.value=\"modif_note\";document.forms[\"" . $form_name . "\"].idnote.value=\"{$note->id_note}\";document.forms[\"" . $form_name . "\"].submit();'>";
             $dialog .= '<div class="entete_note">' . $note->createur_note . ' ' . $msg['381'] . ' ' . formatdate($note->date_note) . '</div>';
             $dialog .= '<p>' . $note->contenu . '</p>';
             $dialog .= '</div>';
             $dialog .= '</div>';
             demandes_notes::note_read($note->id_note, true, "_gestion");
         }
         $dialog .= '<a name="fin"></a>';
     }
     $dialog_note = str_replace('!!dialog!!', $dialog, $dialog_note);
     if ($from_ajax) {
         $dialog_note = str_replace('!!change_action_form!!', 'document.forms["' . $form_name . '"].action="./demandes.php?categ=notes#fin";', $dialog_note);
     } else {
         $dialog_note = str_replace('!!change_action_form!!', '', $dialog_note);
     }
     return $dialog_note;
 }