Example #1
0
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: priorities.inc.php,v 1.1 2016-01-07 07:48:53 ngantier Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
//dépendances
require_once $class_path . '/scan_request/scan_request_priorities.class.php';
$scan_request_priorities = new scan_request_priorities();
switch ($action) {
    case 'save':
        $scan_request_priorities->save();
        print $scan_request_priorities->get_list();
        break;
    case 'add':
        print $scan_request_priorities->get_form(0);
        break;
    case 'edit':
        print $scan_request_priorities->get_form($id);
        break;
    case 'delete':
        $scan_request_priorities->delete($id);
        print $scan_request_priorities->get_list();
        break;
    default:
        print $scan_request_priorities->get_list();
        break;
}
 public function get_form_content($id_suffix = '')
 {
     global $charset;
     global $scan_request_form_content, $opac_scan_request_status, $scan_request_linked_record;
     $display = $scan_request_form_content;
     $display = str_replace('!!title!!', htmlentities($this->title, ENT_QUOTES, $charset), $display);
     $display = str_replace('!!desc!!', htmlentities($this->desc, ENT_QUOTES, $charset), $display);
     $display = str_replace('!!comment!!', htmlentities($this->comment, ENT_QUOTES, $charset), $display);
     $selected_priority = 0;
     if ($this->priority) {
         $selected_priority = $this->priority->get_id();
     }
     $scan_request_priorities = new scan_request_priorities();
     $display = str_replace('!!priority!!', $scan_request_priorities->get_selector_options($selected_priority), $display);
     $display = str_replace('!!date!!', $this->date ? substr($this->date, 0, 10) : date('Y-m-d'), $display);
     $display = str_replace('!!wish_date!!', $this->wish_date ? substr($this->wish_date, 0, 10) : date('Y-m-d'), $display);
     $display = str_replace('!!deadline_date!!', $this->deadline_date ? substr($this->deadline_date, 0, 10) : date('Y-m-d'), $display);
     if ($this->status) {
         $status = $this->status->get_id();
     } else {
         $status = $opac_scan_request_status;
     }
     $display = str_replace('!!status!!', $status, $display);
     $display = str_replace('!!id!!', $this->id, $display);
     $linked_records_display = '';
     foreach ($this->linked_records as $linked_record) {
         $linked_record_display = $scan_request_linked_record;
         $linked_record_display = str_replace('!!linked_record_display!!', $linked_record['display'], $linked_record_display);
         if ($linked_record['notice_id']) {
             $linked_record_type = 'notices';
             $linked_record_id = $linked_record['notice_id'];
         } else {
             $linked_record_type = 'bulletins';
             $linked_record_id = $linked_record['bulletin_id'];
         }
         $linked_record_display = str_replace('!!linked_record_type!!', $linked_record_type, $linked_record_display);
         $linked_record_display = str_replace('!!linked_record_id!!', $linked_record_id, $linked_record_display);
         $linked_record_display = str_replace('!!linked_record_comment!!', $linked_record['comment'], $linked_record_display);
         $linked_records_display .= $linked_record_display;
     }
     $display = str_replace('!!linked_records!!', $linked_records_display, $display);
     $display = str_replace('!!id_suffix!!', htmlentities($id_suffix, ENT_QUOTES, $charset), $display);
     return $display;
 }