예제 #1
0
 function __construct()
 {
     $this->conf = array('path' => 'admin/schedules');
     parent::__construct(User_model::LEVEL_MANAGER);
     /* check how many locations do we have */
     $lm = new Location_Model();
     $location_count = $lm->count();
     $this->data['location_count'] = $location_count;
     /* check how many staff do we have */
     $um = new User_Model();
     $staff_count = $um->count_staff();
     $this->data['staff_count'] = $staff_count;
     $um = new User_Model();
     $staffs = $um->get()->all;
     $this->data['staffs'] = array();
     foreach ($staffs as $sta) {
         $this->data['staffs'][$sta->id] = $sta;
     }
     /* also get all shift templates */
     $shift_template_titles = array();
     $stm = new Shift_Template_Model();
     $stm->get();
     foreach ($stm->get() as $st) {
         //			$shift_template_titles[ $st->start . '-' . $st->end ] = $st->name;
     }
     $this->data['shift_template_titles'] = $shift_template_titles;
 }
예제 #2
0
 function day($date, $location_id = array())
 {
     $this->data['display'] = 'all';
     $sm = new Shift_Model();
     /* load shifts if needed */
     if (!isset($this->data['shifts'])) {
         $this->_load_shifts($date, 0, $location_id);
     }
     /* filter all shifts */
     $this->data['my_shifts'] = array();
     foreach ($this->data['shifts'] as $sh) {
         if ($sh->date > $date) {
             break;
         }
         if ($sh->date < $date) {
             continue;
         }
         $this->data['my_shifts'][] = $sh;
     }
     $um = new User_Model();
     $staffs = $um->get()->all;
     $this->data['staffs'] = array();
     foreach ($staffs as $sta) {
         $this->data['staffs'][$sta->id] = $sta;
     }
     $this->data['date'] = $date;
     $this->set_include('day');
     $this->load->view($this->template, $this->data);
 }