本文整理汇总了PHP中erLhcoreClassUser::getSession方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassUser::getSession方法的具体用法?PHP erLhcoreClassUser::getSession怎么用?PHP erLhcoreClassUser::getSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类erLhcoreClassUser
的用法示例。
在下文中一共展示了erLhcoreClassUser::getSession方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
public static function getList($paramsSearch = array())
{
$paramsDefault = array('limit' => 32, 'offset' => 0);
$params = array_merge($paramsDefault, $paramsSearch);
$session = erLhcoreClassUser::getSession();
$q = $session->createFindQuery('erLhcoreClassModelUserSetting');
$conditions = array();
if (isset($params['filter']) && count($params['filter']) > 0) {
foreach ($params['filter'] as $field => $fieldValue) {
$conditions[] = $q->expr->eq($field, $q->bindValue($fieldValue));
}
}
if (isset($params['filterin']) && count($params['filterin']) > 0) {
foreach ($params['filterin'] as $field => $fieldValue) {
$conditions[] = $q->expr->in($field, $fieldValue);
}
}
if (isset($params['filterlt']) && count($params['filterlt']) > 0) {
foreach ($params['filterlt'] as $field => $fieldValue) {
$conditions[] = $q->expr->lt($field, $q->bindValue($fieldValue));
}
}
if (isset($params['filtergt']) && count($params['filtergt']) > 0) {
foreach ($params['filtergt'] as $field => $fieldValue) {
$conditions[] = $q->expr->gt($field, $q->bindValue($fieldValue));
}
}
if (count($conditions) > 0) {
$q->where($conditions);
}
$q->limit($params['limit'], $params['offset']);
$q->orderBy(isset($params['sort']) ? $params['sort'] : 'identifier DESC');
$objects = $session->find($q, 'erLhcoreClassModelUserSettingOption');
return $objects;
}
示例2: getChatOwner
public function getChatOwner()
{
try {
$user = erLhcoreClassUser::getSession()->load('erLhcoreClassModelUser', $this->user_id);
return $user;
} catch (Exception $e) {
return false;
}
}
示例3: deleteGroup
public static function deleteGroup($group_id)
{
$Group = erLhcoreClassUser::getSession()->load('erLhcoreClassModelGroup', $group_id);
erLhcoreClassUser::getSession()->delete($Group);
$q = ezcDbInstance::get()->createDeleteQuery();
// Transfered chats to user
$q->deleteFrom('lh_groupuser')->where($q->expr->eq('group_id', $group_id));
$stmt = $q->prepare();
$stmt->execute();
// Transfered chats to user
$q->deleteFrom('lh_grouprole')->where($q->expr->eq('group_id', $group_id));
$stmt = $q->prepare();
$stmt->execute();
}
示例4: getCount
public static function getCount($params = array())
{
$session = erLhcoreClassUser::getSession('slave');
$q = $session->database->createSelectQuery();
$q->select("COUNT(id)")->from("lh_group");
if (isset($params['filter']) && count($params['filter']) > 0) {
$conditions = array();
foreach ($params['filter'] as $field => $fieldValue) {
$conditions[] = $q->expr->eq($field, $q->bindValue($fieldValue));
}
$q->where($conditions);
}
$stmt = $q->prepare();
$stmt->execute();
$result = $stmt->fetchColumn();
return $result;
}
示例5: VALUES
$db->query("INSERT INTO `lh_userdep` (`user_id`,`dep_id`,`last_activity`,`hide_online`,`last_accepted`,`active_chats`) VALUES ({$UserData->id},0,0,0,0,0)");
// Transfer chat
$db->query("CREATE TABLE IF NOT EXISTS `lh_transfer` (\n\t\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t `chat_id` int(11) NOT NULL,\n\t\t\t\t `dep_id` int(11) NOT NULL,\n\t\t\t\t `transfer_user_id` int(11) NOT NULL,\n\t\t\t\t `from_dep_id` int(11) NOT NULL,\n\t\t\t\t `transfer_to_user_id` int(11) NOT NULL,\n\t\t\t\t PRIMARY KEY (`id`),\n\t\t\t\t KEY `dep_id` (`dep_id`),\n\t\t\t\t KEY `transfer_user_id_dep_id` (`transfer_user_id`,`dep_id`),\n\t\t\t\t KEY `transfer_to_user_id` (`transfer_to_user_id`)\n\t\t\t\t) DEFAULT CHARSET=utf8;");
// Remember user table
$db->query("CREATE TABLE IF NOT EXISTS `lh_users_remember` (\n\t\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t `user_id` int(11) NOT NULL,\n\t\t\t\t `mtime` int(11) NOT NULL,\n\t\t\t\t PRIMARY KEY (`id`)\n\t\t\t\t) DEFAULT CHARSET=utf8;");
// Chat messages
$db->query("CREATE TABLE IF NOT EXISTS `lh_msg` (\n\t\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t `msg` text NOT NULL,\n\t\t\t\t `time` int(11) NOT NULL,\n\t\t\t\t `chat_id` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t `user_id` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t `name_support` varchar(100) NOT NULL,\n\t\t\t\t PRIMARY KEY (`id`),\n\t\t\t\t KEY `chat_id_id` (`chat_id`, `id`)\n\t\t\t\t) DEFAULT CHARSET=utf8;");
// Forgot password table
$db->query("CREATE TABLE IF NOT EXISTS `lh_forgotpasswordhash` (\n `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n `user_id` INT NOT NULL ,\n `hash` VARCHAR( 40 ) NOT NULL ,\n `created` INT NOT NULL\n ) DEFAULT CHARSET=utf8;");
// User groups table
$db->query("CREATE TABLE IF NOT EXISTS `lh_groupuser` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `group_id` int(11) NOT NULL,\n `user_id` int(11) NOT NULL,\n PRIMARY KEY (`id`),\n KEY `group_id` (`group_id`),\n KEY `user_id` (`user_id`),\n KEY `group_id_2` (`group_id`,`user_id`)\n ) DEFAULT CHARSET=utf8;");
// Assign admin user to admin group
$GroupUser = new erLhcoreClassModelGroupUser();
$GroupUser->group_id = $GroupData->id;
$GroupUser->user_id = $UserData->id;
erLhcoreClassUser::getSession()->save($GroupUser);
//Assign default role functions
$db->query("CREATE TABLE IF NOT EXISTS `lh_rolefunction` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `role_id` int(11) NOT NULL,\n `module` varchar(100) NOT NULL,\n `function` varchar(100) NOT NULL,\n PRIMARY KEY (`id`),\n KEY `role_id` (`role_id`)\n ) DEFAULT CHARSET=utf8;");
// Admin role and function
$RoleFunction = new erLhcoreClassModelRoleFunction();
$RoleFunction->role_id = $Role->id;
$RoleFunction->module = '*';
$RoleFunction->function = '*';
erLhcoreClassRole::getSession()->save($RoleFunction);
// Operators rules and functions
$permissionsArray = array(array('module' => 'lhuser', 'function' => 'selfedit'), array('module' => 'lhuser', 'function' => 'changeonlinestatus'), array('module' => 'lhuser', 'function' => 'changeskypenick'), array('module' => 'lhuser', 'function' => 'personalcannedmsg'), array('module' => 'lhuser', 'function' => 'change_visibility_list'), array('module' => 'lhuser', 'function' => 'see_assigned_departments'), array('module' => 'lhchat', 'function' => 'use'), array('module' => 'lhchat', 'function' => 'chattabschrome'), array('module' => 'lhchat', 'function' => 'singlechatwindow'), array('module' => 'lhchat', 'function' => 'allowopenremotechat'), array('module' => 'lhchat', 'function' => 'allowchattabs'), array('module' => 'lhchat', 'function' => 'use_onlineusers'), array('module' => 'lhchat', 'function' => 'take_screenshot'), array('module' => 'lhfront', 'function' => 'use'), array('module' => 'lhsystem', 'function' => 'use'), array('module' => 'lhtranslation', 'function' => 'use'), array('module' => 'lhchat', 'function' => 'allowblockusers'), array('module' => 'lhsystem', 'function' => 'generatejs'), array('module' => 'lhsystem', 'function' => 'changelanguage'), array('module' => 'lhchat', 'function' => 'allowredirect'), array('module' => 'lhchat', 'function' => 'allowtransfer'), array('module' => 'lhchat', 'function' => 'administratecannedmsg'), array('module' => 'lhchat', 'function' => 'sees_all_online_visitors'), array('module' => 'lhpermission', 'function' => 'see_permissions'), array('module' => 'lhquestionary', 'function' => 'manage_questionary'), array('module' => 'lhfaq', 'function' => 'manage_faq'), array('module' => 'lhchatbox', 'function' => 'manage_chatbox'), array('module' => 'lhbrowseoffer', 'function' => 'manage_bo'), array('module' => 'lhxml', 'function' => '*'), array('module' => 'lhcobrowse', 'function' => 'browse'), array('module' => 'lhfile', 'function' => 'use_operator'), array('module' => 'lhfile', 'function' => 'file_delete_chat'), array('module' => 'lhspeech', 'function' => 'changedefaultlanguage'), array('module' => 'lhspeech', 'function' => 'use'), array('module' => 'lhspeech', 'function' => 'change_chat_recognition'));
foreach ($permissionsArray as $paramsPermission) {
$RoleFunctionOperator = new erLhcoreClassModelRoleFunction();
$RoleFunctionOperator->role_id = $RoleOperators->id;
$RoleFunctionOperator->module = $paramsPermission['module'];
$RoleFunctionOperator->function = $paramsPermission['function'];
示例6: array
} else {
$UserData->invisible_mode = 0;
}
$globalDepartament = array();
if (isset($_POST['all_departments']) && $_POST['all_departments'] == 'on') {
$UserData->all_departments = 1;
$globalDepartament[] = 0;
} else {
$UserData->all_departments = 0;
}
if (count($Errors) == 0) {
$UserData->setPassword($form->Password);
$UserData->email = $form->Email;
$UserData->name = $form->Name;
$UserData->username = $form->Username;
erLhcoreClassUser::getSession()->save($UserData);
if (isset($_POST['UserDepartament']) && count($_POST['UserDepartament']) > 0) {
$globalDepartament = array_merge($_POST['UserDepartament'], $globalDepartament);
}
if (count($globalDepartament) > 0) {
erLhcoreClassUserDep::addUserDepartaments($globalDepartament, $UserData->id, $UserData);
}
erLhcoreClassModelGroupUser::removeUserFromGroups($UserData->id);
foreach ($UserData->user_groups_id as $group_id) {
$groupUser = new erLhcoreClassModelGroupUser();
$groupUser->group_id = $group_id;
$groupUser->user_id = $UserData->id;
$groupUser->saveThis();
}
// Store photo
if (isset($_FILES["UserPhoto"]) && is_uploaded_file($_FILES["UserPhoto"]["tmp_name"]) && $_FILES["UserPhoto"]["error"] == 0 && erLhcoreClassImageConverter::isPhoto('UserPhoto')) {
示例7: getLHCUsers
/**
* LHC Users which does not have assigned operator yet
* */
public static function getLHCUsers($params)
{
$session = erLhcoreClassUser::getSession();
$q = $session->createFindQuery('erLhcoreClassModelUser');
// Fetch already assigned opetators
$usersIds = self::getAllUsersIds($params['user_id']);
if (!empty($usersIds)) {
$q->where($q->expr->not($q->expr->in('id', $usersIds)));
}
$q->orderBy('id DESC');
return $session->find($q);
}
示例8: IN
$q2 = $session->database->createSelectQuery();
$q2->select("user_id")->from("lh_groupuser");
$q2->where($q2->expr->eq('group_id', (int) $Params['user_parameters']['group_id']));
$q->select("COUNT(lh_users.id)")->from("lh_users");
$q->where('lh_users.id NOT IN (' . (string) $q2 . ')');
$stmt = $q->prepare();
$stmt->execute();
$result = $stmt->fetchColumn();
$pages = new lhPaginator();
$pages->items_total = $result;
$pages->setItemsPerPage(10);
$pages->serverURL = erLhcoreClassDesign::baseurl('user/groupassignuser') . '/' . (int) $Params['user_parameters']['group_id'];
$pages->paginate();
$tpl->set('pages', $pages);
if ($pages->items_total > 0) {
$session = erLhcoreClassUser::getSession();
$q = $session->createFindQuery('erLhcoreClassModelUser');
$q2 = $session->database->createSelectQuery();
$q2->select("user_id")->from("lh_groupuser");
$q2->where($q2->expr->eq('group_id', (int) $Params['user_parameters']['group_id']));
$q->where('lh_users.id NOT IN (' . (string) $q2 . ')');
$q->limit($pages->items_per_page, $pages->low);
$q->orderBy('id DESC');
$users = $session->find($q);
$tpl->set('users', $users);
} else {
$tpl->set('users', array());
}
}
$Result['content'] = $tpl->fetch();
$Result['pagelayout'] = 'popup';
示例9: saveThis
public function saveThis()
{
erLhcoreClassUser::getSession()->saveOrUpdate($this);
}
示例10: array
if (isset($_POST['Forgotpassword'])) {
$definition = array('Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'validate_email'));
$form = new ezcInputForm(INPUT_POST, $definition);
$Errors = array();
if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
erLhcoreClassModule::redirect('user/forgotpassword');
exit;
}
if (!$form->hasValidData('Email')) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword', 'Invalid e-mail address!');
}
if (count($Errors) == 0) {
if (($userID = erLhcoreClassModelUser::fetchUserByEmail($form->Email)) !== false) {
$host = $_SERVER['HTTP_HOST'];
$adminEmail = erConfigClassLhConfig::getInstance()->getSetting('site', 'site_admin_email');
$UserData = erLhcoreClassUser::getSession()->load('erLhcoreClassModelUser', $userID);
$hash = erLhcoreClassModelForgotPassword::randomPassword(40);
erLhcoreClassModelForgotPassword::setRemindHash($UserData->id, $hash);
$mail = new PHPMailer();
$mail->CharSet = "UTF-8";
$mail->From = $adminEmail;
$mail->FromName = erConfigClassLhConfig::getInstance()->getSetting('site', 'title');
$mail->Subject = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword', 'Password remind');
// HTML body
$body = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword', 'Click this link and You will be sent a new password') . ' </br><a href="http://' . $host . erLhcoreClassDesign::baseurl('user/remindpassword') . '/' . $hash . '">Restore password</a>';
// Plain text body
$text_body = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword', 'Click this link and You will be sent a new password') . ' - http://' . $host . erLhcoreClassDesign::baseurl('user/remindpassword') . '/' . $hash;
$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($UserData->email, $UserData->username);
erLhcoreClassChatMail::setupSMTP($mail);
示例11: array
$tpl = erLhcoreClassTemplate::getInstance('lhuser/editgroup.tpl.php');
$Group = erLhcoreClassUser::getSession()->load('erLhcoreClassModelGroup', (int) $Params['user_parameters']['group_id']);
if (isset($_POST['Update_group'])) {
$definition = array('Name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw'));
$form = new ezcInputForm(INPUT_POST, $definition);
$Errors = array();
if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
erLhcoreClassModule::redirect('user/userlist');
exit;
}
if (!$form->hasValidData('Name') || $form->Name == '') {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/editgroup', 'Please enter a group name');
}
if (count($Errors) == 0) {
$Group->name = $form->Name;
erLhcoreClassUser::getSession()->update($Group);
erLhcoreClassModule::redirect('user/grouplist');
exit;
} else {
$tpl->set('errors', $Errors);
}
}
if (isset($_POST['AssignRoles']) && isset($_POST['RoleID']) && count($_POST['RoleID']) > 0) {
if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
erLhcoreClassModule::redirect('user/userlist');
exit;
}
foreach ($_POST['RoleID'] as $RoleID) {
$GroupRole = new erLhcoreClassModelGroupRole();
$GroupRole->group_id = $Group->id;
$GroupRole->role_id = $RoleID;
示例12:
<?php
$tpl = erLhcoreClassTemplate::getInstance('lhpermission/getpermissionsummary.tpl.php');
$user = erLhcoreClassUser::getSession()->load('erLhcoreClassModelUser', (int) $Params['user_parameters']['user_id']);
if ($user->id == $currentUser->getUserID() || $currentUser->hasAccessTo('lhchat', 'see_permissions_users')) {
$tpl->set('user', $user);
$tpl->set('permissions', erLhcoreClassRole::accessArrayByUserID($user->id));
echo $tpl->fetch();
}
exit;
示例13: getList
public static function getList($paramsSearch = array())
{
$paramsDefault = array('limit' => 32, 'offset' => 0);
$params = array_merge($paramsDefault, $paramsSearch);
$session = erLhcoreClassUser::getSession();
$q = $session->createFindQuery('erLhcoreClassModelUserSetting');
$conditions = array();
if (!isset($paramsSearch['smart_select'])) {
if (isset($params['filter']) && count($params['filter']) > 0) {
foreach ($params['filter'] as $field => $fieldValue) {
$conditions[] = $q->expr->eq($field, $q->bindValue($fieldValue));
}
}
if (isset($params['filterin']) && count($params['filterin']) > 0) {
foreach ($params['filterin'] as $field => $fieldValue) {
$conditions[] = $q->expr->in($field, $fieldValue);
}
}
if (isset($params['filterlt']) && count($params['filterlt']) > 0) {
foreach ($params['filterlt'] as $field => $fieldValue) {
$conditions[] = $q->expr->lt($field, $q->bindValue($fieldValue));
}
}
if (isset($params['filtergt']) && count($params['filtergt']) > 0) {
foreach ($params['filtergt'] as $field => $fieldValue) {
$conditions[] = $q->expr->gt($field, $q->bindValue($fieldValue));
}
}
if (count($conditions) > 0) {
$q->where($conditions);
}
$q->limit($params['limit'], $params['offset']);
$q->orderBy(isset($params['sort']) ? $params['sort'] : 'id DESC');
} else {
$q2 = $q->subSelect();
$q2->select('pid')->from('lh_users');
if (isset($params['filter']) && count($params['filter']) > 0) {
foreach ($params['filter'] as $field => $fieldValue) {
$conditions[] = $q2->expr->eq($field, $q->bindValue($fieldValue));
}
}
if (isset($params['filterin']) && count($params['filterin']) > 0) {
foreach ($params['filterin'] as $field => $fieldValue) {
$conditions[] = $q2->expr->in($field, $fieldValue);
}
}
if (isset($params['filterlt']) && count($params['filterlt']) > 0) {
foreach ($params['filterlt'] as $field => $fieldValue) {
$conditions[] = $q2->expr->lt($field, $q->bindValue($fieldValue));
}
}
if (isset($params['filtergt']) && count($params['filtergt']) > 0) {
foreach ($params['filtergt'] as $field => $fieldValue) {
$conditions[] = $q2->expr->gt($field, $q->bindValue($fieldValue));
}
}
if (count($conditions) > 0) {
$q2->where($conditions);
}
$q2->limit($params['limit'], $params['offset']);
$q2->orderBy(isset($params['sort']) ? $params['sort'] : 'id DESC');
$q->innerJoin($q->alias($q2, 'items'), 'lh_users_setting.id', 'items.id');
}
$objects = $session->find($q, 'erLhcoreClassModelUserSetting');
return $objects;
}
示例14: deleteGroupUser
public static function deleteGroupUser($AssigneID)
{
$AssignedUser = erLhcoreClassUser::getSession()->load('erLhcoreClassModelGroupUser', $AssigneID);
erLhcoreClassUser::getSession()->delete($AssignedUser);
}
示例15: array
<?php
$currentUser = erLhcoreClassUser::instance();
$userData = $currentUser->getUserData(true);
if ($Params['user_parameters']['status'] == 'false') {
$userData->invisible_mode = 0;
} else {
$userData->invisible_mode = 1;
}
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.operator_visibility_changed', array('user' => &$userData, 'reason' => 'user_action'));
erLhcoreClassUser::getSession()->update($userData);
exit;