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' => ''));
             }
         }
     }
 }
Example #2
0
	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];
	}
 public function Execute()
 {
     if (!CModule::IncludeModule("forum")) {
         return CBPActivityExecutionStatus::Closed;
     }
     if (!CModule::IncludeModule("iblock")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $forumId = intval($this->ForumId);
     if ($forumId <= 0) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $iblockId = $this->IBlockId;
     $dbResult = CIBlockElement::GetProperty($iblockId, $documentId[2], false, false, array("CODE" => "FORUM_TOPIC_ID"));
     $arResult = $dbResult->Fetch();
     if (!$arResult) {
         $obProperty = new CIBlockProperty();
         $obProperty->Add(array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => "Forum topic", "CODE" => "FORUM_TOPIC_ID"));
         $obProperty->Add(array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => "Forum message count", "CODE" => "FORUM_MESSAGE_CNT"));
         $dbResult = CIBlockElement::GetProperty($iblockId, $documentId[2], false, false, array("CODE" => "FORUM_TOPIC_ID"));
         $arResult = $dbResult->Fetch();
     }
     $forumTopicId = intval($arResult["VALUE"]);
     $arForumUserTmp = $this->ForumUser;
     $arForumUser = CBPHelper::ExtractUsers($arForumUserTmp, $documentId, true);
     $forumUserId = 1;
     $forumUserName = "******";
     if ($arForumUser != null) {
         $forumUserId = $arForumUser;
         $dbResult = CUser::GetByID($forumUserId);
         if ($arResult = $dbResult->Fetch()) {
             $forumUserName = CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arResult, true);
         }
     }
     $newTopic = "N";
     if ($forumTopicId <= 0) {
         $documentService = $this->workflow->GetService("DocumentService");
         $document = $documentService->GetDocument($documentId);
         $newTopic = "Y";
         $arFields = array("TITLE" => $document["NAME"], "FORUM_ID" => $forumId, "USER_START_ID" => $forumUserId, "USER_START_NAME" => $forumUserName, "LAST_POSTER_NAME" => $forumUserName, "APPROVED" => "Y");
         $forumTopicId = CForumTopic::Add($arFields);
         CIBlockElement::SetPropertyValues($documentId[2], $iblockId, $forumTopicId, "FORUM_TOPIC_ID");
     }
     $arFields = array("POST_MESSAGE" => $this->ForumPostMessage, "AUTHOR_ID" => $forumUserId, "AUTHOR_NAME" => $forumUserName, "FORUM_ID" => $forumId, "TOPIC_ID" => $forumTopicId, "APPROVED" => "Y", "NEW_TOPIC" => $newTopic, "PARAM2" => $documentId[2]);
     $forumMessageId = CForumMessage::Add($arFields, false, array("SKIP_INDEXING" => "Y", "SKIP_STATISTIC" => "N"));
     return CBPActivityExecutionStatus::Closed;
 }
Example #4
0
 function getRelatedUser($firstUserID, $relationID)
 {
     $arRel = CSocNetUserRelations::GetByID($relationID);
     if ($arRel) {
         $secondUserID = $firstUserID == $arRel["FIRST_USER_ID"] ? $arRel["SECOND_USER_ID"] : $arRel["FIRST_USER_ID"];
         $dbUser = CUser::GetByID($secondUserID);
         if ($arUser = $dbUser->Fetch()) {
             return CUser::FormatName(CSite::GetNameFormat(false), $arUser, true);
         } else {
             return false;
         }
     } else {
         false;
     }
 }
Example #5
0
 protected function prepareData()
 {
     if (strlen(trim($this->arParams["NAME_TEMPLATE"])) <= 0) {
         $this->arParams["NAME_TEMPLATE"] = \CSite::GetNameFormat();
     }
     $dbPost = \CBlogPost::GetList(array(), array("ID" => $this->arParams["postId"]), false, false, array("ID", "BLOG_ID", "PUBLISH_STATUS", "TITLE", "AUTHOR", "ENABLE_COMMENTS", "NUM_COMMENTS", "VIEWS", "CODE", "MICRO", "DETAIL_TEXT", "DATE_PUBLISH", "CATEGORY_ID", "HAS_SOCNET_ALL", "HAS_TAGS", "HAS_IMAGES", "HAS_PROPS", "HAS_COMMENT_IMAGES"));
     if ($arPost = $dbPost->Fetch()) {
         if (strlen($arPost['TITLE']) > 30) {
             $arPost['TITLE'] = substr($arPost['TITLE'], 0, 30) . "...";
         }
         $this->arResult['POST'] = $arPost;
         $this->arResult['POST']['PUBLISH_STATUS_DESCRIPTION'] = Loc::getMessage('BLOG_POST_PUBLISH_STATUS_' . $arPost['PUBLISH_STATUS']);
         $this->arResult['POST']['AUTHOR_FORMATTED_NAME'] = \CUser::FormatName($this->arParams['NAME_TEMPLATE'], array('LOGIN' => $this->arResult['POST']['LOGIN'], 'NAME' => $this->arResult['POST']['NAME'], 'LAST_NAME' => $this->arResult['POST']['LAST_NAME']), true, false);
         $this->arResult["POST"]['AUTHOR_PROFILE'] = \CComponentEngine::MakePathFromTemplate($this->arParams["PATH_TO_USER_PROFILE"], array("user_id" => $this->arResult['POST']['AUTHOR']));
         $this->arResult["POST"]['AUTHOR_UNIQID'] = 'u_' . $this->randString();
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $GLOBALS['CACHE_MANAGER']->RegisterTag('blog_post_' . $this->arParams['postId']);
         }
     }
 }
Example #6
0
 function __format_user4search($userID = null, $nameTemplate = "")
 {
     global $USER;
     if ($userID == null) {
         $userID = $USER->GetID();
     }
     if (empty($nameTemplate)) {
         $nameTemplate = CSite::GetNameFormat(false);
     }
     $rUser = CUser::GetByID($userID);
     if ($rUser && ($arUser = $rUser->Fetch())) {
         $userName = CUser::FormatName($nameTemplate . ' [#ID#]', $arUser);
         if (!(strlen($arUser['NAME']) > 0 || strlen($arUser['LAST_NAME']) > 0)) {
             $userName .= ' [' . $arUser['ID'] . ']';
         }
     } else {
         $userName = '';
     }
     return $userName;
 }
 protected static function getEvent($arParams)
 {
     global $USER;
     $arEvents = CCalendarEvent::GetList(array('arFilter' => array("ID" => $arParams['ID'], "DELETED" => "N"), 'parseRecursion' => true, 'fetchAttendees' => true, 'checkPermissions' => true));
     if (is_array($arEvents) && count($arEvents) > 0) {
         $arEvent = $arEvents[0];
         if ($arEvent['IS_MEETING']) {
             $arGuests = $arEvent['~ATTENDEES'];
             $arEvent['GUESTS'] = array();
             foreach ($arGuests as $guest) {
                 $arEvent['GUESTS'][] = array('id' => $guest['USER_ID'], 'name' => CUser::FormatName(CSite::GetNameFormat(null, $arParams['SITE_ID']), $guest, true), 'status' => $guest['STATUS'], 'accessibility' => $guest['ACCESSIBILITY'], 'bHost' => $guest['USER_ID'] == $arEvent['MEETING_HOST']);
                 if ($guest['USER_ID'] == $USER->GetID()) {
                     $arEvent['STATUS'] = $guest['STATUS'];
                 }
             }
         }
         $set = CCalendar::GetSettings();
         $url = str_replace('#user_id#', $arEvent['CREATED_BY'], $set['path_to_user_calendar']) . '?EVENT_ID=' . $arEvent['ID'];
         return array('ID' => $arEvent['ID'], 'NAME' => $arEvent['NAME'], 'DETAIL_TEXT' => $arEvent['DESCRIPTION'], 'DATE_FROM' => $arEvent['DT_FROM'], 'DATE_TO' => $arEvent['DT_TO'], 'ACCESSIBILITY' => $arEvent['ACCESSIBILITY'], 'IMPORTANCE' => $arEvent['IMPORTANCE'], 'STATUS' => $arEvent['STATUS'], 'IS_MEETING' => $arEvent['IS_MEETING'] ? 'Y' : 'N', 'GUESTS' => $arEvent['GUESTS'], 'UF_WEBDAV_CAL_EVENT' => $arEvent['UF_WEBDAV_CAL_EVENT'], 'URL' => $url);
     }
 }
