当前位置: 首页>>代码示例>>PHP>>正文


PHP User_Model::get_staff方法代码示例

本文整理汇总了PHP中User_Model::get_staff方法的典型用法代码示例。如果您正苦于以下问题:PHP User_Model::get_staff方法的具体用法?PHP User_Model::get_staff怎么用?PHP User_Model::get_staff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在User_Model的用法示例。


在下文中一共展示了User_Model::get_staff方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: find_staff

 public function find_staff()
 {
     /* should have date, start, end set */
     $um = new User_Model();
     $all_staff = $um->get_staff();
     $return = array();
     foreach ($all_staff as $u) {
         $u->warning = array();
         $return[$u->id] = $u;
     }
     /* find users with shifts that fully overlap this one */
     $um->clear();
     $bad_staff = $um->distinct()->select('id')->where_in('id', array_keys($return))->where_related('shift', 'date', $this->date)->where_related('shift', 'start <=', $this->start)->where_related('shift', 'end >=', $this->end)->get()->all;
     foreach ($bad_staff as $u) {
         unset($return[$u->id]);
     }
     /* find overlapping timeoffs */
     $tm = new Timeoff_Model();
     $timeoffs = $tm->where_related('user', 'id', array_keys($return))->include_related('user', 'id')->where('date <=', $this->date)->where('date_end >=', $this->date)->where('start <', $this->end)->where('end >', $this->start)->get()->all;
     foreach ($timeoffs as $to) {
         $return[$to->user_id]->warning = $to;
     }
     return $return;
 }
开发者ID:RVRKC,项目名称:Hackathon_2015,代码行数:24,代码来源:shift_model.php

示例2: index


//.........这里部分代码省略.........
         $within_from = $this->hc_time->getTimestamp();
         if ($within) {
             $this->hc_time->modify($within);
         }
         $end_date = $this->hc_time->formatDate_Db();
         $within_to = $this->hc_time->getTimestamp();
         $this->data['within_from'] = $within_from;
         $this->data['within_to'] = $within_to;
     } else {
         if (isset($args['start'])) {
             $start_date = $args['start'];
         } else {
             $start_date = $this->hc_time->setNow()->formatDate_Db();
         }
         if (isset($args['end'])) {
             $end_date = $args['end'];
         } else {
             $end_date = '';
         }
         $this->hc_time->setDateDb($start_date);
         $range = isset($args['range']) ? $args['range'] : '';
         if ($range) {
             switch ($range) {
                 case 'week':
                     $this->hc_time->setStartWeek();
                     $start_date = $this->hc_time->formatDate_Db();
                     $this->hc_time->setEndWeek();
                     $end_date = $this->hc_time->formatDate_Db();
                     break;
                 case 'month':
                     $this->hc_time->setStartMonth();
                     $start_date = $this->hc_time->formatDate_Db();
                     $this->hc_time->setEndMonth();
                     $end_date = $this->hc_time->formatDate_Db();
                     break;
                 default:
                     $this->hc_time->modify('+' . $range);
                     $this->hc_time->modify('-1 day');
                     $end_date = $this->hc_time->formatDate_Db();
                     break;
             }
         }
     }
     /* find dates that we have shifts */
     $shift_model = new Shift_Model();
     $shift_model->select('date');
     $shift_model->where('date >=', $start_date);
     if ($end_date) {
         $shift_model->where('date <=', $end_date);
     }
     $shift_model->group_start();
     $shift_model->where('status', SHIFT_MODEL::STATUS_ACTIVE);
     if ($this->auth->check() && $this->app_conf->get('staff_pick_shifts')) {
         //				$shift_model->or_where('user_id IS ', 'NULL', FALSE);
     } else {
         $shift_model->where('user_id IS NOT ', 'NULL', FALSE);
     }
     $shift_model->group_end();
     if ($location_id) {
         $shift_model->where_related('location', 'id', $location_id);
     }
     if ($staff_id) {
         $shift_model->where_related('user', 'id', $staff_id);
     }
     $shift_model->distinct();
     //		$shift_model->limit( 3 );
     $shift_model->order_by('date', 'ASC');
     $shift_model->order_by('start', 'ASC');
     $shift_model->get();
     //		$shift_model->check_last_query();
     //		exit;
     $dates = array();
     foreach ($shift_model as $s) {
         $dates[] = $s->date;
     }
     $this->data['dates'] = $dates;
     /* preload staff information */
     $um = new User_Model();
     $staffs = $um->get_staff();
     $this->data['staffs'] = array();
     foreach ($staffs as $sta) {
         $this->data['staffs'][$sta->id] = $sta;
     }
     /* preload location information */
     $lm = new Location_Model();
     $locations = $lm->get()->all;
     $this->data['locations'] = array();
     foreach ($locations as $loc) {
         $this->data['locations'][$loc->id] = $loc;
     }
     $this->data['location_id'] = $location_id;
     $this->data['display'] = $display;
     $this->data['within'] = $within;
     /* load shifts so that they can be reused in module displays to save queries */
     $this->_load_shifts($dates, $staff_id, $location_id, $within);
     $view = 'index';
     $this->set_include($view);
     $this->load->view($this->template, $this->data);
     return;
 }
