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


PHP CUser::getByID方法代码示例

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


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

示例1: 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") {
                     $propertyValueArray = $propertyValue["VALUE"];
                     $propertyKeyArray = isset($propertyValue["VALUE_ENUM_ID"]) ? $propertyValue["VALUE_ENUM_ID"] : $propertyValue["PROPERTY_VALUE_ID"];
                     if (!is_array($propertyValueArray)) {
                         $userQuery = CUser::getByID($propertyValueArray);
                         if ($userArray = $userQuery->getNext()) {
                             $result["PROPERTY_" . $propertyKey] = "user_" . intval($propertyValueArray);
                             $result["PROPERTY_" . $propertyKey . "_PRINTABLE"] = "(" . $userArray["LOGIN"] . ")" . (strlen($userArray["NAME"]) > 0 || strlen($userArray["LAST_NAME"]) > 0 ? " " : "") . $userArray["NAME"] . (strlen($userArray["NAME"]) > 0 && strlen($userArray["LAST_NAME"]) > 0 ? " " : "") . $userArray["LAST_NAME"];
                         }
                     } else {
                         for ($i = 0, $cnt = count($propertyValueArray); $i < $cnt; $i++) {
                             $userQuery = CUser::getByID($propertyValueArray[$i]);
                             if ($userArray = $userQuery->getNext()) {
                                 $result["PROPERTY_" . $propertyKey][$propertyKeyArray[$i]] = "user_" . intval($propertyValueArray[$i]);
                                 $result["PROPERTY_" . $propertyKey . "_PRINTABLE"][$propertyKeyArray[$i]] = "(" . $userArray["LOGIN"] . ")" . (strlen($userArray["NAME"]) > 0 || strlen($userArray["LAST_NAME"]) > 0 ? " " : "") . $userArray["NAME"] . (strlen($userArray["NAME"]) > 0 && strlen($userArray["LAST_NAME"]) > 0 ? " " : "") . $userArray["LAST_NAME"];
                             }
                         }
                     }
                 } 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=" . htmlspecialcharsbx($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;
             }
         }
     }
     return $result;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:87,代码来源:bizprocdocument.php

示例2: 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::getByID($userId);
                 if ($user = $userQuery->getNext()) {
                     $listUser[$count]['id'] = $right['GROUP_CODE'];
                     $listUser[$count]['name'] = CUser::formatName($nameTemplate, $user, false);
                 }
             }
         }
         $count++;
     }
     $this->sendJsonSuccessResponse(array('listUser' => $listUser));
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:36,代码来源:ajax.php

