Exemplo n.º 1
0
 public function onPrepareComponentParams($params)
 {
     if (empty($params['NAME_TEMPLATE'])) {
         $params['NAME_TEMPLATE'] = COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID);
     }
     return $params;
 }
Exemplo n.º 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];
	}
Exemplo n.º 3
0
 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"]);
 }
Exemplo n.º 4
0
 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' => ''));
             }
         }
     }
 }
Exemplo n.º 5
0
 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;
 }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
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;
     }
 }
Exemplo n.º 9
0
 /**
  * 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;
 }
Exemplo n.º 10
0
 /**
  * @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);
 }
Exemplo n.º 11
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']);
         }
     }
 }
Exemplo n.º 12
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;
 }
Exemplo n.º 13
0
 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);
     }
 }
Exemplo n.º 14
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;
     }
 }
Exemplo n.º 15
0
 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;
 }
Exemplo n.º 16
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;
 }
Exemplo n.º 17
0
 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));
 }
Exemplo n.º 18
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\',
Exemplo n.º 19
0
}
if (empty($arParams['OPER_VAR'])) {
    $arParams['OPER_VAR'] = 'oper';
}
if (empty($arParams['SEF_MODE'])) {
    $arParams['SEF_MODE'] = 'N';
    if ($arParams['IN_COMPLEX'] == 'Y') {
        $arParams['SEF_MODE'] = $this->GetParent()->arResult['SEF_MODE'];
    }
}
if (empty($arParams['SOCNET_GROUP_ID']) && $arParams['IN_COMPLEX'] == 'Y') {
    if (strpos($this->GetParent()->GetName(), 'socialnetwork') !== false && !empty($this->GetParent()->arResult['VARIABLES']['group_id'])) {
        $arParams['SOCNET_GROUP_ID'] = $this->GetParent()->arResult['VARIABLES']['group_id'];
    }
}
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
$arParams['PATH_TO_POST'] = trim($arParams['PATH_TO_POST']);
if (empty($arParams['PATH_TO_POST'])) {
    $arParams['PATH_TO_POST'] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?{$arParams['PAGE_VAR']}=#wiki_name#");
}
$arParams['PATH_TO_POST_EDIT'] = trim($arParams['PATH_TO_POST_EDIT']);
if (strlen($arParams['PATH_TO_POST_EDIT']) <= 0) {
    $arParams['PATH_TO_POST_EDIT'] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?{$arParams['PAGE_VAR']}=#wiki_name#");
    if ($arParams['IN_COMPLEX'] == 'Y' && $arParams['SEF_MODE'] == 'Y') {
        $arParams['PATH_TO_POST_EDIT'] = $this->GetParent()->arResult['PATH_TO_POST_EDIT'];
    }
}
$arParams['PATH_TO_HISTORY'] = trim($arParams['PATH_TO_HISTORY']);
if (strlen($arParams['PATH_TO_HISTORY']) <= 0) {
    $arParams['PATH_TO_HISTORY'] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?{$arParams['PAGE_VAR']}=#wiki_name#");
}
Exemplo n.º 20
0
define("DisableEventsCheck", true);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
if (!CModule::IncludeModule("socialnetwork")) {
    echo CUtil::PhpToJsObject(array('ERROR' => 'MODULE_NOT_INSTALLED'));
    die;
}
if (check_bitrix_sessid()) {
    if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser()) {
        echo CUtil::PhpToJsObject(array('ERROR' => 'EXTRANET_USER'));
    } else {
        if (isset($_POST["nt"])) {
            preg_match_all("/(#NAME#)|(#LAST_NAME#)|(#SECOND_NAME#)|(#NAME_SHORT#)|(#SECOND_NAME_SHORT#)|\\s|\\,/", urldecode($_REQUEST["nt"]), $matches);
            $nameTemplate = implode("", $matches[0]);
        } else {
            $nameTemplate = CSite::GetNameFormat(false);
        }
        if ($_POST['LD_SEARCH'] == 'Y') {
            CUtil::decodeURIComponent($_POST);
            echo CUtil::PhpToJsObject(array('USERS' => CSocNetLogDestination::SearchUsers($_POST['SEARCH'], $nameTemplate, false, IsModuleInstalled("extranet"))));
        } elseif ($_POST['LD_DEPARTMENT_RELATION'] == 'Y' && IsModuleInstalled("intranet")) {
            echo CUtil::PhpToJsObject(array('USERS' => CSocNetLogDestination::GetUsers(array('deportament_id' => $_POST['DEPARTMENT_ID'], "NAME_TEMPLATE" => $nameTemplate), false)));
        } elseif (isset($_POST["bitrix_processes"])) {
            if (CModule::IncludeModule('lists')) {
                IncludeModuleLangFile(__FILE__);
                global $USER;
                $listsPerm = CListPermissions::CheckAccess($USER, COption::GetOptionString("lists", "livefeed_iblock_type_id"), false);
                if ($listsPerm < 0) {
                    switch ($listsPerm) {
                        case CListPermissions::WRONG_IBLOCK_TYPE:
                            echo CUtil::PhpToJsObject(array('success' => false, 'error' => GetMessage("CC_BLL_WRONG_IBLOCK_TYPE")));
Exemplo n.º 21
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
/********************************************************************
				Input params
********************************************************************/
/************** URL ************************************************/
$URL_NAME_DEFAULT = array("USER" => "/company/personal/user/#USER_ID#/");
foreach ($URL_NAME_DEFAULT as $URL => $URL_VALUE) {
    $arParams["~PATH_TO_" . $URL] = !!$arParams["~PATH_TO_" . $URL] ? $arParams["PATH_TO_" . $URL] : $URL_VALUE;
    $arParams["PATH_TO_" . $URL] = htmlspecialcharsbx($arParams["~PATH_TO_" . $URL]);
}
/************** ADDITIONAL *****************************************/
$arParams["NAME_TEMPLATE"] = !empty($arParams["NAME_TEMPLATE"]) ? $arParams["NAME_TEMPLATE"] : CSite::GetNameFormat();
/********************************************************************
				/Input params
********************************************************************/
if ($_REQUEST["VOTE_ID"] == $arParams["VOTE_ID"] && $_REQUEST["AJAX_RESULT"] == "Y" && check_bitrix_sessid()) {
    $res = array("LAST_VOTE" => $arResult["LAST_VOTE"], "QUESTIONS" => array());
    foreach ($arResult["QUESTIONS"] as $arQuestion) {
        $res["QUESTIONS"][$arQuestion["ID"]] = array();
        foreach ($arQuestion["ANSWERS"] as $arAnswer) {
            $res["QUESTIONS"][$arQuestion["ID"]][$arAnswer["ID"]] = array("USERS" => $arAnswer["USERS"], "COUNTER" => $arAnswer["COUNTER"], "PERCENT" => $arAnswer["PERCENT"], "BAR_PERCENT" => $arAnswer["BAR_PERCENT"]);
        }
    }
    while (@ob_end_clean()) {
    }
    Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
    echo CUtil::PhpToJsObject($res);
Exemplo n.º 22
0
    } elseif (CModule::IncludeModule("blog")) {
        $arBlog = CBlog::GetByUrl($arParams["BLOG_URL"]);
        if (IntVal($arBlog["ID"]) > 0) {
            $blogComPerm = CBlog::GetBlogUserCommentPerms(IntVal($arBlog["ID"]), $USER->GetId());
            $arParams["COMMENTS_PERM_VIEW"] = $blogComPerm >= "I" ? "Y" : "N";
            $arParams["COMMENTS_PERM_ADD"] = $blogComPerm >= "P" ? "Y" : "N";
        }
    }
    if ($arParams["COMMENTS_PERM_VIEW"] == "N") {
        $arParams["USE_COMMENTS"] = "N";
        $arParams["SHOW_COMMENTS"] = "N";
    }
}
$arParams["SHOW_LOGIN"] = $arParams["SHOW_LOGIN"] == "N" ? "N" : "Y";
if (strlen($arParams["NAME_TEMPLATE"]) <= 0) {
    $arParams["NAME_TEMPLATE"] = CSite::GetNameFormat();
}
//if (strlen($arParams["PATH_TO_USER"]) <= 0)
//	$arParams["PATH_TO_USER"] = '******';
if (!is_array($arParams["USER_SETTINGS"])) {
    $arParams["USER_SETTINGS"] = array();
}
$arResult["MORE_PHOTO_NAV"] = $arParams["MORE_PHOTO_NAV"] != "N" ? "Y" : "N";
$arParams["USE_PERMISSIONS"] = $arParams["USE_PERMISSIONS"] == "Y" ? "Y" : "N";
if (!is_array($arParams["GROUP_PERMISSIONS"])) {
    $arParams["GROUP_PERMISSIONS"] = array(1);
}
$arParams["USE_DESC_PAGE"] = $arParams["USE_DESC_PAGE"] == "N" ? "N" : "Y";
$arParams["PAGE_ELEMENTS"] = intVal($arParams["PAGE_ELEMENTS"]);
$arParams["PAGE_ELEMENTS"] = $arParams["PAGE_ELEMENTS"] > 0 ? $arParams["PAGE_ELEMENTS"] : 50;
$arParams["PAGE_NAVIGATION_WINDOW"] = intVal(intVal($arParams["PAGE_NAVIGATION_WINDOW"]) > 0 ? $arParams["PAGE_NAVIGATION_WINDOW"] : 5);
Exemplo n.º 23
0
		$clearStoreUser = (int)Option::get('catalog', 'clear_store_user');
		if ($clearStoreUser < 0)
			$clearStoreUser = 0;
		$userListID[$clearStoreUser] = true;

		if (isset($userListID[0]))
			unset($userListID[0]);
		if (!empty($userListID))
		{
			$strClearQuantityDate = Option::get('catalog', 'clear_quantity_date');
			$strClearQuantityReservedDate = Option::get('catalog', 'clear_reserved_quantity_date');
			$strClearStoreDate = Option::get('catalog', 'clear_store_date');

			$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]))
