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


PHP User_Model::select方法代码示例

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


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

示例1: get_form_fields

 public function get_form_fields()
 {
     $return = parent::get_form_fields();
     /* remove archived users if any */
     $remove_users = array();
     $um = new User_Model();
     $um->select('id')->where('active', USER_MODEL::STATUS_ARCHIVE)->get();
     foreach ($um as $u) {
         $remove_users[] = $u->id;
     }
     if ($remove_users) {
         reset($remove_users);
         foreach ($remove_users as $rid) {
             unset($return['user']['options'][$rid]);
         }
     }
     /* adjust min and max time */
     $CI =& ci_get_instance();
     $time_min = $CI->app_conf->get('time_min');
     $time_max = $CI->app_conf->get('time_max');
     $time_min = $time_min ? $time_min : 0;
     $time_max = $time_max ? $time_max : 24 * 60 * 60;
     $return['start']['conf']['min'] = $time_min;
     $return['start']['conf']['max'] = $time_max;
     $return['end']['conf']['min'] = $time_min;
     $return['end']['conf']['max'] = $time_max;
     return $return;
 }
开发者ID:RVRKC,项目名称:Hackathon_2015,代码行数:28,代码来源:shift_model.php

示例2: index


//.........这里部分代码省略.........
                 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':
             $stats_shifts = array();
             $stats_drafts = array();
             reset($this->data['staffs']);
             foreach ($this->data['staffs'] as $sta) {
                 if ($filter == 'staff') {
                     if ($sta->id != $this->data['current_staff']->id) {
                         continue;
                     }
                 }
                 $stats_shifts[$sta->id] = array(0, 0);
                 $stats_drafts[$sta->id] = array(0, 0);
             }
             reset($this->data['shifts']);
             foreach ($this->data['shifts'] as $sh) {
                 if (!$sh->user_id) {
                     continue;
                 }
                 if ($sh->date < $this->data['start_date']) {
                     continue;
                 }
                 if ($sh->date > $this->data['end_date']) {
                     continue;
                 }
                 if ($filter == 'location') {
                     if ($sh->location_id != $this->data['current_location']->id) {
                         continue;
                     }
                 }
                 if ($filter == 'staff') {
                     if ($sh->user_id != $this->data['current_staff']->id) {
                         continue;
                     }
                 }
                 if (!isset($stats_shifts[$sh->user_id])) {
                     continue;
                     //						$stats_shifts[$sh->user_id] = array( 0, 0 );
                     //						$stats_drafts[$sh->user_id] = array( 0, 0 );
                 }
                 if ($sh->status == SHIFT_MODEL::STATUS_ACTIVE) {
                     $stats_shifts[$sh->user_id][0] += 1;
                     $stats_shifts[$sh->user_id][1] += $sh->get_duration();
                 } else {
                     $stats_drafts[$sh->user_id][0] += 1;
                     $stats_drafts[$sh->user_id][1] += $sh->get_duration();
                 }
             }
             /* filter archived staff if they have no shifts */
             $archived_users = array();
             $um = new User_Model();
             $um->select('id')->where('active', USER_MODEL::STATUS_ARCHIVE)->get();
             foreach ($um as $u) {
                 $archived_users[] = $u->id;
             }
             if ($archived_users) {
                 $all_users = array_keys($stats_shifts);
                 foreach ($all_users as $uid) {
                     if (in_array($uid, $archived_users) && $stats_shifts[$uid][0] == 0 && $stats_drafts[$uid][0] == 0) {
                         unset($stats_shifts[$uid]);
                         unset($stats_drafts[$uid]);
                     }
                 }
             }
             $this->data['stats_shifts'] = $stats_shifts;
             $this->data['stats_drafts'] = $stats_drafts;
             /* sort by duration */
             uasort($this->data['stats_shifts'], create_function('$a, $b', 'return ($b[1] - $a[1]);'));
             if ($display == 'exportstats') {
                 return $this->export_stats();
             } else {
                 $view = 'index_stats';
             }
             break;
         default:
             $view = 'index_calendar';
             break;
     }
     $this->set_include($view);
     $this->load->view($this->template, $this->data);
     return;
 }
开发者ID:RVRKC,项目名称:Hackathon_2015,代码行数:101,代码来源:schedules.php


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