本文整理汇总了PHP中erLhcoreClassModelUser::getUserList方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassModelUser::getUserList方法的具体用法?PHP erLhcoreClassModelUser::getUserList怎么用?PHP erLhcoreClassModelUser::getUserList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类erLhcoreClassModelUser
的用法示例。
在下文中一共展示了erLhcoreClassModelUser::getUserList方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTopTodaysOperators
/**
* Gets pending chats
*/
public static function getTopTodaysOperators($limit = 100, $offset = 0)
{
$time = time() - 24 * 3600;
$SQL = 'SELECT lh_chat.user_id,count(lh_chat.id) as assigned_chats FROM lh_chat WHERE time > :time AND user_id > 0 GROUP BY user_id';
$db = ezcDbInstance::get();
$stmt = $db->prepare($SQL);
$stmt->bindValue(':time', $time, PDO::PARAM_INT);
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$stmt->execute();
$rows = $stmt->fetchAll();
$usersID = array();
foreach ($rows as $item) {
$usersID[] = $item['user_id'];
}
if (!empty($usersID)) {
$users = erLhcoreClassModelUser::getUserList(array('limit' => $limit, 'filterin' => array('id' => $usersID)));
}
$usersReturn = array();
foreach ($rows as $row) {
$usersReturn[$row['user_id']] = $users[$row['user_id']];
$usersReturn[$row['user_id']]->statistic_total_chats = $row['assigned_chats'];
$usersReturn[$row['user_id']]->statistic_total_messages = erLhcoreClassChat::getCount(array('filtergte' => array('time' => $time), 'filter' => array('user_id' => $row['user_id'])), 'lh_msg');
$usersReturn[$row['user_id']]->statistic_upvotes = erLhcoreClassChat::getCount(array('filtergte' => array('time' => $time), 'filter' => array('fbst' => 1, 'user_id' => $row['user_id'])));
$usersReturn[$row['user_id']]->statistic_downvotes = erLhcoreClassChat::getCount(array('filtergte' => array('time' => $time), 'filter' => array('fbst' => 2, 'user_id' => $row['user_id'])));
}
return $usersReturn;
}
示例2: getTopTodaysOperators
/**
* Gets pending chats
*/
public static function getTopTodaysOperators($limit = 100, $offset = 0, $filter = array())
{
$db = ezcDbInstance::get();
if (empty($filter)) {
$time = time() - 24 * 3600;
$SQL = 'SELECT lh_chat.user_id,count(lh_chat.id) as assigned_chats FROM lh_chat WHERE time > :time AND user_id > 0 GROUP BY user_id';
$stmt = $db->prepare($SQL);
$stmt->bindValue(':time', $time, PDO::PARAM_INT);
$filter['filtergte']['time'] = $time;
} else {
$paramsFilter = array();
$bindFields = array();
if (isset($filter['filtergte']['time'])) {
$paramsFilter['time >= :timegte'] = $filter['filtergte']['time'];
$bindFields[] = ':timegte';
}
if (isset($filter['filterlte']['time'])) {
$paramsFilter['time <= :timelte'] = $filter['filterlte']['time'];
$bindFields[] = ':timelte';
}
$SQL = 'SELECT lh_chat.user_id,count(lh_chat.id) as assigned_chats FROM lh_chat WHERE ' . implode(' AND ', array_keys($paramsFilter)) . ' AND user_id > 0 GROUP BY user_id';
$stmt = $db->prepare($SQL);
$i = 0;
foreach ($paramsFilter as $filterItemValue) {
$stmt->bindValue($bindFields[$i], $filterItemValue, PDO::PARAM_INT);
$i++;
}
}
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$stmt->execute();
$rows = $stmt->fetchAll();
$usersID = array();
foreach ($rows as $item) {
$usersID[] = $item['user_id'];
}
if (!empty($usersID)) {
$users = erLhcoreClassModelUser::getUserList(array('limit' => $limit, 'filterin' => array('id' => $usersID)));
}
$usersReturn = array();
foreach ($rows as $row) {
$usersReturn[$row['user_id']] = $users[$row['user_id']];
$usersReturn[$row['user_id']]->statistic_total_chats = $row['assigned_chats'];
$usersReturn[$row['user_id']]->statistic_total_messages = erLhcoreClassChat::getCount(array_merge_recursive($filter, array('filter' => array('user_id' => $row['user_id']))), 'lh_msg');
$usersReturn[$row['user_id']]->statistic_upvotes = erLhcoreClassChat::getCount(array_merge_recursive($filter, array('filter' => array('fbst' => 1, 'user_id' => $row['user_id']))));
$usersReturn[$row['user_id']]->statistic_downvotes = erLhcoreClassChat::getCount(array_merge_recursive($filter, array('filter' => array('fbst' => 2, 'user_id' => $row['user_id']))));
}
return $usersReturn;
}
示例3: removeInstanceData
public function removeInstanceData()
{
foreach (erLhAbstractModelFormCollected::getList(array('limit' => 1000000)) as $item) {
$item->removeThis();
}
foreach (erLhAbstractModelWidgetTheme::getList(array('limit' => 1000000)) as $item) {
$item->removeThis();
}
foreach (erLhcoreClassChat::getList(array('limit' => 1000000)) as $item) {
$item->removeThis();
}
foreach (erLhcoreClassChat::getList(array('limit' => 1000000), 'erLhcoreClassModelChatFile', 'lh_chat_file') as $item) {
$item->removeThis();
}
foreach (erLhcoreClassModelUser::getUserList(array('limit' => 1000000)) as $item) {
$item->removeFile();
}
// Dispatch event for extensions
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('instance.destroyed', array('instance' => $this));
return true;
}
示例4: loginBySSO
public static function loginBySSO($params)
{
$settings = (include 'extension/singlesignon/settings/settings.ini.php');
// Try to find operator by our logins
if (isset($params[$settings['attr_map']['username']][0])) {
$username = $params[$settings['attr_map']['username']][0];
if (erLhcoreClassModelUser::userExists($username)) {
$user = array_shift(erLhcoreClassModelUser::getUserList(array('limit' => 1, 'filter' => array('username'))));
erLhcoreClassUser::instance()->setLoggedUser($user->id);
} else {
$user = new erLhcoreClassModelUser();
foreach ($settings['attr_map'] as $attr => $ssoAttr) {
$user->{$attr} = $params[$settings['attr_map'][$attr]][0];
}
foreach ($settings['default_attributes'] as $attr => $value) {
$user->{$attr} = $value;
}
$user->password = sha1(erLhcoreClassModelForgotPassword::randomPassword() . rand(0, 1000) . microtime());
$user->saveThis();
// Set that users sees all pending chats
erLhcoreClassModelUserSetting::setSetting('show_all_pending', 1, $user->id);
// Set default departments
erLhcoreClassUserDep::addUserDepartaments($settings['default_departments'], $user->id, $user);
// Cleanup if previously existed
erLhcoreClassModelGroupUser::removeUserFromGroups($user->id);
// Assign user to default group
foreach ($settings['default_user_groups'] as $group_id) {
$groupUser = new erLhcoreClassModelGroupUser();
$groupUser->group_id = $group_id;
$groupUser->user_id = $user->id;
$groupUser->saveThis();
}
erLhcoreClassUser::instance()->setLoggedUser($user->id);
}
return true;
} else {
throw new Exception('Username field not found');
}
}
示例5: informChatClosed
public static function informChatClosed(erLhcoreClassModelChat $chat, $operator = false)
{
$sendMail = erLhAbstractModelEmailTemplate::fetch(5);
$mail = new PHPMailer();
$mail->CharSet = "UTF-8";
if ($sendMail->from_email != '') {
$mail->Sender = $mail->From = $sendMail->from_email;
}
$mail->FromName = $sendMail->from_name;
$mail->Subject = $sendMail->subject;
$messages = array_reverse(erLhcoreClassModelmsg::getList(array('limit' => 10, 'sort' => 'id DESC', 'filter' => array('chat_id' => $chat->id))));
$messagesContent = '';
foreach ($messages as $msg) {
if ($msg->user_id == -1) {
$messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmin', 'System assistant') . ': ' . htmlspecialchars($msg->msg) . "\n";
} else {
$messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . ($msg->user_id == 0 ? htmlspecialchars($chat->nick) : htmlspecialchars($msg->name_support)) . ': ' . htmlspecialchars($msg->msg) . "\n";
}
}
$emailRecipient = array();
if ($sendMail->recipient != '') {
// This time we give priority to template recipients
$emailRecipient = explode(',', $sendMail->recipient);
} elseif ($chat->department !== false && $chat->department->email != '') {
$emailRecipient = explode(',', $chat->department->email);
} else {
// Lets find first user and send him an e-mail
$list = erLhcoreClassModelUser::getUserList(array('limit' => 1, 'sort' => 'id ASC'));
$user = array_pop($list);
$emailRecipient = array($user->email);
}
self::setupSMTP($mail);
$cfgSite = erConfigClassLhConfig::getInstance();
$secretHash = $cfgSite->getSetting('site', 'secrethash');
if ($chat->email != '') {
$mail->AddReplyTo($chat->email, $chat->nick);
}
// Format user friendly additional data
if ($chat->additional_data != '') {
$paramsAdditional = json_decode($chat->additional_data, true);
$elementsAdditional = array();
if (is_array($paramsAdditional) && !empty($paramsAdditional)) {
foreach ($paramsAdditional as $param) {
$elementsAdditional[] = $param['key'] . ' - ' . $param['value'];
}
$additional_data = implode("\n", $elementsAdditional);
} else {
$additional_data = $chat->additional_data;
}
} else {
$additional_data = '';
}
foreach ($emailRecipient as $receiver) {
$veryfyEmail = sha1(sha1($receiver . $secretHash) . $secretHash);
$mail->Body = str_replace(array('{chat_id}', '{phone}', '{name}', '{email}', '{message}', '{additional_data}', '{url_request}', '{ip}', '{department}', '{url_accept}', '{operator}', '{country}', '{city}'), array($chat->id, $chat->phone, $chat->nick, $chat->email, $messagesContent, $additional_data, $chat->referrer, erLhcoreClassIPDetect::getIP(), (string) $chat->department, 'http://' . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurl('chat/accept') . '/' . erLhcoreClassModelChatAccept::generateAcceptLink($chat) . '/' . $veryfyEmail . '/' . $receiver, $operator, $chat->country_name, $chat->city), $sendMail->content);
$mail->AddAddress($receiver);
$mail->Send();
$mail->ClearAddresses();
}
if ($sendMail->bcc_recipients != '') {
$recipientsBCC = explode(',', $sendMail->bcc_recipients);
foreach ($recipientsBCC as $receiver) {
$receiver = trim($receiver);
$veryfyEmail = sha1(sha1($receiver . $secretHash) . $secretHash);
$mail->Body = str_replace(array('{chat_id}', '{phone}', '{name}', '{email}', '{message}', '{additional_data}', '{url_request}', '{ip}', '{department}', '{url_accept}', '{operator}', '{country}', '{city}'), array($chat->id, $chat->phone, $chat->nick, $chat->email, $messagesContent, $additional_data, $chat->referrer, erLhcoreClassIPDetect::getIP(), (string) $chat->department, 'http://' . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurl('chat/accept') . '/' . erLhcoreClassModelChatAccept::generateAcceptLink($chat) . '/' . $veryfyEmail . '/' . $receiver, $operator, $chat->country_name, $chat->city), $sendMail->content);
$mail->AddAddress($receiver);
$mail->Send();
$mail->ClearAddresses();
}
}
}
示例6: array
exit;
}
$data = erLhcoreClassModelChatConfig::fetch('autologin_data')->data;
if ($data['enabled'] == 1) {
$dataRequest = array('r' => base64_decode(rawurldecode($Params['user_parameters_unordered']['r'])), 'u' => rawurldecode($Params['user_parameters_unordered']['u']), 'l' => rawurldecode($Params['user_parameters_unordered']['l']), 't' => rawurldecode($Params['user_parameters_unordered']['t']));
$dataRequest = array_filter($dataRequest);
$validateHash = sha1($data['secret_hash'] . sha1($data['secret_hash'] . implode(',', $dataRequest)));
if ($validateHash == $Params['user_parameters']['hash']) {
if ($dataRequest['t'] > 0 && $dataRequest['t'] < time()) {
die(erTranslationClassLhTranslation::getInstance()->getTranslation('users/autologin', 'Autologin hash has expired'));
}
try {
if (is_numeric($dataRequest['u'])) {
$userToLogin = erLhcoreClassModelUser::fetch((int) $dataRequest['u']);
} else {
$users = erLhcoreClassModelUser::getUserList(array('limit' => 1, 'filter' => array('username' => $dataRequest['l'])));
if (!empty($users)) {
$userToLogin = array_shift($users);
} else {
die(erTranslationClassLhTranslation::getInstance()->getTranslation('users/autologin', 'Could not find a user'));
}
}
} catch (Exception $e) {
die($e->getMessage());
}
if ($userToLogin instanceof erLhcoreClassModelUser) {
erLhcoreClassUser::instance()->setLoggedUser($userToLogin->id);
header('Location: ' . erLhcoreClassDesign::baseurldirect('site_admin') . '/' . ltrim($dataRequest['r'], '/'));
exit;
} else {
die(erTranslationClassLhTranslation::getInstance()->getTranslation('users/autologin', 'Could not find a provided user'));
示例7: sha1
<?php
$cfg = erConfigClassLhConfig::getInstance();
$secretHash = $cfg->getSetting('site', 'seller_secret_hash');
$validateHash = sha1((string) $Params['user_parameters']['id'] . (string) $Params['user_parameters']['date'] . $secretHash . '_' . (string) $Params['user_parameters']['operators']);
if ((string) $Params['user_parameters']['hash'] == $validateHash && $Params['user_parameters']['id'] == erLhcoreClassInstance::$instanceChat->id && date('Ym') == (string) $Params['user_parameters']['date']) {
if ($Params['user_parameters']['operators'] > 0) {
$userCount = erLhcoreClassModelUser::getUserCount(array('filter' => array('disabled' => 0)));
// We have to disable exceeded users
if ($userCount > $Params['user_parameters']['operators']) {
$users = erLhcoreClassModelUser::getUserList(array('sort' => 'id ASC', 'filter' => array('disabled' => 0), 'offset' => (int) $Params['user_parameters']['operators'], 'limit' => 100000000));
foreach ($users as $user) {
$user->disabled = 1;
$user->saveThis();
}
}
}
echo "ok";
} else {
echo 'Invalid hash';
}
exit;
示例8: explode
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('permission/request', 'Please choose a user!');
} else {
$userRecipient = erLhcoreClassModelUser::fetch($form->UserID);
}
if ($userRecipient !== false && $userRecipient->rec_per_req == 0) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('permission/request', 'This user can not receive permision request!');
}
if ($form->hasValidData('Permissions') && $form->Permissions != '') {
$permissionsCombinations = explode(',', $form->Permissions);
$permissionsRequestedData = array();
foreach ($permissionsCombinations as $combination) {
list($module, $function) = explode('_f_', $combination);
$moduleName = erLhcoreClassModules::getModuleName($module);
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('lhpermission.getmodulename', array('module' => $module, 'name' => &$moduleName));
$functionName = erLhcoreClassModules::getFunctionName($module, $function);
$permissionsRequestedData[] = $moduleName . ' - ' . $functionName;
}
$tpl->set('permission', $form->Permissions);
} else {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('permission/request', 'Permissions were not provided');
}
if (empty($Errors)) {
erLhcoreClassChatMail::sendMailRequestPermission($userRecipient, $currentUser->getUserData(), implode("\n", $permissionsRequestedData));
$tpl->set('requested', true);
} else {
$tpl->set('errors', $Errors);
}
}
$tpl->set('users', erLhcoreClassModelUser::getUserList(array('limit' => 100, 'filter' => array('rec_per_req' => 1))));
$Result['content'] = $tpl->fetch();
$Result['pagelayout'] = 'popup';
示例9: lhPaginator
<?php
$tpl = erLhcoreClassTemplate::getInstance('lhuser/userlist.tpl.php');
if (isset($_GET['doSearch'])) {
$filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'user', 'module_file' => 'user_list', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']));
$filterParams['is_search'] = true;
} else {
$filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'user', 'module_file' => 'user_list', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered']));
$filterParams['is_search'] = false;
}
$append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']);
$pages = new lhPaginator();
$pages->serverURL = erLhcoreClassDesign::baseurl('user/userlist') . $append;
$pages->items_total = erLhcoreClassModelUser::getUserCount($filterParams['filter']);
$pages->setItemsPerPage(20);
$pages->paginate();
$userlist = erLhcoreClassModelUser::getUserList(array_merge($filterParams['filter'], array('offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'email ASC')));
$tpl->set('userlist', $userlist);
$tpl->set('pages', $pages);
$tpl->set('currentUser', $currentUser);
$filterParams['input_form']->form_action = erLhcoreClassDesign::baseurl('user/userlist');
$tpl->set('input', $filterParams['input_form']);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/userlist', 'System configuration')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/userlist', 'Users')));
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.userlist_path', array('result' => &$Result));
示例10: lhPaginator
<?php
$tpl = erLhcoreClassTemplate::getInstance('lhuser/userlist.tpl.php');
$pages = new lhPaginator();
$pages->serverURL = '/index.php/site_admin/user/userlist';
$pages->items_total = erLhcoreClassModelUser::getUserCount();
$pages->setItemsPerPage(20);
$pages->paginate();
$userlist = erLhcoreClassModelUser::getUserList(array('offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'email ASC'));
$tpl->set('userlist', $userlist);
$tpl->set('pages', $pages);
$tpl->set('currentUser', $currentUser);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => '/index.php/site_admin/system/configuration', 'title' => 'System configuration'), array('title' => 'Users'));
示例11: sha1
<?php
$instance = erLhcoreClassInstance::getInstance();
$hashValidation = sha1(erConfigClassLhConfig::getInstance()->getSetting('site', 'seller_secret_hash') . sha1(erConfigClassLhConfig::getInstance()->getSetting('site', 'seller_secret_hash') . $instance->address . $Params['user_parameters']['ts']));
if (time() < $Params['user_parameters']['ts'] + 60 && time() + 61 > $Params['user_parameters']['ts'] && $hashValidation == $Params['user_parameters']['hash']) {
$users = erLhcoreClassModelUser::getUserList(array('limit' => 1, 'sort' => 'id ASC'));
if (!empty($users)) {
$user = array_shift($users);
// Login user and redirect
erLhcoreClassUser::instance()->setLoggedUser($user->id);
header('Location: ' . erLhcoreClassDesign::baseurldirect('site_admin'));
exit;
} else {
die('Could not find a user');
}
} else {
die('Invalid hash or it has expired');
}
exit;
示例12: header
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
header('Content-Type: application/json');
try {
erLhcoreClassRestAPIHandler::validateRequest();
$userlist = erLhcoreClassModelUser::getUserList();
foreach ($userlist as $index => $user) {
// loose password
unset($user->password);
$userlist[$index] = $user;
}
// end of foreach($userlist as $index => $user)
erLhcoreClassRestAPIHandler::outputResponse(array('error' => false, 'result' => $userlist));
} catch (Exception $e) {
echo json_encode(array('error' => true, 'result' => $e->getMessage()));
}
exit;