Example #8
0
 function GetUserName($USER_ID, $nameTemplate = "")
 {
     $ar_res = false;
     if (IntVal($USER_ID) > 0) {
         $db_res = CUser::GetByID(IntVal($USER_ID));
         $ar_res = $db_res->Fetch();
     }
     if (!$ar_res) {
         $db_res = CUser::GetByLogin($USER_ID);
         $ar_res = $db_res->Fetch();
     }
     $USER_ID = IntVal($ar_res["ID"]);
     $f_LOGIN = htmlspecialcharsex($ar_res["LOGIN"]);
     $forum_user = CForumUser::GetByUSER_ID($USER_ID);
     if ($forum_user["SHOW_NAME"] == "Y" && (strlen(trim($ar_res["NAME"])) > 0 || strlen(trim($ar_res["LAST_NAME"])) > 0)) {
         $nameTemplate = trim(empty($nameTemplate)) ? CSite::GetNameFormat() : $nameTemplate;
         return trim(CUser::FormatName($nameTemplate, array("NAME" => htmlspecialcharsEx($ar_res["NAME"]), "LAST_NAME" => htmlspecialcharsEx($ar_res["LAST_NAME"]), "SECOND_NAME" => htmlspecialcharsEx($ar_res["SECOND_NAME"]))));
     } else {
         return $f_LOGIN;
     }
 }
Example #9
0
 protected static function prepareUserNames(array $userIDs)
 {
     if (empty($userIDs)) {
         return array();
     }
     $results = array();
     foreach ($userIDs as $k => $v) {
         if (isset(self::$userNames[$v])) {
             $results[$v] = self::$userNames[$v];
             unset($userIDs[$v]);
         }
     }
     if (!empty($userIDs)) {
         $dbResult = \CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => implode('||', $userIDs)), array('FIELDS' => array('ID', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'TITLE')));
         $format = \CSite::GetNameFormat(false);
         while ($user = $dbResult->Fetch()) {
             $userID = (int) $user['ID'];
             $results[$userID] = \CUser::FormatName($format, $user, true, false);
         }
     }
     return $results;
 }
Example #10
0
 function __CrmQuickPanelViewPrepareResponsible($entityFields, $userProfilePath, $nameTemplate, $enableEdit, $editorID, $serviveUrl, $key = '', $useTildeKey = true)
 {
     if ($key === '') {
         $key = 'ASSIGNED_BY';
     }
     $map = array('ID' => ($useTildeKey ? '~' : '') . $key . '_ID', 'FORMATTED_NAME' => ($useTildeKey ? '~' : '') . $key . '_FORMATTED_NAME', 'LOGIN' => ($useTildeKey ? '~' : '') . $key . '_LOGIN', 'NAME' => ($useTildeKey ? '~' : '') . $key . '_NAME', 'LAST_NAME' => ($useTildeKey ? '~' : '') . $key . '_LAST_NAME', 'SECOND_NAME' => ($useTildeKey ? '~' : '') . $key . '_SECOND_NAME', 'PERSONAL_PHOTO' => ($useTildeKey ? '~' : '') . $key . '_PERSONAL_PHOTO', 'WORK_POSITION' => ($useTildeKey ? '~' : '') . $key . '_WORK_POSITION');
     $userID = isset($entityFields[$map['ID']]) ? $entityFields[$map['ID']] : 0;
     $formattedName = isset($entityFields[$map['FORMATTED_NAME']]) ? $entityFields[$map['FORMATTED_NAME']] : '';
     if ($formattedName === '') {
         $formattedName = CUser::FormatName($nameTemplate, array('LOGIN' => isset($entityFields[$map['LOGIN']]) ? $entityFields[$map['LOGIN']] : '', 'NAME' => isset($entityFields[$map['NAME']]) ? $entityFields[$map['NAME']] : '', 'LAST_NAME' => isset($entityFields[$map['LAST_NAME']]) ? $entityFields[$map['LAST_NAME']] : '', 'SECOND_NAME' => isset($entityFields[$map['SECOND_NAME']]) ? $entityFields[$map['SECOND_NAME']] : ''), true, false);
     }
     $photoID = isset($entityFields[$map['PERSONAL_PHOTO']]) ? $entityFields[$map['PERSONAL_PHOTO']] : 0;
     $photoUrl = '';
     if ($photoID > 0) {
         $file = new CFile();
         $fileInfo = $file->ResizeImageGet($photoID, array('width' => 38, 'height' => 38), BX_RESIZE_IMAGE_EXACT);
         if (is_array($fileInfo) && isset($fileInfo['src'])) {
             $photoUrl = $fileInfo['src'];
         }
     }
     return array('type' => 'responsible', 'enableCaption' => false, 'editable' => $enableEdit, 'data' => array('fieldID' => $useTildeKey ? substr($map['ID'], 1) : $map['ID'], 'userID' => $userID, 'name' => $formattedName, 'photoID' => $photoID, 'photoUrl' => $photoUrl, 'position' => isset($entityFields[$map['WORK_POSITION']]) ? $entityFields[$map['WORK_POSITION']] : '', 'profileUrlTemplate' => $userProfilePath, 'profileUrl' => CComponentEngine::makePathFromTemplate($userProfilePath, array('user_id' => $userID)), 'editorID' => $editorID, 'serviceUrl' => $serviveUrl, 'userInfoProviderID' => md5($serviveUrl)));
 }
Example #11
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
CUtil::InitJSCore(array('taskQuickPopups'));
$loggedInUserId = (int) $GLOBALS['USER']->GetID();
$loggedInUserFormattedName = '';
$rsUser = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => $loggedInUserId), array('FIELDS' => array('NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN')));
if ($arUser = $rsUser->Fetch()) {
    $loggedInUserFormattedName = CUser::FormatName(CSite::GetNameFormat(false), array('NAME' => $arUser['NAME'], 'LAST_NAME' => $arUser['LAST_NAME'], 'SECOND_NAME' => $arUser['SECOND_NAME'], 'LOGIN' => $arUser['LOGIN']), $bUseLogin = true, $bHtmlSpecialChars = false);
}
ob_start();
?>
	<div class="task-filter-popup" id="task-filter-popup" style="display: block;">
		<div class="task-filter-popup-header">
			<div class="task-filter-popup-name"><?php 
