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


PHP CUser::formatName方法代码示例

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


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

示例1: 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

示例2: getDestinations

 protected function getDestinations()
 {
     if ($this->taskPostData === null) {
         return array();
     }
     $members = array();
     if (!empty($this->taskPostData['RESPONSIBLE_ID'])) {
         $members[] = array("NAME" => \CUser::formatName('#NAME# #LAST_NAME#', array('NAME' => $this->taskPostData['RESPONSIBLE_NAME'], 'LAST_NAME' => $this->taskPostData['RESPONSIBLE_LAST_NAME'], 'SECOND_NAME' => $this->taskPostData['RESPONSIBLE_SECOND_NAME'], 'ID' => $this->taskPostData['RESPONSIBLE_ID'], 'LOGIN' => $this->taskPostData['RESPONSIBLE_LOGIN']), true, false), "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $this->taskPostData['RESPONSIBLE_ID'])), 'AVATAR_SRC' => Ui\Avatar::getPerson($this->taskPostData['RESPONSIBLE_PHOTO']), "IS_EXTRANET" => "N");
     }
     if (!empty($this->taskPostData['CREATED_BY'])) {
         $members[] = array("NAME" => \CUser::formatName('#NAME# #LAST_NAME#', array('NAME' => $this->taskPostData['CREATED_BY_NAME'], 'LAST_NAME' => $this->taskPostData['CREATED_BY_LAST_NAME'], 'SECOND_NAME' => $this->taskPostData['CREATED_BY_SECOND_NAME'], 'ID' => $this->taskPostData['CREATED_BY'], 'LOGIN' => $this->taskPostData['CREATED_BY_LOGIN']), true, false), "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $this->taskPostData['CREATED_BY'])), 'AVATAR_SRC' => Ui\Avatar::getPerson($this->taskPostData['CREATED_BY_PHOTO']), "IS_EXTRANET" => "N");
     }
     return $members;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:14,代码来源:taskconnector.php

示例3: 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

示例4: getDestinations

 protected function getDestinations()
 {
     $isExtranetInstalled = Loader::includeModule("extranet");
     $members = array();
     if ($this->blogPostData["HAS_SOCNET_ALL"] != "Y") {
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         $perm = \CBlogPost::getSocnetPermsName($this->entityId);
         foreach ($perm as $type => $v) {
             foreach ($v as $vv) {
                 if ($type == "SG") {
                     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
                     if ($socNetGroup = \CSocNetGroup::getByID($vv["ENTITY_ID"])) {
                         $name = $socNetGroup["~NAME"];
                         $link = \CComponentEngine::makePathFromTemplate($this->getPathToGroup(), array("group_id" => $vv["ENTITY_ID"]));
                         $groupSiteID = false;
                         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
                         $queryGroupSite = \CSocNetGroup::getSite($vv["ENTITY_ID"]);
                         while ($groupSite = $queryGroupSite->fetch()) {
                             /** @noinspection PhpDynamicAsStaticMethodCallInspection */
                             if (!$isExtranetInstalled || $groupSite["LID"] != \CExtranet::getExtranetSiteID()) {
                                 $groupSiteID = $groupSite["LID"];
                                 break;
                             }
                         }
                         if ($groupSiteID) {
                             /** @noinspection PhpDynamicAsStaticMethodCallInspection */
                             $tmp = \CSocNetLogTools::processPath(array("GROUP_URL" => $link), $this->getUser()->getId(), $groupSiteID);
                             // user_id is not important parameter
                             $link = strlen($tmp["URLS"]["GROUP_URL"]) > 0 ? $tmp["URLS"]["GROUP_URL"] : $link;
                         }
                         $isExtranet = is_array($GLOBALS["arExtranetGroupID"]) && in_array($vv["ENTITY_ID"], $GLOBALS["arExtranetGroupID"]);
                         $members[] = array("NAME" => $name, "LINK" => $link, 'AVATAR_SRC' => Ui\Avatar::getGroup($socNetGroup['IMAGE_ID']), "IS_EXTRANET" => $isExtranet ? "Y" : "N");
                     }
                 } elseif ($type == "U") {
                     if (in_array("US" . $vv["ENTITY_ID"], $vv["ENTITY"])) {
                         array_unshift($members, array("NAME" => Loc::getMessage('DISK_UF_BLOG_POST_CONNECTOR_MEMBERS_ALL'), "LINK" => null, 'AVATAR_SRC' => Ui\Avatar::getDefaultGroup(), "IS_EXTRANET" => "N"));
                     } else {
                         $name = \CUser::formatName('#NAME# #LAST_NAME#', array("NAME" => $vv["~U_NAME"], "LAST_NAME" => $vv["~U_LAST_NAME"], "SECOND_NAME" => $vv["~U_SECOND_NAME"], "LOGIN" => $vv["~U_LOGIN"], "NAME_LIST_FORMATTED" => ""), false);
                         $isExtranet = is_array($GLOBALS["arExtranetUserID"]) && in_array($vv["ENTITY_ID"], $GLOBALS["arExtranetUserID"]);
                         $members[] = array("NAME" => $name, "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $vv["ENTITY_ID"])), 'AVATAR_SRC' => Ui\Avatar::getPerson($vv['U_PERSONAL_PHOTO']), "IS_EXTRANET" => $isExtranet ? "Y" : "N");
                     }
                 } elseif ($type == "DR") {
                     $members[] = array("NAME" => $vv["EL_NAME"], "LINK" => null, 'AVATAR_SRC' => Ui\Avatar::getDefaultGroup(), "IS_EXTRANET" => "N");
                 }
             }
         }
     } else {
         $members[] = array("NAME" => Loc::getMessage('DISK_UF_BLOG_POST_CONNECTOR_MEMBERS_ALL'), "LINK" => null, 'AVATAR_SRC' => Ui\Avatar::getDefaultGroup(), "IS_EXTRANET" => "N");
     }
     return $members;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:51,代码来源:blogpostconnector.php

示例5: array

	</form>
</div>
<?php 
CJSCore::Init(array('admin_interface'));
$arResult['ROWS_COUNT'] = $arResult['NAV_OBJECT']->selectedRowsCount();
$arRows = array();
foreach ($arResult["USERS"] as $user) {
    $arCols = array('NAME' => '<table id="user_' . $user['ID'] . '" style="border-collapse: collapse; border: none; ">
			<tr>
				<td style="border: none !important; padding: 0px !important; ">
					<div style="width: 32px; height: 32px; margin-top:4px; border-radius: 50%; overflow: hidden;">
						<a href="' . $user['DETAIL_URL'] . '">' . $user['PHOTO_THUMB'] . '</a>
					</div>
				</td>
				<td style="border: none !important; padding: 0px 0px 0px 7px !important; vertical-align: middle; ">
					<a href="' . $user['DETAIL_URL'] . '"><b>' . CUser::formatName(CSite::getNameFormat(), $user, true, true) . '</b></a><br>
					' . htmlspecialcharsbx($user['WORK_POSITION']) . '
				</td>
			</tr>
		</table>', 'UF_PHONE_INNER' => '<span id="innerphone_' . $user['ID'] . '">' . $user["UF_PHONE_INNER"] . '</span>', 'UF_VI_BACKPHONE' => '<span id="backphone_' . $user['ID'] . '">' . (array_key_exists($user["UF_VI_BACKPHONE"], $numbers) ? $numbers[$user["UF_VI_BACKPHONE"]] : GetMessage('VI_NUMBERS_DEFAULT')) . '</span>' . '<span id="backphone_' . $user['ID'] . '_value" style="display:none;">' . $user["UF_VI_BACKPHONE"] . '</span>');
    $arCols['UF_VI_PHONE'] = '<span id="vi_phone_' . $user['ID'] . '"' . ($user["UF_VI_PHONE"] == "Y" ? ' class="bx-vi-phone-enable"' : '') . '>' . ($user["UF_VI_PHONE"] == "Y" ? GetMessage('VI_NUMBERS_PHONE_DEVICE_ENABLE') : GetMessage('VI_NUMBERS_PHONE_DEVICE_DISABLE')) . '</span>' . '<span style="display:none" id="vi_phone_enable_' . $user['ID'] . '">' . ($user["UF_VI_PHONE"] == "Y" ? 'Y' : 'N') . '</span>';
    $arCols['EDIT'] = '<span id="create_' . $user['ID'] . '">' . '<a href="#" onclick="BX.Voximplant.Numbers.edit(' . $user['ID'] . '); return false; ">' . GetMessage('VI_NUMBERS_EDIT') . '</a>' . '</span>';
    $arRows[$user['ID']] = array('data' => $user, 'columns' => $arCols);
}
$arResult['ROWS'] = $arRows;
$arHeaders = array(array('id' => 'NAME', 'name' => GetMessage('VI_NUMBERS_GRID_NAME'), 'sort' => 'name', 'default' => true, 'editable' => false), array('id' => 'UF_PHONE_INNER', 'name' => GetMessage('VI_NUMBERS_GRID_CODE'), 'default' => true, 'editable' => false), array('id' => 'UF_VI_BACKPHONE', 'name' => GetMessage('VI_NUMBERS_GRID_PHONE'), 'default' => true, 'editable' => false));
$arHeaders[] = array('id' => 'UF_VI_PHONE', 'name' => GetMessage('VI_NUMBERS_GRID_PHONE_DEVICE'), 'default' => true, 'editable' => false);
$arHeaders[] = array('id' => 'EDIT', 'name' => '', 'default' => true, 'editable' => false);
$APPLICATION->IncludeComponent('bitrix:main.interface.grid', '', array('GRID_ID' => $arResult['GRID_ID'], 'HEADERS' => $arHeaders, 'ROWS' => $arResult['ROWS'], 'NAV_OBJECT' => $arResult['NAV_OBJECT']));
?>
<div style="padding-top: 30px;">
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:template.php

示例6: pow

        $pval = $pval * $zval + $dx[$i];
    }
    $pval = pow($pval, -16);
    $pval = 0.5 - abs($pval - 0.5);
    return $pval;
}
if ($abtest['START_DATE'] || $abtest['STOP_DATE']) {
    $math = array('pwr' => false, 'sgn' => false);
    if ($abtest['MIN_AMOUNT'] > 0) {
        if (min($arGroupABaseRate['DENOMINATOR'], $arGroupBBaseRate['DENOMINATOR']) >= $abtest['MIN_AMOUNT']) {
            $pval = pvalue($arGroupABaseRate['RATE'], $arGroupBBaseRate['RATE'], $arGroupABaseRate['DENOMINATOR'], $arGroupBBaseRate['DENOMINATOR']);
            $math = array('pwr' => true, 'sgn' => $pval < 0.05);
        }
    }
}
$user_name = $abtest['USER_ID'] ? CUser::formatName(CSite::getNameFormat(), array('TITLE' => $abtest['USER_TITLE'], 'NAME' => $abtest['USER_NAME'], 'SECOND_NAME' => $abtest['USER_SECOND_NAME'], 'LAST_NAME' => $abtest['USER_LAST_NAME'], 'LOGIN' => $abtest['USER_LOGIN']), true, true) : false;
?>

<tr><td>

<div class="stat-item-block-container abtest-report-container">
	<div class="stat-item-container item-test-info">
		<?php 
if ($user_name) {
    ?>
		<span class="ab-test-info ab-test-info-right"><?php 
    echo getMessage($abtest['ACTIVE'] == 'Y' ? 'ABTEST_STARTED_BY' : 'ABTEST_STOPPED_BY');
    ?>
: <a href="/bitrix/admin/user_edit.php?ID=<?php 
    echo intval($abtest['USER_ID']);
    ?>
开发者ID:Hawkart,项目名称:megatv,代码行数:31,代码来源:abtest_report.php

示例7: getFormattedName

 public function getFormattedName()
 {
     if ($this->formattedName === null) {
         $this->formattedName = \CUser::formatName('#NAME# #LAST_NAME#', array('NAME' => $this->name, 'LAST_NAME' => $this->lastName, 'SECOND_NAME' => $this->secondName, 'EMAIL' => $this->email, 'ID' => $this->id, 'LOGIN' => $this->login), true, false);
     }
     return $this->formattedName;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:7,代码来源:user.php

示例8: executeManagePage


//.........这里部分代码省略.........
                        }
                    } else {
                        if ($service['type'] == 'crdomain') {
                            $crUsers = CControllerClient::ExecuteEvent('OnMailControllerGetMemberUsers', array('DOMAIN' => $service['server']));
                            if (!empty($crUsers['result']) && is_array($crUsers['result'])) {
                                $service['users'][$service['server']] = $crUsers['result'];
                            }
                        }
                    }
                    $dbMailboxes = CMailbox::getList(array('TIMESTAMP_X' => 'ASC'), array('ACTIVE' => 'Y', '!USER_ID' => 0, 'SERVICE_ID' => $service['id']));
                    while ($mailbox = $dbMailboxes->fetch()) {
                        list($login, $domain) = explode('@', $mailbox['LOGIN'], 2);
                        if (!empty($service['users'][$domain]) && ($key = array_search($login, $service['users'][$domain])) !== false) {
                            array_splice($service['users'][$domain], $key, 1);
                        }
                    }
                    $this->arParams['SERVICES'][] = $service;
                }
            }
        }
        $this->arResult['GRID_ID'] = 'manage_domain_grid';
        $gridOptions = new CGridOptions($this->arResult['GRID_ID']);
        $arSort = $gridOptions->getSorting(array('sort' => array('ID' => 'ASC'), 'vars' => array('by' => 'by', 'order' => 'order')));
        $arNav = $gridOptions->getNavParams(array('nPageSize' => 50));
        $arSortArg = each($arSort['sort']);
        $arFilter = array('ACTIVE' => 'Y', '!UF_DEPARTMENT' => false);
        if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'search' && !empty($_REQUEST['FILTER'])) {
            $this->arResult['FILTER'] = $_REQUEST['FILTER'];
            $userIds = array();
            $dbMailboxes = CMailbox::getList(array('TIMESTAMP_X' => 'ASC'), array('LID' => SITE_ID, 'ACTIVE' => 'Y', '!USER_ID' => 0, 'LOGIN' => $_REQUEST['FILTER']));
            while ($mailbox = $dbMailboxes->fetch()) {
                if (in_array($mailbox['SERVER_TYPE'], array('imap', 'controller', 'domain'))) {
                    $userIds[] = $mailbox['USER_ID'];
                }
            }
            $arFilter['ID'] = empty($userIds) ? 0 : join('|', $userIds);
        }
        $dbUsers = CUser::GetList($arSortArg['key'], $arSortArg['value'], $arFilter, array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'PERSONAL_PHOTO', 'WORK_POSITION')));
        $dbUsers->navStart($arNav['nPageSize']);
        $arRows = array();
        while ($user = $dbUsers->fetch()) {
            $user['DETAIL_URL'] = COption::getOptionString('intranet', 'search_user_url', '/user/#ID#/');
            $user['DETAIL_URL'] = str_replace(array('#ID#', '#USER_ID#'), array($user['ID'], $user['ID']), $user['DETAIL_URL']);
            $user['PHOTO_THUMB'] = '<img src="/bitrix/components/bitrix/main.user.link/templates/.default/images/nopic_30x30.gif" border="0" alt="" width="32" height="32">';
            if (intval($user['PERSONAL_PHOTO']) > 0) {
                $imageFile = CFile::getFileArray($user['PERSONAL_PHOTO']);
                if ($imageFile !== false) {
                    $arFileTmp = CFile::resizeImageGet($imageFile, array('width' => 42, 'height' => 42), BX_RESIZE_IMAGE_EXACT, false);
                    $user['PHOTO_THUMB'] = CFile::showImage($arFileTmp['src'], 32, 32);
                }
            }
            $anchor_id = RandString(8);
            $arCols = array('NAME' => '<table id="user_' . $user['ID'] . '" style="border-collapse: collapse; border: none; ">
					<tr>
						<td style="border: none !important; padding: 0px !important; ">
							<div style="width: 32px; height: 32px; margin:2px; padding: 2px; box-shadow:0 0 2px 1px rgba(0, 0, 0, 0.1);">
								<a href="' . $user['DETAIL_URL'] . '">' . $user['PHOTO_THUMB'] . '</a>
							</div>
						</td>
						<td style="border: none !important; padding: 0px 0px 0px 7px !important; vertical-align: top; ">
							<a href="' . $user['DETAIL_URL'] . '"><b>' . CUser::formatName(CSite::getNameFormat(), $user, true, true) . '</b></a><br>
							' . htmlspecialcharsbx($user['WORK_POSITION']) . '
						</td>
					</tr>
				</table>', 'EMAIL' => '', 'ADD' => '', 'DELETE' => '');
            if ($mailbox = CIntranetMailSetupHelper::getUserMailbox($user['ID'])) {
                switch ($mailbox['SERVER_TYPE']) {
                    case 'imap':
                        $arCols['EMAIL'] = $mailbox['LOGIN'];
                        if (strpos($mailbox['LOGIN'], '@') === false) {
                            $arCols['EMAIL'] .= '<br><span style="font-weight: normal; ">imap://' . $mailbox['SERVER'] . ':' . $mailbox['PORT'] . '</span>';
                        }
                        $arCols['ADD'] = '<a href="#" onclick="mb.create(' . $user['ID'] . '); return false; ">' . GetMessage('INTR_MAIL_MANAGE_CHANGE') . '</a>';
                        break;
                    case 'controller':
                    case 'domain':
                    case 'crdomain':
                        $arCols['EMAIL'] = $mailbox['LOGIN'];
                        $arCols['ADD'] = '<a href="#" onclick="mb.create(' . $user['ID'] . '); return false; ">' . GetMessage('INTR_MAIL_MANAGE_CHANGE') . '</a><br><a href="#" onclick="mb.changePassword(' . $user['ID'] . '); return false; ">' . GetMessage('INTR_MAIL_MANAGE_PASSWORD') . '</a>';
                        $arCols['DELETE'] = '<a href="#" onclick="mb.remove(' . $user['ID'] . '); return false; ">' . GetMessage('INTR_MAIL_MANAGE_DELETE') . '</a>';
                        break;
                }
            } else {
                $arCols['ADD'] = '<a href="#" onclick="mb.create(' . $user['ID'] . '); return false; ">' . GetMessage('INTR_MAIL_MANAGE_CREATE') . '</a>';
            }
            if (empty($this->arParams['SERVICES'])) {
                $arCols['ADD'] = '';
                $arCols['DELETE'] = '';
            }
            $arCols['EMAIL'] = '<span id="email_' . $user['ID'] . '" style="font-weight: bold; white-space: nowrap; ">' . $arCols['EMAIL'] . '</span>';
            $arCols['ADD'] = '<span id="create_' . $user['ID'] . '" style="white-space: nowrap; ">' . $arCols['ADD'] . '</span>';
            $arCols['DELETE'] = '<span id="delete_' . $user['ID'] . '" style="white-space: nowrap; ">' . $arCols['DELETE'] . '</span>';
            $arRows[$user['ID']] = array('data' => $user, 'columns' => $arCols);
        }
        $this->arResult['ROWS'] = $arRows;
        $this->arResult['ROWS_COUNT'] = $dbUsers->selectedRowsCount();
        $this->arResult['NAV_OBJECT'] = $dbUsers;
        $this->arResult['NAV_OBJECT']->bShowAll = false;
        $this->includeComponentTemplate('manage');
    }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:class.php