Exemplo n.º 24
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"];
Exemplo n.º 25
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);
     }
 }
Exemplo n.º 26
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 = '';
Exemplo n.º 27
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']);
Exemplo n.º 28
0
global $APPLICATION;
$arResult['RUBRIC'] = array('ENABLED' => false);
$enablePaging = $arResult['ENABLE_PAGING'] = isset($_GET['PAGING']) && strtoupper($_GET['PAGING']) === 'Y';
$enableSearch = $arResult['ENABLE_SEARCH'] = isset($_GET['SEARCH']) && strtoupper($_GET['SEARCH']) === 'Y';
if ($enableSearch) {
    // decode encodeURIComponent params
    CUtil::JSPostUnescape();
}
$companyID = $arResult['COMPANY_ID'] = isset($_GET['company_id']) ? intval($_GET['company_id']) : 0;
$arResult['SHOW_SEARCH_PANEL'] = $companyID <= 0;
$currentUserID = $arResult['USER_ID'] = intval(CCrmSecurityHelper::GetCurrentUserID());
$arParams['CONTACT_EDIT_URL_TEMPLATE'] = isset($arParams['CONTACT_EDIT_URL_TEMPLATE']) ? $arParams['CONTACT_EDIT_URL_TEMPLATE'] : '';
$arParams['CONTACT_SHOW_URL_TEMPLATE'] = isset($arParams['CONTACT_SHOW_URL_TEMPLATE']) ? $arParams['CONTACT_SHOW_URL_TEMPLATE'] : '';
$arParams['COMPANY_SHOW_URL_TEMPLATE'] = isset($arParams['COMPANY_SHOW_URL_TEMPLATE']) ? $arParams['COMPANY_SHOW_URL_TEMPLATE'] : '';
$arParams['USER_PROFILE_URL_TEMPLATE'] = isset($arParams['USER_PROFILE_URL_TEMPLATE']) ? $arParams['USER_PROFILE_URL_TEMPLATE'] : '';
$arParams['NAME_TEMPLATE'] = isset($arParams['NAME_TEMPLATE']) ? str_replace(array('#NOBR#', '#/NOBR#'), array('', ''), $arParams['NAME_TEMPLATE']) : CSite::GetNameFormat(false);
$arParams['UID'] = isset($arParams['UID']) ? $arParams['UID'] : '';
if (!isset($arParams['UID']) || $arParams['UID'] === '') {
    $arParams['UID'] = 'mobile_crm_contact_list';
}
$arResult['UID'] = $arParams['UID'];
/*
$arParams['PULL_TAG'] = $arResult['PULL_TAG'] = isset($arParams['PULL_TAG']) ? $arParams['PULL_TAG'] : 'CRM_CONTACT_CHANGE';
$arParams['PULL_UPDATE_CMD'] = $arResult['PULL_UPDATE_CMD'] = isset($arParams['PULL_UPDATE_CMD']) ? $arParams['PULL_UPDATE_CMD'] : 'crm_contact_update';
$arParams['PULL_DELETE_CMD'] = $arResult['PULL_DELETE_CMD'] = isset($arParams['PULL_DELETE_CMD']) ? $arParams['PULL_DELETE_CMD'] : 'crm_contact_delete';
*/
$arResult['FILTER'] = array(array('id' => 'NAME'), array('id' => 'LAST_NAME'), array('id' => 'FULL_NAME'), array('id' => 'MODIFY_BY_ID'), array('id' => 'ASSIGNED_BY_ID'));
$arResult['FILTER_PRESETS'] = array('filter_my' => array('name' => GetMessage('M_CRM_CONTACT_LIST_PRESET_MY'), 'fields' => array('ASSIGNED_BY_ID' => $currentUserID)), 'filter_change_my' => array('name' => GetMessage('M_CRM_CONTACT_LIST_PRESET_CHANGE_MY'), 'fields' => array('MODIFY_BY_ID' => $currentUserID)));
$itemPerPage = isset($arParams['ITEM_PER_PAGE']) ? intval($arParams['ITEM_PER_PAGE']) : 0;
if ($itemPerPage <= 0) {
    $itemPerPage = 20;
Exemplo n.º 29
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$arParams['NAME_TEMPLATE'] = $arParams['NAME_TEMPLATE'] ? $arParams['NAME_TEMPLATE'] : CSite::GetNameFormat();
$cacheTtl = 604800;
$cacheID = 'bx_cp_intranet_user_info_' . $GLOBALS["USER"]->GetID() . '_' . $arParams['bShowFilter'];
if ($arResult['DEPARTMENT'] > 0) {
    $cacheID .= '_' . $arResult['DEPARTMENT'];
}
$cacheDir = SITE_ID . '/intranet/user_info/';
$obUserCache = new CPHPCache();
if ($obUserCache->InitCache($cacheTtl, $cacheID, $cacheDir)) {
    $cacheData = $obUserCache->GetVars();
    $arResult['CURRENT_USER'] = $cacheData['CURRENT_USER'];
    $arResult['ONLY_MINE'] = $cacheData['ONLY_MINE'];
    unset($cacheData);
} else {
    global $CACHE_MANAGER;
    $CACHE_MANAGER->StartTagCache($cacheDir);
    if ($arParams['bShowFilter']) {
        $dbCurrentUser = CUser::GetByID($GLOBALS['USER']->GetID());
        $arResult['CURRENT_USER'] = $dbCurrentUser->Fetch();
        if ($arParams['bShowFilter'] = !!$arResult['CURRENT_USER']['UF_DEPARTMENT']) {
            $arResult['CURRENT_USER']['DEPARTMENT_TOP'] = CIntranetUtils::GetIBlockTopSection($arResult['CURRENT_USER']['UF_DEPARTMENT']);
            if (intval($arResult['DEPARTMENT']) == $arResult['CURRENT_USER']['DEPARTMENT_TOP']) {
                $arResult['ONLY_MINE'] = 'Y';
            }
        }
    }
Exemplo n.º 30
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;
}