echo GetMessage('TASKS_FILTERV2_CONSTRUCTOR_FILTER_TITLE');
?>
</div>
			<div class="task-filter-popup-inp-wrap">
				<input type="text" value="" id="tasks-filter-name" class="task-filter-popup-inp"
					onkeyup="BX.Tasks.filterV2.engine.setFilterName({},this.value,{renderer : {skipRender: true}});"
					onchange="BX.Tasks.filterV2.engine.setFilterName({},this.value,{renderer : {skipRender: true}});">
			</div>
		</div>
		<div id="task-filter-popup-root-level" class="task-filter-popup-items-wrap task-filter-and"></div>
	</div>
<?php 
$html = ob_get_clean();
$href = '';
Example #12
0
         if ($arOneUser = $rsUsers->Fetch()) {
             $arOneUser['ID'] = intval($arOneUser['ID']);
             $arUserList[$arOneUser['ID']] = CUser::FormatName($strNameFormat, $arOneUser);
         }
     }
     if (isset($arUserList[$arDiscount['CREATED_BY']])) {
         $strCreatedBy = '<a href="/bitrix/admin/user_edit.php?lang=' . LANGUAGE_ID . '&ID=' . $arDiscount['CREATED_BY'] . '">' . $arUserList[$arDiscount['CREATED_BY']] . '</a>';
     }
 }
 $arDiscount['MODIFIED_BY'] = intval($arDiscount['MODIFIED_BY']);
 if (0 < $arDiscount['MODIFIED_BY']) {
     if (!array_key_exists($arDiscount['MODIFIED_BY'], $arUserList)) {
         $rsUsers = CUser::GetList($by2 = 'ID', $order2 = 'ASC', array('ID_EQUAL_EXACT' => $arDiscount['MODIFIED_BY']), array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME')));
         if ($arOneUser = $rsUsers->Fetch()) {
             $arOneUser['ID'] = intval($arOneUser['ID']);
             $arUserList[$arOneUser['ID']] = CUser::FormatName($strNameFormat, $arOneUser);
         }
     }
     if (isset($arUserList[$arDiscount['MODIFIED_BY']])) {
         $strModifiedBy = '<a href="/bitrix/admin/user_edit.php?lang=' . LANGUAGE_ID . '&ID=' . $arDiscount['MODIFIED_BY'] . '">' . $arUserList[$arDiscount['MODIFIED_BY']] . '</a>';
     }
 }
 $row->AddViewField("CREATED_BY", $strCreatedBy);
 $row->AddViewField("DATE_CREATE", $arDiscount['DATE_CREATE']);
 $row->AddViewField("MODIFIED_BY", $strModifiedBy);
 $row->AddViewField("TIMESTAMP_X", $arDiscount['TIMESTAMP_X']);
 if ($bReadOnly) {
     $row->AddCheckField("ACTIVE", false);
     $row->AddViewField("COUPON", $f_COUPON);
     $row->AddCalendarField("DATE_APPLY", false);
     $row->AddViewField("ONE_TIME", $arCouponType[$arDiscount['ONE_TIME']]);
Example #13
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$arUser = $arParams['~USER'];
$name = CUser::FormatName($arParams['NAME_TEMPLATE'], $arUser, $arResult["bUseLogin"]);
$user_action_menu_number = rand();
?>
<div class="department-manager">
	<div class="department-titles"><?php 
echo GetMessage("INTR_STR_UF_HEAD");
?>
</div>
		<span class="department-manager-info-block">
			<a class="department-manager-avatar" href="<?php 
echo $arUser['DETAIL_URL'];
?>
">
				<?php 
if (!empty($arUser["PERSONAL_PHOTO"])) {
    ?>
<img src="<?php 
    echo $arUser["PERSONAL_PHOTO"];
    ?>
"/><?php 
}
?>
			</a>
			<span class="department-manager-name-block">
				<div class="department-manager-name">
Example #14
0
                ?>
		<td><?php 
                switch ($key) {
                    case 'FULL_NAME':
                        if (true) {
                            ?>
					<div class="bx-user-name">
					<?php 
                            $APPLICATION->IncludeComponent("bitrix:main.user.link", '', array("ID" => $arUser["ID"], "HTML_ID" => "system_person_" . $arUser["ID"], "NAME" => $arUser["NAME"], "LAST_NAME" => $arUser["LAST_NAME"], "SECOND_NAME" => $arUser["SECOND_NAME"], "LOGIN" => $arUser["LOGIN"], "USE_THUMBNAIL_LIST" => "N", "INLINE" => "Y", "IS_ONLINE" => $arUser["IS_ONLINE"], "PROFILE_URL" => $arUser["DETAIL_URL"], "PATH_TO_SONET_MESSAGES_CHAT" => $arParams["PM_URL"], "DATE_TIME_FORMAT" => $arParams["DATE_TIME_FORMAT"], "SHOW_YEAR" => $arParams["SHOW_YEAR"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "PATH_TO_CONPANY_DEPARTMENT" => $arParams["~PATH_TO_CONPANY_DEPARTMENT"], "PATH_TO_VIDEO_CALL" => $arParams["~PATH_TO_VIDEO_CALL"]), false, array("HIDE_ICONS" => "Y"));
                            ?>
					</div>
					<?php 
                            $result = '';
                        } else {
                            $bUseLogin = $arParams['SHOW_LOGIN'] != "N" ? true : false;
                            $result = '<a href="' . $arUser['DETAIL_URL'] . '">' . CUser::FormatName($arParams['NAME_TEMPLATE'], $arUser, $bUseLogin) . '</a>';
                        }
                        break;
                    case 'EMAIL':
                        $result = '<a href="mailto:' . urlencode($arUser[$key]) . '">' . htmlspecialcharsbx($arUser[$key]) . '</a>';
                        break;
                    case 'PERSONAL_WWW':
                        $result = '<a href="http://' . urlencode($arUser[$key]) . '" target="_blank">' . htmlspecialcharsbx($arUser[$key]) . '</a>';
                        break;
                    case 'PERSONAL_GENDER':
                        $result = $arUser[$key] == 'F' ? GetMessage('INTR_ISL_TPL_GENDER_F') : ($arUser[$key] == 'M' ? GetMessage('INTR_ISL_TPL_GENDER_M') : '');
                        break;
                    case 'PERSONAL_PHOTO':
                        if (!$arUser[$key]) {
                            $result = '<div class="bx-user-image-default-100"></div>';
                        } else {
Example #15
0
	public static function InitUserTmp($userID, $arParams, $bCurrentUserIsAdmin = "unknown", $bRSS = false)
	{
		$title = "";
		$message = "";
		$bUseLogin = $arParams['SHOW_LOGIN'] != "N" ? true : false;

		$dbUser = CUser::GetByID($userID);
		if ($arUser = $dbUser->Fetch())
		{
			if ($bCurrentUserIsAdmin == "unknown")
				$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();

			$canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUser["ID"], "viewprofile", $bCurrentUserIsAdmin);
			$pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"]));

			if (!$bRSS && $canViewProfile)
				$title .= "<a href=\"".$pu."\">";
			$title .= CUser::FormatName($arParams['NAME_TEMPLATE'], $arUser, $bUseLogin);
			if (!$bRSS && $canViewProfile)
				$title .= "</a>";

			if (intval($arUser["PERSONAL_PHOTO"]) <= 0)
			{
				switch ($arUser["PERSONAL_GENDER"])
				{
					case "M":
						$suffix = "male";
						break;
					case "F":
						$suffix = "female";
							break;
					default:
						$suffix = "unknown";
				}
				$arUser["PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_".$suffix, false, SITE_ID);
			}
			$arImage = CSocNetTools::InitImage($arUser["PERSONAL_PHOTO"], 100, "/bitrix/images/socialnetwork/nopic_user_100.gif", 100, $pu, $canViewProfile);

			$message = $arImage["IMG"];
		}

		return array($title, $message);
	}
Example #16
0
			$arUserList = array();
			$strNameFormat = CSite::GetNameFormat(true);

			$byUser = '******';
			$orderUser = '******';
			$rsUsers = CUser::GetList(
				$byUser,
				$orderUser,
				array('ID' => implode(' || ', array_keys($userListID))),
				array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME', 'SECOND_NAME'))
			);
			while ($arOneUser = $rsUsers->Fetch())
			{
				$arOneUser['ID'] = (int)$arOneUser['ID'];
				$arUserList[$arOneUser['ID']] = '<a href="/bitrix/admin/user_edit.php?lang='.LANGUAGE_ID.'&ID='.$arOneUser['ID'].'">'.CUser::FormatName($strNameFormat, $arOneUser).'</a>';
			}
			if (isset($arUserList[$clearQuantityUser]))
				$strQuantityUser = $arUserList[$clearQuantityUser];
			if (isset($arUserList[$clearQuantityReservedUser]))
				$strQuantityReservedUser = $arUserList[$clearQuantityReservedUser];
			if (isset($arUserList[$clearStoreUser]))
				$strStoreUser = $arUserList[$clearStoreUser];
		}
		$boolStoreExists = false;
		$arStores = array();
		$arStores[] = array("ID" => -1, "ADDRESS" => Loc::getMessage("CAT_ALL_STORES"));
		$rsStores = CCatalogStore::GetList(
			array('SORT' => 'ASC', 'ID' => 'ASC'),
			array('ACTIVE' => 'Y'),
			false,
Example #17
0
 /**
  * Function formats user info in arResult
  * @return void
  */
 protected function formatResultUser()
 {
     $arResult =& $this->arResult;
     if (!empty($arResult["NAME"])) {
         $arResult["USER_NAME"] = CUser::FormatName(CSite::GetNameFormat(false), $arResult["NAME"], true, false);
     }
 }
Example #18
0
                        $arContact['BIZPROC_STATUS'] = 'attention';
                    }
                    $totalTaskQty += $taskQty;
                    if ($totalTaskQty > 5) {
                        break;
                    }
                }
            }
            unset($arDocState);
            if (!$isInExportMode) {
                $arContact['BIZPROC_STATUS_HINT'] = '<span class=\'bizproc-item-title\'>' . GetMessage('CRM_BP_R_P') . ': <a href=\'' . $arContact['PATH_TO_BIZPROC_LIST'] . '\' title=\'' . GetMessage('CRM_BP_R_P_TITLE') . '\'>' . $docStatesQty . '</a></span>' . ($totalTaskQty === 0 ? '' : '<br /><span class=\'bizproc-item-title\'>' . GetMessage('CRM_TASKS') . ': <a href=\'' . $arContact['PATH_TO_USER_BP'] . '\' title=\'' . GetMessage('CRM_TASKS_TITLE') . '\'>' . $totalTaskQty . ($totalTaskQty > 5 ? '+' : '') . '</a></span>');
            }
        }
    }
    $arContact['ASSIGNED_BY_ID'] = $arContact['~ASSIGNED_BY_ID'] = intval($arContact['ASSIGNED_BY']);
    $arContact['ASSIGNED_BY'] = CUser::FormatName($arParams['NAME_TEMPLATE'], array('LOGIN' => $arContact['ASSIGNED_BY_LOGIN'], 'NAME' => $arContact['ASSIGNED_BY_NAME'], 'LAST_NAME' => $arContact['ASSIGNED_BY_LAST_NAME'], 'SECOND_NAME' => $arContact['ASSIGNED_BY_SECOND_NAME']), true, false);
    if (isset($arSelectMap['FULL_ADDRESS'])) {
        $arContact['FULL_ADDRESS'] = ContactAddressFormatter::format($arContact, array('SEPARATOR' => AddressSeparator::HtmlLineBreak, 'NL2BR' => true));
    }
    $arResult['CONTACT'][$arContact['ID']] = $arContact;
    $arResult['CONTACT_UF'][$arContact['ID']] = array();
    $arResult['CONTACT_ID'][$arContact['ID']] = $arContact['ID'];
}
unset($arContact);
$CCrmUserType->ListAddEnumFieldsValue($arResult, $arResult['CONTACT'], $arResult['CONTACT_UF'], $isInExportMode ? ', ' : '<br />', $isInExportMode, array('FILE_URL_TEMPLATE' => '/bitrix/components/bitrix/crm.contact.show/show_file.php?ownerId=#owner_id#&fieldName=#field_name#&fileId=#file_id#'));
$arResult['ENABLE_TOOLBAR'] = isset($arParams['ENABLE_TOOLBAR']) ? $arParams['ENABLE_TOOLBAR'] : false;
if ($arResult['ENABLE_TOOLBAR']) {
    $arResult['PATH_TO_CONTACT_ADD'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_EDIT'], array('contact_id' => 0));
    $addParams = array();
    if ($bInternal && isset($arParams['INTERNAL_CONTEXT']) && is_array($arParams['INTERNAL_CONTEXT'])) {
        $internalContext = $arParams['INTERNAL_CONTEXT'];
Example #19
0
 function FormatName($NAME_TEMPLATE, $arUser, $bHTMLSpec = true)
 {
     return CUser::FormatName($NAME_TEMPLATE, $arUser, true, $bHTMLSpec);
 }
Example #20
0
$strLockUser = '';
$strLockUserExt = '';
$strLockUserInfo = '';
$strLockUserInfoExt = '';
$strLockTime = '';
$strNameFormat = CSite::GetNameFormat(true);

$boolLocked = CSaleOrder::IsLocked($ID, $intLockUserID, $strLockTime);
if ($boolLocked)
{
	$strLockUser = $intLockUserID;
	$strLockUserInfo = $intLockUserID;
	$rsUsers = CUser::GetList(($by2 = 'ID'),($order2 = 'ASC'), array('ID' => $intLockUserID), array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME')));
	if ($arOneUser = $rsUsers->Fetch())
	{
		$strLockUser = CUser::FormatName($strNameFormat, $arOneUser);
		$strLockUserInfo = '<a href="/bitrix/admin/user_edit.php?lang='.LANGUAGE_ID.'&ID='.$intLockUserID.'">'.$strLockUser.'</a>';
	}
	$strLockUserExt = htmlspecialcharsbx(GetMessage(
		'SOE_ORDER_LOCKED2',
		array(
			'#ID#' => $strLockUser,
			'#DATE#' => $strLockTime,
		)
	));
	$strLockUserInfoExt = GetMessage(
		'SOE_ORDER_LOCKED2',
		array(
			'#ID#' => $strLockUserInfo,
			'#DATE#' => $strLockTime,
		)
Example #21
0
    $tabControl->Begin();
    $tabControl->BeginNextTab();
    ?>
			<?php 
    if ($allowAdminAccess) {
        ?>
			<tr>
				<td align="right" valign="top" width="40%"><?php 
        echo GetMessage("BPAT_USER");
        ?>
:</td>
				<td width="60%" valign="top">
					<?php 
        $dbUserTmp = CUser::GetByID($arTask["USER_ID"]);
        $arUserTmp = $dbUserTmp->GetNext();
        $str = $arUserTmp ? CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arUserTmp, true) : GetMessage('BPAT_USER_NOT_FOUND');
        $str .= " [" . $arTask["USER_ID"] . "]";
        echo $str;
        ?>
				</td>
			</tr>
			<?php 
    }
    ?>
			<tr>
				<td align="right" valign="top" width="40%"><?php 
    echo GetMessage("BPAT_NAME");
    ?>
:</td>
				<td width="60%" valign="top"><?php 
    echo $arTask["NAME"];
Example #22
0
function GetFormatedUserName($USER_ID, $bEnableId = true)
{
    $result = "";
    $USER_ID = IntVal($USER_ID);
    if ($USER_ID > 0) {
        if (!isset($LOCAL_PAYED_USER_CACHE[$USER_ID]) || !is_array($LOCAL_PAYED_USER_CACHE[$USER_ID])) {
            $dbUser = CUser::GetByID($USER_ID);
            if ($arUser = $dbUser->Fetch()) {
                $LOCAL_PAYED_USER_CACHE[$USER_ID] = CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $arUser["NAME"], "LAST_NAME" => $arUser["LAST_NAME"], "SECOND_NAME" => $arUser["SECOND_NAME"], "LOGIN" => $arUser["LOGIN"]), true, true);
            }
        }
        if ($bEnableId) {
            $result .= "[<a href=\"/bitrix/admin/user_edit.php?ID=" . $USER_ID . "&lang=" . LANG . "\">" . $USER_ID . "</a>] ";
        }
        $result .= "<a href=\"/bitrix/admin/sale_buyers_profile.php?USER_ID=" . $USER_ID . "&lang=" . LANG . "\">";
        $result .= $LOCAL_PAYED_USER_CACHE[$USER_ID];
        $result .= "</a>";
    }
    return $result;
}
Example #23
0
         if (!empty($ar)) {
             foreach ($ar as $name => $tags) {
                 $arr = array("TAG_NAME" => $tags, "TAG_URL" => CComponentEngine::MakePathFromTemplate($arParams["~SEARCH_URL"], array()));
                 $arr["TAG_URL"] .= (strpos($arr["TAG_URL"], "?") === false ? "?" : "&") . "tags=" . $tags;
                 $arElement["TAGS_LIST"][] = $arr;
             }
         }
     }
     if ($arElement["PREVIEW_TEXT"] == "" && $arElement["NAME"] != "" && !preg_match('/\\d{3,}/', $arElement["NAME"])) {
         $arElement["~NAME"] = preg_replace(array('/\\.jpg/i', '/\\.jpeg/i', '/\\.gif/i', '/\\.png/i', '/\\.bmp/i'), '', $arElement["~NAME"]);
         $arElement["~PREVIEW_TEXT"] = $arElement["~NAME"];
         $arElement["PREVIEW_TEXT"] = htmlspecialcharsbx($arElement["~PREVIEW_TEXT"]);
     }
     unset($arElement["DETAIL_PICTURE"]);
     $arElements[$arElement["ID"]] = $arElement;
     $arElementsJS[$arElement["ID"]] = array("id" => intVal($arElement["ID"]), "active" => $arElement["ACTIVE"] == "Y" ? "Y" : "N", "title" => $arElement["NAME"], "album_id" => $arElement["IBLOCK_SECTION_ID"], "album_name" => $arSections[$arElement["IBLOCK_SECTION_ID"]]["NAME"], "gallery_id" => $arGallery["CODE"], "description" => $arElement["~PREVIEW_TEXT"], "shows" => $arElement["SHOW_COUNTER"], "index" => $index, "author_id" => $arElement['CREATED_BY'], "date" => FormatDate('x', MakeTimeStamp($arElement["DATE_CREATE"], CSite::GetDateFormat())), "author_name" => CUser::FormatName($arParams['NAME_TEMPLATE'], $arUsers[$arElement['CREATED_BY']], $arParams["SHOW_LOGIN"] != 'N'), "comments" => $arParams["SHOW_COMMENTS"] == "Y" ? intVal($arParams["COMMENTS_TYPE"] != "BLOG" ? $arElement["PROPERTIES"]["FORUM_MESSAGE_CNT"]["VALUE"] : $arElement["PROPERTIES"]["BLOG_COMMENTS_CNT"]["VALUE"]) : "", "detail_url" => $arElement["~URL"]);
     if ($arParams['DRAG_SORT'] == "Y") {
         $arElementsJS[$arElement["ID"]]['sort'] = $arElement["SORT"];
     }
     if ($arParams["SHOW_TAGS"]) {
         $arElementsJS[$arElement["ID"]]['tags'] = $arElement["TAGS"];
         if ($bParseTags) {
             $arElementsJS[$arElement["ID"]]['tags_array'] = $arElement["TAGS_LIST"];
         }
     }
     $index++;
 }
 $strFileId = trim($strFileId, " ,");
 if (strLen($strFileId) > 0) {
     $rsFile = CFile::GetList(array(), array("@ID" => $strFileId));
     $upload = COption::GetOptionString("main", "upload_dir", "upload");
Example #24
0
    foreach ($arResult['DATA']['CHECKLIST_ITEMS'] as &$item) {
        if (is_array($item)) {
            $keys = array();
            foreach ($item as $fld => $value) {
                $keys[] = $fld;
            }
            foreach ($keys as $key) {
                if (!isset($item['~' . $key])) {
                    $item['~' . $key] = $item[$key];
                }
            }
            $item['IS_COMPLETE'] = $item['CHECKED'] == '1' ? 'Y' : 'N';
            if (!isset($item['ID'])) {
                $item['ID'] = 'task-detail-checklist-item-xxx_' . rand(0, 999999);
            }
            // newly created item, ID should be defined anyway
        }
    }
}
$arResult['RESPONSIBLE_NAME_FORMATTED'] = $arResult['DATA']["RESPONSIBLE_NAME"] || $arResult['DATA']["RESPONSIBLE_LAST_NAME"] || $arResult['DATA']["RESPONSIBLE_LOGIN"] ? CUser::FormatName($arParams["NAME_TEMPLATE"], array("NAME" => $arResult['DATA']["RESPONSIBLE_NAME"], "LAST_NAME" => $arResult['DATA']["RESPONSIBLE_LAST_NAME"], "LOGIN" => $arResult['DATA']["RESPONSIBLE_LOGIN"], "SECOND_NAME" => $arResult['DATA']["RESPONSIBLE_SECOND_NAME"]), true, false) : "";
$arResult['CREATED_BY_NAME_FORMATTED'] = $arResult['DATA']["CREATED_BY_NAME"] || $arResult['DATA']["CREATED_BY_LAST_NAME"] || $arResult['DATA']["CREATED_BY_LOGIN"] ? CUser::FormatName($arParams["NAME_TEMPLATE"], array("NAME" => $arResult['DATA']["CREATED_BY_NAME"], "LAST_NAME" => $arResult['DATA']["CREATED_BY_LAST_NAME"], "LOGIN" => $arResult['DATA']["CREATED_BY_LOGIN"], "SECOND_NAME" => $arResult['DATA']["CREATED_BY_SECOND_NAME"]), true, false) : "";
$arResult['USER_CREATE_TEMPLATE'] = $arResult['DATA']['TPARAM_TYPE'] == CTaskTemplates::TYPE_FOR_NEW_USER;
$arResult['CSS_MODES'] = array();
if (intval($arResult['DATA']['BASE_TEMPLATE_ID'])) {
    $arResult['CSS_MODES'][] = 'state-base-template-choosen';
}
if ($arResult['USER_CREATE_TEMPLATE']) {
    $arResult['CSS_MODES'][] = 'state-user-create-template';
}
$arResult['RESPONSIBLE_DISABLED'] = $arResult['DATA']["CREATED_BY"] != $USER->GetID() || $arResult['USER_CREATE_TEMPLATE'];
$arResult['BX24_MODE'] = \Bitrix\Main\ModuleManager::isModuleInstalled('bitrix24');
Example #25
0
 function __SLEGetLogCommentRecord($arComments, $arParams, &$arAssets)
 {
     // for the same post log_update - time only, if not - date and time
     $timestamp = MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"]);
     $timeFormated = FormatDateFromDB($arComments["LOG_DATE"], stripos($arParams["DATE_TIME_FORMAT"], 'a') || ($arParams["DATE_TIME_FORMAT"] == 'FULL' && IsAmPmMode()) !== false ? strpos(FORMAT_DATETIME, 'TT') !== false ? 'G:MI TT' : 'G:MI T' : 'HH:MI');
     $dateTimeFormated = FormatDate(!empty($arParams['DATE_TIME_FORMAT']) ? $arParams['DATE_TIME_FORMAT'] == 'FULL' ? $GLOBALS['DB']->DateFormatToPHP(str_replace(':SS', '', FORMAT_DATETIME)) : $arParams['DATE_TIME_FORMAT'] : $GLOBALS['DB']->DateFormatToPHP(FORMAT_DATETIME), $timestamp);
     if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
         $dateTimeFormated = ToLower($dateTimeFormated);
     }
     // strip current year
     if (!empty($arParams['DATE_TIME_FORMAT']) && ($arParams['DATE_TIME_FORMAT'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT'] == 'j F Y g:i a')) {
         $dateTimeFormated = ltrim($dateTimeFormated, '0');
         $curYear = date('Y');
         $dateTimeFormated = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $dateTimeFormated);
     }
     $path2Entity = $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arComments["ENTITY_ID"])) : CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["ENTITY_ID"]));
     if (intval($arComments["USER_ID"]) > 0) {
         $suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arComments["USER_ID"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : "";
         $arTmpUser = array("NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"]);
         $bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false;
         $arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arTmpUser, $bUseLogin) . $suffix, "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["USER_ID"], "id" => $arComments["USER_ID"])));
         $arCreatedBy["TOOLTIP_FIELDS"] = array("ID" => $arComments["USER_ID"], "NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"], "USE_THUMBNAIL_LIST" => "N", "PATH_TO_SONET_MESSAGES_CHAT" => $arParams["PATH_TO_MESSAGES_CHAT"], "PATH_TO_SONET_USER_PROFILE" => $arParams["PATH_TO_USER"], "PATH_TO_VIDEO_CALL" => $arParams["PATH_TO_VIDEO_CALL"], "DATE_TIME_FORMAT" => $arParams["DATE_TIME_FORMAT"], "SHOW_YEAR" => $arParams["SHOW_YEAR"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"] . $suffix, "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "PATH_TO_CONPANY_DEPARTMENT" => $arParams["PATH_TO_CONPANY_DEPARTMENT"], "INLINE" => "Y");
     } else {
         $arCreatedBy = array("FORMATTED" => GetMessage("SONET_C73_CREATED_BY_ANONYMOUS"));
     }
     $arTmpUser = array("NAME" => $arComments["~USER_NAME"], "LAST_NAME" => $arComments["~USER_LAST_NAME"], "SECOND_NAME" => $arComments["~USER_SECOND_NAME"], "LOGIN" => $arComments["~USER_LOGIN"]);
     $arParamsTmp = $arParams;
     $arParamsTmp["AVATAR_SIZE"] = isset($arParams["AVATAR_SIZE_COMMON"]) ? $arParams["AVATAR_SIZE_COMMON"] : $arParams["AVATAR_SIZE"];
     $arTmpCommentEvent = array("EVENT" => $arComments, "LOG_DATE" => $arComments["LOG_DATE"], "LOG_DATE_TS" => MakeTimeStamp($arComments["LOG_DATE"]), "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComments["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "LOG_DATETIME_FORMAT" => $dateTimeFormated, "TITLE_TEMPLATE" => "", "TITLE" => "", "TITLE_FORMAT" => "", "ENTITY_NAME" => $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arComments["GROUP_NAME"] : CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin), "ENTITY_PATH" => $path2Entity, "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arComments, $arParamsTmp));
     $arEvent = CSocNetLogTools::FindLogCommentEventByID($arComments["EVENT_ID"]);
     if ($arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent)) {
         $arLog = $arParams["USER_COMMENTS"] == "Y" ? array() : array("TITLE" => $arComments["~LOG_TITLE"], "URL" => $arComments["~LOG_URL"], "PARAMS" => $arComments["~LOG_PARAMS"]);
         $arFIELDS_FORMATTED = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arComments, $arParams, false, $arLog);
         if ($arParams["USE_COMMENTS"] != "Y") {
             if (array_key_exists("CREATED_BY", $arFIELDS_FORMATTED) && isset($arFIELDS_FORMATTED["CREATED_BY"]["TOOLTIP_FIELDS"])) {
                 $arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] = $arFIELDS_FORMATTED["CREATED_BY"]["TOOLTIP_FIELDS"];
             }
         }
     }
     $message = $arFIELDS_FORMATTED && array_key_exists("EVENT_FORMATTED", $arFIELDS_FORMATTED) && array_key_exists("MESSAGE", $arFIELDS_FORMATTED["EVENT_FORMATTED"]) ? $arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"] : $arTmpCommentEvent["EVENT"]["MESSAGE"];
     if (strlen($message) > 0) {
         $arFIELDS_FORMATTED["EVENT_FORMATTED"]["FULL_MESSAGE_CUT"] = CSocNetTextParser::closetags(htmlspecialcharsback($message));
     }
     if (is_array($arTmpCommentEvent)) {
         $arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $arTmpCommentEvent["LOG_DATE_DAY"] == ConvertTimeStamp() ? $timeFormated : $dateTimeFormated;
         $arTmpCommentEvent["EVENT_FORMATTED"] = $arFIELDS_FORMATTED["EVENT_FORMATTED"];
         if (isset($arComments["UF"]["UF_SONET_COM_URL_PRV"]) && !empty($arComments["UF"]["UF_SONET_COM_URL_PRV"]["VALUE"])) {
             $arCss = $GLOBALS["APPLICATION"]->sPath2css;
             $arJs = $GLOBALS["APPLICATION"]->arHeadScripts;
             ob_start();
             $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:system.field.view", $arComments["UF"]["UF_SONET_COM_URL_PRV"]["USER_TYPE_ID"], array("arUserField" => $arComments["UF"]["UF_SONET_COM_URL_PRV"], "arAddField" => array("NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "PATH_TO_USER" => $arParams["~PATH_TO_USER"])), null, array("HIDE_ICONS" => "Y"));
             $urlPreviewText = ob_get_clean();
             $arTmpCommentEvent["EVENT_FORMATTED"]["FULL_MESSAGE_CUT"] .= $urlPreviewText;
             $arAssets["CSS"] = array_merge($arAssets["CSS"], array_diff($GLOBALS["APPLICATION"]->sPath2css, $arCss));
             $arAssets["JS"] = array_merge($arAssets["JS"], array_diff($GLOBALS["APPLICATION"]->arHeadScripts, $arJs));
             unset($arComments["UF"]["UF_SONET_COM_URL_PRV"]);
         }
         $arTmpCommentEvent["UF"] = $arComments["UF"];
         if (isset($arTmpCommentEvent["EVENT_FORMATTED"]) && is_array($arTmpCommentEvent["EVENT_FORMATTED"])) {
             $arFields2Cache = array("DATETIME", "MESSAGE", "FULL_MESSAGE_CUT", "ERROR_MSG");
             foreach ($arTmpCommentEvent["EVENT_FORMATTED"] as $field => $value) {
                 if (!in_array($field, $arFields2Cache)) {
                     unset($arTmpCommentEvent["EVENT_FORMATTED"][$field]);
                 }
             }
         }
         if (isset($arTmpCommentEvent["EVENT"]) && is_array($arTmpCommentEvent["EVENT"])) {
             if (!empty($arTmpCommentEvent["EVENT"]["URL"])) {
                 $arTmpCommentEvent["EVENT"]["URL"] = str_replace("#GROUPS_PATH#", COption::GetOptionString("socialnetwork", "workgroups_page", "/workgroups/", SITE_ID), $arTmpCommentEvent["EVENT"]["URL"]);
             }
             $arFields2Cache = array("ID", "SOURCE_ID", "EVENT_ID", "USER_ID", "LOG_DATE", "RATING_TYPE_ID", "RATING_ENTITY_ID", "URL");
             foreach ($arTmpCommentEvent["EVENT"] as $field => $value) {
                 if (!in_array($field, $arFields2Cache)) {
                     unset($arTmpCommentEvent["EVENT"][$field]);
                 }
             }
         }
         if (isset($arTmpCommentEvent["CREATED_BY"]) && is_array($arTmpCommentEvent["CREATED_BY"])) {
             $arFields2Cache = array("TOOLTIP_FIELDS", "FORMATTED", "URL");
             foreach ($arTmpCommentEvent["CREATED_BY"] as $field => $value) {
                 if (!in_array($field, $arFields2Cache)) {
                     unset($arTmpCommentEvent["CREATED_BY"][$field]);
                 }
             }
             if (isset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"]) && is_array($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"])) {
                 $arFields2Cache = array("ID", "PATH_TO_SONET_USER_PROFILE", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "EMAIL");
                 foreach ($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] as $field => $value) {
                     if (!in_array($field, $arFields2Cache)) {
                         unset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"][$field]);
                     }
                 }
             }
         }
     }
     foreach ($arTmpCommentEvent["EVENT"] as $key => $value) {
         if (strpos($key, "~") === 0) {
             unset($arTmpCommentEvent["EVENT"][$key]);
         }
     }
     return $arTmpCommentEvent;
 }
