本文整理汇总了PHP中erLhcoreClassModelUser::getUserCount方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassModelUser::getUserCount方法的具体用法?PHP erLhcoreClassModelUser::getUserCount怎么用?PHP erLhcoreClassModelUser::getUserCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类erLhcoreClassModelUser
的用法示例。
在下文中一共展示了erLhcoreClassModelUser::getUserCount方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
$stringParts[] = array('key' => $name_item, 'value' => isset($valuesArray[$key]) ? trim($valuesArray[$key]) : '');
}
$chat->additional_data = json_encode($stringParts);
}
if (erLhcoreClassModelChatConfig::fetch('session_captcha')->current_value == 1) {
if (!$form->hasValidData($nameField) || $form->{$nameField} == '' || $form->{$nameField} < time() - 600 || $hashCaptcha != sha1($_SERVER['REMOTE_ADDR'] . $form->{$nameField} . erConfigClassLhConfig::getInstance()->getSetting('site', 'secrethash'))) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Invalid captcha code, please enable Javascript!');
}
} else {
// Captcha validation
if (!$form->hasValidData($nameField) || $form->{$nameField} == '' || $form->{$nameField} < time() - 600) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Invalid captcha code, please enable Javascript!');
}
}
if ($form->hasValidData('operator') && erLhcoreClassModelUser::getUserCount(array('filter' => array('id' => $form->operator, 'disabled' => 0))) > 0) {
$inputData->operator = $chat->user_id = $form->operator;
}
if ($form->hasValidData('user_timezone')) {
$timezone_name = timezone_name_from_abbr(null, $form->user_timezone * 3600, true);
if ($timezone_name !== false) {
$chat->user_tz_identifier = $timezone_name;
} else {
$chat->user_tz_identifier = '';
}
}
$chat->dep_id = $inputData->departament_id;
// Assign default department
if ($form->hasValidData('DepartamentID') && erLhcoreClassModelDepartament::getCount(array('filter' => array('id' => $form->DepartamentID, 'disabled' => 0))) > 0) {
$inputData->departament_id = $chat->dep_id = $form->DepartamentID;
} elseif ($chat->dep_id == 0 || erLhcoreClassModelDepartament::getCount(array('filter' => array('id' => $chat->dep_id, 'disabled' => 0))) == 0) {
示例2: canUserBeSaved
public function canUserBeSaved($params)
{
if (erLhcoreClassInstance::getInstance()->max_operators > 0 && $params['userData']->disabled == 0) {
$isEditingUserDisabled = erLhcoreClassModelUser::getUserCount(array('filter' => array('disabled' => 1, 'id' => $params['userData']->id))) > 0;
// User is enabling one of disabled users
if ($isEditingUserDisabled == true && erLhcoreClassModelUser::getUserCount(array('filter' => array('disabled' => 0))) + 1 > erLhcoreClassInstance::getInstance()->max_operators) {
$params['errors'][] = erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'You cannot enable user, because you have exceeded maximum number of allowed operators!');
}
}
}
示例3: validateStartChat
//.........这里部分代码省略.........
} else {
$chat->email = $inputForm->email = $_POST['Email'];
}
}
// Validate question
if (isset($validationFields['Question'])) {
if (!$form->hasValidData('keyUpStarted') && (!$form->hasValidData('Question') || trim($form->Question) == '' && ($start_data_fields['message_require_option'] == 'required' && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_message_require_option']) && $start_data_fields['offline_message_require_option'] == 'required'))) {
$Errors['question'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your message');
} elseif ($form->hasValidData('Question')) {
$inputForm->question = trim($form->Question);
}
if ($form->hasValidData('Question') && trim($form->Question) != '' && strlen($form->Question) > (int) erLhcoreClassModelChatConfig::fetch('max_message_length')->current_value) {
$Errors['question'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Maximum') . ' ' . (int) erLhcoreClassModelChatConfig::fetch('max_message_length')->current_value . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'characters for a message');
}
}
if (isset($validationFields['AcceptTOS'])) {
if (!$form->hasValidData('AcceptTOS') || $form->AcceptTOS == false) {
$Errors['accept_tos'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'You have to accept our Terms Of Service');
} else {
$inputForm->accept_tos = true;
}
}
// Validate phone
if (isset($validationFields['Phone'])) {
if (!$form->hasValidData('Phone') || ($form->Phone == '' || mb_strlen($form->Phone) < erLhcoreClassModelChatConfig::fetch('min_phone_length')->current_value) && ($start_data_fields['phone_require_option'] == 'required' && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_phone_require_option']) && $start_data_fields['offline_phone_require_option'] == 'required')) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your phone');
} elseif ($form->hasValidData('Phone')) {
$chat->phone = $inputForm->phone = $form->Phone;
}
if ($form->hasValidData('Phone') && $form->Phone != '' && strlen($form->Phone) > 100) {
$Errors['phone'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Maximum 100 characters for phone');
}
}
if ($form->hasValidData('operator') && erLhcoreClassModelUser::getUserCount(array('filter' => array('id' => $form->operator, 'disabled' => 0))) > 0) {
$inputForm->operator = $chat->user_id = $form->operator;
}
/**
* File for offline form
* */
$inputForm->has_file = false;
if (isset($additionalParams['offline']) && ($inputForm->validate_start_chat == true && isset($start_data_fields['offline_file_visible_in_popup']) && $start_data_fields['offline_file_visible_in_popup'] == true || $inputForm->validate_start_chat == false && isset($start_data_fields['offline_file_visible_in_page_widget']) && $start_data_fields['offline_file_visible_in_page_widget'] == true)) {
$fileData = erLhcoreClassModelChatConfig::fetch('file_configuration');
$data = (array) $fileData->data;
if ($_FILES['File']['error'] != 4) {
// No file was provided
if (isset($_FILES['File']) && erLhcoreClassSearchHandler::isFile('File', '/\\.(' . $data['ft_us'] . ')$/i', $data['fs_max'] * 1024)) {
$inputForm->has_file = true;
// Just extract file extension
$fileNameAray = explode('.', $_FILES['File']['name']);
end($fileNameAray);
// Set attribute for futher
$inputForm->file_extension = strtolower(current($fileNameAray));
$inputForm->file_location = $_FILES['File']['tmp_name'];
} elseif (isset($_FILES['File'])) {
$Errors[] = erLhcoreClassSearchHandler::$lastError != '' ? erLhcoreClassSearchHandler::$lastError : erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Invalid file');
}
}
}
if ($form->hasValidData('user_timezone')) {
$timezone_name = timezone_name_from_abbr(null, $form->user_timezone * 3600, true);
if ($timezone_name !== false) {
$chat->user_tz_identifier = $timezone_name;
} else {
$chat->user_tz_identifier = '';
}
}
示例4: 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;
示例5: 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));
示例6: 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'));
示例7: isset
<?php
if (erLhcoreClassInstance::getInstance()->max_operators > 0 && erLhcoreClassModelUser::getUserCount() + 1 > erLhcoreClassInstance::getInstance()->max_operators) {
$errorsOriginal = isset($errors) ? $errors : false;
$errors = array(erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'You have exceeded maximum number of allowed operators!'));
?>
<?php
include erLhcoreClassDesign::designtpl('lhkernel/validation_error.tpl.php');
if ($errorsOriginal == false) {
unset($errors);
} else {
$errors = $errorsOriginal;
}
}
示例8: validateStartChat
//.........这里部分代码省略.........
} else {
$chat->email = $inputForm->email = $_POST['Email'];
}
}
// Validate question
if (isset($validationFields['Question'])) {
if (!$form->hasValidData('Question') || trim($form->Question) == '' && ($start_data_fields['message_require_option'] == 'required' && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_message_require_option']) && $start_data_fields['offline_message_require_option'] == 'required')) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your message');
} elseif ($form->hasValidData('Question')) {
$inputForm->question = trim($form->Question);
}
if ($form->hasValidData('Question') && trim($form->Question) != '' && strlen($form->Question) > (int) erLhcoreClassModelChatConfig::fetch('max_message_length')->current_value) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Maximum') . ' ' . (int) erLhcoreClassModelChatConfig::fetch('max_message_length')->current_value . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'characters for a message');
}
}
if (isset($validationFields['AcceptTOS'])) {
if (!$form->hasValidData('AcceptTOS') || $form->AcceptTOS == false) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'You have to accept our Terms Of Service');
} else {
$inputForm->accept_tos = true;
}
}
// Validate phone
if (isset($validationFields['Phone'])) {
if (!$form->hasValidData('Phone') || ($form->Phone == '' || mb_strlen($form->Phone) < erLhcoreClassModelChatConfig::fetch('min_phone_length')->current_value) && ($start_data_fields['phone_require_option'] == 'required' && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_phone_require_option']) && $start_data_fields['offline_phone_require_option'] == 'required')) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your phone');
} elseif ($form->hasValidData('Phone')) {
$chat->phone = $inputForm->phone = $form->Phone;
}
if ($form->hasValidData('Phone') && $form->Phone != '' && strlen($form->Phone) > 100) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Maximum 100 characters for phone');
}
}
if ($form->hasValidData('operator') && erLhcoreClassModelUser::getUserCount(array('filter' => array('id' => $form->operator, 'disabled' => 0))) > 0) {
$inputForm->operator = $chat->user_id = $form->operator;
}
if ($form->hasValidData('user_timezone')) {
$timezone_name = timezone_name_from_abbr(null, $form->user_timezone * 3600, true);
if ($timezone_name !== false) {
$chat->user_tz_identifier = $timezone_name;
} else {
$chat->user_tz_identifier = '';
}
}
if ($form->hasValidData('DepartmentIDDefined')) {
$inputForm->departament_id_array = $form->DepartmentIDDefined;
}
if ($form->hasValidData('DepartamentID') && erLhcoreClassModelDepartament::getCount(array('filter' => array('id' => $form->DepartamentID, 'disabled' => 0))) > 0) {
$chat->dep_id = $form->DepartamentID;
} elseif ($chat->dep_id == 0 || erLhcoreClassModelDepartament::getCount(array('filter' => array('id' => $chat->dep_id, 'disabled' => 0))) == 0) {
$departments = erLhcoreClassModelDepartament::getList(array('limit' => 1, 'filter' => array('disabled' => 0)));
if (!empty($departments)) {
$department = array_shift($departments);
$chat->dep_id = $department->id;
} else {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Could not determine a default department!');
}
}
// Set chat attributes for transfer workflow logic
if ($chat->department !== false && $chat->department->department_transfer_id > 0) {
$chat->transfer_if_na = 1;
$chat->transfer_timeout_ts = time();
$chat->transfer_timeout_ac = $chat->department->transfer_timeout;
}
if ($chat->department !== false && $chat->department->inform_unread == 1) {
$chat->reinform_timeout = $chat->department->inform_unread_delay;