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


PHP CUser::getList方法代码示例

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


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

示例1: getDataToShow

 public function getDataToShow()
 {
     $event = \CCalendarEvent::getById($this->entityId);
     if (empty($event)) {
         return array();
     }
     $members = array();
     if ($event['IS_MEETING']) {
         if (is_array($event['~ATTENDEES'])) {
             foreach ($event['~ATTENDEES'] as $user) {
                 $members[] = array("NAME" => $user['DISPLAY_NAME'], "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $user['USER_ID'])), 'AVATAR_SRC' => $user['AVATAR'], "IS_EXTRANET" => "N");
             }
         }
     } else {
         $by = "id";
         $order = "asc";
         $userRow = \CUser::getList($by, $order, array("ID_EQUAL_EXACT" => $event['CREATED_BY'], "ACTIVE" => "Y"), array("SELECT" => array('ID', 'NAME', 'LAST_NAME', 'LOGIN', 'PERSONAL_PHOTO')))->fetch();
         if ($userRow) {
             $name = trim($userRow['NAME'] . ' ' . $userRow['LAST_NAME']);
             if ($name == '') {
                 $name = trim($userRow['LOGIN']);
             }
             $members[] = array("NAME" => $name, "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $event['CREATED_BY'])), 'AVATAR_SRC' => Ui\Avatar::getPerson($userRow['PERSONAL_PHOTO']), "IS_EXTRANET" => "N");
         }
     }
     return array('TITLE' => Loc::getMessage('DISK_UF_CAL_EVENT_CONNECTOR_TITLE') . ": " . $event['NAME'], 'DETAIL_URL' => null, 'DESCRIPTION' => Ui\Text::killTags($event['DESCRIPTION']), 'MEMBERS' => $members);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:27,代码来源:calendareventconnector.php

示例2: isExternalUser

 /**
  * Check if user is extranet user
  * @param integer $userID User ID
  * @return boolean
  */
 public static function isExternalUser($userID)
 {
     if (!ModuleManager::isModuleInstalled('extranet')) {
         return false;
     }
     $dbResult = \CUser::getList($o = 'ID', $b = 'ASC', array('ID_EQUAL_EXACT' => $userID), array('FIELDS' => array('ID'), 'SELECT' => array('UF_DEPARTMENT')));
     $user = $dbResult->Fetch();
     return !(is_array($user) && isset($user['UF_DEPARTMENT']) && isset($user['UF_DEPARTMENT'][0]) && $user['UF_DEPARTMENT'][0] > 0);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:14,代码来源:intranetmanager.php

示例3: getMembers

 protected function getMembers($members)
 {
     $result = array();
     foreach ($members as $memberId) {
         $rs = \CUser::getList($by = "ID", $order = "ASC", array("ID" => $memberId), array("FIELDS" => array("ID", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "EMAIL", "PERSONAL_PHOTO")));
         if ($ar = $rs->fetch()) {
             $result[] = array("NAME" => \CUser::formatName('#NAME# #LAST_NAME#', $ar, true, false), "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $memberId)), 'AVATAR_SRC' => Ui\Avatar::getPerson($ar['PERSONAL_PHOTO']), "IS_EXTRANET" => "N");
         }
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:11,代码来源:crmconnector.php

示例4: processActionGetListAdmin

 protected function processActionGetListAdmin()
 {
     $this->checkRequiredPostParams(array('iblockId'));
     if ($this->errorCollection->hasErrors()) {
         $this->sendJsonErrorResponse();
     }
     $this->iblockId = intval($this->request->getPost('iblockId'));
     $this->iblockTypeId = COption::GetOptionString("lists", "livefeed_iblock_type_id");
     $this->checkPermissionElement();
     if ($this->errorCollection->hasErrors()) {
         $this->sendJsonErrorResponse();
     }
     $rightObject = new CIBlockRights($this->iblockId);
     $rights = $rightObject->getRights();
     $rightsList = $rightObject->getRightsList(false);
     $idRight = array_search('iblock_full', $rightsList);
     $listUser = array();
     $nameTemplate = CSite::GetNameFormat(false);
     foreach ($rights as $right) {
         $res = strpos($right['GROUP_CODE'], 'U');
         if ($right['TASK_ID'] == $idRight && $res === 0) {
             $userId = substr($right['GROUP_CODE'], 1);
             $users = CUser::GetList($by = "id", $order = "asc", array('ID' => $userId), array('FIELDS' => array('ID', 'PERSONAL_PHOTO', 'NAME', 'LAST_NAME')));
             $user = $users->fetch();
             $file['src'] = '';
             if ($user) {
                 $file = \CFile::ResizeImageGet($user['PERSONAL_PHOTO'], array('width' => 58, 'height' => 58), \BX_RESIZE_IMAGE_EXACT, false);
             }
             $listUser[$userId]['id'] = $userId;
             $listUser[$userId]['img'] = $file['src'];
             $listUser[$userId]['name'] = CUser::FormatName($nameTemplate, $user, false);
         }
     }
     $users = CUser::getList($b = 'ID', $o = 'ASC', array('GROUPS_ID' => 1, 'ACTIVE' => 'Y'), array('FIELDS' => array('ID', 'PERSONAL_PHOTO', 'NAME', 'LAST_NAME')));
     while ($user = $users->fetch()) {
         $file = \CFile::ResizeImageGet($user['PERSONAL_PHOTO'], array('width' => 58, 'height' => 58), \BX_RESIZE_IMAGE_EXACT, false);
         $listUser[$user['ID']]['id'] = $user['ID'];
         $listUser[$user['ID']]['img'] = $file['src'];
         $listUser[$user['ID']]['name'] = CUser::FormatName($nameTemplate, $user, false);
     }
     $listUser = array_values($listUser);
     $this->sendJsonSuccessResponse(array('listAdmin' => $listUser));
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:43,代码来源:ajax.php

示例5: notifyMailDomain

 public static function notifyMailDomain($type, $sid, $user_id, $cnt = 0)
 {
     $user_id = intval($user_id);
     $cnt = intval($cnt);
     if (!CModule::includeModule('mail')) {
         return '';
     }
     $arAdmin = CUser::getList($by, $order, array('ID' => $user_id, 'GROUPS_ID' => 1, 'ACTIVE' => 'Y'), array('FIELDS' => array('ID', 'EMAIL')))->fetch();
     if (empty($arAdmin)) {
         return '';
     }
     if ($cnt == 0) {
         return 'CIntranetUtils::notifyMailDomain("' . $type . '", "' . $sid . '", ' . $user_id . ', ' . ++$cnt . ');';
     }
     includeModuleLangFile(__FILE__);
     if (isModuleInstalled('bitrix24')) {
         $learnmoreLink = getMessage('INTR_MAIL_DOMAIN_LEARNMOREB24_LINK');
         $supportLink = getMessage('INTR_MAIL_DOMAIN_SUPPORTB24_LINK');
     } else {
         $learnmoreLink = getMessage('INTR_MAIL_DOMAIN_LEARNMORE_LINK');
         $supportLink = getMessage('INTR_MAIL_DOMAIN_SUPPORT_LINK');
     }
     if (in_array($type, array('nocomplete', 'nomailbox'))) {
         $sid = intval($sid);
         $service = \Bitrix\Mail\MailServicesTable::getList(array('filter' => array('=ID' => $sid)))->fetch();
         if (empty($service) || $service['ACTIVE'] != 'Y' || !in_array($service['SERVICE_TYPE'], array('domain', 'crdomain'))) {
             return '';
         }
         if ($service['SERVICE_TYPE'] == 'domain') {
             $result = CMailDomain2::getDomainStatus($service['TOKEN'], $service['SERVER'], $error);
             $stage = empty($result['stage']) ? null : $result['stage'];
         } else {
             $crResponse = CControllerClient::executeEvent('OnMailControllerCheckMemberDomain', array('DOMAIN' => $service['SERVER']));
             $stage = empty($crResponse['result']['stage']) ? null : $crResponse['result']['stage'];
         }
         if ($type == 'nocomplete') {
             if (in_array($stage, array('owner-check', 'mx-check'))) {
                 CEvent::send('INTRANET_MAILDOMAIN_NOCOMPLETE', array($service['SITE_ID']), array('EMAIL_TO' => $arAdmin['EMAIL'], 'LEARNMORE_LINK' => $learnmoreLink, 'SUPPORT_LINK' => $supportLink));
                 if ($cnt == 1) {
                     global $pPERIOD;
                     $pPERIOD = 3600 * 24 * 4;
                     return 'CIntranetUtils::notifyMailDomain("nocomplete", ' . $sid . ', ' . $user_id . ', ' . ++$cnt . ');';
                 }
             }
         } else {
             if ($stage == 'added') {
                 $dbMailboxes = CMailbox::getList(array(), array('ACTIVE' => 'Y', '!USER_ID' => 0, 'SERVICE_ID' => $sid));
                 $adminMailbox = false;
                 $userMailboxes = false;
                 while ($arMailbox = $dbMailboxes->fetch()) {
                     if ($arMailbox['USER_ID'] == $user_id) {
                         $adminMailbox = true;
                     } else {
                         $userMailboxes = true;
                         break;
                     }
                 }
                 if (!$userMailboxes) {
                     $eventType = $adminMailbox ? 'INTRANET_MAILDOMAIN_NOMAILBOX2' : 'INTRANET_MAILDOMAIN_NOMAILBOX';
                     CEvent::send($eventType, array($service['SITE_ID']), array('EMAIL_TO' => $arAdmin['EMAIL'], 'LEARNMORE_LINK' => $learnmoreLink, 'SUPPORT_LINK' => $supportLink));
                     if ($cnt == 1) {
                         global $pPERIOD;
                         $pPERIOD = 3600 * 24 * 21;
                         return 'CIntranetUtils::notifyMailDomain("nomailbox", ' . $sid . ', ' . $user_id . ', ' . ++$cnt . ');';
                     }
                 }
             }
         }
     } else {
         if ($type == 'noreg') {
             $dbServices = \Bitrix\Mail\MailServicesTable::getList(array('filter' => array('ACTIVE' => 'Y', 'SERVICE_TYPE' => 'crdomain')));
             while ($service = $dbServices->fetch()) {
                 if ($service['FLAGS'] & CMail::F_DOMAIN_REG) {
                     return '';
                 }
             }
             $r = CEvent::send('INTRANET_MAILDOMAIN_NOREG', array($sid), array('EMAIL_TO' => $arAdmin['EMAIL'], 'LEARNMORE_LINK' => $learnmoreLink, 'SUPPORT_LINK' => $supportLink));
         }
     }
     return '';
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:81,代码来源:utils.php

示例6: GetDocument

 /**
  * @param string $documentId - document id.
  * @return array - document fields array.
  */
 public function GetDocument($documentId)
 {
     $documentId = intval($documentId);
     if ($documentId <= 0) {
         throw new CBPArgumentNullException("documentId");
     }
     $result = null;
     $dbDocumentList = CIBlockElement::getList(array(), array("ID" => $documentId, "SHOW_NEW" => "Y", "SHOW_HISTORY" => "Y"));
     if ($objDocument = $dbDocumentList->getNextElement(false, true)) {
         $fields = $objDocument->getFields();
         $properties = $objDocument->getProperties();
         foreach ($fields as $fieldKey => $fieldValue) {
             if (substr($fieldKey, 0, 1) == "~") {
                 continue;
             }
             $result[$fieldKey] = $fieldValue;
             if (in_array($fieldKey, array("MODIFIED_BY", "CREATED_BY"))) {
                 $result[$fieldKey] = "user_" . $fieldValue;
                 $result[$fieldKey . "_PRINTABLE"] = $fields[$fieldKey == "MODIFIED_BY" ? "USER_NAME" : "CREATED_USER_NAME"];
             } elseif (in_array($fieldKey, array("PREVIEW_TEXT", "DETAIL_TEXT"))) {
                 if ($fields[$fieldKey . "_TYPE"] == "html") {
                     $result[$fieldKey] = HTMLToTxt($fields["~" . $fieldKey]);
                 }
             }
         }
         foreach ($properties as $propertyKey => $propertyValue) {
             if (strlen($propertyValue["USER_TYPE"]) > 0) {
                 if ($propertyValue["USER_TYPE"] == "UserID" || $propertyValue["USER_TYPE"] == "employee" && COption::getOptionString("bizproc", "employee_compatible_mode", "N") != "Y") {
                     if (!is_array($propertyValue["VALUE"])) {
                         $propertyValue["VALUE"] = array($propertyValue["VALUE"]);
                     }
                     $listUsers = implode(' | ', $propertyValue["VALUE"]);
                     $userQuery = CUser::getList($by = 'ID', $order = 'ASC', array('ID' => $listUsers), array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME')));
                     while ($user = $userQuery->fetch()) {
                         $result["PROPERTY_" . $propertyKey][$user['ID']] = "user_" . intval($user['ID']);
                         $result["PROPERTY_" . $propertyKey . "_PRINTABLE"][$user['ID']] = "(" . $user["LOGIN"] . ")" . (strlen($user["NAME"]) > 0 || strlen($user["LAST_NAME"]) > 0 ? " " : "") . $user["NAME"] . (strlen($user["NAME"]) > 0 && strlen($user["LAST_NAME"]) > 0 ? " " : "") . $user["LAST_NAME"];
                     }
                 } elseif ($propertyValue["USER_TYPE"] == "DiskFile") {
                     if (is_array($propertyValue["VALUE"])) {
                         if ($propertyValue["MULTIPLE"] == "Y") {
                             $propertyValue["VALUE"] = current($propertyValue["VALUE"]);
                         }
                         foreach ($propertyValue["VALUE"] as $attachedId) {
                             $userType = \CIBlockProperty::getUserType($propertyValue['USER_TYPE']);
                             $fileId = null;
                             if (array_key_exists('GetObjectId', $userType)) {
                                 $fileId = call_user_func_array($userType['GetObjectId'], array($attachedId));
                             }
                             if (!$fileId) {
                                 continue;
                             }
                             $printableUrl = '';
                             if (array_key_exists('GetUrlAttachedFileElement', $userType)) {
                                 $printableUrl = call_user_func_array($userType['GetUrlAttachedFileElement'], array($documentId, $fileId));
                             }
                             $result["PROPERTY_" . $propertyKey][$attachedId] = $fileId;
                             $result["PROPERTY_" . $propertyKey . "_PRINTABLE"][$attachedId] = $printableUrl;
                         }
                     } else {
                         continue;
                     }
                 } else {
                     $result["PROPERTY_" . $propertyKey] = $propertyValue["VALUE"];
                 }
             } elseif ($propertyValue["PROPERTY_TYPE"] == "L") {
                 $propertyValueArray = $propertyValue["VALUE"];
                 $propertyKeyArray = $propertyValue["VALUE_XML_ID"];
                 if (!is_array($propertyValueArray)) {
                     $propertyValueArray = array($propertyValueArray);
                     $propertyKeyArray = array($propertyKeyArray);
                 }
                 for ($i = 0, $cnt = count($propertyValueArray); $i < $cnt; $i++) {
                     $result["PROPERTY_" . $propertyKey][$propertyKeyArray[$i]] = $propertyValueArray[$i];
                 }
             } elseif ($propertyValue["PROPERTY_TYPE"] == "F") {
                 $propertyValueArray = $propertyValue["VALUE"];
                 if (!is_array($propertyValueArray)) {
                     $propertyValueArray = array($propertyValueArray);
                 }
                 foreach ($propertyValueArray as $v) {
                     $userArray = CFile::getFileArray($v);
                     if ($userArray) {
                         $result["PROPERTY_" . $propertyKey][intval($v)] = $userArray["SRC"];
                         $result["PROPERTY_" . $propertyKey . "_printable"][intval($v)] = "[url=/bitrix/tools/bizproc_show_file.php?f=" . urlencode($userArray["FILE_NAME"]) . "&i=" . $v . "&h=" . md5($userArray["SUBDIR"]) . "]" . htmlspecialcharsbx($userArray["ORIGINAL_NAME"]) . "[/url]";
                     }
                 }
             } else {
                 $result["PROPERTY_" . $propertyKey] = $propertyValue["VALUE"];
             }
         }
         $documentFields = static::getDocumentFields(static::getDocumentType($documentId));
         foreach ($documentFields as $fieldKey => $field) {
             if (!array_key_exists($fieldKey, $result)) {
                 $result[$fieldKey] = null;
             }
         }
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:bizprocdocument.php

示例7: getUserList

 /**
  * @deprecated
  */
 public static function getUserList()
 {
     trigger_error("The CUser::getUserList static method has been deprecated in 3.1 and will be removed in v4.0. Please use CUser->getList instead.", E_USER_NOTICE);
     $user = new CUser();
     return $user->getList();
 }
开发者ID:victorrod,项目名称:web2project,代码行数:9,代码来源:users.class.php

示例8: NotifyComment

 public static function NotifyComment($comment)
 {
     if (!Loader::includeModule("im")) {
         return;
     }
     if ($comment["TO_USER_ID"] == $comment["FROM_USER_ID"]) {
         return;
     }
     $siteDir = rtrim(SITE_DIR, '/');
     $url = str_replace('#SITE_DIR#', $siteDir, $comment["URL"]);
     $url .= '' . $comment['LOG_ID'] . '/';
     $messageAddComment = Loc::getMessage("LISTS_LF_COMMENT_MESSAGE_ADD", array("#PROCESS#" => '<a href="' . $url . '" class="bx-notifier-item-action">' . $comment["TITLE"] . '</a>'));
     $userQuery = CUser::getList($by = "id", $order = "asc", array("ID_EQUAL_EXACT" => intval($comment["TO_USER_ID"])), array("FIELDS" => array("PERSONAL_GENDER")));
     if ($user = $userQuery->fetch()) {
         switch ($user["PERSONAL_GENDER"]) {
             case "F":
             case "M":
                 $messageAddComment = Loc::getMessage("LISTS_LF_COMMENT_MESSAGE_ADD" . '_' . $user["PERSONAL_GENDER"], array("#PROCESS#" => '<a href="' . $url . '" class="bx-notifier-item-action">' . $comment["TITLE"] . '</a>'));
                 break;
             default:
                 break;
         }
     }
     $messageFields = array("TO_USER_ID" => $comment["TO_USER_ID"], "FROM_USER_ID" => $comment["FROM_USER_ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "lists", "NOTIFY_TAG" => "SONET|EVENT|" . $comment["LOG_ID"], "NOTIFY_EVENT" => "event_lists_comment_add", "NOTIFY_MESSAGE" => $messageAddComment);
     CIMNotify::Add($messageFields);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:26,代码来源:livefeed.php

示例9: getUsersFromUserGroup

 public static function getUsersFromUserGroup($group, $documentId)
 {
     if (substr($documentId, 0, 8) == "STORAGE_") {
         $storageId = self::getStorageIdByType($documentId);
     } else {
         if (is_array($documentId)) {
             $documentId = intval($documentId[2]);
         }
         /** @var File $file */
         $file = File::loadById($documentId);
         if (!$file) {
             return array();
         }
         $storageId = $file->getStorageId();
     }
     if (strtolower($group) == "author") {
         $documentId = intval($documentId);
         if ($documentId <= 0) {
             return array();
         }
         /** @var File $file */
         $file = File::loadById($documentId);
         if (!$file) {
             return array();
         }
         return array($file->getCreatedBy());
     }
     if ($storageId) {
         $storage = Storage::loadById($storageId, array('ROOT_OBJECT'));
         if ($storage->getProxyType() instanceof ProxyType\Group) {
             $entityId = $storage->getEntityId();
             $group = strtoupper($group);
             if (Loader::includeModule("socialnetwork")) {
                 $listUserGroup = array();
                 if ($group == SONET_ROLES_OWNER) {
                     $listGroup = \CSocNetGroup::getByID($entityId);
                     if ($listGroup) {
                         $listUserGroup[] = $listGroup["OWNER_ID"];
                     }
                 } elseif ($group == SONET_ROLES_MODERATOR) {
                     $dbRes = \CSocNetUserToGroup::getList(array(), array("GROUP_ID" => $entityId, "<=ROLE" => SONET_ROLES_MODERATOR, "USER_ACTIVE" => "Y"), false, false, array("USER_ID"));
                     while ($res = $dbRes->fetch()) {
                         $listUserGroup[] = $res["USER_ID"];
                     }
                 } elseif ($group == SONET_ROLES_USER) {
                     $dbRes = \CSocNetUserToGroup::getList(array(), array("GROUP_ID" => $entityId, "<=ROLE" => SONET_ROLES_USER, "USER_ACTIVE" => "Y"), false, false, array("USER_ID"));
                     while ($res = $dbRes->fetch()) {
                         $listUserGroup[] = $res["USER_ID"];
                     }
                 }
                 return $listUserGroup;
             }
         }
     }
     $group = intval($group);
     if ($group <= 0) {
         return array();
     }
     $userIds = array();
     $filter = array("ACTIVE" => "Y");
     if ($group != 2) {
         $filter["GROUPS_ID"] = $group;
     }
     $query = \CUser::getList($b = "ID", $o = "ASC", $filter);
     while ($user = $query->fetch()) {
         $userIds[] = $user["ID"];
     }
     return $userIds;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:69,代码来源:bizprocdocument.php

示例10: processActionCheckDelegateResponsible

 protected function processActionCheckDelegateResponsible()
 {
     $this->checkRequiredPostParams(array('iblockId'));
     if (!Loader::includeModule('iblock')) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_SEAC_CONNECTION_MODULE_IBLOCK'))));
     }
     $this->iblockId = intval($this->request->getPost('iblockId'));
     $this->iblockTypeId = COption::GetOptionString('lists', 'livefeed_iblock_type_id');
     $this->checkPermission();
     if ($this->errorCollection->hasErrors()) {
         $this->sendJsonErrorResponse();
     }
     $rightObject = new CIBlockRights($this->iblockId);
     $rights = $rightObject->getRights();
     $rightsList = $rightObject->getRightsList(false);
     $idRight = array_search('iblock_full', $rightsList);
     $listUser = array();
     $nameTemplate = CSite::GetNameFormat(false);
     $count = 0;
     foreach ($rights as $right) {
         $res = strpos($right['GROUP_CODE'], 'U');
         if ($right['TASK_ID'] == $idRight && $res === 0) {
             $userId = substr($right['GROUP_CODE'], 1);
             $userGroups = CUser::getUserGroup($userId);
             if (!in_array(1, $userGroups)) {
                 $userQuery = CUser::getList($by = 'ID', $order = 'ASC', array('ID' => $userId), array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'TITLE', 'EMAIL')));
                 if ($user = $userQuery->fetch()) {
                     $listUser[$count]['id'] = $right['GROUP_CODE'];
                     $listUser[$count]['name'] = CUser::formatName($nameTemplate, $user, false);
                 }
             }
         }
         $count++;
     }
     $this->sendJsonSuccessResponse(array('listUser' => $listUser));
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:36,代码来源:ajax.php

示例11: array_unique

$groupIds = array_unique($groupIds);

$slaGroupNames = array();
$res = CGroup::getList($by=null, $order=null, array('ID' => join('|', $groupIds)));
while ($arRes = $res->Fetch())
{
	$slaGroupNames[$arRes['ID']] = $arRes['NAME'];
}

// users info
$slaResponsiblesInfo = array();
$slaResponsibles = array_unique($slaResponsibles);

if ($slaResponsibles)
{
	$res = CUser::getList($by=null, $order=null, array('ID' => join('|', $slaResponsibles)));
	while ($arRes = $res->Fetch())
	{
		$slaResponsiblesInfo[$arRes['ID']] = array(
			'NAME' => htmlspecialcharsbx($arRes["NAME"]." ".$arRes["LAST_NAME"]),
			'LOGIN' => htmlspecialcharsbx($arRes["LOGIN"])
		);
	}
}

// continue admin page

$arHeaders = Array();
$arHeaders[] = Array("id"=>"ID", "content"=>"ID", "default"=>true, "sort" => "ID");
$arHeaders[] = Array("id"=>"PRIORITY", "content"=>GetMessage("SUP_PRIORITY"), "default"=>true, "sort" => "PRIORITY");
$arHeaders[] = Array("id"=>"SITE_ID", "content"=>GetMessage("SUP_SITE"), "default"=>true);
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:ticket_sla_list.php

示例12: isIntranetUser

 public function isIntranetUser()
 {
     if ($this->isIntranetUser !== null) {
         return $this->isIntranetUser;
     }
     $this->isIntranetUser = false;
     if (!Loader::includeModule('intranet')) {
         return false;
     }
     $o = 'ID';
     $b = '';
     $queryUser = \CUser::getList($o, $b, array('ID_EQUAL_EXACT' => $this->id), array('FIELDS' => array('ID'), 'SELECT' => array('UF_DEPARTMENT')));
     if ($user = $queryUser->fetch()) {
         $this->isIntranetUser = !empty($user['UF_DEPARTMENT'][0]);
     }
     return $this->isIntranetUser;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:17,代码来源:user.php

示例13: executeManageCreateMailbox

 private static function executeManageCreateMailbox(&$error)
 {
     $domainUsers = array('vacant' => array(), 'occupied' => array());
     $error = false;
     if (!check_bitrix_sessid()) {
         $error = GetMessage('INTR_MAIL_CSRF');
     }
     if ($error === false) {
         if (!isset($_REQUEST['create'])) {
             $error = GetMessage('INTR_MAIL_FORM_ERROR');
         } else {
             $exists = $_REQUEST['create'] == 0;
             $userId = $_REQUEST['USER_ID'];
             if ($exists) {
                 $serviceId = $_REQUEST['sservice'];
                 $domain = $_REQUEST['sdomain'];
                 $login = $_REQUEST['suser'];
             } else {
                 $serviceId = $_REQUEST['cservice'];
                 $domain = $_REQUEST['cdomain'];
                 $login = $_REQUEST['cuser'];
                 $password = $_REQUEST['password'];
                 $password2 = $_REQUEST['password2'];
             }
         }
     }
     if ($error === false) {
         if (intval($userId)) {
             $dbUser = CUser::getList($by = 'ID', $order = 'ASC', array('ID_EQUAL_EXACT' => intval($userId)), array('FIELDS' => 'ID'));
             if (!$dbUser->fetch()) {
                 $error = GetMessage('INTR_MAIL_FORM_ERROR');
             }
         }
     }
     if ($error === false) {
         $services = CIntranetMailSetupHelper::getMailServices();
         if (empty($services[$serviceId]) || !in_array($services[$serviceId]['type'], array('controller', 'domain', 'crdomain'))) {
             $error = GetMessage('INTR_MAIL_FORM_ERROR');
         } else {
             $service = $services[$serviceId];
             if ($service['type'] == 'controller') {
                 $crDomains = CControllerClient::ExecuteEvent('OnMailControllerGetDomains', array());
                 $arDomains = empty($crDomains['result']) ? array() : $crDomains['result'];
                 if (!is_array($arDomains) || !in_array($domain, $arDomains)) {
                     $error = CMail::getErrorMessage(CMail::ERR_API_OP_DENIED);
                 }
             } else {
                 if ($service['type'] == 'crdomain') {
                     $crDomains = CControllerClient::ExecuteEvent('OnMailControllerGetMemberDomains', array());
                     $arDomains = empty($crDomains['result']) ? array() : $crDomains['result'];
                     if (!is_array($arDomains) || !in_array($domain, $arDomains)) {
                         $error = CMail::getErrorMessage(CMail::ERR_API_OP_DENIED);
                     }
                 } else {
                     if ($service['type'] == 'domain') {
                         if ($service['server'] != $domain) {
                             $error = GetMessage('INTR_MAIL_FORM_ERROR');
                         }
                     }
                 }
             }
         }
     }
     if ($error === false) {
         if (!$exists && $password != $password2) {
             $error = GetMessage('INTR_MAIL_INP_PASSWORD2_BAD');
         }
     }
     if ($error === false) {
         if ($service['type'] == 'controller') {
             $crCheckName = CControllerClient::ExecuteEvent('OnMailControllerCheckName', array('DOMAIN' => $domain, 'NAME' => $login));
             if (isset($crCheckName['result'])) {
                 $isExistsNow = (bool) $crCheckName['result'];
             } else {
                 $error = empty($crCheckName['error']) ? GetMessage('INTR_MAIL_CONTROLLER_INVALID') : CMail::getErrorMessage($crCheckName['error']);
             }
         } else {
             if ($service['type'] == 'crdomain') {
                 $crCheckName = CControllerClient::ExecuteEvent('OnMailControllerCheckMemberName', array('DOMAIN' => $domain, 'NAME' => $login));
                 if (isset($crCheckName['result'])) {
                     $isExistsNow = (bool) $crCheckName['result'];
                 } else {
                     $error = empty($crCheckName['error']) ? GetMessage('INTR_MAIL_CONTROLLER_INVALID') : CMail::getErrorMessage($crCheckName['error']);
                 }
             } else {
                 if ($service['type'] == 'domain') {
                     $isExistsNow = CMailDomain2::isUserExists($service['token'], $domain, $login, $error);
                     if (is_null($isExistsNow)) {
                         $error = CMail::getErrorMessage($error);
                     }
                 }
             }
         }
         if ($error === false) {
             if ($exists) {
                 if ($isExistsNow == false) {
                     $error = CMail::getErrorMessage(CMail::ERR_API_USER_NOTFOUND);
                 }
                 if ($error === false) {
                     if ($service['type'] == 'controller') {
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:ajax.php

示例14: createMailbox

 public static function createMailbox($exists, $userId, $serviceId, $domain, $login, $password, &$error)
 {
     $error = false;
     if (intval($userId)) {
         $dbUser = CUser::getList($by = 'ID', $order = 'ASC', array('ID_EQUAL_EXACT' => intval($userId)), array('FIELDS' => 'ID'));
         if (!$dbUser->fetch()) {
             $error = GetMessage('INTR_MAIL_FORM_ERROR');
         }
     }
     if ($error === false) {
         $services = self::getMailServices();
         if (empty($services[$serviceId]) || !in_array($services[$serviceId]['type'], array('controller', 'domain', 'crdomain'))) {
             $error = GetMessage('INTR_MAIL_FORM_ERROR');
         }
     }
     if ($error === false) {
         $service = $services[$serviceId];
         if ($service['type'] == 'controller') {
             $crDomains = CControllerClient::ExecuteEvent('OnMailControllerGetDomains', array());
             $arDomains = empty($crDomains['result']) ? array() : $crDomains['result'];
             if (!is_array($arDomains) || !in_array($domain, $arDomains)) {
                 $error = CMail::getErrorMessage(CMail::ERR_API_OP_DENIED);
             }
         } else {
             if ($service['type'] == 'crdomain') {
                 $crDomains = CControllerClient::ExecuteEvent('OnMailControllerGetMemberDomains', array());
                 $arDomains = empty($crDomains['result']) ? array() : $crDomains['result'];
                 if (!is_array($arDomains) || !in_array($domain, $arDomains)) {
                     $error = CMail::getErrorMessage(CMail::ERR_API_OP_DENIED);
                 }
             } else {
                 if ($service['type'] == 'domain') {
                     if ($service['server'] != $domain) {
                         $error = GetMessage('INTR_MAIL_FORM_ERROR');
                     }
                 }
             }
         }
     }
     if ($error === false && !$exists) {
         if (!preg_match('/^[a-z0-9_]+(\\.?[a-z0-9_-]*[a-z0-9_]+)*?$/i', $login)) {
             $error = CMail::getErrorMessage(CMail::ERR_API_BAD_NAME);
         }
         if ($error === false) {
             if ($service['type'] == 'controller') {
                 $crResponse = CControllerClient::ExecuteEvent('OnMailControllerAddUser', array('DOMAIN' => $domain, 'NAME' => $login, 'PASSWORD' => $password));
                 if (!isset($crResponse['result'])) {
                     $error = empty($crResponse['error']) ? GetMessage('INTR_MAIL_CONTROLLER_INVALID') : CMail::getErrorMessage($crResponse['error']);
                 }
             } else {
                 if ($service['type'] == 'crdomain') {
                     $crResponse = CControllerClient::ExecuteEvent('OnMailControllerAddMemberUser', array('DOMAIN' => $domain, 'NAME' => $login, 'PASSWORD' => $password));
                     if (!isset($crResponse['result'])) {
                         $error = empty($crResponse['error']) ? GetMessage('INTR_MAIL_CONTROLLER_INVALID') : CMail::getErrorMessage($crResponse['error']);
                     }
                 } else {
                     if ($service['type'] == 'domain') {
                         $result = CMailDomain2::addUser($service['token'], $domain, $login, $password, $error);
                         if (is_null($result)) {
                             $error = CMail::getErrorMessage($error);
                         }
                     }
                 }
             }
         }
     }
     if ($error === false && intval($userId)) {
         if ($exists) {
             if ($service['type'] == 'controller') {
                 $crCheckMailbox = CControllerClient::ExecuteEvent('OnMailControllerCheckMailbox', array('DOMAIN' => $domain, 'NAME' => $login));
                 if (!isset($crCheckMailbox['result'])) {
                     $error = empty($crCheckMailbox['error']) ? GetMessage('INTR_MAIL_CONTROLLER_INVALID') : CMail::getErrorMessage($crCheckMailbox['error']);
                 }
             }
             if ($error === false) {
                 $dbMailbox = CMailbox::getList(array('TIMESTAMP_X' => 'ASC'), array('ACTIVE' => 'Y', '!USER_ID' => intval($userId), '=LOGIN' => $login . '@' . $domain));
                 if (($mailbox = $dbMailbox->fetch()) && $mailbox['USER_ID']) {
                     $error = GetMessage('INTR_MAIL_MAILBOX_OCCUPIED');
                 }
             }
         }
         if ($error === false) {
             $mailbox = self::getUserMailbox($userId);
             if (!empty($mailbox)) {
                 $res = CMailbox::delete($mailbox['ID']);
             }
             $arFields = array('LID' => SITE_ID, 'ACTIVE' => 'Y', 'SERVICE_ID' => $serviceId, 'NAME' => $service['name'], 'LOGIN' => $login . '@' . $domain, 'SERVER_TYPE' => $service['type'], 'USER_ID' => intval($userId));
             $res = CMailbox::add($arFields);
             if (!$res) {
                 $error = GetMessage('INTR_MAIL_SAVE_ERROR');
             }
         }
     }
     if ($error === false) {
         return $login . '@' . $domain;
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:97,代码来源:helper.php

示例15: workWithNonCacheAttr

 /**
  * Set mutable attributes
  * @param bool   $bFromCache
  * @param string $strUserIds
  */
 protected function workWithNonCacheAttr($bFromCache = false, $strUserIds = '')
 {
     //if list of users in cache - get last activity
     if ($bFromCache && $strUserIds) {
         $dbRes = CUser::getList($by = 'id', $order = 'asc', array('ID' => $strUserIds, 'LAST_ACTIVITY' => static::LAST_ACTIVITY), array('FIELDS' => array('ID')));
         while ($arRes = $dbRes->fetch()) {
             if ($this->arResult['USERS'][$arRes['ID']]) {
                 $this->arResult['USERS'][$arRes['ID']]['IS_ONLINE'] = true;
             }
         }
         unset($dbRes, $arRes);
     }
     $buildResizedPhoto = false;
     $displayPhoto = $this->displayPersonalPhoto();
     foreach ($this->arResult['USERS'] as &$arUser) {
         if ($this->bExcel && $displayPhoto) {
             //if export in excel, then method $this->resizePersonalPhoto() not run. And not modify PERSONAL_PHOTO
             if (!$arUser['PERSONAL_PHOTO']) {
                 $arUser['PERSONAL_PHOTO'] = $this->getDefaultPictureSonet($arUser['PERSONAL_GENDER']);
             }
             $arUser['PERSONAL_PHOTO_SOURCE'] = $arUser['PERSONAL_PHOTO'];
             $arUser['PERSONAL_PHOTO'] = CFile::GetPath($arUser['PERSONAL_PHOTO']);
         } elseif ($bFromCache && $displayPhoto) {
             $buildResizedPhoto = $this->resizePersonalPhoto($arUser) || $buildResizedPhoto;
         }
         $arUser['IS_BIRTHDAY'] = CIntranetUtils::IsToday($arUser['PERSONAL_BIRTHDAY']);
         $arUser['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
     }
     //rewrite cache if we build new resized photo
     if ($buildResizedPhoto) {
         $this->obCache->clean($this->cacheId, $this->cacheDir);
         $this->obCache->startDataCache();
         $this->obCache->endDataCache(array('USERS' => $this->arResult['USERS'], 'STR_USER_ID' => $strUserIds, 'DEPARTMENTS' => $this->arResult['DEPARTMENTS'], 'DEPARTMENT_HEAD' => $this->arResult['DEPARTMENT_HEAD'], 'USERS_NAV' => $this->arResult['USERS_NAV']));
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:40,代码来源:class.php


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