Example #26
0
                 }
                 $res['REPORTS'][$key][0]['REPORT'] = htmlspecialcharsbx($arReport['REPORT']);
                 if ($arReport['REPORT_FULL']) {
                     $res['REPORTS'][$key][count($res['REPORTS'][$key]) - 1]['REPORT_FULL'] = htmlspecialcharsbx($arReport['REPORT_FULL']);
                 }
             }
             break;
         case 'REPORT':
             $res['REPORT'] = nl2br(htmlspecialcharsbx($arReport['REPORT']));
     }
 }
 if (count($arUserIDs) > 0) {
     $arUserIDs = array_unique($arUserIDs);
     $dbUsers = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => implode('|', $arUserIDs), 'ACTIVE' => 'Y'));
     while ($arUser = $dbUsers->Fetch()) {
         $name = CUser::FormatName(CSite::GetNameFormat(false), $arUser);
         foreach ($res['REPORTS'] as &$rep) {
             foreach ($rep as &$arReport) {
                 if ($arReport['USER_ID'] == $arUser['ID']) {
                     $arReport['USER_NAME'] = $name;
                 }
             }
         }
     }
 }
 $dbRes = CTimeManReportDaily::GetList(array('ID' => 'DESC'), array('ENTRY_ID' => $arInfo['INFO']['ID']));
 if ($arRes = $dbRes->Fetch()) {
     // $arRes['ACTIVE'], $arRes['MARK'];
     $res['REPORT'] = nl2br(htmlspecialcharsEx($arRes['REPORT']));
     if ($res['INFO']['TASKS_ENABLED']) {
         $res['INFO']['TASKS'] = unserialize($arRes['TASKS']);
Example #27
0
    }
    $row->AddField("DESCRIPTION", $description);
    $row->AddField("DESCRIPTION_FULL", $f_DESCRIPTION);
    $row->AddField("MODIFIED", $f_MODIFIED);
    $row->AddField("WORKFLOW_NAME", $f_WORKFLOW_TEMPLATE_NAME);
    $row->AddField("WORKFLOW_STATE", $f_WORKFLOW_STATE);
    $row->AddField("WORKFLOW_STARTED", FormatDateFromDB($f_WORKFLOW_STARTED));
    if (intval($f_STARTED_BY) > 0) {
        $dbUserTmp = CUser::GetByID($f_STARTED_BY);
        $arUserTmp = $dbUserTmp->fetch();
        $row->AddField("WORKFLOW_STARTED_BY", CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arUserTmp, true) . " [" . $f_STARTED_BY . "]");
    }
    if (in_array("USER", $arVisibleColumns)) {
        $dbUserTmp = CUser::GetByID($arResultItem["USER_ID"]);
        if ($arUserTmp = $dbUserTmp->GetNext()) {
            $str = CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arUserTmp, true);
            $str .= " [" . $arResultItem["USER_ID"] . "]";
        } else {
            $str = str_replace("#USER_ID#", $arResultItem["USER_ID"], GetMessage("BPATL_USER_NOT_FOUND"));
        }
        $row->AddField("USER", $str);
    }
    $arActions = array();
    $arActions[] = array("ICON" => "edit", "TEXT" => GetMessage("BPATL_VIEW"), "ACTION" => $lAdmin->ActionRedirect('bizproc_task.php?id=' . $f_ID . $s . '&back_url=' . urlencode($APPLICATION->GetCurPageParam("lang=" . LANGUAGE_ID, array("lang"))) . ''), "DEFAULT" => true);
    $row->AddActions($arActions);
}
$lAdmin->AddFooter(array(array("title" => GetMessage("MAIN_ADMIN_LIST_SELECTED"), "value" => $dbResultList->SelectedRowsCount()), array("counter" => true, "title" => GetMessage("MAIN_ADMIN_LIST_CHECKED"), "value" => "0")));
if ($allowAdminAccess && isset($arFilter['USER_STATUS']) && $arFilter['USER_STATUS'] == 0) {
    $lAdmin->AddGroupActionTable(array('set_status_' . CBPTaskUserStatus::Yes => GetMessage("BPATL_GROUP_ACTION_YES"), 'set_status_' . CBPTaskUserStatus::No => GetMessage("BPATL_GROUP_ACTION_NO"), 'set_status_' . CBPTaskUserStatus::Ok => GetMessage("BPATL_GROUP_ACTION_OK"), 'delegate' => GetMessage('BPATL_GROUP_ACTION_DELEGATE'), 'delegate_dialog' => array('type' => 'html', 'value' => '<div id="action_delegate_to" style="display:none">
					<input type="text" name="delegate_to" size="3" name=""/>
					<input type="button" OnClick="window.open(\'/bitrix/admin/user_search.php?lang=' . LANGUAGE_ID . '&FN=form_' . $sTableID . '&FC=delegate_to\',
Example #28
0
    echo GetMessage("SONET_C30_T_FILTER_TITLE");
    ?>
</div>
		<form method="GET" name="log_filter" target="_self" action="<?php 
    echo $postFormUrl !== '' ? $postFormUrl : POST_FORM_ACTION_URI;
    ?>
">
		<input type="hidden" name="SEF_APPLICATION_CUR_PAGE_URL" value="<?php 
    echo GetPagePath();
    ?>
"><?php 
    $userName = "";
    if ($createdByID > 0) {
        $rsUser = CUser::GetByID($createdByID);
        if ($arUser = $rsUser->Fetch()) {
            $userName = CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, $arParams["SHOW_LOGIN"] != "N" ? true : false);
        }
    }
    ?>
<div class="filter-field">
			<label class="filter-field-title" for="filter-field-created-by"><?php 
    echo GetMessage("SONET_C30_T_FILTER_CREATED_BY");
    ?>
</label>
			<span class="webform-field webform-field-textbox<?php 
    echo $createdByID <= 0 ? " webform-field-textbox-empty" : "";
    ?>
 webform-field-textbox-clearable">
				<span id="sonet-log-filter-created-by" class="webform-field-textbox-inner" style="width: 200px; padding: 0 20px 0 4px;">
					<input type="text" class="webform-field-textbox" id="filter-field-created-by" value="<?php 
    echo $userName;
Example #29
0
 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));
 }
