本文整理汇总了PHP中CUser::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::GetList方法的具体用法?PHP CUser::GetList怎么用?PHP CUser::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserByProviderAndId
public static function getUserByProviderAndId($providerName, $userProfile)
{
CModule::IncludeModule("iblock");
$userID = false;
//Проверим привязан ли к какому нибудь пользователю
$arrFilter = array("IBLOCK_ID" => USER_SOCIAL_IB, "ACTIVE" => "Y", "PROPERTY_SOCIAL_PROVIDER" => $providerName, "PROPERTY_SOCIAL_ID" => $userProfile["identifier"]);
$arSelect = array("PROPERTY_USER_ID");
$rsRes = \CIBlockElement::GetList($arOrder, $arrFilter, false, false, $arSelect);
if ($arItem = $rsRes->GetNext()) {
$userID = intval($arItem["PROPERTY_USER_ID_VALUE"]);
}
$email = "";
if (!empty($userProfile["email"])) {
$email = $userProfile["email"];
} else {
if (!empty($userProfile["emailVerified"])) {
$email = $userProfile["emailVerified"];
}
}
//Проверяем есть ли пользователь с таким мэйлом
if (!$userID && !empty($email)) {
$dbUsers = CUser::GetList($by = "EMAIL", $order = "desc", array("=EMAIL" => $email));
while ($arUser = $dbUsers->Fetch()) {
$userID = $arUser["ID"];
self::connectToUser($userID, $providerName, $userProfile);
self::updateUser($userID, $userProfile);
}
}
return $userID;
}
示例2: onUserLoginExternal
public function onUserLoginExternal(&$arParams)
{
if (!$this->useOfficeAuth()) {
return null;
}
$login = new UserLogin($arParams['LOGIN']);
$password = $arParams['PASSWORD'];
if ($this->isAuthorized($login->getOfficeLogin(), $password, $this->officeAuthUrl())) {
$fields = array("LOGIN" => $login->getBitrixLogin(), "NAME" => $login->getOfficeLogin(), "PASSWORD" => $password, "EMAIL" => $login->getEmail(), "ACTIVE" => "Y", "EXTERNAL_AUTH_ID" => "Office", "LID" => SITE_ID);
$user = new \CUser();
$existedUser = \CUser::GetList($by = "timestamp_x", $order = "desc", array("LOGIN_EQUAL_EXACT" => $login->getBitrixLogin(), "EXTERNAL_AUTH_ID" => "Office"))->Fetch();
if (!$existedUser) {
$id = $user->Add($fields);
} else {
$id = $existedUser["ID"];
$user->Update($id, $fields);
}
if ($id > 0) {
$groups = \CUser::GetUserGroup($id);
if (!in_array(1, $groups)) {
$groups[] = 1;
\CUser::SetUserGroup($id, $groups);
}
$arParams["store_password"] = "N";
return $id;
}
}
return null;
}
示例3: getEventsLog
/**
* Return array with events list and users
*
* @param int $iblockId Info-block ID
* @param int $elementId Info-block element ID
* @param int $limit Limit returned rows
* @return array (EVENTS => array(), USERS => array())
*/
public static function getEventsLog($iblockId, $elementId, $limit = 0)
{
$arEvents = array();
$arUsersId = array();
$arUsers = array();
$limit = intval($limit);
if ($limit > 0) {
$rsEventsNav = array('nTopCount' => $limit);
} else {
$rsEventsNav = false;
}
$rsEvents = \CEventLog::GetList(array('ID' => 'DESC'), array('MODULE_ID' => 'iblock', 'ITEM_ID' => $iblockId), $rsEventsNav);
while ($arEvent = $rsEvents->Fetch()) {
$arEventDesc = unserialize($arEvent['DESCRIPTION']);
if ($arEventDesc['ID'] === $elementId) {
$arEvents[] = array_merge($arEvent, array('DESCRIPTION' => $arEventDesc));
$arUsersId[] = $arEventDesc['USER_ID'];
}
}
if (!empty($arUsersId)) {
$rsUsers = \CUser::GetList($by = 'id', $order = 'asc', array('ID' => $arUsersId), array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME')));
while ($arUser = $rsUsers->Fetch()) {
$arUsers[$arUser['ID']] = $arUser;
}
}
return array('EVENTS' => $arEvents, 'USERS' => $arUsers);
}
示例4: GetJIdByUserId
static function GetJIdByUserId($arUserID, $domain = "")
{
if (is_array($arUserID) && count($arUserID) > 0) {
foreach ($arUserID as $key => $ID) {
$ID = intval($ID);
if ($ID > 0) {
$arUserID[$key] = $ID;
} else {
unset($arUserID[$key]);
}
}
} else {
return false;
}
$userID = implode(' | ', $arUserID);
if (strlen($userID) == 0) {
return false;
}
$arUserJID = array();
$dbUsers = CUser::GetList($by = "ID", $order = "desc", array("ID" => $userID, "!UF_DEPARTMENT" => false), array('FIELDS' => array('ID', 'LOGIN')));
while ($arUser = $dbUsers->Fetch()) {
$arUserJID[$arUser['ID']] = CXMPPUtility::GetJId($arUser, $domain);
}
if (count($arUserJID) == 0) {
return false;
}
return $arUserJID;
}
示例5: OnBeforeUpdate
/**
* Если включили бесплатный канал, активируем для всех пользователей подписку.
*
* @return object
*/
public static function OnBeforeUpdate(Entity\Event $event)
{
$result = new Entity\EventResult();
$primary = $event->getParameter("id");
$data = $event->getParameter("fields");
$res = self::getById($primary);
$arChannel = $res->fetch();
$price = floatval($arChannel["UF_PRICE_H24"]);
if ($data["UF_ACTIVE"] && !$arChannel["UF_ACTIVE"] && $price == 0) {
//Найдем пользователей, для кого эта подписка была включена
$userIds = array();
$result = SubscribeTable::getList(array('filter' => array("=UF_CHANNEL_ID" => $data["ID"]), 'select' => array("ID", "UF_USER_ID")));
while ($arSub = $result->fetch()) {
$userIds[$arSub["UF_USER_ID"]] = $arSub["ID"];
}
$CSubscribe = new CSubscribe("CHANNEL");
$dbUsers = \CUser::GetList($by = "EMAIL", $order = "desc", array("ACTIVE" => "Y"));
while ($arUser = $dbUsers->Fetch()) {
if (!array_key_exists($arUser["ID"], $userIds)) {
$CSubscribe->setUserSubscribe($data["ID"], $arUser["ID"]);
} else {
$sub_id = $userIds[$arUser["ID"]];
$CSubscribe->updateUserSubscribe($sub_id, array("UF_ACTIVE" => 1));
}
}
}
return $result;
}
示例6: Add
public function Add()
{
global $USER;
if ($USER->isAuthorized()) {
return \CUser::GetID();
}
$this->arFields = array_merge($this->getFields(), $this->defaultFields);
if (!$this->arFields["EMAIL"]) {
throw new CRUDException("Please, set email for new user");
}
$u = \CUser::GetList($by = "ID", $order = "DESC", array("EMAIL" => $this->arFields["EMAIL"]))->Fetch();
if ($u) {
return $u["ID"];
}
try {
$this->generate('LOGIN')->generate('PASSWORD')->generate('GROUP_ID');
} catch (CRUDGenerateException $e) {
prentExpection($e->getMessage());
}
$objUser = new \CUser();
$newUserID = $objUser->Add($this->arFields);
if (!intval($newUserID)) {
throw new CRUDException("An error was occured while adding new User in CRUD: " . $objUser->LAST_ERROR . ". Line: " . __LINE__);
} else {
return $newUserID;
}
}
示例7: MULChangeOnlineStatus
function MULChangeOnlineStatus($USER_ID = false, $HTML_ID = false)
{
static $arUserList, $arUserListID, $arUserListHTML_ID;
static $bNotFirstCall;
if (!$bNotFirstCall) {
$GLOBALS["APPLICATION"]->AddBufferContent("MULChangeOnlineStatus");
$bNotFirstCall = true;
}
if (intval($USER_ID) > 0) {
if (!$HTML_ID) {
$HTML_ID = "main_" . $USER_ID;
}
$arUserListID[] = $USER_ID;
$arUserListHTML_ID[] = "'" . $HTML_ID . "'";
$arUserList[] = array("USER_ID" => $USER_ID, "HTML_ID" => $HTML_ID);
} else {
$arUserListIDUnique = array_unique($arUserListID);
$strUserListID = implode("|", $arUserListIDUnique);
$rsUser = CUser::GetList($by = "id", $order = "desc", array("ID" => $strUserListID));
$arUserListOnlineHTML_ID = array();
while ($arUser = $rsUser->Fetch()) {
if (time() - intval(MakeTimeStamp($arUser["LAST_ACTIVITY_DATE"], "YYYY-MM-DD HH-MI-SS")) < 120) {
foreach ($arUserList as $arTmp) {
if ($arUser["ID"] == $arTmp["USER_ID"]) {
$arUserListOnlineHTML_ID[] = "'" . $arTmp["HTML_ID"] . "'";
}
}
}
}
return '<script type="text/javascript">
BX.ready(function() {
var arMULUserList = [' . implode(",", $arUserListHTML_ID) . '];
var arMULUserListOnline = [' . implode(",", $arUserListOnlineHTML_ID) . '];
for(var i=0; i<arMULUserList.length; i++)
{
var elOnline = document.getElementById(arMULUserList[i]);
if(elOnline)
{
if (BX.util.in_array(arMULUserList[i], arMULUserListOnline))
{
elOnline.className = "bx-user-info-online";
elOnline.title = "' . GetMessageJS("MAIN_UL_ONLINE") . '";
}
else
{
elOnline.className = "bx-user-info-offline";
elOnline.title = "";
}
}
}
});
</script>';
}
}
示例8: getStartedByPhoto
protected function getStartedByPhoto($userId)
{
$iterator = \CUser::GetList($by = 'id', $order = 'asc', array('ID' => $userId), array('FIELDS' => array('PERSONAL_PHOTO')));
$startedUser = $iterator->fetch();
if ($startedUser) {
return \CFile::ResizeImageGet($startedUser['PERSONAL_PHOTO'], array('width' => 58, 'height' => 58), \BX_RESIZE_IMAGE_EXACT, false);
}
return null;
}
示例9: getUsersId
public static function getUsersId()
{
$cUser = new CUser();
$sort_by = "ID";
$sort_ord = "ASC";
$arFilter = array("ACTIVE" => 'Y');
$dbUsers = $cUser->GetList($sort_by, $sort_ord, $arFilter);
$dbUsers->NavStart(8);
return $dbUsers;
}
示例10: FindUserIDByEmail
private static function FindUserIDByEmail($email)
{
$email = trim(strval($email));
if ($email === '') {
return 0;
}
$dbUsers = CUser::GetList($by = 'ID', $order = 'ASC', array('=EMAIL' => $email), array('FIELDS' => array('ID'), 'NAV_PARAMS' => array('nTopCount' => 1)));
$arUser = $dbUsers ? $dbUsers->Fetch() : null;
return $arUser ? intval($arUser['ID']) : 0;
}
示例11: getFieldHtml
protected function getFieldHtml($arProperty)
{
$rsElement = CIBlockElement::GetByID(intval($_REQUEST['ID']));
$arResult['ELEMENT'] = $rsElement->Fetch();
$rsUsers = \CUser::GetList($by = 'id', $order = 'asc', array('ID' => $arResult['ELEMENT']['MODIFIED_BY'] . ' | ' . $arResult['ELEMENT']['CREATED_BY']), array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME')));
while ($arUser = $rsUsers->Fetch()) {
$arResult['USERS'][$arUser['ID']] = $arUser;
}
include_once __DIR__ . '/templates/' . basename(__FILE__);
}
示例12: getStartedBy
protected function getStartedBy($workflowState)
{
if ($workflowState['STARTED_BY']) {
$iterator = CUser::GetList($by = "id", $order = "asc", array('ID' => $workflowState['STARTED_BY']), array('FIELDS' => array('ID', 'PERSONAL_PHOTO', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'TITLE')));
$startedUser = $iterator->fetch();
if ($startedUser) {
return $startedUser;
}
}
return false;
}
示例13: getUserIdForLogin
/**
* @param string $pLogin
* @return int
*/
protected static function getUserIdForLogin($pLogin)
{
$selectedFields = array("ID");
$filter = array("LOGIN_EQUAL_EXACT" => $pLogin, "EXTERNAL_AUTH_ID" => "");
$dbUser = CUser::GetList($by = 'ID', $order = 'ASC', $filter, array("FIELDS" => $selectedFields));
$userId = 0;
if ($dbUser) {
$userInfo = $dbUser->Fetch();
$userId = $userInfo["ID"];
}
return $userId;
}
示例14: OnBeforeUserLogin
function OnBeforeUserLogin($arFields)
{
$phone = preg_replace("/[^0-9]/", '', $arFields["LOGIN"]);
if (\CDev::check_phone($phone)) {
$filter = array("PERSONAL_PHONE" => $phone);
} else {
$filter = array("=EMAIL" => $arFields["LOGIN"]);
}
$rsUsers = \CUser::GetList($by = "LAST_NAME", $order = "asc", $filter);
if ($user = $rsUsers->GetNext()) {
$arFields["LOGIN"] = $user["LOGIN"];
}
}
示例15: dailyAllUsers
/**
* Billing by all users at 3-30
*/
public static function dailyAllUsers()
{
global $DB;
$table = \Hawkart\Megatv\SubscribeTable::getTableName();
$time_update = "03:30:00";
$datetime = new \Bitrix\Main\Type\Datetime(date("Y-m-d " . $time_update), 'Y-m-d H:i:s');
$datetime_next_date = new \Bitrix\Main\Type\Datetime(date('Y-m-d' . $time_update, strtotime('+1 day')), 'Y-m-d H:i:s');
$datetime_from_db = date("d.m.Y " . $time_update);
$datetime_to_db = date("d.m.Y " . $time_update, strtotime('+1 day'));
/**
* Get all users
*/
$arUsers = array();
$arFilter = array("ACTIVE" => "Y");
$rsUsers = \CUser::GetList($by = "LAST_NAME", $order = "asc", $arFilter);
while ($arUser = $rsUsers->GetNext()) {
$arUsers[$arUser["ID"]] = $arUser;
}
/**
* Get all priced subscribe for all users
*/
$arSubscribeUsers = array();
$result = \Hawkart\Megatv\SubscribeTable::getList(array('filter' => array("UF_ACTIVE" => 1, ">UF_CHANNEL_ID" => 0, ">UF_CHANNEL.UF_PRICE_H24" => 0, "<=UF_DATETIME_TO" => $datetime), 'select' => array("ID", "PRICE" => "UF_CHANNEL.UF_PRICE_H24", "UF_USER_ID")));
while ($arSub = $result->fetch()) {
$arSubscribeUsers[$arSub["UF_USER_ID"]][] = array("ID" => $arSub["ID"], "PRICE" => $arSub["PRICE"]);
}
$result = \Hawkart\Megatv\SubscribeTable::getList(array('filter' => array("UF_ACTIVE" => 1, ">UF_SERVICE_ID" => 0, ">UF_SERVICE.UF_PRICE" => 0), 'select' => array("ID", "PRICE" => "UF_SERVICE.UF_PRICE", "UF_USER_ID")));
while ($arSub = $result->fetch()) {
$arSubscribeUsers[$arSub["UF_USER_ID"]][] = array("ID" => $arSub["ID"], "PRICE" => $arSub["PRICE"]);
}
/**
* Make transaction for 1 day for all users
*/
foreach ($arSubscribeUsers as $user_id => $arSubscribes) {
$daily_price = 0;
foreach ($arSubscribes as $arSubscribe) {
$daily_price += $arSubscribe["PRICE"];
}
$balance = \CUserEx::getBudget($user_id);
if ($balance > 0 && $daily_price > 0) {
\CSaleAccountEx::transaction(-1 * $daily_price, $user_id, "Оплата услуг за " . date('d.m.Y'));
$strSql = "UPDATE " . $table . " SET UF_DATETIME_TO=curdate() + INTERVAL 1 DAY + INTERVAL 3 HOUR + INTERVAL 30 MINUTE WHERE UF_USER_ID=" . $user_id;
$res = $DB->Query($strSql, false, $err_mess . __LINE__);
//Send email to user to add money to budget for 3 days
if ($balance < $daily_price * 2) {
\CEvent::SendImmediate("NOTIFICATION_PAY_AFTER_DAYS", SITE_ID, array("EMAIL_TO" => $arUsers[$user_id]["EMAIL"], "PRICE" => $daily_price * 5));
}
}
}
}