本文整理汇总了PHP中Location_Model::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Location_Model::get方法的具体用法?PHP Location_Model::get怎么用?PHP Location_Model::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Location_Model
的用法示例。
在下文中一共展示了Location_Model::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$my_user_id = $this->auth->user()->id;
$this->hc_time->setNow();
$today = $this->hc_time->formatDate_Db();
$args = $this->parse_args(func_get_args());
$display = isset($args['display']) ? $args['display'] : 'my';
if (isset($args['start'])) {
$start_date = $args['start'];
} else {
// last month
$this->hc_time->setNow();
// $this->hc_time->modify( '-1 month' );
$this->hc_time->setStartMonth();
$start_date = $this->hc_time->formatDate_Db();
}
if (isset($args['end'])) {
$end_date = $args['end'];
} else {
// last month
$this->hc_time->setNow();
// $this->hc_time->modify( '-1 month' );
$this->hc_time->setEndMonth();
$end_date = $this->hc_time->formatDate_Db();
}
$location_id = 0;
switch ($display) {
case 'list':
case 'my':
$sm = $this->auth->user()->shift;
break;
case 'pickup':
$sm = new Shift_Model();
if (isset($args['location'])) {
$location_id = $args['location'];
}
break;
}
$sm->include_related('location', 'show_order')->include_related('location', 'id')->include_related('location', 'name')->include_related('user', 'id')->where('status', SHIFT_MODEL::STATUS_ACTIVE)->order_by('date', 'ASC')->order_by('start', 'ASC')->order_by('location_show_order', 'ASC');
if ($location_id) {
$sm->where('location_id', $location_id);
}
switch ($display) {
case 'pickup':
case 'my':
$sm->where('date >=', $today);
break;
case 'list':
$sm->where('date >=', $start_date);
$sm->where('date <=', $end_date);
break;
}
switch ($display) {
case 'pickup':
$sm->include_related('user', 'id')->group_start()->or_group_start()->where('user_id <> ', $my_user_id)->where('has_trade <>', 0)->group_end();
$staff_can_pickup = $this->app_conf->get('staff_pick_shifts');
if ($staff_can_pickup) {
$sm->or_group_start()->or_where('user_id IS ', 'NULL', FALSE)->or_where('user_id', 0)->group_end();
}
$sm->group_end();
break;
}
$this->data['shifts'] = $sm->get()->all;
// timeoffs
$this->data['timeoffs'] = $this->auth->user()->timeoff->where('date_end >=', $today)->where('status', TIMEOFF_MODEL::STATUS_ACTIVE)->order_by('date', 'ASC')->get()->all;
$this->data['display'] = $display;
// view file
switch ($display) {
case 'pickup':
case 'my':
$view_file = 'index';
break;
case 'list':
$view_file = 'index_browse';
break;
}
$this->data['start_date'] = $start_date;
$this->data['end_date'] = $end_date;
$this->data['location_id'] = $location_id;
$lm = new Location_Model();
$locations = $lm->get()->all;
$this->data['locations'] = array();
foreach ($locations as $loc) {
$this->data['locations'][$loc->id] = $loc;
}
$this->set_include($view_file);
$this->load->view($this->template, $this->data);
}
示例2: index
function index()
{
$args = $this->parse_args(func_get_args());
$args = array_merge($this->default_params, $args);
$display = 'all';
$location_id = array();
$supplied_location_id = isset($args['location']) ? $args['location'] : '';
if (strlen($supplied_location_id)) {
if (strpos($supplied_location_id, ',') !== FALSE) {
$location_id = explode(',', $supplied_location_id);
array_walk($location_id, 'intval');
} else {
if ($location_id) {
$location_id = array($supplied_location_id);
} else {
$location_id = $supplied_location_id;
}
// 0 for all
}
}
$staff_id = array();
$supplied_staff_id = isset($args['staff']) ? $args['staff'] : '';
if ($supplied_staff_id) {
if (strpos($supplied_staff_id, ',') !== FALSE) {
$staff_id = explode(',', $supplied_staff_id);
array_walk($staff_id, 'intval');
} elseif ($supplied_staff_id == '_current_user_id_') {
if ($this->auth && $this->auth->user()) {
$staff_id = array($this->auth->user()->id);
}
} else {
$staff_id = array($supplied_staff_id);
}
}
$within = FALSE;
/* whithin now */
if (isset($args['within'])) {
$within = $args['within'];
if (strlen($within)) {
$within = urldecode($within);
}
$this->hc_time->setNow();
$start_date = $this->hc_time->formatDate_Db();
$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);
}
//.........这里部分代码省略.........
示例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':
//.........这里部分代码省略.........