示例3: formatListsElement

 public static function formatListsElement($fields, $params, $mail = false)
 {
     $element = array('EVENT' => $fields, 'CREATED_BY' => array(), 'ENTITY' => array(), 'EVENT_FORMATTED' => array());
     $userObject = CUser::getByID($fields['ENTITY_ID']);
     $user = $userObject->fetch();
     if ($user) {
         if (!$mail) {
             global $APPLICATION;
             $rights = array();
             $rightsQuery = CSocNetLogRights::getList(array(), array('LOG_ID' => $fields['ID']));
             while ($right = $rightsQuery->fetch()) {
                 $rights[] = $right['GROUP_CODE'];
             }
             if (defined('BX_COMP_MANAGED_CACHE')) {
                 $GLOBALS['CACHE_MANAGER']->registerTag('LISTS_ELEMENT_LIVE_FEED');
             }
             $componentResult = $APPLICATION->includeComponent('bitrix:bizproc.workflow.livefeed', '', array('WORKFLOW_ID' => $fields['MESSAGE']), null, array('HIDE_ICONS' => 'Y'));
             $siteDir = rtrim(SITE_DIR, '/');
             $url = CSocNetLogTools::formatEvent_GetURL($fields, true);
             $url = str_replace('#SITE_DIR#', $siteDir, $url);
             $url .= '' . $fields['ID'] . '/';
             $element = array('EVENT' => $fields, 'EVENT_FORMATTED' => array('TITLE_24' => '<a href="' . $fields['TITLE_TEMPLATE'] . '" class="bx-lists-live-feed-title-link">' . $fields['TITLE'] . '</a>', 'MESSAGE' => $fields['TEXT_MESSAGE'] . $componentResult['MESSAGE'], 'IS_IMPORTANT' => false, 'STYLE' => 'new-employee', 'AVATAR_STYLE' => 'avatar-info', 'DESTINATION' => CSocNetLogTools::formatDestinationFromRights($rights, array_merge($params, array('CREATED_BY' => $fields['USER_ID']))), 'URL' => $url), 'CREATED_BY' => CSocNetLogTools::formatEvent_GetCreatedBy($fields, $params, $mail), 'AVATAR_SRC' => CSocNetLog::formatEvent_CreateAvatar($fields, $params), 'CACHED_JS_PATH' => $componentResult['CACHED_JS_PATH'], 'CACHED_CSS_PATH' => $componentResult['CACHED_CSS_PATH']);
             if ($params['MOBILE'] == 'Y') {
                 $element['EVENT_FORMATTED']['TITLE_24'] = Loc::getMessage('LISTS_LF_MOBILE_DESTINATION');
                 $element['EVENT_FORMATTED']['TITLE_24_2'] = $fields['TITLE'];
             }
             if (CModule::IncludeModule('bizproc')) {
                 $workflowId = \CBPStateService::getWorkflowByIntegerId($element['EVENT']['SOURCE_ID']);
             }
             if ($workflowId) {
                 $element['EVENT']['SOURCE_ID'] = $workflowId;
             }
         }
         return $element;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:36,代码来源:livefeed.php

示例4: onShipmentTrackingNumberChange

 /**
  * @param Main\Event $event
  *
  * @return Main\EventResult
  * @throws Main\ObjectNotFoundException
  */
 public static function onShipmentTrackingNumberChange(Main\Event $event)
 {
     $parameters = $event->getParameters();
     /** @var Sale\Shipment $basketItem */
     $shipment = $parameters['ENTITY'];
     $oldValues = $parameters['VALUES'];
     if (!$shipment instanceof Sale\Shipment) {
         return new Main\EventResult(Main\EventResult::ERROR, new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_EVENT_COMPATIBILITY_SHIPMENT_TRACKING_NUMBER_CHANGE_WRONG_BASKET'), 'SALE_EVENT_COMPATIBILITY_SHIPMENT_TRACKING_NUMBER_CHANGE_WRONG_BASKET'), 'sale');
     }
     /** @var Sale\ShipmentCollection $shipmentCollection */
     if (!($shipmentCollection = $shipment->getCollection())) {
         throw new Main\ObjectNotFoundException('Entity "ShipmentCollection" not found');
     }
     /** @var Sale\Order $order */
     if (!($order = $shipmentCollection->getOrder())) {
         throw new Main\ObjectNotFoundException('Entity "Order" not found');
     }
     foreach (GetModuleEvents("sale", static::EVENT_COMPATIBILITY_ON_TRACKING_NUMBER_CHANGE, true) as $oldEvent) {
         ExecuteModuleEventEx($oldEvent, array($order->getId(), $shipment->getField('TRACKING_NUMBER')));
     }
     if (array_key_exists('TRACKING_NUMBER', $oldValues) && strval($shipment->getField('TRACKING_NUMBER')) != '' && $oldValues["TRACKING_NUMBER"] != $shipment->getField('TRACKING_NUMBER')) {
         $accountNumber = $order->getField("ACCOUNT_NUMBER");
         $userId = $order->getField("USER_ID");
         $payerName = "";
         $payerEMail = '';
         $userRes = \CUser::getByID($userId);
         if ($userData = $userRes->fetch()) {
             if (strval($payerName) == '') {
                 $payerName = $userData["NAME"] . (strval($userData["NAME"]) == '' || strval($userData["LAST_NAME"]) == '' ? "" : " ") . $userData["LAST_NAME"];
             }
             if (strval($payerEMail) == '') {
                 $payerEMail = $userData["EMAIL"];
             }
         }
         $emailFields = array("ORDER_ID" => $accountNumber, "ORDER_DATE" => $order->getDateInsert()->toString(), "ORDER_USER" => $payerName, "ORDER_TRACKING_NUMBER" => $shipment->getField('TRACKING_NUMBER'), "BCC" => Main\Config\Option::get("sale", "order_email", "order@" . $_SERVER['SERVER_NAME']), "EMAIL" => $payerEMail, "SALE_EMAIL" => Main\Config\Option::get("sale", "order_email", "order@" . $_SERVER['SERVER_NAME']));
         $event = new \CEvent();
         $event->send("SALE_ORDER_TRACKING_NUMBER", $order->getField("LID"), $emailFields, "N");
     }
     return new Main\EventResult(Main\EventResult::SUCCESS, null, 'sale');
 }
开发者ID:Satariall,项目名称:izurit,代码行数:46,代码来源:eventcompatibility.php

示例5: executeComponent

 public function executeComponent()
 {
     if (!empty($this->arParams['ERROR'])) {
         ShowError(array_shift($this->arParams['ERROR']));
         return;
     }
     $this->arResult['USER_ID'] = $this->arParams['USER_ID'];
     $this->arResult['GRID_ID'] = 'lists_processes';
     $selectFields = array('ID', 'IBLOCK_TYPE_ID', 'IBLOCK_ID', 'NAME');
     $gridOptions = new CGridOptions($this->arResult['GRID_ID']);
     $gridColumns = $gridOptions->getVisibleColumns();
     $gridSort = $gridOptions->getSorting(array('sort' => array('ID' => 'desc')));
     $this->arResult['HEADERS'] = array(array("id" => "ID", "name" => "ID", "default" => false, "sort" => "ID"), array('id' => 'DOCUMENT_NAME', 'name' => Loc::getMessage('CC_BLL_DOCUMENT_NAME'), 'default' => true, 'sort' => 'DOCUMENT_NAME'), array('id' => 'COMMENTS', 'name' => Loc::getMessage('CC_BLL_COMMENTS'), 'default' => true, 'sort' => '', 'hideName' => true, 'iconCls' => 'bp-comments-icon'), array('id' => 'WORKFLOW_PROGRESS', 'name' => Loc::getMessage('CC_BLL_WORKFLOW_PROGRESS'), 'default' => true, 'sort' => ''), array('id' => 'WORKFLOW_STATE', 'name' => Loc::getMessage('CC_BLL_WORKFLOW_STATE'), 'default' => false, 'sort' => ''));
     $this->arResult['FILTER'] = array(array("id" => "NAME", "name" => GetMessage("BPATL_NAME"), "type" => "string"), array('id' => 'TIMESTAMP_X', 'name' => Loc::getMessage('CC_BLL_MODIFIED'), 'type' => 'date'), array('id' => 'DATE_CREATE', 'name' => Loc::getMessage('CC_BLL_CREATED'), 'type' => 'date', 'default' => true));
     $gridFilter = $gridOptions->getFilter($this->arResult['FILTER']);
     foreach ($gridFilter as $key => $value) {
         if (substr($key, -5) == "_from") {
             $op = ">=";
             $newKey = substr($key, 0, -5);
         } elseif (substr($key, -3) == "_to") {
             $op = "<=";
             $newKey = substr($key, 0, -3);
             if (in_array($newKey, array("TIMESTAMP_X", 'DATE_CREATE'))) {
                 if (!preg_match("/\\d\\d:\\d\\d:\\d\\d\$/", $value)) {
                     $value .= " 23:59:59";
                 }
             }
         } else {
             $op = "";
             $newKey = $key;
         }
         $filter[$op . $newKey] = $value;
     }
     $this->arResult['SORT'] = $gridSort['sort'];
     $useComments = (bool) CModule::includeModule("forum");
     $workflows = array();
     $this->arResult['DATA'] = array();
     $this->arResult["COMMENTS_COUNT"] = array();
     $filter['CREATED_BY'] = $this->arParams['USER_ID'];
     $iblockTypeId = COption::GetOptionString("lists", "livefeed_iblock_type_id");
     $filter['IBLOCK_TYPE'] = $iblockTypeId;
     $filter['CHECK_PERMISSIONS'] = $this->arParams['LIST_PERM'] >= CListPermissions::CAN_READ ? "N" : "Y";
     $elementObject = CIBlockElement::getList($gridSort['sort'], $filter, false, $gridOptions->getNavParams(), $selectFields);
     $documentState = true;
     $path = rtrim(SITE_DIR, '/');
     while ($element = $elementObject->fetch()) {
         $documentState = CBPDocument::GetDocumentStates(BizprocDocument::generateDocumentComplexType($iblockTypeId, $element['IBLOCK_ID']), BizprocDocument::getDocumentComplexId($iblockTypeId, $element['ID']));
         $this->arResult['DATA'][$element['ID']]['ID'] = $element['ID'];
         $this->arResult['DATA'][$element['ID']]['DOCUMENT_NAME'] = $element['NAME'];
         $this->arResult['DATA'][$element['ID']]['DOCUMENT_URL'] = $path . COption::GetOptionString('lists', 'livefeed_url') . '?livefeed=y&list_id=' . $element["IBLOCK_ID"] . '&element_id=' . $element['ID'];
         if (!empty($documentState)) {
             $this->arResult['DATA'][$element['ID']]['DOCUMENT_STATE'] = true;
             $documentState = current($documentState);
             $this->arResult['DATA'][$element['ID']]['WORKFLOW_ID'] = $documentState['ID'];
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_NAME"] = $documentState["TEMPLATE_NAME"];
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_STATE"] = $documentState["STATE_TITLE"];
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED"] = FormatDateFromDB($documentState["STARTED_FORMATTED"]);
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED_BY"] = "";
             if (intval($documentState["STARTED_BY"]) > 0) {
                 $dbUserTmp = CUser::getByID($documentState["STARTED_BY"]);
                 $arUserTmp = $dbUserTmp->fetch();
                 $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED_BY"] = CUser::FormatName($this->arParams["NAME_TEMPLATE"], $arUserTmp, true);
                 $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED_BY"] .= " [" . $documentState["STARTED_BY"] . "]";
             }
             $this->arResult['DATA'][$element['ID']]['MODULE_ID'] = $documentState["DOCUMENT_ID"][0];
             $this->arResult['DATA'][$element['ID']]['ENTITY'] = $documentState["DOCUMENT_ID"][1];
             $this->arResult['DATA'][$element['ID']]['DOCUMENT_ID'] = $documentState["DOCUMENT_ID"][2];
         } else {
             $documentState = false;
             $this->arResult['DATA'][$element['ID']]['DOCUMENT_STATE'] = false;
         }
     }
     foreach ($this->arResult['DATA'] as $data) {
         if ($documentState) {
             if ($useComments) {
                 $workflows[] = 'WF_' . $data['WORKFLOW_ID'];
             }
         }
         $actions = array();
         if (strlen($data["DOCUMENT_URL"]) > 0) {
             $actions[] = array('ICONCLASS' => '', 'DEFAULT' => false, 'TEXT' => Loc::getMessage('CC_BLL_C_DOCUMENT'), 'ONCLICK' => 'window.open("' . $data["DOCUMENT_URL"] . '");');
         }
         $this->arResult['RECORDS'][] = array('data' => $data, 'actions' => $actions);
     }
     if ($useComments && $documentState) {
         $workflows = array_unique($workflows);
         if ($workflows) {
             $iterator = CForumTopic::getList(array(), array("@XML_ID" => $workflows));
             while ($row = $iterator->fetch()) {
                 $this->arResult["COMMENTS_COUNT"][$row['XML_ID']] = $row['POSTS'];
             }
         }
     }
     $this->arResult['COUNTERS'] = array('all' => 0);
     $this->arResult["ROWS_COUNT"] = $elementObject->selectedRowsCount();
     $this->arResult["NAV_RESULT"] = $elementObject;
     if ($this->arParams['SET_TITLE'] == 'Y') {
         $this->getApplication()->setTitle(Loc::getMessage('CC_BLL_TITLE'));
     }
     $this->includeComponentTemplate();
//.........这里部分代码省略.........
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:class.php

示例6: showBizProc


//.........这里部分代码省略.........
                         $status = Loc::getMessage("DISK_FILE_VIEW_BPABL_STATUS_3");
                         break;
                     case CBPActivityExecutionStatus::Closed:
                         $status = Loc::getMessage("DISK_FILE_VIEW_BPABL_STATUS_4");
                         break;
                     case CBPActivityExecutionStatus::Faulting:
                         $status = Loc::getMessage("DISK_FILE_VIEW_BPABL_STATUS_5");
                         break;
                     default:
                         $status = Loc::getMessage("DISK_FILE_VIEW_BPABL_STATUS_6");
                 }
                 switch ($track["EXECUTION_RESULT"]) {
                     case CBPActivityExecutionResult::None:
                         $result = Loc::getMessage("DISK_FILE_VIEW_BPABL_RES_1");
                         break;
                     case CBPActivityExecutionResult::Succeeded:
                         $result = Loc::getMessage("DISK_FILE_VIEW_BPABL_RES_2");
                         break;
                     case CBPActivityExecutionResult::Canceled:
                         $result = Loc::getMessage("DISK_FILE_VIEW_BPABL_RES_3");
                         break;
                     case CBPActivityExecutionResult::Faulted:
                         $result = Loc::getMessage("DISK_FILE_VIEW_BPABL_RES_4");
                         break;
                     case CBPActivityExecutionResult::Uninitialized:
                         $result = Loc::getMessage("DISK_FILE_VIEW_BPABL_RES_5");
                         break;
                     default:
                         $result = Loc::getMessage("DISK_FILE_VIEW_BPABL_RES_6");
                 }
                 $note = strlen($track["ACTION_NOTE"]) > 0 ? ": " . $track["ACTION_NOTE"] : "";
                 $pattern = array("#ACTIVITY#", "#STATUS#", "#RESULT#", "#NOTE#");
                 $replaceArray = array($name, $status, $result, $note);
                 if (!empty($track["ACTION_NAME"]) && !empty($track["ACTION_TITLE"])) {
                     $pattern[] = $track["ACTION_NAME"];
                     $replaceArray[] = $track["ACTION_TITLE"];
                 }
                 $messageTemplate = str_replace($pattern, $replaceArray, $messageTemplate);
                 if (preg_match_all("/(?<=\\{\\=user\\:)([^\\}]+)(?=\\})/is", $messageTemplate, $arMatches)) {
                     $pattern = array();
                     $replacement = array();
                     foreach ($arMatches[0] as $user) {
                         $user = preg_quote($user);
                         if (in_array("/\\{\\=user\\:" . $user . "\\}/is", $pattern)) {
                             continue;
                         }
                         $replace = "";
                         if (array_key_exists(strtolower($user), $groups)) {
                             $replace = $groups[strtolower($user)];
                         } elseif (array_key_exists(strtoupper($user), $groups)) {
                             $replace = $groups[strtoupper($user)];
                         } else {
                             $id = intVal(str_replace("user_", "", $user));
                             if (!array_key_exists($id, $users)) {
                                 $dbRes = \CUser::getByID($id);
                                 $users[$id] = false;
                                 if ($dbRes && ($arUser = $dbRes->getNext())) {
                                     $name = \CUser::formatName($this->arParams["NAME_TEMPLATE"], $arUser);
                                     $arUser["FULL_NAME"] = empty($name) ? $arUser["LOGIN"] : $name;
                                     $users[$id] = $arUser;
                                 }
                             }
                             if (!empty($users[$id])) {
                                 $replace = "<a href=\"" . \CComponentEngine::makePathFromTemplate('/company/personal/user/#USER_ID#/', array("USER_ID" => $id)) . "\">" . $users[$id]["FULL_NAME"] . "</a>";
                             }
                         }
                         if (!empty($replace)) {
                             $pattern[] = "/\\{\\=user\\:" . $user . "\\}/is";
                             $pattern[] = "/\\{\\=user\\:user\\_" . $user . "\\}/is";
                             $replacement[] = $replace;
                             $replacement[] = $replace;
                         }
                     }
                     $messageTemplate = preg_replace($pattern, $replacement, $messageTemplate);
                 }
                 $this->arResult['BIZPROC_LIST'][$count]['DUMP_WORKFLOW'][] = $messageTemplate;
             }
             $tasks = CBPDocument::getUserTasksForWorkflow($this->getUser()->getId(), $idBizProc);
             $events = CBPDocument::getAllowableEvents($this->getUser()->getId(), $userGroup, $bizProcArray);
             if (!empty($tasks)) {
                 foreach ($tasks as $task) {
                     $urlTaskBizproc = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_DISK_TASK'], array("ID" => $task['ID']));
                     $urlTaskBizproc .= "?back_url=" . urlencode($this->getApplication()->getCurPage()) . "&file=" . $this->file->getName();
                     $this->arResult['BIZPROC_LIST'][$count]['TASK']['URL'] = $urlTaskBizproc;
                     $this->arResult['BIZPROC_LIST'][$count]['TASK']['TASK_ID'] = $task['ID'];
                     $this->arResult['BIZPROC_LIST'][$count]['TASK']['TASK_NAME'] = $task['NAME'];
                 }
             }
             $this->arResult['BIZPROC_LIST'][$count]['ID'] = $bizProcArray['ID'];
             $this->arResult['BIZPROC_LIST'][$count]['WORKFLOW_STATUS'] = $bizProcArray["WORKFLOW_STATUS"];
             $this->arResult['BIZPROC_LIST'][$count]['TEMPLATE_ID'] = $bizProcArray['TEMPLATE_ID'];
             $this->arResult['BIZPROC_LIST'][$count]['TEMPLATE_NAME'] = $bizProcArray['TEMPLATE_NAME'];
             $this->arResult['BIZPROC_LIST'][$count]['STATE_MODIFIED'] = $bizProcArray['STATE_MODIFIED'];
             $this->arResult['BIZPROC_LIST'][$count]['STATE_TITLE'] = $bizProcArray['STATE_TITLE'];
             $this->arResult['BIZPROC_LIST'][$count]['STATE_NAME'] = $bizProcArray['STATE_NAME'];
             $this->arResult['BIZPROC_LIST'][$count]['EVENTS'] = $events;
             $count++;
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:class.php

示例7: getUser

 public static function getUser($userId, $photo = false)
 {
     global $USER;
     if (is_object($USER) && intVal($userId) == $USER->GetId() && !$photo) {
         $user = array('ID' => $USER->GetId(), 'NAME' => $USER->GetFirstName(), 'LAST_NAME' => $USER->GetLastName(), 'SECOND_NAME' => $USER->GetParam('SECOND_NAME'), 'LOGIN' => $USER->GetLogin());
     } else {
         $user = CUser::getByID(intval($userId))->Fetch();
     }
     return $user;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:10,代码来源:tools.php


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