本文整理汇总了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;
}
示例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;
});
}
示例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;
}
示例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;
}
示例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;
});
}
示例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;
});
}