fetch_data(); } protected function fetch_data(){ $this->scan_request_status_workflow = array(); $rqt = "select * from scan_request_status_workflow "; $res = pmb_mysql_query($rqt); if(pmb_mysql_num_rows($res)){ while($row = pmb_mysql_fetch_object($res)){ if(empty($this->scan_request_status_workflow[$row->scan_request_status_workflow_from_num])) { $this->scan_request_status_workflow[$row->scan_request_status_workflow_from_num] = array(); } $this->scan_request_status_workflow[$row->scan_request_status_workflow_from_num][] =$row->scan_request_status_workflow_to_num; } } } public function get_form(){ global $msg, $current_module; global $opac_scan_request_create_status; global $opac_scan_request_cancel_status; global $opac_scan_request_send_mail_status; $url="./admin.php?categ=scan_request&sub=workflow"; $scan_request_admin_status = new scan_request_admin_status(); $scan_request_status = $scan_request_admin_status->get_scan_request_status(); if (trim($opac_scan_request_send_mail_status)) { $send_mail_status = json_decode($opac_scan_request_send_mail_status); } else { $send_mail_status = array(); } $form= "

".$msg["admin_scan_request_workflow_form_title"]."

"; $ligne=""; $parity=0; foreach($scan_request_status as $statusfrom) { $form.=""; if ($parity++ % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $ligne.=""; foreach($scan_request_status as $statusto) { if(in_array($statusto['id'],$this->scan_request_status_workflow[$statusfrom['id']])) $check=" checked='checked' "; else $check=""; if($statusfrom['id']==$statusto['id']){ $ligne.=""; }else{ $ligne.=""; } } } $form.=$ligne."
".$msg["admin_scan_request_workflow_title"]." ".$msg["admin_scan_request_workflow_after_title"]."
".$statusfrom['label']."
".$statusfrom['label']."
 
 
"; $this->fetch_data(); return $form; } public function save(){ global $scan_request_status_tab; global $from_form; global $scan_request_create_opac_status; global $scan_request_cancel_opac_status; global $scan_request_send_mail_status; global $opac_scan_request_create_status; global $opac_scan_request_cancel_status; global $opac_scan_request_send_mail_status; if(!($from_form*1)) return; $query="TRUNCATE TABLE scan_request_status_workflow"; pmb_mysql_query($query); foreach ($scan_request_status_tab as $from => $tolist){ foreach ($tolist as $to => $val){ $query = "insert into scan_request_status_workflow set scan_request_status_workflow_from_num='".$from."', scan_request_status_workflow_to_num='".$to."'"; pmb_mysql_query($query); } } $query = "UPDATE parametres SET valeur_param='".$scan_request_create_opac_status."' WHERE type_param='opac' and sstype_param='scan_request_create_status'"; pmb_mysql_query($query); $query = "UPDATE parametres SET valeur_param='".$scan_request_cancel_opac_status."' WHERE type_param='opac' and sstype_param='scan_request_cancel_status'"; pmb_mysql_query($query); if (!is_array($scan_request_send_mail_status)) { $scan_request_send_mail_status = array(); } $scan_request_send_mail_status = json_encode($scan_request_send_mail_status); $query = "UPDATE parametres SET valeur_param='".$scan_request_send_mail_status."' WHERE type_param='opac' and sstype_param='scan_request_send_mail_status'"; pmb_mysql_query($query); $opac_scan_request_create_status=$scan_request_create_opac_status; $opac_scan_request_cancel_status=$scan_request_cancel_opac_status; $opac_scan_request_send_mail_status=$scan_request_send_mail_status; } public function get_scan_request_status_workflow(){ return $this->scan_request_status_workflow; } }