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


PHP UserManager::getInstance方法代码示例

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


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

示例1: getMembers

 /**
  * Provides all members of this group.
  * 
  * @return UserGroupMember[]
  */
 public function getMembers()
 {
     // First get all userIDs that are members.
     $qAllMembers = db_query(sprintf("SELECT `userID`,`access` FROM `%s_group_members` WHERE `groupID`=%d", db_prefix(), $this->getGroupID()));
     $nAllMembers = db_num($qAllMembers);
     // Verify that we got any users.
     if ($qAllMembers === false || $nAllMembers < 1) {
         return array();
     }
     $members = array();
     $userIDs = array();
     $rowsIndexedByUID = array();
     // Fetch each as User
     while ($row = db_fetch_assoc($qAllMembers)) {
         $userIDs[] = $row["userID"];
         $rowsIndexedByUID[$row["userID"]] = $row;
     }
     // Fetch the users.
     $users = UserManager::getInstance()->getUsersByID($userIDs);
     if (count($users) < 1) {
         return array();
     }
     // Create as UserGroupMember
     foreach ($users as $user) {
         $memberRow = $rowsIndexedByUID[$user->getUserID()];
         $member = new UserGroupMember($user->getUserID());
         $member->fillInfo($user->getInfo());
         // fill extra variables
         $member->setAccess($memberRow["access"]);
         $member->setGroup($this);
         $members[] = $member;
         unset($memberRow, $user, $member);
     }
     return $members;
 }
开发者ID:hultberg,项目名称:relancms,代码行数:40,代码来源:UserGroup.php

示例2: load

 public function load()
 {
     $userManager = UserManager::getInstance($this->config, $this->args);
     $userId = $this->getUserId();
     if ((!isset($_REQUEST['refresh']) || $_REQUEST['refresh'] != 1) && $this->getCustomer()->getLoginType() === 'pcstore') {
         $custEmail = $this->getCustomerLogin();
         if (isset($_REQUEST['password'])) {
             $password = $_REQUEST['password'];
             $dto = $userManager->getUserByEmailAndPassword($custEmail, $password);
             if (!isset($dto)) {
                 $this->addParam("message", $this->getPhraseSpan(581));
                 $this->addParam("checkPassword", 1);
                 return;
             }
         } else {
             $this->addParam("checkPassword", 1);
             return;
         }
     }
     $userPhonesArray = $userManager->getUserPhonesArray($userId);
     $this->addParam("phones", $userPhonesArray);
     $regions_phrase_ids_array = explode(',', $this->getCmsVar('armenia_regions_phrase_ids'));
     $this->addParam('regions_phrase_ids_array', $regions_phrase_ids_array);
     $region = $userManager->selectByPK($userId)->getRegion();
     $this->addParam('region_selected', $region);
     $this->addParam('userManager', $userManager);
 }
开发者ID:pars5555,项目名称:pcstore,代码行数:27,代码来源:YourProfileLoad.class.php

示例3: load

 public function load()
 {
     $companyManager = CompanyManager::getInstance($this->config, $this->args);
     $adminManager = AdminManager::getInstance($this->config, $this->args);
     $userManager = UserManager::getInstance($this->config, $this->args);
     $companyDealersManager = CompanyDealersManager::getInstance($this->config, $this->args);
     $allAdmins = $adminManager->selectAll();
     if ($this->getUserLevel() === UserGroups::$COMPANY) {
         $allCompanies = $companyManager->getAllCompanies();
         $companyDealersJoindWithUsersFullInfo = $companyDealersManager->getCompanyDealersJoindWithUsersFullInfo($this->getUserId());
         $this->addParam('allCompanies', $allCompanies);
         $this->addParam('allDealers', $companyDealersJoindWithUsersFullInfo);
         $this->addParam('allAdmins', $allAdmins);
     }
     if ($this->getUserLevel() === UserGroups::$SERVICE_COMPANY) {
         $allCompanies = $companyManager->getAllCompanies();
         $this->addParam('allCompanies', $allCompanies);
         $this->addParam('allAdmins', $allAdmins);
     }
     if ($this->getUserLevel() === UserGroups::$ADMIN) {
         $allCompanies = $companyManager->getAllCompanies(true, true);
         $allUsers = $userManager->selectAll();
         $this->addParam('allCompanies', $allCompanies);
         $this->addParam('allUsers', $allUsers);
         $this->addParam('allAdmins', $allAdmins);
     }
     if ($this->getUserLevel() === UserGroups::$USER) {
         $allCompanies = $companyManager->getAllCompanies();
         $allUsers = $userManager->selectAll();
         $dealerCompanies = $companyManager->getUserCompaniesJoindWithFullInfo($this->getUserId());
         $this->addParam('allCompanies', $dealerCompanies);
         //$this->addParam('allUsers', $allUsers);
         $this->addParam('allAdmins', $allAdmins);
     }
 }
