当前位置: 首页>>代码示例>>PHP>>正文


PHP erLhcoreClassUserDep类代码示例

本文整理汇总了PHP中erLhcoreClassUserDep的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassUserDep类的具体用法?PHP erLhcoreClassUserDep怎么用?PHP erLhcoreClassUserDep使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了erLhcoreClassUserDep类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDepartmentLimitation

 public static function getDepartmentLimitation()
 {
     $currentUser = erLhcoreClassUser::instance();
     $LimitationDepartament = '';
     $userData = $currentUser->getUserData(true);
     if ($userData->all_departments == 0) {
         $userDepartaments = erLhcoreClassUserDep::getUserDepartaments($currentUser->getUserID());
         if (count($userDepartaments) == 0) {
             return false;
         }
         $LimitationDepartament = '(lh_transfer.dep_id IN (' . implode(',', $userDepartaments) . '))';
         return $LimitationDepartament;
     }
     return true;
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:15,代码来源:lhtransfer.php

示例2: 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');
     }
 }
开发者ID:creativeprogramming,项目名称:livehelperchat-extensions,代码行数:39,代码来源:lhsinglesingon.php

示例3: getOnlineOperators

 public static function getOnlineOperators($currentUser, $canListOnlineUsersAll = false)
 {
     $LimitationDepartament = '';
     $userData = $currentUser->getUserData(true);
     $filter = array();
     if ($userData->all_departments == 0 && $canListOnlineUsersAll == false) {
         $userDepartaments = erLhcoreClassUserDep::getUserDepartaments($currentUser->getUserID());
         if (count($userDepartaments) == 0) {
             return array();
         }
         $index = array_search(-1, $userDepartaments);
         if ($index !== false) {
             unset($userDepartaments[$index]);
         }
         $filter['customfilter'][] = '(dep_id IN (' . implode(',', $userDepartaments) . ') OR user_id = ' . $currentUser->getUserID() . ')';
     }
     $filter['filtergt']['last_activity'] = time() - 120;
     $filter['limit'] = 10;
     $filter['sort'] = 'last_activity DESC';
     $filter['groupby'] = 'user_id';
     return self::getList($filter);
 }
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:22,代码来源:erlhcoreclassmodeluserdep.php

示例4: is_numeric

