/** * Get instrument info for a specific instrument ID * * @param int $instrument_id instrument ID to lookup * * @return void */ public function get_instrument_info($instrument_id = 0) { $results = array(); if ($instrument_id) { $results = $this->eus->get_instrument_name($instrument_id); } transmit_array_with_json_header($results); }
function _change_associated_equipment($values, $action) { extract($values); $child_identifier = $new_equipment_item; $parent_identifier = is_numeric($parent_equipment_id) ? make_equipment_identifier($parent_equipment_type, $parent_equipment_id) : $parent_equipment_id; $ret_object = $this->inv_model->change_equipment_associations($parent_identifier, $child_identifier, $action); transmit_array_with_json_header($ret_object, "field {$action}ed successfully", true); }
function get_daily_timeslots($eus_instrument_id, $eus_user_id, $datestring, $mode = "new", $reservation_id = false) { $available_slots = $this->sched->get_available_tokens_info($eus_user_id, $eus_instrument_id); $token_override = $mode == 'edit' ? 1 : 0; $avail = $this->sched->get_daily_availability($eus_instrument_id, $eus_user_id, $datestring, $mode); $associations_desc = "No Proposal Restrictions"; $show_warning = false; $my_date = new DateTime($datestring); $datestring = $my_date->format('Y-m-d'); $end_date = clone $my_date; $end_date->modify('+1 month'); $end_date_string = $end_date->format('Y-m-d'); $contingent = $this->sched->get_availability($eus_instrument_id, $eus_user_id, $datestring, $end_date_string, $token_override); // var_dump($contingent); $this->page_data['reservation_id'] = $reservation_id ? $reservation_id : -1; if ($this->scheduling_access_level < 400 && $available_slots <= 0 && !$contingent['contingent_available']) { //show existing reservations $this->page_data['title'] = "No Reservation Slots Remaining"; $this->page_data['page_header'] = "Scheduling Information"; $this->page_data['upcoming_reservations'] = $this->sched->get_upcoming_reservations($eus_user_id, $eus_instrument_id); $this->page_data['user_classifications'] = $this->user_classifications; $this->page_data['my_user_info'] = $this->eus_user_info; $this->page_data['privilege_level'] = $this->scheduling_access_level; $this->page_data['eus_user_id'] = $this->eus_user_id; $this->page_data['css_uris'] = array('/stylesheets/tickets.css'); //get the next available slot $response_text = $this->load->view('scheduling/insufficient_tokens_insert.html', $this->page_data, true); $status = "denied"; } else { // if(!empty($avail['association_list']) && !$contingent['contingent_available']){ if (!empty($avail['association_list']) && !in_array($datestring, $contingent['contingent_available'])) { $associations = implode('/', $avail['association_list']); $associations_desc = "Instrument reservations limited to<br />{$associations}-aligned proposals only"; $show_warning = true; } // var_dump($avail); $response_text = $this->load->view('scheduling/reservation_slots_insert.html', $avail, true); $status = "authorized"; } transmit_array_with_json_header(array('html' => $response_text, 'status' => $status, 'associations_desc' => $associations_desc, 'show_warning_indicator' => $show_warning)); }
/** * Get specific details for any item in the system. * * This function takes an item_id from the database and provides all * the pertinent metadata for that oci_fetch_object. * * @param integer $item_id The database id of the requested object * @param string $format The return format for the item info (defaults to * 'xml') * * @return void */ public function iteminfo($item_id, $format = 'xml') { $file_info = $this->api->get_item_info($item_id); if ($format == 'json') { transmit_array_with_json_header(array('myemsl' => $file_info)); } else { $file_info_formatted = new SimpleXMLElement('<?xml version="1.0"?><myemsl></myemsl>'); array_to_xml($file_info, $file_info_formatted); echo $file_info_formatted->asXML(); } }