开发者ID:pars5555,项目名称:pcstore,代码行数:35,代码来源:InsertContactLoad.class.php

示例4: load

 public function load()
 {
     $emailId = $_REQUEST['email_id'];
     $customerLocalEmailsManager = CustomerLocalEmailsManager::getInstance($this->config, $this->args);
     $userManager = UserManager::getInstance($this->config, $this->args);
     $emailDto = $customerLocalEmailsManager->selectByPK($emailId);
     if (isset($emailId) && isset($emailDto) && $emailDto->getCustomerEmail() === $this->getCustomerLogin()) {
         $this->addParam("email_subject", $emailDto->getSubject());
         $this->addParam("email_body", $emailDto->getBody());
         $customerEmail = $emailDto->getFromEmail();
         if (isset($_REQUEST['reply']) && $_REQUEST['reply'] == 1) {
             $this->addParam("email_to", $customerEmail);
             $customer = $userManager->getCustomerByEmail($customerEmail);
             if (isset($customer)) {
                 $customerContactNameForEmail = $customer->getCustomerContactNameForEmail();
                 $this->addParam("email_to_name", $customerContactNameForEmail);
                 $customerTypeString = $userManager->getCustomerTypeStringFromCustomerDto($customer);
                 $this->addParam("email_to_type", $customerTypeString);
             }
         }
         if ($emailDto->getReadStatus() == 0) {
             $customerLocalEmailsManager->setReadStatus($emailId, 1);
         }
     }
 }
开发者ID:pars5555,项目名称:pcstore,代码行数:25,代码来源:ComposeLoad.class.php

示例5: getUser

 /**
  * Provides the object of the user this response is by.
  * 
  * @return \User
  */
 public function getUser()
 {
     if ($this->getUserID() < 1) {
         return null;
     }
     return \UserManager::getInstance()->getUserByID($this->getUserID());
 }
开发者ID:hultberg,项目名称:relancms,代码行数:12,代码来源:QuestionResponse.php

示例6: database_initialize

/**
 * Perform database initialization.
 *
 * @param boolean $create_database
 * @return boolean
 */
function database_initialize($create_database)
{
    global $db, $db_config, $data_path;
    $result = false;
    $database_exists = false;
    $sql_file = 'units/database/init.sql';
    $xml_file = $data_path . 'system_init.xml';
    if (!file_exists($sql_file) || !file_exists($xml_file)) {
        trigger_error('Can not initialize database, missing configuration!', E_USER_ERROR);
        return $result;
    }
    // make a log entry
    trigger_error('Initializing database: ' . $db_config['name'], E_USER_NOTICE);
    // get initialization SQL
    $sql = file_get_contents($sql_file);
    // create database if needed
    if ($create_database) {
        try {
            $db->create($db_config['name']);
            $db->select($db_config['name']);
            $database_exists = true;
        } catch (Exception $error) {
            $database_exists = false;
        }
    } else {
        $database_exists = true;
    }
    // create database
    if ($database_exists && $db->multi_query($sql)) {
        $module_manager = ModuleManager::getInstance();
        $module_handler = ModuleHandler::getInstance();
        $admin_manager = UserManager::getInstance();
        // populate tables
        $raw_data = file_get_contents($xml_file);
        $data = new XMLParser($raw_data, $xml_file);
        $data->parse();
        // go over XML file and insert data
        foreach ($data->document->tagChildren as $item) {
            switch ($item->tagName) {
                case 'module':
                    // insert data
                    $module_manager->insertData(array('name' => $item->tagAttrs['name'], 'order' => $item->tagAttrs['order'], 'preload' => $item->tagAttrs['preload'] == 'yes' ? 1 : 0, 'active' => 1));
                    // initialize module
                    $module = $module_handler->_loadModule($item->tagAttrs['name']);
                    if (!is_null($module)) {
                        $module->onInit();
                    }
                    break;
                case 'user':
                    $salt = hash('sha256', UserManager::SALT . strval(time()));
                    $password = hash_hmac('sha256', $item->tagAttrs['password'], $salt);
                    $admin_manager->insertData(array('username' => $item->tagAttrs['username'], 'password' => $password, 'fullname' => $item->tagAttrs['fullname'], 'level' => $item->tagAttrs['level'], 'verified' => 1, 'salt' => $salt));
                    break;
            }
        }
        // set result
        $result = true;
    }
    return $result;
}
开发者ID:tareqy,项目名称:Caracal,代码行数:66,代码来源:common.php

