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


PHP Location_Model::get_by_id方法代码示例

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


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

示例1: shifts

 function shifts()
 {
     if ($this->staff_id) {
         $um = new User_Model();
         $um->get_by_id($this->staff_id);
         $sm = $um->shift;
     } elseif ($this->location_id) {
         $lm = new Location_Model();
         $lm->get_by_id($this->location_id);
         $sm = $lm->shift;
     } else {
         $sm = new Shift_Model();
     }
     if ($this->start) {
         $sm->where('date >=', $this->start);
     }
     if ($this->end) {
         $sm->where('date <=', $this->end);
     }
     $sm->order_by('date', 'ASC')->order_by('start', 'ASC')->include_related('user', 'id');
     return $sm->get();
 }
开发者ID:RVRKC,项目名称:Hackathon_2015,代码行数:22,代码来源:schedule_model.php

示例2: status

 function status()
 {
     $args = hc_parse_args(func_get_args());
     $count = array();
     $this->data['location_id'] = 0;
     $this->data['staff_id'] = 0;
     if (isset($args['staff']) && $args['staff']) {
         $um = new User_Model();
         $um->get_by_id($args['staff']);
         $sm = $um->shift;
         $this->data['staff_id'] = $args['staff'];
     } elseif (isset($args['location']) && $args['location']) {
         $lm = new Location_Model();
         $lm->get_by_id($args['location']);
         $sm = $lm->shift;
         $this->data['location_id'] = $args['location'];
     } else {
         $sm = new Shift_Model();
     }
     /* duration */
     $sm->clear();
     $sm->where('date >=', $args['start'])->where('date <=', $args['end'])->select_sum('end')->select_sum('start')->get();
     $count['duration'] = $sm->end - $sm->start;
     /* ACTIVE	- published with staff */
     $sm->clear();
     $sm->include_related('user', 'id');
     $count['active'] = $sm->where('date >=', $args['start'])->where('date <=', $args['end'])->where('status', SHIFT_MODEL::STATUS_ACTIVE)->where('user_id IS NOT ', 'NULL', FALSE)->count();
     /* OPEN		- published with no staff */
     $sm->clear();
     $sm->include_related('user', 'id');
     $count['open'] = $sm->where('date >=', $args['start'])->where('date <=', $args['end'])->where('status', SHIFT_MODEL::STATUS_ACTIVE)->where('user_id IS ', 'NULL', FALSE)->count();
     /* PENDING	- not published with staff */
     $sm->clear();
     $count['pending'] = $sm->include_related('user', 'id')->where('date >=', $args['start'])->where('date <=', $args['end'])->where('status <>', SHIFT_MODEL::STATUS_ACTIVE)->where('user_id IS NOT ', 'NULL', FALSE)->count();
     /* DRAFT	- not published with no staff */
     $sm->clear();
     $sm->include_related('user', 'id');
     $count['draft'] = $sm->where('date >=', $args['start'])->where('date <=', $args['end'])->where('status <>', SHIFT_MODEL::STATUS_ACTIVE)->group_start()->or_where('user_id IS ', 'NULL', FALSE)->or_where('user_id', 0)->group_end()->count();
     /* total */
     $sm->clear();
     $count['total'] = $sm->where('date >=', $args['start'])->where('date <=', $args['end'])->count();
     $this->data['count'] = $count;
     $this->data['start_date'] = $args['start'];
     $this->data['end_date'] = $args['end'];
     $this->set_include('status');
     $this->load->view($this->template, $this->data);
 }
开发者ID:RVRKC,项目名称:Hackathon_2015,代码行数:47,代码来源:schedules.php


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