开发者ID:RVRKC,项目名称:Hackathon_2015,代码行数:101,代码来源:wall.php

示例3: index

 function index()
 {
     $args = $this->parse_args(func_get_args());
     $display = isset($args['display']) ? $args['display'] : 'calendar';
     $filter = isset($args['filter']) ? $args['filter'] : 'all';
     $range = isset($args['range']) ? $args['range'] : 'week';
     // or month
     $date = isset($args['start']) ? $args['start'] : '';
     $end_date = isset($args['end']) ? $args['end'] : '';
     $this->data['id'] = isset($args['id']) ? $args['id'] : 0;
     /* check if schedule for this date exists */
     if ($end_date) {
         $start_date = $date;
         if ($end_date < $start_date) {
             $end_date = $start_date;
         }
     } else {
         if ($date) {
             $this->hc_time->setDateDb($date);
         } else {
             $this->hc_time->setNow();
         }
         switch ($range) {
             case 'week':
                 $this->hc_time->setStartWeek();
                 $start_date = $this->hc_time->formatDate_Db();
                 $this->hc_time->setEndWeek();
                 $end_date = $this->hc_time->formatDate_Db();
                 break;
             case 'month':
                 $this->hc_time->setStartMonth();
                 $start_date = $this->hc_time->formatDate_Db();
                 $this->hc_time->setEndMonth();
                 $end_date = $this->hc_time->formatDate_Db();
                 break;
         }
     }
     $this->data['start_date'] = $start_date;
     $this->data['end_date'] = $end_date;
     $this->data['range'] = $range;
     /* working staff */
     $um = new User_Model();
     $this->data['working_staff'] = $um->get_staff();
     $lm = new Location_Model();
     $locations = $lm->get()->all;
     $this->data['locations'] = array();
     foreach ($locations as $loc) {
         $this->data['locations'][$loc->id] = $loc;
     }
     $this->data['display'] = $display;
     $this->data['filter'] = $filter;
     /* load shifts so that they can be reused in module displays to save queries */
     $filter_staff_id = $filter == 'staff' ? $this->data['id'] : 0;
     $this->_load_shifts(array($start_date, $end_date), $filter_staff_id);
     /* save view */
     $this->session->set_userdata(array('schedule_view' => $args));
     switch ($filter) {
         case 'location':
             if (isset($args['id']) && $args['id']) {
                 $location_id = $args['id'];
             } else {
                 $ids = array_keys($this->data['locations']);
                 $location_id = $ids[0];
             }
             $this->data['current_location'] = $this->data['locations'][$location_id];
             break;
         case 'staff':
             if (isset($args['id']) && $args['id']) {
                 $staff_id = $args['id'];
             } else {
                 $ids = array_keys($this->data['staffs']);
                 $staff_id = $ids[0];
             }
             $this->data['current_staff'] = $this->data['staffs'][$staff_id];
             break;
     }
     /* decide which view */
     switch ($display) {
         case 'calendar':
             switch ($filter) {
                 case 'location':
                     $view = 'index_location';
                     break;
                 case 'staff':
                     $view = 'index_staff';
                     break;
                 default:
                     $view = 'index';
                     break;
             }
             $view = 'index_calendar';
             break;
         case 'browse':
             $view = 'index_browse';
             break;
         case 'exportbrowse':
             return $this->export_browse();
             break;
         case 'exportstats':
         case 'stats':
//.........这里部分代码省略.........
开发者ID:RVRKC,项目名称:Hackathon_2015,代码行数:101,代码来源:schedules.php


注:本文中的User_Model::get_staff方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。