示例7: load

 public function load()
 {
     $userManager = UserManager::getInstance($this->config, $this->args);
     $userSubUsersManager = UserSubUsersManager::getInstance($this->config, $this->args);
     $userId = $this->getUserId();
     $subUsersDtos = $userSubUsersManager->getUserSubUsers($userId);
     $this->addParam("subUsers", $subUsersDtos);
     $this->addParam("userManager", $userManager);
 }
开发者ID:pars5555,项目名称:pcstore,代码行数:9,代码来源:SubUsersListLoad.class.php

示例8: load

 public function load()
 {
     $this->addParam("pcstore_contact_us_phone_number", $this->getCmsVar('pcstore_contact_us_phone_number'));
     if ($this->getUserLevel() !== UserGroups::$GUEST) {
         $userManager = UserManager::getInstance($this->config, $this->args);
         $customerEmail = $userManager->getRealEmailAddressByUserDto($this->getCustomer());
         $this->addParam("customer_email", $customerEmail);
     }
 }
开发者ID:pars5555,项目名称:pcstore,代码行数:9,代码来源:ContactUsLoad.class.php

示例9: validateLogin

 public function validateLogin($value)
 {
     //$valid = (preg_match("/^[a-z_\s0-9]{4,}$/i", $value) > 0);
     $valid = preg_match("/^[a-z0-9_\\-\\.]+@[a-z_\\-\\.]+\\.[a-z]{2,3}\$/i", $value) > 0;
     //лоинг он же email
     $this->setValidationResult("login", $valid);
     $valid = $valid && ($count = UserManager::getInstance()->getCount('login = ?', array($value))) == 0;
     if ($count > 0) {
         $this->setValidationResult("login", $valid, 'Логин должен быть уникальным');
     }
     return $valid;
 }
开发者ID:newnamecomua,项目名称:engineown,代码行数:12,代码来源:user.class.php

示例10: load

 public function load()
 {
     $ordersManager = OrdersManager::getInstance($this->config, $this->args);
     if ($this->getUserLevel() === UserGroups::$ADMIN) {
         $showOnlyOrdersValues = array_merge(array(-1), $ordersManager->orderStatusesValues);
         $this->addParam('showOnlyOrdersValues', $showOnlyOrdersValues);
         $orderStatusesDisplayNames = array_merge(array($this->getPhrase(153)), $ordersManager->getOrderStatusesDisplayNamesPhrases());
         $showOnlyOrdersDisplayNamesPphraseIdsArray = array_merge(array(153), $ordersManager->orderStatusesDisplayNamesIds);
         $this->addParam('showOnlyOrdersDisplayNames', $orderStatusesDisplayNames);
         $this->addParam('showOnlyOrdersDisplayNamesPphraseIdsArray', $showOnlyOrdersDisplayNamesPphraseIdsArray);
         $show_only = $showOnlyOrdersValues[1];
         if (isset($_REQUEST['show_only'])) {
             $so = $this->secure($_REQUEST['show_only']);
             if (in_array($so, $showOnlyOrdersValues)) {
                 $show_only = $so;
             }
         }
         $this->addParam('showOnlyOrdersSelected', $show_only);
         $customerOrders = $ordersManager->getAllOrdersJoinedWithDetails($show_only);
     } else {
         $customer = $this->getCustomer();
         $customerEmail = strtolower($customer->getEmail());
         $customerOrders = $ordersManager->getCustomerOrderJoinedWithDetails($customerEmail);
     }
     $groupedOrders = $this->groupCustomerOrders($customerOrders);
     $groupOrdersByOrderIdAndBundleId = $this->groupOrdersByOrderIdAndBundleId($customerOrders);
     $pv = $this->getPriceVariety($groupedOrders);
     $this->addParam('groupOrdersByOrderIdAndBundleId', $groupOrdersByOrderIdAndBundleId);
     $this->addParam('priceVariety', $pv);
     if (isset($_REQUEST['order_id'])) {
         $order_id = $_REQUEST['order_id'];
         $mess1 = $this->getPhrase(301);
         $mess2 = $this->getPhrase(329) . $order_id;
         $mess3 = $this->getPhrase(360);
         $this->addParam('customerMessages', array($mess1, $mess2, $mess3));
     }
     if (isset($_SESSION['success_message'])) {
         $this->addParam('customerMessages', array($_SESSION['success_message']));
         unset($_SESSION['success_message']);
     }
     if (isset($_SESSION['error_message'])) {
         $this->addParam('customerErrorMessages', array($_SESSION['error_message']));
         unset($_SESSION['error_message']);
     }
     $this->addParam('itemManager', ItemManager::getInstance($this->config, $this->args));
     $this->addParam('userManager', UserManager::getInstance($this->config, $this->args));
     $this->addParam('orderManager', OrdersManager::getInstance($this->config, $this->args));
     $this->addParam("orderStatusesValues", $ordersManager->orderStatusesValues);
     $this->addParam("orderStatusesDisplayNames", $ordersManager->getOrderStatusesDisplayNamesPhrases());
 }