if ($showDepartmentsStats == true) {
    /**
     * Departments stats
     * */
    $limitList = is_numeric($Params['user_parameters_unordered']['limitd']) ? (int) $Params['user_parameters_unordered']['limitd'] : 10;
    $filter = array('ignore_fields' => erLhcoreClassChat::$chatListIgnoreField);
    $filter['limit'] = $limitList;
    if (is_array($Params['user_parameters_unordered']['departmentd']) && !empty($Params['user_parameters_unordered']['departmentd'])) {
        erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['departmentd']);
        $filter['filterin']['id'] = $Params['user_parameters_unordered']['departmentd'];
    }
    // Add permission check if operator does not have permission to see all departments stats
    if ($showDepartmentsStatsAll === false) {
        $userData = $currentUser->getUserData(true);
        if ($userData->all_departments == 0) {
            $userDepartaments = erLhcoreClassUserDep::getUserDepartaments($currentUser->getUserID());
            if (!empty($userDepartaments)) {
                if (isset($filter['filterin']['id'])) {
                    $validDepartments = array_intersect($userDepartaments, $filter['filterin']['id']);
                    if (!empty($validDepartments)) {
                        $filter['filterin']['id'] = $validDepartments;
                    } else {
                        $filter['filterin']['id'] = array(-1);
                    }
                } else {
                    $filter['filterin']['id'] = $userDepartaments;
                }
            } else {
                $filter['filterin']['id'] = array(-1);
                // No departments
            }
开发者ID:my-instantcms,项目名称:livehelperchat,代码行数:31,代码来源:syncadmininterface.php

示例5: hasAccessToRead

 public static function hasAccessToRead($chat)
 {
     $currentUser = erLhcoreClassUser::instance();
     $userData = $currentUser->getUserData(true);
     if ($userData->all_departments == 0) {
         /*
          * --From now permission is strictly by assigned department, not by chat owner
          *
          * Finally decided to keep this check, it allows more advance permissions configuration
          * */
         if ($chat->user_id == $currentUser->getUserID()) {
             return true;
         }
         $userDepartaments = erLhcoreClassUserDep::getUserDepartaments($currentUser->getUserID());
         if (count($userDepartaments) == 0) {
             return false;
         }
         if (in_array($chat->dep_id, $userDepartaments)) {
             if ($currentUser->hasAccessTo('lhchat', 'allowopenremotechat') == true) {
                 return true;
             } elseif ($chat->user_id == 0 || $chat->user_id == $currentUser->getUserID()) {
                 return true;
             }
             return false;
         }
         return false;
     }
     return true;
 }
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:29,代码来源:lhchat.php

示例6:

?>
</h5>
	
		<?php 
if (isset($account_updated_departaments) && $account_updated_departaments == 'done') {
    $msg = erTranslationClassLhTranslation::getInstance()->getTranslation('user/account', 'Account updated');
    ?>
			<?php 
    include erLhcoreClassDesign::designtpl('lhkernel/alert_success.tpl.php');
    ?>
		<?php 
}
?>
		
		<?php 
$userDepartaments = erLhcoreClassUserDep::getUserDepartaments($user->id);
?>
		
		<form action="<?php 
echo erLhcoreClassDesign::baseurl('user/edit');
?>
/<?php 
echo $user->id;
?>
#departments" method="post">
		
			<?php 
include erLhcoreClassDesign::designtpl('lhkernel/csfr_token.tpl.php');
?>
		
		    <label><input type="checkbox" value="on" name="all_departments" <?php 
开发者ID:niravpatel2008,项目名称:north-american-nemesis-new,代码行数:31,代码来源:edit.tpl.php

示例7: getFields

 public function getFields()
 {
     $currentUser = erLhcoreClassUser::instance();
     $userDepartments = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID());
     return array('name' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Name for personal purposes'), 'required' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'operator_name' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Operator name'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'position' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Position'), 'required' => true, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'siteaccess' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Language, leave empty for all. E.g lit, rus, ger etc...'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'time_on_site' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Time on site in seconds'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int')), 'pageviews' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Pageviews'), 'required' => false, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'referrer' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Referrer domain without www, E.g google keyword will match any of google domain'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'hide_after_ntimes' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'How many times user show invitation, 0 - untill users closes it, > 0 limits.'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int')), 'requires_email' => array('type' => 'checkbox', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Requires e-mail'), 'required' => false, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean')), 'requires_username' => array('type' => 'checkbox', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Requires name'), 'required' => false, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean')), 'requires_phone' => array('type' => 'checkbox', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Requires phone'), 'required' => false, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean')), 'show_random_operator' => array('type' => 'checkbox', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Show random operator profile'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean')), 'operator_ids' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Enter operators IDs from whom random operator should be shown, separated by comma'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string')), 'identifier' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Identifier, for what identifier this message should be shown, leave empty for all'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string')), 'tag' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Tag'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string')), 'dep_id' => array('type' => 'combobox', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Department'), 'required' => false, 'hidden' => true, 'source' => 'erLhcoreClassModelDepartament::getList', 'hide_optional' => $userDepartments !== true, 'params_call' => $userDepartments === true ? array() : array('filterin' => array('id' => $userDepartments)), 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int')), 'executed_times' => array('type' => 'none', 'hide_edit' => true, 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Matched times'), 'required' => false, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'message' => array('type' => 'textarea', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message to user'), 'required' => true, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'message_returning' => array('type' => 'textarea', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message to returning user'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'message_returning_nick' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Nick which will be used if we cannot determine returning user name'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'wait_message' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Wait message. Visible then users starts chat and is waiting for someone to accept a chat.'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'wait_timeout' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Wait timeout. Time in seconds before timeout message is shown.'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'timeout_message' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Show visitor this message then wait timeout passes.'), 'required' => false, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw')), 'repeat_number' => array('type' => 'text', 'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'How many times repeat message?'), 'required' => true, 'hidden' => true, 'validation_definition' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1))));
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:6,代码来源:erlhabstractmodeleproactivechatinvitation.php

