コード例 #1
0
 public function add($year, $month, $day)
 {
     if ($this->require_role('admin')) {
         $rules = array(array('field' => 'schedule', 'label' => 'Schedule', 'rules' => 'required'));
         $this->load->model('Schedule', 'schedule');
         $this->load->model('ResourceCalendar', 'calendar');
         $this->load->model('ScheduledDay', 'day');
         $this->load->helper(array('form', 'url'));
         $this->load->library('form_validation');
         $schedule_options = $this->calendar->select_options();
         if (count($schedule_options) == 0) {
             $this->session->set_flashdata('error', 'Please create at least one resource calendar first!');
             redirect(site_url('admin') . '/resourcecalendars/add');
             return;
         }
         $this->form_validation->set_rules($rules);
         if ($this->form_validation->run() == FALSE) {
             $data = array('schedules' => $schedule_options, 'year' => $year, 'month' => $month, 'day' => $day);
             $this->load->template('admin/master_calendar_add', $data);
         } else {
             $data = $this->input->post();
             if ($this->day->create($data) === FALSE) {
                 $this->session->set_flashdata('error', 'Unable to add the calendar!');
             }
             redirect(site_url('admin') . '/mastercalendar/index/' . $year . '/' . $month);
             redirect(site_ur('') . '/appointments/edit/' . $resource_id . '/' . $resource_calendar_id . '/' . $year . '/' . $month . '/' . $day);
         }
     }
 }
コード例 #2
0
 public function overview($service_id = NULL)
 {
     if (is_null($service_id)) {
         add_error_flash_message('Služba sa nenašla.');
         redirect(site_ur('services'));
     }
     $service = new Service();
     $service->get_by_id((int) $service_id);
     if (!$service->exists()) {
         add_error_flash_message('Služba sa nenašla.');
         redirect(site_ur('services'));
     }
     $service_usages = new Service_usage();
     $service_usages->where_related_service($service);
     $service_usages->include_related('operation', array('id', 'type', 'created'));
     $service_usages->include_related('operation/person', array('name', 'surname'));
     $service_usages->include_related('operation/admin', array('name', 'surname'));
     $service_usages->include_related('operation/workplace', array('title'));
     $service_usages->order_by('created', 'desc');
     $service_usages->order_by_related('operation', 'created', 'desc');
     $service_usages->get_iterated();
     $this->parser->parse('web/controllers/services/overview.tpl', array('title' => 'Administrácia / Služby / Prehľad služby / ' . $service->title, 'service' => $service, 'service_usages' => $service_usages, 'back_url' => site_url('services')));
 }