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


PHP CSite::GetNameFormat方法代码示例

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


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

示例1: onPrepareComponentParams

 public function onPrepareComponentParams($params)
 {
     if (empty($params['NAME_TEMPLATE'])) {
         $params['NAME_TEMPLATE'] = COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID);
     }
     return $params;
 }
开发者ID:k-kalashnikov,项目名称:geekcon,代码行数:7,代码来源:class.php

示例2: 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];
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:29,代码来源:mobile_order.php

示例3: prepareParams

 private function prepareParams(&$arParams)
 {
     if (strlen($arParams["FORM_ID"]) <= 0) {
         $arParams["FORM_ID"] = "POST_FORM_" . RandString(3);
     }
     $arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? \CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), "", $arParams["NAME_TEMPLATE"]);
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:7,代码来源:class.php

示例4: 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' => ''));
             }
         }
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:32,代码来源:report_helper.php

示例5: onPrepareComponentParams

 public function onPrepareComponentParams($params)
 {
     if (empty($params['NAME_TEMPLATE'])) {
         $params['NAME_TEMPLATE'] = COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID);
     }
     if (!empty($_REQUEST['WS_STARTED_BY']) && !empty($_REQUEST['clear_filter'])) {
         unset($_REQUEST['WS_STARTED_BY']);
     }
     return $params;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:10,代码来源:class.php

