empr_id = $empr_id*1; $this->fetch_data(); } protected function fetch_data() { global $dbh; $this->scan_requests = array(); $query = 'select id_scan_request from scan_requests join scan_request_status on scan_request_status.id_scan_request_status = scan_requests.scan_request_num_status where scan_request_num_dest_empr = '.$this->empr_id.' and scan_request_status_opac_show = 1 order by scan_request_date'; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $this->scan_requests[] = new scan_request($row->id_scan_request); } } } public function get_display_list() { global $msg, $include_path; if(count($this->scan_requests)) { $tpl = $include_path.'/templates/scan_request/scan_requests_list.tpl.html'; if (file_exists($include_path.'/templates/scan_request/scan_requests_list_subst.tpl.html')) { $tpl = $include_path.'/templates/scan_request/scan_requests_list_subst.tpl.html'; } $h2o = H2o_collection::get_instance($tpl); return $h2o->render(array('scan_requests' => $this)); } else { return $msg['scan_request_list_empty']; } } public function get_scan_requests() { return $this->scan_requests; } public static function get_scan_requests_on_record($empr_id, $record_id, $record_type) { global $dbh; $scan_requests_on_record = array(); $query = 'select id_scan_request from scan_requests join scan_request_linked_records on scan_requests.id_scan_request = scan_request_linked_records.scan_request_linked_record_num_request'; $query.= ' where scan_requests.scan_request_num_dest_empr = '.$empr_id; if ($record_type == 'bulletins') { $query.= ' and scan_request_linked_records.scan_request_linked_record_num_bulletin = '.$record_id; } else if ($record_type == 'notices') { $query.= ' and scan_request_linked_records.scan_request_linked_record_num_notice = '.$record_id; } $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $scan_requests_on_record[] = $row->id_scan_request; } } return $scan_requests_on_record; } }