开发者ID:pars5555,项目名称:pcstore,代码行数:50,代码来源:YourOrdersLoad.class.php

示例11: load

 public function load()
 {
     $this->addParam('pcstore_contact_number', $this->getCmsVar('pcstore_sales_phone_number'));
     $customer = $this->getCustomer();
     $sms_sent = false;
     if (isset($_REQUEST['co_code'])) {
         $code = $this->secure($_REQUEST['co_code']);
         $this->addParam('co_code', $code);
         if ($customer->getLastSmsValidationCode() === $code) {
             $this->addParam('order_confirmed', true);
         } else {
             $this->addParam('errorMessage', 223);
         }
         $this->addParam('sms_sent', true);
         return true;
     }
     $cell_phone_editable = $this->secure($_REQUEST['cho_do_shipping']) != 1;
     if ($cell_phone_editable) {
         $this->addParam('infoMessage', 362);
     }
     $cell_phone_number = $this->getPhoneNumberToSendSMS();
     $validNumber = null;
     if ($cell_phone_number != null) {
         $validNumber = SentSmsManager::getValidArmenianNumber($cell_phone_number);
     }
     if ($validNumber != null) {
         $lastSmsValidationCode = substr(uniqid(rand(), true), 0, 6);
         if ($this->getUserLevel() == UserGroups::$USER) {
             $userManager = UserManager::getInstance($this->config, $this->args);
             $userManager->setLastSmsValidationCode($customer->getId(), $lastSmsValidationCode);
         } elseif ($this->getUserLevel() == UserGroups::$COMPANY) {
             $companyManager = CompanyManager::getInstance($this->config, $this->args);
             $companyManager->setLastSmsValidationCode($customer->getId(), $lastSmsValidationCode);
         }
         $sentSmsManager = SentSmsManager::getInstance($this->config, $this->args);
         $sentSmsManager->sendSmsToArmenia($validNumber, $lastSmsValidationCode);
         $this->addParam('infoMessage', "`319` ({$validNumber})");
         $this->addParam('validNumber', "(" . $validNumber . ")");
         $this->addParam('sms_sent', true);
     } else {
         if (!empty($cell_phone_number)) {
             $this->addParam('errorMessage', 318);
         }
         $this->addParam('cell_phone_number', $cell_phone_number);
         if (!$cell_phone_editable) {
             $this->addParam('infoMessage', 387);
         }
     }
     $this->addParam('cell_phone_editable', $cell_phone_editable);
 }
开发者ID:pars5555,项目名称:pcstore,代码行数:50,代码来源:ConfirmCellPhoneNumberLoad.class.php

