本文整理汇总了PHP中CUser::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::GetByID方法的具体用法?PHP CUser::GetByID怎么用?PHP CUser::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::GetByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AddNewUser
function AddNewUser($SITE_ID, $arFields, &$strError)
{
$ID_ADDED = 0;
$iDepartmentId = intval($arFields["DEPARTMENT_ID"]);
$bExtranet = $iDepartmentId <= 0;
$strEmail = trim($arFields["ADD_EMAIL"]);
$strName = trim($arFields["ADD_NAME"]);
$strLastName = trim($arFields["ADD_LAST_NAME"]);
$strPosition = trim($arFields["ADD_POSITION"]);
$strPassword = self::GeneratePassword($SITE_ID, $bExtranetUser);
self::setSendPassword($arFields["ADD_SEND_PASSWORD"] == "Y");
if (strlen($strEmail) <= 0) {
if (!isset($arFields["ADD_MAILBOX_ACTION"]) || !in_array($arFields["ADD_MAILBOX_ACTION"], array("create", "connect")) || strlen($arFields['ADD_MAILBOX_USER']) <= 0 || strlen($arFields['ADD_MAILBOX_DOMAIN']) <= 0) {
$strError = GetMessage("BX24_INVITE_DIALOG_ERROR_EMPTY_EMAIL");
} else {
// email from mailbox
$strEmail = $arFields['ADD_MAILBOX_USER'] . "@" . $arFields['ADD_MAILBOX_DOMAIN'];
}
}
if (!$strError) {
$arUser = array("LOGIN" => $strEmail, "NAME" => $strName, "LAST_NAME" => $strLastName, "EMAIL" => $strEmail, "PASSWORD" => $strPassword, "GROUP_ID" => CIntranetInviteDialog::getUserGroups($SITE_ID, $bExtranet), "WORK_POSITION" => $strPosition, "UF_DEPARTMENT" => $iDepartmentId > 0 ? array($iDepartmentId) : array(0));
if (!self::getSendPassword()) {
$arUser["CONFIRM_CODE"] = randString(8);
}
$obUser = new CUser();
$ID_ADDED = $obUser->Add($arUser);
if (!$ID_ADDED) {
if ($e = $GLOBALS["APPLICATION"]->GetException()) {
$strError = $e->GetString();
} else {
$strError = $obUser->LAST_ERROR;
}
} else {
if (self::getSendPassword()) {
$db_events = GetModuleEvents("main", "OnUserInitialize", true);
foreach ($db_events as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID_ADDED, $arUser));
}
}
$SiteIdToSend = $bExtranet && CModule::IncludeModule("extranet") ? CExtranet::GetExtranetSiteID() : CSite::GetDefSite();
$rsSites = CSite::GetByID($SiteIdToSend);
$arSite = $rsSites->Fetch();
$serverName = strlen($arSite["SERVER_NAME"]) > 0 ? $arSite["SERVER_NAME"] : (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
$event = new CEvent();
if (self::getSendPassword()) {
$url = (CMain::IsHTTPS() ? "https" : "http") . "://" . $serverName . $arSite["DIR"];
$event->SendImmediate("INTRANET_USER_ADD", $SITE_ID, array("EMAIL_TO" => $arUser["EMAIL"], "LINK" => $url, "PASSWORD" => $strPassword, "USER_TEXT" => GetMessage("BX24_INVITE_DIALOG_INVITE_MESSAGE_TEXT")));
} else {
$dbUser = CUser::GetByID($ID_ADDED);
$arUser = $dbUser->Fetch();
if (IsModuleInstalled("bitrix24")) {
$event->SendImmediate("BITRIX24_USER_INVITATION", $SITE_ID, array("EMAIL_FROM" => $GLOBALS["USER"]->GetEmail(), "EMAIL_TO" => $arUser["EMAIL"], "LINK" => CHTTP::URN2URI("/bitrix/tools/intranet_invite_dialog.php?user_id=" . $ID_ADDED . "&checkword=" . urlencode($arUser["CONFIRM_CODE"]), $serverName), "USER_TEXT" => GetMessage("BX24_INVITE_DIALOG_INVITE_MESSAGE_TEXT")));
} else {
$event->SendImmediate("INTRANET_USER_INVITATION", $SITE_ID, array("EMAIL_TO" => $arUser["EMAIL"], "LINK" => CHTTP::URN2URI("/bitrix/tools/intranet_invite_dialog.php?user_id=" . $ID_ADDED . "&checkword=" . urlencode($arUser["CONFIRM_CODE"]), $serverName), "USER_TEXT" => GetMessage("BX24_INVITE_DIALOG_INVITE_MESSAGE_TEXT")));
}
}
}
}
return $ID_ADDED;
}
示例2: CheckFields
public static function CheckFields(&$arFields, $ID = false)
{
global $DB, $APPLICATION;
$arMsg = array();
if ((is_set($arFields, "USER_ID") || $ID === false) && intval($arFields["USER_ID"]) <= 0) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_USER_ID"), "EMPTY_USER_ID");
return false;
} elseif (is_set($arFields, "USER_ID")) {
$dbResult = CUser::GetByID($arFields["USER_ID"]);
if (!$dbResult->Fetch()) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_USER_ID_EX"), "ERROR_NO_USER_ID");
return false;
}
$dbResult = CStudent::GetList(array(), array("USER_ID" => $arFields["USER_ID"]));
if ($dbResult->Fetch()) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_USER_ID_EXISTS"), "ERROR_USER_ID_EXISTS");
return false;
}
}
if ($ID === false && !is_set($arFields, "TRANSCRIPT")) {
$arFields["TRANSCRIPT"] = CStudent::GenerateTranscipt();
} elseif (is_set($arFields, "TRANSCRIPT") && !preg_match("~^[0-9]{6,}\$~", $arFields["TRANSCRIPT"])) {
$arFields["TRANSCRIPT"] = CStudent::GenerateTranscipt();
}
if (is_set($arFields, "PUBLIC_PROFILE") && $arFields["PUBLIC_PROFILE"] != "N") {
$arFields["ACTIVE"] = "Y";
}
return true;
}
示例3: GetFormatedUserName
public static function GetFormatedUserName($userId)
{
static $userCache = array();
$userId = IntVal($userId);
if($userId > 0)
{
if (!isset($userCache[$userId]) || !is_array($userCache[$userId]))
{
$dbUser = CUser::GetByID($userId);
if ($arUser = $dbUser->Fetch())
{
$userCache[$userId] = CUser::FormatName(
CSite::GetNameFormat(false),
array(
"NAME" => $arUser["NAME"],
"LAST_NAME" => $arUser["LAST_NAME"],
"SECOND_NAME" => $arUser["SECOND_NAME"],
"LOGIN" => $arUser["LOGIN"]
),
true
);
}
}
}
return $userCache[$userId];
}
示例4: CheckFields
function CheckFields(&$arFields, $ID = false)
{
global $DB, $APPLICATION;
if ($ID === false && !is_set($arFields, "STUDENT_ID")) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_USER_ID"), "EMPTY_STUDENT_ID");
return false;
} elseif (is_set($arFields, "STUDENT_ID")) {
$dbResult = CUser::GetByID($arFields["STUDENT_ID"]);
if (!$dbResult->Fetch()) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_USER_ID_EX"), "ERROR_NO_STUDENT_ID");
return false;
}
}
if ($ID === false && !is_set($arFields, "TEST_ID")) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_TEST_ID"), "EMPTY_TEST_ID");
return false;
} elseif (is_set($arFields, "TEST_ID")) {
$r = CTest::GetByID($arFields["TEST_ID"]);
if (!$r->Fetch()) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_TEST_ID_EX"), "ERROR_NO_TEST_ID");
return false;
}
}
if (is_set($arFields, "STUDENT_ID") && is_set($arFields, "TEST_ID")) {
$res = CGradeBook::GetList(array(), array("STUDENT_ID" => $arFields["STUDENT_ID"], "TEST_ID" => $arFields["TEST_ID"]));
if ($res->Fetch()) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_GRADEBOOK_DUPLICATE"), "ERROR_GRADEBOOK_DUPLICATE");
return false;
}
}
if (is_set($arFields, "COMPLETED") && $arFields["COMPLETED"] != "Y") {
$arFields["COMPLETED"] = "N";
}
return true;
}
示例5: InitializeFromId
public function InitializeFromId($userId)
{
$dbUser = CUser::GetByID($userId);
if ($arUser = $dbUser->Fetch()) {
$this->InitializeFromArray($arUser);
}
}
示例6: sendOnAfterResultStatusChange
function sendOnAfterResultStatusChange($WEB_FORM_ID, $RESULT_ID, $NEW_STATUS_ID = false, $CHECK_RIGHTS = 'Y')
{
$NEW_STATUS_ID = intval($NEW_STATUS_ID);
$dbRes = CForm::GetByID($WEB_FORM_ID);
if (!($arForm = $dbRes->Fetch())) {
return;
}
CTimeZone::Disable();
$dbRes = CFormResult::GetByID($RESULT_ID);
CTimeZone::Enable();
if (!($arResult = $dbRes->Fetch()) || !$arResult['USER_ID']) {
return;
}
$dbRes = CUser::GetByID($arResult['USER_ID']);
if (!($arUser = $dbRes->Fetch())) {
return;
}
if (!$NEW_STATUS_ID) {
$NEW_STATUS_ID = CFormStatus::GetDefault($WEB_FORM_ID);
}
$dbRes = CFormStatus::GetByID($NEW_STATUS_ID);
if (!($arStatus = $dbRes->Fetch()) || strlen($arStatus['MAIL_EVENT_TYPE']) <= 0) {
return;
}
$arTemplates = CFormStatus::GetMailTemplateArray($NEW_STATUS_ID);
if (!is_array($arTemplates) || count($arTemplates) <= 0) {
return;
}
$arEventFields = array("EMAIL_TO" => $arUser['EMAIL'], "RS_FORM_ID" => $arForm["ID"], "RS_FORM_NAME" => $arForm["NAME"], "RS_FORM_VARNAME" => $arForm["SID"], "RS_FORM_SID" => $arForm["SID"], "RS_RESULT_ID" => $arResult["ID"], "RS_DATE_CREATE" => $arResult["DATE_CREATE"], "RS_USER_ID" => $arResult['USER_ID'], "RS_USER_EMAIL" => $arUser['EMAIL'], "RS_USER_NAME" => $arUser["NAME"] . " " . $arUser["LAST_NAME"], "RS_STATUS_ID" => $arStatus["ID"], "RS_STATUS_NAME" => $arStatus["TITLE"]);
$dbRes = CEventMessage::GetList($by = "id", $order = "asc", array('ID' => implode('|', $arTemplates), "ACTIVE" => "Y", "EVENT_NAME" => $arStatus["MAIL_EVENT_TYPE"]));
while ($arTemplate = $dbRes->Fetch()) {
CEvent::Send($arTemplate["EVENT_NAME"], $arTemplate["SITE_ID"], $arEventFields, "Y", $arTemplate["ID"]);
}
}
示例7: fillFilterReferenceColumn
public static function fillFilterReferenceColumn(&$filterElement, Entity\ReferenceField $field)
{
if ($field->GetDataType() == 'Bitrix\\Main\\User') {
// USER
if ($filterElement['value']) {
$res = CUser::GetByID($filterElement['value']);
$user = $res->fetch();
if ($user) {
$username = CUser::FormatName(CSite::GetNameFormat(false), $user, true);
$filterElement['value'] = array('id' => $user['ID'], 'name' => $username);
} else {
$filterElement['value'] = array('id' => $filterElement['value'], 'name' => GetMessage('REPORT_USER_NOT_FOUND'));
}
} else {
$filterElement['value'] = array('id' => '');
}
} else {
if ($field->GetDataType() == 'Bitrix\\Socialnetwork\\Workgroup') {
// GROUP
if ($filterElement['value']) {
$group = CSocNetGroup::GetByID($filterElement['value']);
if ($group) {
$filterElement['value'] = array(array('id' => $group['ID'], 'title' => $group['NAME']));
} else {
$filterElement['value'] = array(array('id' => $filterElement['value'], 'title' => GetMessage('REPORT_PROJECT_NOT_FOUND')));
}
} else {
$filterElement['value'] = array(array('id' => ''));
}
}
}
}
示例8: CheckFields
function CheckFields(&$arFields, $ID = false)
{
/** @global CMain $APPLICATION */
global $APPLICATION;
$arMsg = array();
if (!is_set($arFields, "TASK_ID")) {
$arMsg[] = array("text" => GetMessage("TASKS_BAD_TASK_ID"), "id" => "ERROR_TASKS_BAD_TASK_ID");
} else {
/** @noinspection PhpDeprecationInspection */
$r = CTasks::GetByID($arFields["TASK_ID"], false);
if (!$r->Fetch()) {
$arMsg[] = array("text" => GetMessage("TASKS_BAD_TASK_ID_EX"), "id" => "ERROR_TASKS_BAD_TASK_ID_EX");
}
}
if (!is_set($arFields, "USER_ID")) {
$arMsg[] = array("text" => GetMessage("TASKS_BAD_USER_ID"), "id" => "ERROR_TASKS_BAD_USER_ID");
} else {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
$r = CUser::GetByID($arFields["USER_ID"]);
if (!$r->Fetch()) {
$arMsg[] = array("text" => GetMessage("TASKS_BAD_USER_ID_EX"), "id" => "ERROR_TASKS_BAD_USER_ID_EX");
}
}
if (!empty($arMsg)) {
$e = new CAdminException($arMsg);
$APPLICATION->ThrowException($e);
return false;
}
//Defaults
if (!is_set($arFields, "TYPE") || !in_array($arFields["TYPE"], array("A", "U"))) {
$arFields["TYPE"] = "A";
}
return true;
}
示例9: __mpl_get_avatar
function __mpl_get_avatar()
{
global $USER;
static $avatar = null;
if ($avatar == null)
{
$avatar = '/bitrix/images/1.gif';
if ($USER->IsAuthorized())
{
$u = CUser::GetByID($USER->GetID())->Fetch();
if ($u["PERSONAL_PHOTO"])
{
$res = CFile::ResizeImageGet(
$u["PERSONAL_PHOTO"],
array('width' => 58, 'height' => 58),
BX_RESIZE_IMAGE_EXACT,
false
);
if ($res["src"])
$avatar = $res["src"];
}
}
}
return $avatar;
}
示例10: CheckFields
function CheckFields($ACTION, &$arFields, $ID = 0)
{
if ((is_set($arFields, "USER_ID") || $ACTION == "ADD") && IntVal($arFields["USER_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("Empty user field", "EMPTY_USER_ID");
return false;
}
if ((is_set($arFields, "ITEM") || $ACTION == "ADD") && strlen($arFields["ITEM"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("Empty item field", "EMPTY_ITEM");
return false;
}
if ((is_set($arFields, "ITEM_MD5") || $ACTION == "ADD") && strlen($arFields["ITEM_MD5"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("Empty item md5 field", "EMPTY_ITEM_MD5");
return false;
}
if ((is_set($arFields, "DATE_INSERT") || $ACTION == "ADD") && strlen($arFields["DATE_INSERT"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("Empty date insert field", "EMPTY_DATE_INSERT");
return false;
}
if (is_set($arFields, "ITEM_MD5")) {
$arFields["ITEM_MD5"] = md5($arFields["ITEM_MD5"]);
}
if (is_set($arFields, "USER_ID")) {
$dbUser = CUser::GetByID($arFields["USER_ID"]);
if (!$dbUser->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["USER_ID"], GetMessage("SGMA_NO_USER")), "ERROR_NO_USER_ID");
return false;
}
}
return True;
}
示例11: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
if ((is_set($arFields, "USER_ID") || $ACTION == "ADD") && IntVal($arFields["USER_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("Empty user field", "EMPTY_USER_ID");
return false;
}
if ((is_set($arFields, "CURRENCY") || $ACTION == "ADD") && strlen($arFields["CURRENCY"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("Empty currency field", "EMPTY_CURRENCY");
return false;
}
if ((is_set($arFields, "TRANSACT_DATE") || $ACTION == "ADD") && strlen($arFields["TRANSACT_DATE"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("Empty transaction date field", "EMPTY_TRANSACT_DATE");
return false;
}
if (is_set($arFields, "AMOUNT") || $ACTION == "ADD") {
$arFields["AMOUNT"] = str_replace(",", ".", $arFields["AMOUNT"]);
$arFields["AMOUNT"] = DoubleVal($arFields["AMOUNT"]);
}
if ((is_set($arFields, "DEBIT") || $ACTION == "ADD") && $arFields["DEBIT"] != "Y") {
$arFields["DEBIT"] = "N";
}
if (is_set($arFields, "USER_ID")) {
$dbUser = CUser::GetByID($arFields["USER_ID"]);
if (!$dbUser->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["USER_ID"], GetMessage("SKGUT_NO_USER")), "ERROR_NO_USER_ID");
return false;
}
}
return True;
}
示例12: __wd_get_root_section
function __wd_get_root_section($IBLOCK_ID, $object, $object_id)
{
$result = CIBlockWebdavSocnet::GetSectionID($IBLOCK_ID, $object, $object_id);
if (intval($result) > 0) {
return $result;
} else {
__wd_check_uf_use_bp_property($arParams["IBLOCK_ID"]);
$arFields = array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE" => "Y", "SOCNET_GROUP_ID" => false, "IBLOCK_SECTION_ID" => 0, "UF_USE_BP" => "N");
if ($object == "user") {
$dbUser = CUser::GetByID($object_id);
$arUser = $dbUser->Fetch();
$arFields["NAME"] = trim($arUser['LAST_NAME'] . " " . $arUser['FIRST_NAME']);
$arFields["NAME"] = trim(!empty($arFields["NAME"]) ? $arFields["NAME"] : $arUser['LOGIN']);
$arFields['CREATED_BY'] = $arUser['ID'];
$arFields['MODIFIED_BY'] = $arUser['ID'];
if (CIBlock::GetArrayByID($IBLOCK_ID, "RIGHTS_MODE") === "E") {
$arTasks = CWebDavIblock::GetTasks();
$arFields['RIGHTS'] = array('n0' => array('GROUP_CODE' => 'U' . $object_id, 'TASK_ID' => $arTasks['X']));
}
} else {
/* $res = CSocNetGroup::GetByID($arResult["VARIABLES"]["group_id"]);
if (!$res)
{
$arParams["ERROR_MESSAGE"] = GetMessage("SONET_GROUP_NOT_EXISTS");
return 0;
} */
$arFields["SOCNET_GROUP_ID"] = $object_id;
//$arGroup = CSocNetGroup::GetByID($object_id);
$arFields["NAME"] = GetMessage("SONET_GROUP_PREFIX") . $object_id;
$dbGroup = CSocNetGroup::GetList(array(), array("ID" => (int) $object_id), false, false, array("ID", "SITE_ID", "NAME"));
if ($arGroup = $dbGroup->Fetch()) {
$arFields["NAME"] = GetMessage("SONET_GROUP_PREFIX") . $arGroup["NAME"];
}
if (CIBlock::GetArrayByID($IBLOCK_ID, "RIGHTS_MODE") === "E") {
$arTasks = CWebDavIblock::GetTasks();
$arFields['RIGHTS'] = array('n0' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_A', 'TASK_ID' => $arTasks['X']), 'n1' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_E', 'TASK_ID' => $arTasks['W']), 'n2' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_K', 'TASK_ID' => $arTasks['W']));
}
}
if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
\Bitrix\Disk\Driver::getInstance()->addGroupStorage($arFields["SOCNET_GROUP_ID"]);
}
$GLOBALS["UF_USE_BP"] = $arFields["UF_USE_BP"];
$GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $IBLOCK_ID . "_SECTION", $arFields);
$bs = new CIBlockSection();
$sectionID = $bs->Add($arFields);
if (!$sectionID) {
$arParams["ERROR_MESSAGE"] = $bs->LAST_ERROR;
return 0;
}
WDClearComponentCache(array("webdav.element.edit", "webdav.element.hist", "webdav.element.upload", "webdav.element.view", "webdav.menu", "webdav.section.edit", "webdav.section.list"));
return true;
/*
if ($ob->workflow == 'bizproc')
{
__wd_create_default_bp_user_and_groups($arBizProcParameters);
}
*/
}
}
示例13: UserInfo
function UserInfo($USER_ID)
{
if(intval($USER_ID) <= 0)
return "";
$user = CUser::GetByID($USER_ID);
if($user_arr = $user->Fetch())
return '[<a title="'.GetMessage("MAIN_USER_PROFILE").'" href="user_edit.php?ID='.$user_arr["ID"].'&lang='.LANG.'">'.$user_arr["ID"].'</a>] ('.htmlspecialcharsbx($user_arr["LOGIN"]).') '.htmlspecialcharsbx($user_arr["NAME"]).' '.htmlspecialcharsbx($user_arr["LAST_NAME"]);
}
示例14: __wd_create_default_bp_user_and_groups
function __wd_create_default_bp_user_and_groups($arr)
{
if($handle = opendir($_SERVER['DOCUMENT_ROOT'].'/'.BX_ROOT.'/modules/bizproc/templates'))
{
$documentType = array("webdav", "CIBlockDocumentWebdavSocnet", $arr["document_type"]);
while(false !== ($file = readdir($handle)))
{
if(!is_file($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/bizproc/templates/'.$file))
{
continue;
}
$arFields = false;
include($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/bizproc/templates/'.$file);
if(is_array($arFields))
{
$arFields["DOCUMENT_TYPE"] = $documentType;
$arFields["SYSTEM_CODE"] = $file;
$arFields["USER_ID"] = $GLOBALS['USER']->GetID();
array_walk_recursive($arFields["TEMPLATE"], "__wd_replace_user_and_groups", $arr);
if ($file == "status.php")
{
$arFields["AUTO_EXECUTE"] = CBPDocumentEventType::Create;
if (!empty($arFields["PARAMETERS"]) && !empty($arFields["PARAMETERS"]["Approvers"]))
{
$name = "";
if ($GLOBALS["USER"]->IsAuthorized() && $arr["owner"] == $GLOBALS["USER"]->GetID())
{
$name = trim($GLOBALS["USER"]->GetFirstName()." ".$GLOBALS["USER"]->GetLastName());
$name = (empty($name) ? $GLOBALS["USER"]->GetLogin() : $name);
}
else
{
$dbUser = CUser::GetByID($arr["owner"]);
$arUser = $dbUser->Fetch();
$name = trim($arUser["NAME"]." ".$arUser["LAST_NAME"]);
$name = (empty($name) ? $arUser["LOGIN"] : $name);
}
$arFields["PARAMETERS"]["Approvers"]["Default"] = $name.' ['.$arr["owner"].']';
}
}
try
{
CBPWorkflowTemplateLoader::Add($arFields);
}
catch (Exception $e)
{
}
}
}
closedir($handle);
}
}
示例15: getByUser
public static function getByUser($user_id = false)
{
global $USER;
if ($USER->IsAuthorized() && !$user_id) {
$user_id = $USER->GetID();
}
$rsUser = \CUser::GetByID($user_id);
$arUser = $rsUser->Fetch();
return json_decode($arUser["UF_STATISTIC"], true);
}