示例6: add

 public function add($data, $parameters = array())
 {
     global $DB, $USER;
     $result = array();
     if (!$USER->IsAuthorized()) {
         throw new Tasks\Exception("Authentication is required.");
     }
     $title = isset($data["title"]) ? trim($data["title"]) : "";
     $responsible = isset($data["responsible"]) ? intval($data["responsible"]) : $USER->GetID();
     $deadline = isset($data["deadline"]) && $DB->FormatDate($data["deadline"], \CSite::GetDateFormat("FULL")) ? $data["deadline"] : "";
     $description = isset($data["description"]) ? trim($data["description"]) : "";
     $project = isset($data["project"]) ? intval($data["project"]) : 0;
     $nameTemplate = isset($data["nameTemplate"]) ? trim($data["nameTemplate"]) : "";
     $ganttMode = isset($data["ganttMode"]) && $data["ganttMode"] === "true";
     if (strlen($nameTemplate) > 0) {
         preg_match_all("/(#NAME#)|(#NOBR#)|(#\\/NOBR#)|(#LAST_NAME#)|(#SECOND_NAME#)|(#NAME_SHORT#)|(#SECOND_NAME_SHORT#)|\\s|\\,/", $nameTemplate, $matches);
         $nameTemplate = implode("", $matches[0]);
     } else {
         $nameTemplate = \CSite::GetNameFormat(false);
     }
     $fields = array("TITLE" => $title, "DESCRIPTION" => $description, "RESPONSIBLE_ID" => $responsible, "DEADLINE" => $deadline, "SITE_ID" => $data["siteId"], "GROUP_ID" => $project, "NAME_TEMPLATE" => $nameTemplate, 'DESCRIPTION_IN_BBCODE' => "Y");
     $taskItem = \CTaskItem::add($fields, $USER->GetId());
     $task = $taskItem->getData();
     $task["GROUP_NAME"] = "";
     if ($task["GROUP_ID"]) {
         $socGroup = \CSocNetGroup::GetByID($task["GROUP_ID"]);
         if ($socGroup) {
             $task["GROUP_NAME"] = $socGroup["~NAME"];
         }
     }
     \Bitrix\Main\FinderDestTable::merge(array("CONTEXT" => "TASK_RESPONSIBLE", "CODE" => array("U" . $task["RESPONSIBLE_ID"], "SG" . $task["GROUP_ID"])));
     $taskId = $taskItem->getId();
     $arPaths = array("PATH_TO_TASKS_TASK" => isset($data["pathToTask"]) ? trim($data["pathToTask"]) : "", "PATH_TO_USER_PROFILE" => isset($data["pathToUser"]) ? trim($data["pathToUser"]) : "", "PATH_TO_USER_TASKS_TASK" => isset($data["pathToUserTasksTask"]) ? trim($data["pathToUserTasksTask"]) : "");
     $columnsOrder = null;
     if (isset($data["columnsOrder"]) && is_array($data["columnsOrder"])) {
         $columnsOrder = array_map("intval", $data["columnsOrder"]);
     }
     $order = isset($data["order"]) && checkSerializedData($data["order"]) ? unserialize($data["order"]) : array();
     $filter = isset($data["filter"]) && checkSerializedData($data["filter"]) ? unserialize($data["filter"]) : array();
     $navigation = isset($data["navigation"]) && checkSerializedData($data["navigation"]) ? unserialize($data["navigation"]) : array();
     $select = isset($data["select"]) && checkSerializedData($data["select"]) ? unserialize($data["select"]) : array();
     $result["taskRaw"] = $task;
     $result["taskId"] = $task["ID"];
     $result["taskPath"] = \CComponentEngine::MakePathFromTemplate($arPaths["PATH_TO_TASKS_TASK"], array("task_id" => $task["ID"], "action" => "view"));
     $result["position"] = $this->getTaskPosition($taskId, $order, $filter, $navigation, $select);
     if ($ganttMode) {
         $result["task"] = $this->getJson($task, $arPaths, $nameTemplate);
     } else {
         $result["html"] = $this->getHtml($task, $arPaths, $nameTemplate, $columnsOrder);
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:52,代码来源:listcontrols.php

示例7: Execute

 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 = "Admin";
     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;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:49,代码来源:forumreviewactivity.php

示例8: getRelatedUser

 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;
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:15,代码来源:component.php

示例9: update

 /**
  * Create new comment for task
  * 
  * @param integer $taskId
  * @param integet $commentId
  * @param integer $commentEditorId - ID of user who is comment's editor
  * @param string[] $arFields - fields to be updated, including text in BB code
  * 
  * @throws TasksException, CTaskAssertException
  * 
  * @return boolean
  */
 public static function update($taskId, $commentId, $commentEditorId, $arFields)
 {
     CTaskAssert::assertLaxIntegers($taskId, $commentId, $commentEditorId);
     CTaskAssert::assert(is_array($arFields) && !empty($arFields));
     if (!CModule::includeModule('forum')) {
         throw new TasksException('forum module can not be loaded', TasksException::TE_ACTION_FAILED_TO_BE_PROCESSED);
     }
     IncludeModuleLangFile(__FILE__);
     $forumId = CTasksTools::GetForumIdForIntranet();
     $oTask = CTaskItem::getInstance($taskId, $commentEditorId);
     $arTask = $oTask->getData();
     $outForumTopicId = $outStrUrl = null;
     $arErrorCodes = array();
     $arFields = array_merge(array('EDITOR_ID' => $commentEditorId), $arFields);
     $messageId = self::__deprecated_Add($arFields['POST_MESSAGE'], $forumTopicId = $arTask['FORUM_TOPIC_ID'], $forumId, $nameTemplate = CSite::GetNameFormat(false), $arTask = $arTask, $permissions = 'Y', $commentId = $commentId, $givenUserId = $commentEditorId, $imageWidth = 300, $imageHeight = 300, $arSmiles = array(), $arForum = CForumNew::GetByID($forumId), $messagesPerPage = 10, $arUserGroupArray = CUser::GetUserGroup($commentEditorId), $backPage = null, $strMsgAddComment = GetMessage("TASKS_COMMENT_MESSAGE_ADD"), $strMsgEditComment = GetMessage("TASKS_COMMENT_MESSAGE_EDIT"), $strMsgNewTask = GetMessage("TASKS_COMMENT_SONET_NEW_TASK_MESSAGE"), $componentName = null, $outForumTopicId, $arErrorCodes, $outStrUrl, $arFields);
     if (!($messageId >= 1)) {
         throw new TasksException(serialize($arErrorCodes), TasksException::TE_ACTION_FAILED_TO_BE_PROCESSED | TasksException::TE_FLAG_SERIALIZED_ERRORS_IN_MESSAGE);
     }
     return true;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:32,代码来源:taskcomments.php

示例10: onPrepareComponentParams

 /**
  * @param $arParams
  * @return array
  */
 public function onPrepareComponentParams($arParams)
 {
     $arParams['FILTER_NAME'] = $this->initFilterName($arParams['FILTER_NAME']);
     $this->loadTooltipFromSocialNetwork($arParams);
     $arParams["NAME_TEMPLATE"] = empty($arParams["NAME_TEMPLATE"]) || !trim($arParams["NAME_TEMPLATE"]) ? CSite::GetNameFormat() : $arParams["NAME_TEMPLATE"];
     //set default to Y
     $arParams['SHOW_LOGIN'] = empty($arParams['SHOW_LOGIN']) || $arParams['SHOW_LOGIN'] != "N" ? "Y" : "N";
     //if not set value, set to default
     $arParams["PM_URL"] = empty($arParams["PM_URL"]) ? "/company/personal/messages/chat/#USER_ID#/" : $arParams["PM_URL"];
     $arParams["PATH_TO_CONPANY_DEPARTMENT"] = empty($arParams["PATH_TO_CONPANY_DEPARTMENT"]) ? "/company/structure.php?set_filter_structure=Y&structure_UF_DEPARTMENT=#ID#" : $arParams["PATH_TO_CONPANY_DEPARTMENT"];
     $arParams["PATH_TO_VIDEO_CALL"] = IsModuleInstalled("video") && empty($arParams["PATH_TO_VIDEO_CALL"]) ? "/company/personal/video/#USER_ID#/" : $arParams["PATH_TO_VIDEO_CALL"];
     TrimArr($arParams['ALPHABET_LANG']);
     $arParams['ALPHABET_LANG'] = empty($arParams['ALPHABET_LANG']) ? array(LANGUAGE_ID) : $arParams['ALPHABET_LANG'];
     $arParams['CURRENT_VIEW'] = $this->getCurrentView($arParams);
     $arParams['LIST_URL'] = $this->getApplication()->GetCurPage();
     if (!$arParams['DETAIL_URL']) {
         $arParams['DETAIL_URL'] = $arParams['LIST_URL'] . '?ID=#USER_ID#';
     }
     return parent::onPrepareComponentParams($arParams);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:24,代码来源:class.php

示例11: prepareData

 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']);
         }
     }
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:20,代码来源:class.php

示例12: __format_user4search

 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;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:20,代码来源:functions.php

示例13: getEvent

 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);
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:21,代码来源:calendar_event_handlers.php

示例14: GetUserName

 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;
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:21,代码来源:component.php

示例15: Execute

 public function Execute()
 {
     global $DB;
     if (!CModule::IncludeModule("socialnetwork") || !CModule::IncludeModule("blog")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $siteId = $this->PostSite ? $this->PostSite : SITE_ID;
     $ownerId = CBPHelper::ExtractUsers($this->OwnerId, $documentId, true);
     $pathToPost = COption::GetOptionString("socialnetwork", "userblogpost_page", false, $siteId);
     $pathToSmile = COption::GetOptionString("socialnetwork", "smile_page", false, $siteId);
     $blogGroupID = COption::GetOptionString("socialnetwork", "userbloggroup_id", false, $siteId);
     $blog = CBlog::GetByOwnerID($ownerId);
     if (!$blog) {
         $blog = $this->createBlog($ownerId, $blogGroupID, $siteId);
     }
     $micro = 'N';
     $title = trim($this->PostTitle);
     if (!$title) {
         $micro = 'Y';
         $title = trim(preg_replace(array("/\n+/is" . BX_UTF_PCRE_MODIFIER, '/\\s+/is' . BX_UTF_PCRE_MODIFIER), " ", blogTextParser::killAllTags($this->PostMessage)));
     }
     try {
         $postFields = array('TITLE' => $title, 'DETAIL_TEXT' => $this->PostMessage, 'DETAIL_TEXT_TYPE' => $this->PostMessageType == 'html' ? 'html' : 'text', '=DATE_PUBLISH' => $DB->CurrentTimeFunction(), 'PUBLISH_STATUS' => BLOG_PUBLISH_STATUS_PUBLISH, 'CATEGORY_ID' => '', 'PATH' => CComponentEngine::MakePathFromTemplate($pathToPost, array("post_id" => "#post_id#", "user_id" => $ownerId)), 'URL' => $blog['URL'], 'PERMS_POST' => array(), 'PERMS_COMMENT' => array(), 'MICRO' => $micro, 'SOCNET_RIGHTS' => $this->getSocnetRights($this->UsersTo), '=DATE_CREATE' => $DB->CurrentTimeFunction(), 'AUTHOR_ID' => $ownerId, 'BLOG_ID' => $blog['ID'], "HAS_IMAGES" => "N", "HAS_TAGS" => "N", "HAS_PROPS" => "N", "HAS_SOCNET_ALL" => "N");
         if (!empty($postFields["SOCNET_RIGHTS"]) && count($postFields["SOCNET_RIGHTS"]) == 1 && in_array("UA", $postFields["SOCNET_RIGHTS"])) {
             $postFields['HAS_SOCNET_ALL'] = 'Y';
         }
         $newId = CBlogPost::add($postFields);
         $postFields["ID"] = $newId;
         $arParamsNotify = array("bSoNet" => true, "UserID" => $ownerId, "allowVideo" => COption::GetOptionString("blog", "allow_video", "Y"), "PATH_TO_SMILE" => $pathToSmile, "PATH_TO_POST" => $pathToPost, "SOCNET_GROUP_ID" => $blogGroupID, "user_id" => $ownerId, "NAME_TEMPLATE" => CSite::GetNameFormat(false));
         CBlogPost::Notify($postFields, $blog, $arParamsNotify);
         BXClearCache(true, "/" . $siteId . "/blog/last_messages_list/");
         $arFieldsIM = array("TYPE" => "POST", "TITLE" => $postFields["TITLE"], "URL" => CComponentEngine::MakePathFromTemplate($pathToPost, array("post_id" => $newId, "user_id" => $ownerId)), "ID" => $newId, "FROM_USER_ID" => $ownerId, "TO_USER_ID" => array(), "TO_SOCNET_RIGHTS" => $postFields["SOCNET_RIGHTS"], "TO_SOCNET_RIGHTS_OLD" => array());
         CBlogPost::NotifyIm($arFieldsIM);
     } catch (Exception $e) {
         $this->WriteToTrackingService($e->getMessage());
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:40,代码来源:socnetblogpostactivity.php


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