當前位置: 首頁>>代碼示例>>PHP>>正文


PHP cmsUser::userIsOnline方法代碼示例

本文整理匯總了PHP中cmsUser::userIsOnline方法的典型用法代碼示例。如果您正苦於以下問題:PHP cmsUser::userIsOnline方法的具體用法?PHP cmsUser::userIsOnline怎麽用?PHP cmsUser::userIsOnline使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cmsUser的用法示例。


在下文中一共展示了cmsUser::userIsOnline方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getUser

 public function getUser($id = false)
 {
     $this->useCache("users.user.{$id}");
     $this->select("u.nickname", 'inviter_nickname');
     $this->joinLeft('{users}', 'u', 'u.id = i.inviter_id');
     if ($id) {
         $user = $this->getItemById('{users}', $id);
     } else {
         $user = $this->getItem('{users}');
     }
     if (!$user) {
         return false;
     }
     $user['groups'] = cmsModel::yamlToArray($user['groups']);
     $user['theme'] = cmsModel::yamlToArray($user['theme']);
     $user['notify_options'] = cmsModel::yamlToArray($user['notify_options']);
     $user['privacy_options'] = cmsModel::yamlToArray($user['privacy_options']);
     $user['is_online'] = cmsUser::userIsOnline($user['id']);
     return $user;
 }
開發者ID:Val-Git,項目名稱:icms2,代碼行數:20,代碼來源:model.php

示例2: getContact

 public function getContact($user_id, $contact_id)
 {
     $this->select('u.id', 'id');
     $this->select('u.nickname', 'nickname');
     $this->select('u.date_log', 'date_log');
     $this->select('u.avatar', 'avatar');
     $this->select('u.is_admin', 'is_admin');
     $this->select('u.privacy_options', 'privacy_options');
     $this->select('COUNT(g.user_id)', 'is_ignored');
     $this->join('{users}', 'u', 'u.id = i.contact_id');
     $this->joinLeft('{users}_ignors', 'g', "g.ignored_user_id = i.contact_id AND g.user_id = '{$user_id}'");
     $this->filterEqual('user_id', $user_id);
     $this->filterEqual('contact_id', $contact_id);
     $this->groupBy('i.id');
     return $this->getItem('{users}_contacts', function ($item, $model) {
         $item['privacy_options'] = cmsModel::yamlToArray($item['privacy_options']);
         $item['is_online'] = cmsUser::userIsOnline($item['contact_id']);
         return $item;
     });
 }
開發者ID:Val-Git,項目名稱:icms2,代碼行數:20,代碼來源:model.php

示例3: getUser

 public function getUser($id = false)
 {
     $this->useCache("users.user.{$id}");
     $this->select("IFNULL(c.name, '')", 'city_name');
     $this->select("IFNULL(c.id, 0)", 'city_id');
     $this->select("u.nickname", 'inviter_nickname');
     $this->joinLeft('geo_cities', 'c', 'c.id = i.city');
     $this->joinLeft('{users}', 'u', 'u.id = i.inviter_id');
     if ($id) {
         $user = $this->getItemById('{users}', $id);
     } else {
         $user = $this->getItem('{users}');
     }
     if (!$user) {
         return false;
     }
     $user['groups'] = cmsModel::yamlToArray($user['groups']);
     $user['theme'] = cmsModel::yamlToArray($user['theme']);
     $user['notify_options'] = cmsModel::yamlToArray($user['notify_options']);
     $user['privacy_options'] = cmsModel::yamlToArray($user['privacy_options']);
     $user['city'] = $user['city_id'] ? array('id' => $user['city_id'], 'name' => $user['city_name']) : false;
     $user['is_online'] = cmsUser::userIsOnline($user['id']);
     return $user;
 }
開發者ID:asphix,項目名稱:icms2,代碼行數:24,代碼來源:model.php

示例4: getCommentsModerators

 public function getCommentsModerators()
 {
     // сначала ищем юзеров, которым разрешено модерировать
     $moderators = cmsPermissions::getRulesGroupMembers('comments', 'is_moderator');
     if (!$moderators) {
         // не нашли модераторов, получаем администраторов
         $moderators = $this->filterEqual('is_admin', 1)->selectList(array('i.id' => 'id', 'i.notify_options' => 'notify_options', 'i.email' => 'email', 'i.nickname' => 'nickname', 'i.avatar' => 'avatar'), true)->get('{users}', function ($item, $model) {
             $item['notify_options'] = cmsModel::yamlToArray($item['notify_options']);
             $item['is_online'] = cmsUser::userIsOnline($item['id']);
             return $item;
         });
     }
     return $moderators;
 }
開發者ID:Val-Git,項目名稱:icms2,代碼行數:14,代碼來源:model.php

示例5: getRulesGroupMembers

 /**
  * Возвращает пользователей групп, для которых переданное правило включено
  * или установлено в значение $value
  *
  * @param string $controller Название компонента
  * @param string $name Название правила
  * @param mixed $value Значение правила. Если не передано, значение не учитывается
  * @param string $subject Субъект правила. Если не передан, то одинаков с компонентом
  *
  * @return array Массив пользователей с данными: id, email, nickname, avatar, notify_options, is_online
  */
 static function getRulesGroupMembers($controller, $name, $value = false, $subject = false)
 {
     if (!$subject) {
         $subject = $controller;
     }
     $model = new cmsModel();
     $rule = $model->filterEqual('controller', $controller)->filterEqual('name', $name)->getItem('perms_rules');
     if (!$rule) {
         return array();
     }
     $model->filterEqual('subject', $subject)->filterEqual('rule_id', $rule['id']);
     if ($value) {
         $model->filterEqual('value', $value);
     }
     $groups_ids = $model->selectOnly('group_id')->get('perms_users', function ($item, $model) {
         return $item['group_id'];
     }, 'group_id');
     if (!$groups_ids) {
         return array();
     }
     return $model->filterIn('group_id', $groups_ids)->selectOnly('user_id', 'id')->joinUser('user_id', array('u.notify_options' => 'notify_options', 'u.email' => 'email', 'u.nickname' => 'nickname', 'u.avatar' => 'avatar'))->get('{users}_groups_members', function ($item, $model) {
         $item['notify_options'] = cmsModel::yamlToArray($item['notify_options']);
         $item['is_online'] = cmsUser::userIsOnline($item['id']);
         return $item;
     });
 }
開發者ID:Val-Git,項目名稱:icms2,代碼行數:37,代碼來源:permissions.php

示例6: getComment

 public function getComment($id)
 {
     $this->select('u.nickname', 'user_nickname');
     $this->select('u.avatar', 'user_avatar');
     $this->joinUserLeft();
     return $this->getItemById('comments', $id, function ($item, $model) {
         $item['user'] = array('id' => $item['user_id'], 'nickname' => $item['user_nickname'], 'is_online' => cmsUser::userIsOnline($item['user_id']), 'avatar' => $item['user_avatar']);
         return $item;
     });
 }
開發者ID:pin-git,項目名稱:icms2,代碼行數:10,代碼來源:model.php


注:本文中的cmsUser::userIsOnline方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。