Example #30
0
            }
            $arTmpUser = array("NAME" => "", "LAST_NAME" => "", "SECOND_NAME" => "", "LOGIN" => "");
            if ($arEvents["ENTITY_TYPE"] == SONET_ENTITY_USER && intval($arEvents["ENTITY_ID"]) > 0) {
                $arTmpUser = array("NAME" => $arEvents["~USER_NAME"], "LAST_NAME" => $arEvents["~USER_LAST_NAME"], "SECOND_NAME" => $arEvents["~USER_SECOND_NAME"], "LOGIN" => $arEvents["~USER_LOGIN"]);
            }
            $arTmpEvent = array("ID" => $arEvents["ID"], "ENTITY_TYPE" => $arEvents["ENTITY_TYPE"], "ENTITY_ID" => $arEvents["ENTITY_ID"], "EVENT_ID" => $arEvents["EVENT_ID"], "LOG_DATE" => $arEvents["LOG_DATE"], "LOG_TIME_FORMAT" => $timeFormated, "TITLE_TEMPLATE" => $arEvents["TITLE_TEMPLATE"], "TITLE" => $arEvents["TITLE"], "TITLE_FORMAT" => CSocNetLog::MakeTitle($arEvents["TITLE_TEMPLATE"], $arEvents["TITLE"], $arEvents["URL"], true), "MESSAGE" => $arEvents["MESSAGE"], "MESSAGE_FORMAT" => $arEvents["MESSAGE_FORMAT"], "URL" => $arEvents["URL"], "MODULE_ID" => $arEvents["MODULE_ID"], "CALLBACK_FUNC" => $arEvents["CALLBACK_FUNC"], "ENTITY_NAME" => $arEvents["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arEvents["GROUP_NAME"] : CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin), "ENTITY_PATH" => $path2Entity);
            if ($arEvents["ENTITY_TYPE"] == SONET_ENTITY_USER) {
                $arTmpEvent["USER_NAME"] = $arTmpUser["NAME"];
                $arTmpEvent["USER_LAST_NAME"] = $arTmpUser["LAST_NAME"];
                $arTmpEvent["USER_SECOND_NAME"] = $arTmpUser["SECOND_NAME"];
                $arTmpEvent["USER_LOGIN"] = $arTmpUser["LOGIN"];
            }
            if (preg_match("/#USER_NAME#/i" . BX_UTF_PCRE_MODIFIER, $arTmpEvent["TITLE_FORMAT"], $res)) {
                if (intval($arEvents["USER_ID"]) > 0) {
                    $arTmpCreatedBy = array("NAME" => $arEvents["~CREATED_BY_NAME"], "LAST_NAME" => $arEvents["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arEvents["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arEvents["~CREATED_BY_LOGIN"]);
                    $name_formatted = CUser::FormatName($arParams["NAME_TEMPLATE_WO_NOBR"], $arTmpCreatedBy, $bUseLogin);
                } else {
                    $name_formatted = GetMessage("SONET_C73_CREATED_BY_ANONYMOUS");
                }
                $arTmpEvent["TITLE_FORMAT"] = str_replace("#USER_NAME#", $name_formatted, $arTmpEvent["TITLE_FORMAT"]);
            }
            $arResult["Events"][$dateFormated][] = $arTmpEvent;
            $cnt++;
        }
    } else {
        ShowError(GetMessage("SONET_ACTIVITY_NO_ACCESS"));
        return;
    }
} else {
    ShowError(GetMessage("SONET_ACTIVITY_NO_USER"));
    return;