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


PHP User_Model::exists方法代码示例

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


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

示例1: staff

 function staff($id, $display = 'week')
 {
     $um = new User_Model();
     $um->get_by_id($id);
     if (!$um->exists()) {
         return;
     }
     $this->data['object'] = $um;
     $um->shift->where('status', SHIFT_MODEL::STATUS_ACTIVE);
     /* find min and max date */
     $max_date = $um->shift->select_max('date')->get()->date;
     $min_date = $um->shift->select_min('date')->get()->date;
     $shifts = $um->shift->get_iterated();
     /* compile dates */
     $dates = array();
     $date = $min_date;
     $this->hc_time->setDateDb($date);
     switch ($display) {
         case 'week':
             $this->hc_time->setStartWeek();
             break;
         case 'month':
             $this->hc_time->setStartMonth();
             break;
     }
     $date = $this->hc_time->formatDate_Db();
     while ($date <= $max_date) {
         switch ($display) {
             case 'week':
                 $start = $this->hc_time->formatDate_Db();
                 $this->hc_time->setEndWeek();
                 $end = $this->hc_time->formatDate_Db();
                 break;
             case 'month':
                 $start = $this->hc_time->formatDate_Db();
                 $this->hc_time->setEndMonth();
                 $end = $this->hc_time->formatDate_Db();
                 break;
         }
         $dates[$start . '-' . $end] = array('shift_count' => 0, 'shift_duration' => 0, 'timeoff_count' => 0, 'timeoff_duration' => 0);
         $this->hc_time->modify('+1 day');
         $date = $this->hc_time->formatDate_Db();
     }
     foreach ($shifts as $sh) {
         reset($dates);
         foreach (array_keys($dates) as $dk) {
             list($start, $end) = explode('-', $dk);
             if ($sh->date >= $start && $sh->date <= $end) {
                 $dates[$dk]['shift_count']++;
                 $dates[$dk]['shift_duration'] += $sh->get_duration();
             }
         }
     }
     $this->data['dates'] = $dates;
     $this->data['display'] = $display;
     //		$this->conf['path'] = 'admin/users';
     $this->set_include('edit/stats', 'admin/users');
     $this->load->view($this->template, $this->data);
 }
开发者ID:RVRKC,项目名称:Hackathon_2015,代码行数:59,代码来源:stats.php

示例2: _notify

 private function _notify($shift, $reason)
 {
     $CI =& ci_get_instance();
     $text = $shift->view_text(array('user'));
     $changes = $shift->get_changes();
     $staff = $shift->user->get();
     $msgs = array();
     switch ($reason) {
         case 'new':
             if ($staff->exists()) {
                 $msgs['shifts_published'] = array($staff);
             }
             break;
         case 'staff_change':
             $old_staff = new User_Model();
             $old_staff->get_by_id($changes['user_id']);
             if ($old_staff->exists()) {
                 $msgs['shifts_cancelled'] = array($old_staff);
             }
             if ($staff->exists()) {
                 $msgs['shifts_published'] = array($staff);
             }
             break;
         case 'change':
             if ($staff->exists()) {
                 $msgs['shifts_changed'] = array($staff);
             }
             break;
     }
     foreach ($msgs as $key => $staffs) {
         /* compile message */
         $msg = new stdClass();
         $msg->body = array();
         foreach ($text as $ta) {
             $msg->body[] = $ta[0] . ': ' . $ta[1];
         }
         $msg->subject = lang($key);
         $msg_id = $CI->hc_notifier->add_message($msg);
         foreach ($staffs as $staff) {
             $CI->hc_notifier->enqueue_message($msg_id, $staff, $key);
         }
     }
 }
开发者ID:RVRKC,项目名称:Hackathon_2015,代码行数:43,代码来源:shifts.php


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