示例8: hasAccessToRead

 /**
  * 
  * @param erLhcoreClassModelChat $chat
  * 
  * @return boolean
  */
 public static function hasAccessToRead(erLhcoreClassModelChat $chat)
 {
     if (self::$apiKey->user->all_departments == 0) {
         if ($chat->user_id == self::$apiKey->user->id) {
             return true;
         }
         $userDepartaments = erLhcoreClassUserDep::getUserDepartaments(self::$apiKey->user->id);
         if (count($userDepartaments) == 0) {
             return false;
         }
         if (in_array($chat->dep_id, $userDepartaments)) {
             if (self::hasAccessTo('lhchat', 'allowopenremotechat') == true || $chat->status == erLhcoreClassModelChat::STATUS_OPERATORS_CHAT) {
                 return true;
             } elseif ($chat->user_id == 0 || $chat->user_id == self::$apiKey->user->id) {
                 return true;
             }
             return false;
         }
         return false;
     }
     return true;
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:28,代码来源:lhrestapivalidator.php

示例9: array

    }
    $tpl->set('account_updated', 'done');
    $tpl->set('tab', 'tab_pending');
}
if (isset($_POST['UpdateDepartaments_account'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('user/userlist');
        exit;
    }
    $globalDepartament = array();
    if (isset($_POST['all_departments']) && $_POST['all_departments'] == 'on') {
        $UserData->all_departments = 1;
        $globalDepartament[] = 0;
    } else {
        $UserData->all_departments = 0;
        $globalDepartament[] = -1;
    }
    erLhcoreClassUser::getSession()->update($UserData);
    if (isset($_POST['UserDepartament']) && count($_POST['UserDepartament']) > 0) {
        $globalDepartament = array_merge($_POST['UserDepartament'], $globalDepartament);
    }
    if (count($globalDepartament) > 0) {
        erLhcoreClassUserDep::addUserDepartaments($globalDepartament, $Params['user_parameters']['user_id'], $UserData);
    } else {
        erLhcoreClassUserDep::addUserDepartaments(array(), $Params['user_parameters']['user_id'], $UserData);
    }
    $tpl->set('account_updated_departaments', 'done');
}
$tpl->set('user', $UserData);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('user/userlist'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'Users')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'User edit') . ' - ' . $UserData->name . ' ' . $UserData->surname));
开发者ID:nagyistoce,项目名称:livehelperchat,代码行数:31,代码来源:edit.php

示例10: array

        $tpl->set('errors', $Errors);
    }
}
if (isset($_POST['UpdatePending_account'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('user/edit', '/' . $UserData->id);
        exit;
    }
    $showAllPending = erLhcoreClassUserValidator::validateShowAllPendingOption();
    erLhcoreClassModelUserSetting::setSetting('show_all_pending', $showAllPending, $UserData->id);
    $tpl->set('account_updated', 'done');
    $tpl->set('tab', 'tab_pending');
}
if (isset($_POST['UpdateDepartaments_account'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('user/edit', '/' . $UserData->id);
        exit;
    }
    $globalDepartament = erLhcoreClassUserValidator::validateDepartments($UserData, array('all_departments_0_global_value' => -1));
    erLhcoreClassUser::getSession()->update($UserData);
    if (count($globalDepartament) > 0) {
        erLhcoreClassUserDep::addUserDepartaments($globalDepartament, $UserData->id, $UserData);
    } else {
        erLhcoreClassUserDep::addUserDepartaments(array(), $UserData->id, $UserData);
    }
    $tpl->set('account_updated_departaments', 'done');
}
$tpl->set('user', $UserData);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('user/userlist'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'Users')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'User edit') . ' - ' . $UserData->name . ' ' . $UserData->surname));
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.edit_path', array('result' => &$Result));
开发者ID:detain,项目名称:livehelperchat,代码行数:31,代码来源:edit.php