示例9: getMembersOfSharing

 /**
  * Returns list users who have sharing on this object.
  * @return array
  * @throws \Bitrix\Main\ArgumentException
  * @throws \Bitrix\Main\LoaderException
  */
 public function getMembersOfSharing()
 {
     $sharings = $this->getRealObject()->getSharingsAsReal();
     $members = array();
     $membersToSharing = array();
     foreach ($sharings as $sharing) {
         if ($sharing->isToDepartmentChild()) {
             continue;
         }
         list($type, $id) = Sharing::parseEntityValue($sharing->getToEntity());
         $members[$type][] = $id;
         $membersToSharing[$type . '|' . $id] = $sharing;
     }
     unset($sharing);
     $enabledSocialnetwork = Loader::includeModule('socialnetwork');
     $entityList = array();
     foreach (SharingTable::getListOfTypeValues() as $type) {
         if (empty($members[$type])) {
             continue;
         }
         if ($type == SharingTable::TYPE_TO_USER) {
             $query = \Bitrix\Main\UserTable::getList(array('select' => array('ID', 'PERSONAL_PHOTO', 'NAME', 'LOGIN', 'LAST_NAME', 'SECOND_NAME'), 'filter' => array('ID' => array_values($members[$type]))));
             while ($userRow = $query->fetch()) {
                 /** @var Sharing $sharing */
                 $sharing = $membersToSharing[$type . '|' . $userRow['ID']];
                 $entityList[] = array('entityId' => Sharing::CODE_USER . $userRow['ID'], 'name' => \CUser::formatName('#NAME# #LAST_NAME#', array("NAME" => $userRow['NAME'], "LAST_NAME" => $userRow['LAST_NAME'], "SECOND_NAME" => $userRow['SECOND_NAME'], "LOGIN" => $userRow['LOGIN']), false), 'right' => $sharing->getTaskName(), 'avatar' => Avatar::getPerson($userRow['PERSONAL_PHOTO']), 'type' => 'users');
             }
         } elseif ($type == SharingTable::TYPE_TO_GROUP && $enabledSocialnetwork) {
             $query = \CSocNetGroup::getList(array(), array('ID' => array_values($members[$type])), false, false, array('ID', 'IMAGE_ID', 'NAME'));
             while ($query && ($groupRow = $query->fetch())) {
                 /** @var Sharing $sharing */
                 $sharing = $membersToSharing[$type . '|' . $groupRow['ID']];
                 $entityList[] = array('entityId' => Sharing::CODE_SOCNET_GROUP . $groupRow['ID'], 'name' => $groupRow['NAME'], 'right' => $sharing->getTaskName(), 'avatar' => Avatar::getGroup($groupRow['IMAGE_ID']), 'type' => 'groups');
             }
         } elseif ($type == SharingTable::TYPE_TO_DEPARTMENT && $enabledSocialnetwork) {
             // intranet structure
             $structure = \CSocNetLogDestination::getStucture();
             foreach (array_values($members[$type]) as $departmentId) {
                 if (empty($structure['department']['DR' . $departmentId])) {
                     continue;
                 }
                 /** @var Sharing $sharing */
                 $sharing = $membersToSharing[$type . '|' . $departmentId];
                 $entityList[] = array('entityId' => Sharing::CODE_DEPARTMENT . $departmentId, 'name' => $structure['department']['DR' . $departmentId]['name'], 'right' => $sharing->getTaskName(), 'avatar' => Avatar::getDefaultGroup(), 'type' => 'department');
             }
             unset($departmentId);
         }
     }
     unset($type);
     return $entityList;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:57,代码来源:baseobject.php

示例10: 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

示例11: getUserName

 public static function getUserName($user)
 {
     if (!is_array($user) && intVal($user) > 0) {
         $user = self::getUser($user);
     }
     if (!$user || !is_array($user)) {
         return '';
     }
     return CUser::formatName(self::$userNameTemplate, $user, self::$showLogin, false);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:10,代码来源:tools.php

示例12: getTemplateData

 protected function getTemplateData()
 {
     $this->arResult['NAV_RESULT'] = "";
     $this->arResult['TEMPLATES'] = array();
     $this->arResult['GRID_TEMPLATES'] = array();
     $this->arResult['CREATE_NEW_TEMPLATES'] = false;
     $this->arResult['PROMPT_OLD_TEMPLATE'] = false;
     $checkNewTemplate = false;
     $checkOldTemplate = false;
     foreach ($this->arParams['DOCUMENT_DATA'] as $nameModule => $data) {
         $result = CBPWorkflowTemplateLoader::getList(array('name' => 'asc'), array('DOCUMENT_TYPE' => $data["DOCUMENT_TYPE"]), false, false, array('ID', 'NAME', 'DESCRIPTION', 'MODIFIED', 'USER_ID', 'AUTO_EXECUTE', 'USER_NAME', 'USER_LAST_NAME', 'USER_LOGIN', 'ACTIVE', 'USER_SECOND_NAME'));
         if ($result) {
             $checklistTemplate = $result->fetch();
             if (!empty($checklistTemplate) && $nameModule == 'DISK') {
                 $checkNewTemplate = true;
             } elseif (!empty($checklistTemplate) && $nameModule == 'WEBDAV') {
                 $checkOldTemplate = true;
             }
             $result->NavStart(25, false);
             $this->arResult['NAV_RESULT'] = $result;
             $adminPage = $this->getApplication()->getCurPageParam('&action=delete&' . bitrix_sessid_get(), array('back_url', 'action', 'ID', 'sessid'));
             while ($res = $result->getNext()) {
                 $res['URL'] = array('EDIT' => CComponentEngine::makePathFromTemplate($this->arParams['~EDIT_URL'], array('ID' => $res['ID'])), 'DELETE' => $adminPage . '&ID=' . $res['ID']);
                 foreach ($res['URL'] as $key => $val) {
                     $res['URL']['~' . $key] = $val;
                     $res['URL'][$key] = htmlspecialcharsbx($val);
                 }
                 $res['USER'] = CUser::formatName($this->arParams['NAME_TEMPLATE'], array('NAME' => $res['~USER_NAME'], 'LAST_NAME' => $res['~USER_LAST_NAME'], 'SECOND_NAME' => $res['~USER_SECOND_NAME'], 'LOGIN' => $res['~USER_LOGIN']), true);
                 $autoExecuteText = array();
                 if ($res['AUTO_EXECUTE'] == CBPDocumentEventType::None) {
                     $autoExecuteText[] = Loc::getMessage('BPATT_AE_NONE');
                 }
                 if (($res['AUTO_EXECUTE'] & CBPDocumentEventType::Create) != 0) {
                     $autoExecuteText[] = Loc::getMessage('BPATT_AE_CREATE');
                 }
                 if (($res['AUTO_EXECUTE'] & CBPDocumentEventType::Edit) != 0) {
                     $autoExecuteText[] = Loc::getMessage('BPATT_AE_EDIT');
                 }
                 if (($res['AUTO_EXECUTE'] & CBPDocumentEventType::Delete) != 0) {
                     $autoExecuteText[] = Loc::getMessage('BPATT_AE_DELETE');
                 }
                 $res['AUTO_EXECUTE'] = $autoExecuteText;
                 $this->arResult['TEMPLATES'][$res['ID']] = $res;
                 $presentCreate = ($res['~AUTO_EXECUTE'] & CBPDocumentEventType::Create) != 0;
                 $url = $this->getApplication()->getCurPageParam('ID=' . $res['ID'] . '&action=create' . ($presentCreate ? 'present' : '') . '&' . bitrix_sessid_get(), array('back_url', 'action', 'ID', 'sessid'));
                 $presentEdit = ($res["~AUTO_EXECUTE"] & CBPDocumentEventType::Edit) != 0;
                 $url1 = $this->getApplication()->getCurPageParam('ID=' . $res["ID"] . '&action=edit' . ($presentEdit ? 'present' : '') . '&' . bitrix_sessid_get(), array('back_url', 'action', 'ID', 'sessid'));
                 $actions = array(array('ICONCLASS' => '', 'TITLE' => $presentCreate ? Loc::getMessage('BPATT_DO_N_LOAD_CREATE_TITLE') : Loc::getMessage('BPATT_DO_LOAD_CREATE_TITLE'), 'TEXT' => $presentCreate ? Loc::getMessage('BPATT_DO_N_LOAD_CREATE') : Loc::getMessage('BPATT_DO_LOAD_CREATE'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "');"), array('ICONCLASS' => '', 'TITLE' => $presentEdit ? Loc::getMessage('BPATT_DO_N_LOAD_EDIT_TITLE') : Loc::getMessage('BPATT_DO_LOAD_EDIT_TITLE'), 'TEXT' => $presentEdit ? Loc::getMessage('BPATT_DO_N_LOAD_EDIT') : Loc::getMessage('BPATT_DO_LOAD_EDIT'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($url1) . "');"));
                 $actions[] = array('SEPARATOR' => true);
                 if (isset($res['URL']['VARS'])) {
                     $actions[] = array('ICONCLASS' => "edit", 'TITLE' => Loc::getMessage('BPATT_DO_EDIT_VARS'), 'TEXT' => Loc::getMessage('BPATT_DO_EDIT_VARS1'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($res['URL']['~VARS']) . "');", 'DEFAULT' => false);
                 }
                 if (Loader::includeModule('bizprocdesigner')) {
                     $actions[] = array('ICONCLASS' => 'edit', 'TITLE' => Loc::getMessage('BPATT_DO_EDIT1'), 'TEXT' => Loc::getMessage('BPATT_DO_EDIT1'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($res['URL']['~EDIT']) . "');", 'DEFAULT' => true);
                 }
                 $actions[] = array('ICONCLASS' => "delete", 'TITLE' => Loc::getMessage('BPATT_DO_DELETE1'), 'TEXT' => Loc::getMessage('BPATT_DO_DELETE1'), 'ONCLICK' => "if(confirm('" . CUtil::JSEscape(Loc::getMessage('BPATT_DO_DELETE1_CONFIRM')) . "')){jsUtils.Redirect([], '" . CUtil::JSEscape($res['URL']['~DELETE']) . "')};");
                 if ($nameModule == 'WEBDAV') {
                     $res['NAME'] .= ' ' . Loc::getMessage('BPATT_DO_OLD_TEMPLATE');
                     $res['~NAME'] .= ' ' . Loc::getMessage('BPATT_DO_OLD_TEMPLATE');
                 }
                 $this->arResult['GRID_TEMPLATES'][$res['ID']] = array('id' => $res['ID'], 'data' => $res, 'actions' => $actions, 'columns' => array('NAME' => Loader::includeModule('bizprocdesigner') ? '<a href="' . $res['URL']['EDIT'] . '">' . $res['NAME'] . '</a>' : $res['NAME'], 'AUTO_EXECUTE' => implode("<br />", $res['AUTO_EXECUTE'])), 'editable' => false);
             }
         }
     }
     if ($checkOldTemplate) {
         $this->arResult['PROMPT_OLD_TEMPLATE'] = true;
         if (!$checkNewTemplate) {
             $this->arResult['CREATE_NEW_TEMPLATES'] = true;
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:71,代码来源:class.php


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