示例12: load

 public function load()
 {
     $user = $this->getUser();
     $pccm = PcConfiguratorManager::getInstance($this->config, $this->args);
     $selectedComponents = $pccm->getSelectedComponentsDtosOrderedInArray($user);
     $itemManager = ItemManager::getInstance($this->config, $this->args);
     $this->addParam("selected_components", $selectedComponents);
     $priceGroup = null;
     if ($this->getUserLevel() === UserGroups::$ADMIN) {
         $customer = $this->getCustomer();
         $priceGroup = $customer->getPriceGroup();
     }
     list($totalUsd, $totalAmd) = $pccm->getSelectedComponentSubTotalsAndTotals($selectedComponents, $user->getLevel(), $priceGroup);
     $required_components_ids = $pccm->getRequestComponentRequiredComponents($this->sessionManager->getUser());
     if (count($required_components_ids) === 0) {
         $this->addParam("ready_to_order", "true");
     } else {
         $this->addParam("ready_to_order", "false");
     }
     if (isset($_REQUEST['configurator_mode_edit_cart_row_id']) && intval($_REQUEST['configurator_mode_edit_cart_row_id']) > 0) {
         $this->addParam("configurator_mode_edit_cart_row_id", intval($_REQUEST['configurator_mode_edit_cart_row_id']));
     }
     $this->addParam("pccm", $pccm);
     $this->addParam("total_usd", $totalUsd);
     $this->addParam("total_amd", $totalAmd);
     $vipCustomer = 0;
     if ($this->getUserLevel() === UserGroups::$USER) {
         $customer = $this->getCustomer();
         $userManager = UserManager::getInstance($this->config, $this->args);
         $vipCustomer = $userManager->isVipAndVipEnabled($customer);
     }
     if ($this->getUserLevel() === UserGroups::$ADMIN) {
         $customer = $this->getCustomer();
         $vipCustomer = $customer->getPriceGroup() === 'vip';
     }
     if ($vipCustomer) {
         $pc_configurator_discount = floatval($this->getCmsVar('vip_pc_configurator_discount'));
     } else {
         $pc_configurator_discount = floatval($this->getCmsVar('pc_configurator_discount'));
     }
     $this->addParam("pc_configurator_discount", $pc_configurator_discount);
     $selectedComponentProfitWithDiscount = $pccm->calcSelectedComponentProfitWithDiscount($selectedComponents, $user->getLevel(), $pc_configurator_discount, $priceGroup);
     $pcBuildFeeAMD = $pccm->calcPcBuildFee($selectedComponentProfitWithDiscount);
     $this->addParam("pc_build_fee_amd", $pcBuildFeeAMD);
     $this->pcGrandTotalAmd = $totalAmd * (1 - $pc_configurator_discount / 100) + $pcBuildFeeAMD;
     $this->pcGrandTotalUsd = $totalUsd;
     $this->addParam("grand_total_amd", $this->pcGrandTotalAmd);
     $this->addParam("itemManager", $itemManager);
 }
开发者ID:pars5555,项目名称:pcstore,代码行数:49,代码来源:PccTotalCalculationsLoad.class.php

示例13: create

 /**
  * @param Kiosk $kiosk
  * @param \User $staffUser
  * @return LanKioskSession|mixed
  * @throws \Exception
  */
 public static function create(Kiosk $kiosk = null, \User $staffUser = null)
 {
     if ($kiosk === null) {
         $kiosk = new LanKiosk();
     }
     if ($staffUser === null) {
         $staffUser = \UserManager::getInstance()->getOnlineUser();
     }
     try {
         return self::loadFromSession($staffUser->getUserID());
     } catch (\Exception $e) {
         // no-op
     }
     return new self($kiosk, $staffUser);
 }
开发者ID:hultberg,项目名称:relancms,代码行数:21,代码来源:LanKioskSession.php

示例14: service

 public function service()
 {
     $lc = $_REQUEST['l'];
     if ($lc === 'am' || $lc === 'en' || $lc === 'ru') {
         $this->setcookie('ul', $lc);
         $_COOKIE['ul'] = $lc;
         if ($this->getUserLevel() == UserGroups::$USER) {
             $userManager = UserManager::getInstance($this->config, $this->args);
             $userManager->setLanguageCode($this->getUserId(), $lc);
         } elseif ($this->getUserLevel() == UserGroups::$COMPANY) {
             $companyManager = CompanyManager::getInstance($this->config, $this->args);
             $companyManager->setLanguageCode($this->getUserId(), $lc);
         }
     }
 }
开发者ID:pars5555,项目名称:pcstore,代码行数:15,代码来源:SetLanguageAction.class.php

示例15: load

 public function load()
 {
     $userManager = UserManager::getInstance($this->config, $this->args);
     $allUsersDtos = $userManager->selectAll();
     $this->addParam("users", $allUsersDtos);
     $companyDealersManager = CompanyDealersManager::getInstance($this->config, $this->args);
     $serviceCompanyDealersManager = ServiceCompanyDealersManager::getInstance($this->config, $this->args);
     $allCompanyDealers = $companyDealersManager->getAllUsersCompaniesFull();
     $userCompanies = $this->getUserCompaniesArray($allCompanyDealers);
     $allServiceCompanyDealers = $serviceCompanyDealersManager->getAllUsersCompaniesFull();
     $userServiceCompanies = $this->getUserCompaniesArray($allServiceCompanyDealers);
     $this->addParam('userCompanies', $userCompanies);
     $this->addParam('userServiceCompanies', $userServiceCompanies);
     $this->addParam('visible_fields_names', array('id', 'email', 'name', 'lastName', 'phones', 'password', 'registeredDate', 'lastSmsValidationCode', 'vip'));
 }
开发者ID:pars5555,项目名称:pcstore,代码行数:15,代码来源:UsersLoad.class.php


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