示例11: htmlspecialchars_decode

    $chat->status_sub = erLhcoreClassModelChat::STATUS_SUB_OWNER_CHANGED;
    $chat->user_typing_txt = (string) $chat->user . ' ' . htmlspecialchars_decode(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/accepttrasnfer', 'has joined the chat!'), ENT_QUOTES);
    $chat->user_typing = time();
    // Change department if user cannot read current department, so chat appears in right menu
    $filter = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID());
    if ($filter !== true && !in_array($chat->dep_id, $filter)) {
        $dep_id = erLhcoreClassUserDep::getDefaultUserDepartment();
        if ($dep_id > 0) {
            $chat->dep_id = $dep_id;
            $chat->status_sub = erLhcoreClassModelChat::STATUS_SUB_OWNER_CHANGED;
        }
    }
}
if (!erLhcoreClassChat::hasAccessToRead($chat)) {
    if ($currentUser->getUserID() == $chatTransfer->transfer_to_user_id) {
        $dep_id = erLhcoreClassUserDep::getDefaultUserDepartment();
        if ($dep_id > 0) {
            $chat->dep_id = $dep_id;
            $chat->status_sub = erLhcoreClassModelChat::STATUS_SUB_OWNER_CHANGED;
        }
    } else {
        exit;
        // User does not have permission to assign chat to himself
    }
}
// All ok, we can make changes
erLhcoreClassChat::getSession()->update($chat);
erLhcoreClassTransfer::getSession()->delete($chatTransfer);
if ($Params['user_parameters_unordered']['postaction'] == 'singlewindow') {
    erLhcoreClassModule::redirect('chat/single/' . $chat->id);
    exit;
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:31,代码来源:accepttransfer.php

示例12: isset

$userDepartamentsGroup = isset($_POST['UserDepartamentGroup']) ? $_POST['UserDepartamentGroup'] : array();
$userParams = array('show_all_pending' => 1, 'global_departament' => array());
$tpl->set('tab', $Params['user_parameters_unordered']['tab'] == 'canned' ? 'tab_canned' : '');
if (isset($_POST['Update_account'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('user/new');
        exit;
    }
    $Errors = erLhcoreClassUserValidator::validateUserNew($UserData, $userParams);
    if (count($Errors) == 0) {
        try {
            $db = ezcDbInstance::get();
            $db->beginTransaction();
            erLhcoreClassUser::getSession()->save($UserData);
            if (count($userParams['global_departament']) > 0) {
                erLhcoreClassUserDep::addUserDepartaments($userParams['global_departament'], $UserData->id, $UserData);
            }
            $UserData->setUserGroups();
            $userPhotoErrors = erLhcoreClassUserValidator::validateUserPhoto($UserData);
            if ($userPhotoErrors !== false && count($userPhotoErrors) == 0) {
                $UserData->saveThis();
            }
            erLhcoreClassModelDepartamentGroupUser::addUserDepartmentGroups($UserData, erLhcoreClassUserValidator::validateDepartmentsGroup($UserData));
            erLhcoreClassModelUserSetting::setSetting('show_all_pending', $userParams['show_all_pending'], $UserData->id);
            erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.user_created', array('userData' => &$UserData, 'password' => $UserData->password_front));
            $db->commit();
            erLhcoreClassModule::redirect('user/userlist');
            exit;
        } catch (Exception $e) {
            $tpl->set('errors', array($e->getMessage()));
            $UserData->removeFile();
开发者ID:remdex,项目名称:livehelperchat,代码行数:31,代码来源:new.php

示例13:

?>
</h5>
	
		<?php 
if (isset($account_updated_departaments) && $account_updated_departaments == 'done') {
    $msg = erTranslationClassLhTranslation::getInstance()->getTranslation('user/account', 'Account updated');
    ?>
			<?php 
    include erLhcoreClassDesign::designtpl('lhkernel/alert_success.tpl.php');
    ?>
		<?php 
}
?>
		
		<?php 
$userDepartaments = erLhcoreClassUserDep::getUserDepartamentsIndividual($user->id);
$userDepartamentsGroup = erLhcoreClassModelDepartamentGroupUser::getUserGroupsIds($user->id);
?>
		
		<form action="<?php 
echo erLhcoreClassDesign::baseurl('user/edit');
?>
/<?php 
echo $user->id;
?>
#departments" method="post">
		
		    <?php 
include erLhcoreClassDesign::designtpl('lhuser/account/departments_assignment.tpl.php');
?>
		    
开发者ID:remdex,项目名称:livehelperchat,代码行数:30,代码来源:edit.tpl.php

示例14: array

    }
    $globalDepartament = array();
    if (isset($_POST['all_departments']) && $_POST['all_departments'] == 'on') {
        $UserData->all_departments = 1;
        $globalDepartament[] = 0;
    } else {
        $UserData->all_departments = 0;
    }
    erLhcoreClassUser::getSession()->update($UserData);
    if (isset($_POST['UserDepartament']) && count($_POST['UserDepartament']) > 0) {
        $globalDepartament = array_merge($_POST['UserDepartament'], $globalDepartament);
    }
    if (count($globalDepartament) > 0) {
        erLhcoreClassUserDep::addUserDepartaments($globalDepartament, false, $UserData);
    } else {
        erLhcoreClassUserDep::addUserDepartaments(array(), false, $UserData);
    }
    $tpl->set('account_updated_departaments', 'done');
    $tpl->set('tab', 'tab_departments');
}
// If already set during account update
if (!isset($UserData)) {
    $UserData = $currentUser->getUserData();
}
$tpl->set('editdepartaments', $allowEditDepartaments);
$tpl->set('user', $UserData);
if (erLhcoreClassUser::instance()->hasAccessTo('lhuser', 'personalcannedmsg')) {
    /**
     * Canned messages part
     * */
    $cannedMessage = new erLhcoreClassModelCannedMsg();
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:31,代码来源:account.php

示例15: array_merge

     $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')) {
         $dir = 'var/userphoto/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/' . $UserData->id . '/';
         erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.edit.photo_path', array('dir' => &$dir, 'storage_id' => $UserData->id));
         erLhcoreClassFileUpload::mkdirRecursive($dir);
         $file = qqFileUploader::upload($_FILES, 'UserPhoto', $dir);
         if (empty($file["errors"])) {
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:31,代码来源:new.php


注:本文中的erLhcoreClassUserDep类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。