public static function resolveComponentEngine(CComponentEngine $engine, $pageCandidates, &$arVariables) { /** @global CMain $APPLICATION */ global $APPLICATION, $CACHE_MANAGER; $component = $engine->GetComponent(); if ($component) { $iblock_id = intval($component->arParams["IBLOCK_ID"]); } else { $iblock_id = 0; } $requestURL = $APPLICATION->GetCurPage(true); $cacheId = $requestURL . implode("|", array_keys($pageCandidates)); $cache = new CPHPCache(); if ($cache->startDataCache(3600, $cacheId, "iblock_find")) { if (defined("BX_COMP_MANAGED_CACHE")) { $CACHE_MANAGER->StartTagCache("iblock_find"); CIBlock::registerWithTagCache($iblock_id); } foreach ($pageCandidates as $pageID => $arVariablesTmp) { if ($arVariablesTmp["SECTION_CODE_PATH"] != "" && (isset($arVariablesTmp["ELEMENT_ID"]) || isset($arVariablesTmp["ELEMENT_CODE"]))) { if (CIBlockFindTools::checkElement($iblock_id, $arVariablesTmp)) { $arVariables = $arVariablesTmp; if (defined("BX_COMP_MANAGED_CACHE")) { $CACHE_MANAGER->EndTagCache(); } $cache->endDataCache(array($pageID, $arVariablesTmp)); return $pageID; } } } foreach ($pageCandidates as $pageID => $arVariablesTmp) { if ($arVariablesTmp["SECTION_CODE_PATH"] != "" && (!isset($arVariablesTmp["ELEMENT_ID"]) && !isset($arVariablesTmp["ELEMENT_CODE"]))) { if (CIBlockFindTools::checkSection($iblock_id, $arVariablesTmp)) { $arVariables = $arVariablesTmp; if (defined("BX_COMP_MANAGED_CACHE")) { $CACHE_MANAGER->EndTagCache(); } $cache->endDataCache(array($pageID, $arVariablesTmp)); return $pageID; } } } if (defined("BX_COMP_MANAGED_CACHE")) { $CACHE_MANAGER->AbortTagCache(); } $cache->abortDataCache(); } else { $vars = $cache->getVars(); $pageID = $vars[0]; $arVariables = $vars[1]; return $pageID; } list($pageID, $arVariables) = each($pageCandidates); return $pageID; }
/** * Resolves path in complex component (socialnetwork) and find target file or folder. * @param \CComponentEngine $engine Component engine. * @param array $pageCandidates Page candidates. * @param array &$variables Output variables. * @return int|string */ public function resolveSocNetPathComponentEngine(\CComponentEngine $engine, $pageCandidates, &$variables) { $component = $engine->getComponent(); if (!$component) { list($pageId, $variables) = each($pageCandidates); return $pageId; } $storage = null; foreach ($pageCandidates as $pageId => $variablesTmp) { if (!empty($variablesTmp["PATH"]) && is_string($variablesTmp["PATH"])) { $storage = $this->getStorageByVariables($variablesTmp); if (!$storage) { return ''; } $variables = array_merge($variablesTmp, $this->resolvePathToFolder($storage, $variablesTmp["PATH"])); if (empty($variables['FOLDER_ID'])) { return ''; } return $pageId; } elseif (!empty($variablesTmp["FILE_PATH"]) && is_string($variablesTmp["FILE_PATH"])) { $storage = $this->getStorageByVariables($variablesTmp); if (!$storage) { return ''; } $variables = array_merge($variablesTmp, $this->resolvePathToFile($storage, $variablesTmp["FILE_PATH"])); if (empty($variables['FILE_ID'])) { return ''; } return $pageId; } elseif (!empty($variablesTmp["TRASH_PATH"]) && is_string($variablesTmp["TRASH_PATH"])) { $storage = $this->getStorageByVariables($variablesTmp); if (!$storage) { return ''; } $variables = array_merge($variablesTmp, $this->resolvePathToTrashFolder($storage, $variablesTmp["TRASH_PATH"])); if (empty($variables['FOLDER_ID'])) { return ''; } return $pageId; } elseif (!empty($variablesTmp["TRASH_FILE_PATH"]) && is_string($variablesTmp["TRASH_FILE_PATH"])) { $storage = $this->getStorageByVariables($variablesTmp); if (!$storage) { return ''; } $variables = array_merge($variablesTmp, $this->resolvePathToTrashFile($storage, $variablesTmp["TRASH_FILE_PATH"])); if (empty($variables['FILE_ID'])) { return ''; } return $pageId; } } list($pageId, $variables) = each($pageCandidates); return $pageId; }
/** * @param CBitrixComponentTemplate &$component * @param mixed &$arParams[] * @param mixed &$arResult[] */ function reportViewShowTopButtons(&$component, &$arParams, &$arResult) { /** @global CMain $APPLICATION */ global $APPLICATION; $component->SetViewTarget("pagetitle", 100); ?> <div class="reports-title-buttons"> <a class="reports-title-button" href="<?php echo $APPLICATION->GetCurPageParam("EXCEL=Y&ncc=1"); ?> "> <?php //ncc=1 is for preventing composite work on this hit ?> <i class="reports-title-button-excel-icon"></i><span class="reports-link"><?php echo GetMessage('REPORT_EXCEL_EXPORT'); ?> </span> </a> <?php if ($arResult['MARK_DEFAULT'] > 0) { ?> <a class="reports-title-button" href="<?php echo CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_REPORT_CONSTRUCT"], array("report_id" => $arParams['REPORT_ID'], 'action' => 'copy')); ?> "> <i class="reports-title-button-edit-icon"></i><span class="reports-link"><?php echo GetMessage('REPORT_COPY'); ?> </span> </a> <?php } else { ?> <a class="reports-title-button" href="<?php echo CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_REPORT_CONSTRUCT"], array("report_id" => $arParams['REPORT_ID'], 'action' => 'edit')); ?> "> <i class="reports-title-button-edit-icon"></i><span class="reports-link"><?php echo GetMessage('REPORT_EDIT'); ?> </span> </a> <?php } ?> <a class="reports-title-button" href="<?php echo CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_REPORT_LIST"], array()); ?> "> <i class="reports-title-button-back-icon"></i><span class="reports-link"><?php echo GetMessage('REPORT_RETURN_TO_LIST'); ?> </span> </a> </div> <?php $component->EndViewTarget(); }
/** * Gets url which use for building url to listing folders, trashcan, etc. * @return string */ public function getStorageBaseUrl() { if (!empty($this->unserializedMiscData['BASE_URL'])) { return '/' . ltrim(\CComponentEngine::makePathFromTemplate($this->unserializedMiscData['BASE_URL']), '/'); } return '/common/' . $this->entityId . '/files/'; }
public function getDataToShow() { $event = \CCalendarEvent::getById($this->entityId); if (empty($event)) { return array(); } $members = array(); if ($event['IS_MEETING']) { if (is_array($event['~ATTENDEES'])) { foreach ($event['~ATTENDEES'] as $user) { $members[] = array("NAME" => $user['DISPLAY_NAME'], "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $user['USER_ID'])), 'AVATAR_SRC' => $user['AVATAR'], "IS_EXTRANET" => "N"); } } } else { $by = "id"; $order = "asc"; $userRow = \CUser::getList($by, $order, array("ID_EQUAL_EXACT" => $event['CREATED_BY'], "ACTIVE" => "Y"), array("SELECT" => array('ID', 'NAME', 'LAST_NAME', 'LOGIN', 'PERSONAL_PHOTO')))->fetch(); if ($userRow) { $name = trim($userRow['NAME'] . ' ' . $userRow['LAST_NAME']); if ($name == '') { $name = trim($userRow['LOGIN']); } $members[] = array("NAME" => $name, "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $event['CREATED_BY'])), 'AVATAR_SRC' => Ui\Avatar::getPerson($userRow['PERSONAL_PHOTO']), "IS_EXTRANET" => "N"); } } return array('TITLE' => Loc::getMessage('DISK_UF_CAL_EVENT_CONNECTOR_TITLE') . ": " . $event['NAME'], 'DETAIL_URL' => null, 'DESCRIPTION' => Ui\Text::killTags($event['DESCRIPTION']), 'MEMBERS' => $members); }
private function getGridData($gridId) { $grid = array('ID' => $gridId); $securityContext = $this->storage->getCurrentUserSecurityContext(); $parameters = array('with' => array('FILE', 'CREATE_USER'), 'filter' => array('IS_EXPIRED' => false, 'OBJECT.STORAGE_ID' => $this->storage->getId(), 'CREATED_BY' => $this->getUser()->getId())); $parameters = Driver::getInstance()->getRightsManager()->addRightsCheck($securityContext, $parameters, array('OBJECT_ID', 'OBJECT.CREATED_BY')); $items = ExternalLink::getModelList($parameters); Collection::sortByColumn($items, array('CREATE_TIME' => array(SORT_NUMERIC, SORT_ASC))); $urlManager = Driver::getInstance()->getUrlManager(); $rows = array(); foreach ($items as $externalLink) { /** @var ExternalLink $externalLink */ $exportData = $externalLink->toArray(); $nameSpecialChars = htmlspecialcharsbx($externalLink->getFile()->getName()); $createDateText = htmlspecialcharsbx((string) $externalLink->getCreateTime()); $columnName = "\n\t\t\t\t<table class=\"bx-disk-object-name\"><tr>\n\t\t\t\t\t\t<td style=\"width: 45px;\"><div data-object-id=\"{$externalLink->getId()}\" class=\"draggable bx-file-icon-container-small bx-disk-file-icon\"></div></td>\n\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$externalLink->getId()}\" href=\"\" data-bx-dateModify=\"{$createDateText}\">{$nameSpecialChars}</a></td>\n\t\t\t\t</tr></table>\n\t\t\t"; $createdByLink = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_USER'], array("user_id" => $externalLink->getCreatedBy())); $rows[] = array('data' => $exportData, 'columns' => array('CREATE_TIME' => formatDate('x', $externalLink->getCreateTime()->getTimestamp(), time() + CTimeZone::getOffset()), 'UPDATE_TIME' => formatDate('x', $externalLink->getCreateTime()->getTimestamp(), time() + CTimeZone::getOffset()), 'NAME' => $columnName, 'FORMATTED_SIZE' => CFile::formatSize($externalLink->getFile()->getSize()), 'CREATE_USER' => "\n\t\t\t\t\t\t<div class=\"bx-disk-user-link\"><a target='_blank' href=\"{$createdByLink}\" id=\"\">" . htmlspecialcharsbx($externalLink->getCreateUser()->getFormattedName()) . "</a></div>\n\t\t\t\t\t"), 'actions' => array(array("PSEUDO_NAME" => "download", "DEFAULT" => true, "ICONCLASS" => "download", "TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DOWNLOAD'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $urlManager->getUrlForDownloadFile($externalLink->getFile()) . "')"), array("PSEUDO_NAME" => "disable_external_link", "ICONCLASS" => "disable_external_link", "TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DISABLE_EXTERNAL_LINK'), "SHORT_TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DISABLE_EXTERNAL_LINK_SHORT'), "ONCLICK" => "BX.Disk['ExternalLinkListClass_{$this->getComponentId()}'].disableExternalLink({$externalLink->getId()}, {$externalLink->getObjectId()})"))); } unset($externalLink); $grid['MODE'] = 'list'; $grid['HEADERS'] = array(array('id' => 'ID', 'name' => 'ID', 'default' => false, 'show_checkbox' => true), array('id' => 'NAME', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_NAME'), 'default' => true), array('id' => 'CREATE_TIME', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_CREATE_TIME'), 'default' => true), array('id' => 'CREATE_USER', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_CREATE_USER'), 'default' => false), array('id' => 'FORMATTED_SIZE', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_FORMATTED_SIZE'), 'default' => true)); $grid['ROWS'] = $rows; $grid['ROWS_COUNT'] = count($rows); $grid['FOOTER'] = array(); return $grid; }
public function createLinkFromTemplate($sTemplate = "") { if (!$this->sPathTemplate && !$sTemplate || !$this->sName) { return false; } $this->sLink = CComponentEngine::MakePathFromTemplate($sTemplate != "" ? $sTemplate : $this->sPathTemplate, array('wiki_name' => urlencode('category:' . $this->sName), 'group_id' => CWikiSocnet::$iSocNetId)); return true; }
public function getUrl($entityID, $fieldName, $fileID = 0) { $params = array('owner_id' => $entityID, 'field_name' => $fieldName); if ($fileID > 0) { $params['file_id'] = $fileID; } return \CComponentEngine::MakePathFromTemplate(self::$urlTemplates[$this->entityTypeName], $params); }
protected function getBreadcrumbs() { $crumbs = array(); $parts = explode('/', '/' . trim($this->arParams['RELATIVE_PATH'], '/')); foreach ($parts as $i => $part) { $crumbs[] = array('NAME' => $part, 'LINK' => rtrim(CComponentEngine::MakePathFromTemplate($this->arParams['PATH_TO_FOLDER_LIST'], array('PATH' => implode('/', array_slice($parts, 0, $i + 1)))), '/') . '/'); } unset($i, $part); return $crumbs; }
static function getRightsLinks($arPage) { global $arParams, $APPLICATION; if (!is_array($arPage)) { $arPage = array($arPage); } $arLinks = array(); $arParams['ELEMENT_NAME'] = htmlspecialcharsback($arParams['ELEMENT_NAME']); $arParams['ELEMENT_NAME'] = urlencode($arParams['ELEMENT_NAME']); if (in_array('categories', $arPage)) { return array(); } if (in_array('article', $arPage) && !in_array('add', $arPage)) { $arLinks['article'] = array('NAME' => GetMessage('PAGE_ARTICLE'), 'TITLE' => GetMessage('PAGE_ARTICLE_TITLE'), 'CURRENT' => in_array('article', $arPage), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_POST'], array('wiki_name' => $arParams['ELEMENT_NAME'], 'group_id' => CWikiSocnet::$iSocNetId)), 'ID' => 'article', 'TYPE' => 'page', 'IS_RED' => in_array('add', $arPage) ? 'Y' : 'N'); } if (self::IsWriteable() && ((!in_array('history', $arPage) || in_array('history_diff', $arPage)) && (!in_array('add', $arPage) && !in_array('edit', $arPage) && !in_array('delete', $arPage) && !in_array('rename', $arPage)))) { if (IsModuleInstalled('bizproc')) { $arLinks['history'] = array('NAME' => GetMessage('PAGE_HISTORY'), 'TITLE' => GetMessage('PAGE_HISTORY_TITLE'), 'CURRENT' => in_array('history', $arPage), 'LINK' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_HISTORY'], array('wiki_name' => $arParams['ELEMENT_NAME'], 'group_id' => CWikiSocnet::$iSocNetId)), $arParams['IN_COMPLEX'] == 'Y' && $arParams['SEF_MODE'] == 'N' ? array($arParams['OPER_VAR'] => 'history') : array()), 'ID' => 'history', 'TYPE' => 'page', 'IS_RED' => 'N'); } } if ($arParams['USE_REVIEW'] == 'Y') { $arLinks['discussion'] = array('NAME' => GetMessage('PAGE_DISCUSSION'), 'TITLE' => GetMessage('PAGE_DISCUSSION_TITLE'), 'CURRENT' => in_array('discussion', $arPage), 'LINK' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DISCUSSION'], array('wiki_name' => $arParams['ELEMENT_NAME'], 'group_id' => CWikiSocnet::$iSocNetId)), $arParams['IN_COMPLEX'] == 'Y' && $arParams['SEF_MODE'] == 'N' ? array($arParams['OPER_VAR'] => 'discussion') : array()), 'ID' => 'discussion', 'TYPE' => 'page', 'IS_RED' => 'N'); } if (self::IsWriteable() && (!in_array('history', $arPage) && !in_array('history_diff', $arPage))) { $arLinks['add'] = array('NAME' => GetMessage('PAGE_ADD'), 'TITLE' => GetMessage('PAGE_ADD_TITLE'), 'CURRENT' => in_array('add', $arPage), 'LINK' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_POST_EDIT'], array('wiki_name' => GetMessage('WIKI_NEW_PAGE_TITLE'), 'group_id' => CWikiSocnet::$iSocNetId)), array($arParams['OPER_VAR'] => 'add')), 'ID' => 'add', 'TYPE' => 'edit', 'IS_RED' => in_array('add', $arPage) ? 'Y' : 'N'); if (!in_array('add', $arPage)) { $arLinks['edit'] = array('NAME' => GetMessage('PAGE_EDIT'), 'TITLE' => GetMessage('PAGE_EDIT_TITLE'), 'CURRENT' => in_array('edit', $arPage), 'LINK' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_POST_EDIT'], array('wiki_name' => $arParams['ELEMENT_NAME'], 'group_id' => CWikiSocnet::$iSocNetId)), $arParams['IN_COMPLEX'] == 'Y' && $arParams['SEF_MODE'] == 'N' ? array($arParams['OPER_VAR'] => 'edit') : array()), 'ID' => 'edit', 'TYPE' => 'edit', 'IS_RED' => in_array('add', $arPage) ? 'Y' : 'N'); $url = $APPLICATION->GetPopupLink(array('URL' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_POST_EDIT'], array('wiki_name' => urlencode($arParams['ELEMENT_NAME']), 'group_id' => CWikiSocnet::$iSocNetId)), array($arParams['OPER_VAR'] => 'rename')), 'PARAMS' => array('width' => 400, 'height' => 150, 'resizable' => false))); $arLinks['rename'] = array('NAME' => GetMessage('WIKI_PAGE_RENAME'), 'TITLE' => GetMessage('WIKI_PAGE_RENAME_TITLE'), 'CURRENT' => in_array('rename', $arPage), 'LINK' => 'javascript:' . $url, 'ID' => 'rename', 'TYPE' => 'page'); if (self::IsDeleteable()) { $url = $APPLICATION->GetPopupLink(array('URL' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_POST_EDIT'], array('wiki_name' => $arParams['ELEMENT_ID'], 'group_id' => CWikiSocnet::$iSocNetId)), array($arParams['OPER_VAR'] => 'delete')), 'PARAMS' => array('width' => 400, 'height' => 150, 'resizable' => false))); $arLinks['delete'] = array('NAME' => GetMessage('PAGE_DELETE'), 'TITLE' => GetMessage('PAGE_DELETE_TITLE'), 'CURRENT' => in_array('delete', $arPage), 'LINK' => 'javascript:' . $url, 'ID' => 'delete', 'TYPE' => 'edit', 'IS_RED' => 'N'); } } /** $arLinks['access'] = array( 'NAME' => GetMessage('PAGE_ACCESS'), 'TITLE' => GetMessage('PAGE_ACCESS_TITLE'), 'CURRENT' => in_array('access', $arPage), 'LINK' => CHTTP::urlAddParams( CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_POST_EDIT'], array( 'wiki_name' => $arParams['ELEMENT_NAME'], 'group_id' => CWikiSocnet::$iSocNetId ) ), array($arParams['OPER_VAR'] => 'access') ), 'ID' => 'access', 'TYPE' => 'edit', 'IS_RED' => 'N' ); **/ } return $arLinks; }
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; }
protected function getBreadcrumbs() { $crumbs = array(); $parts = explode('/', trim($this->arParams['RELATIVE_PATH'], '/')); foreach ($this->arParams['RELATIVE_ITEMS'] as $i => $item) { if (empty($item)) { continue; } $crumbs[] = array('ID' => $item['ID'], 'NAME' => $item['NAME'], 'LINK' => rtrim(CComponentEngine::MakePathFromTemplate($this->arParams['PATH_TO_FOLDER_LIST'], array('PATH' => implode('/', array_slice($parts, 0, $i + 1)) ?: '')), '/') . '/'); } unset($i, $item); return $crumbs; }
protected function getDestinations() { if ($this->taskPostData === null) { return array(); } $members = array(); if (!empty($this->taskPostData['RESPONSIBLE_ID'])) { $members[] = array("NAME" => \CUser::formatName('#NAME# #LAST_NAME#', array('NAME' => $this->taskPostData['RESPONSIBLE_NAME'], 'LAST_NAME' => $this->taskPostData['RESPONSIBLE_LAST_NAME'], 'SECOND_NAME' => $this->taskPostData['RESPONSIBLE_SECOND_NAME'], 'ID' => $this->taskPostData['RESPONSIBLE_ID'], 'LOGIN' => $this->taskPostData['RESPONSIBLE_LOGIN']), true, false), "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $this->taskPostData['RESPONSIBLE_ID'])), 'AVATAR_SRC' => Ui\Avatar::getPerson($this->taskPostData['RESPONSIBLE_PHOTO']), "IS_EXTRANET" => "N"); } if (!empty($this->taskPostData['CREATED_BY'])) { $members[] = array("NAME" => \CUser::formatName('#NAME# #LAST_NAME#', array('NAME' => $this->taskPostData['CREATED_BY_NAME'], 'LAST_NAME' => $this->taskPostData['CREATED_BY_LAST_NAME'], 'SECOND_NAME' => $this->taskPostData['CREATED_BY_SECOND_NAME'], 'ID' => $this->taskPostData['CREATED_BY'], 'LOGIN' => $this->taskPostData['CREATED_BY_LOGIN']), true, false), "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $this->taskPostData['CREATED_BY'])), 'AVATAR_SRC' => Ui\Avatar::getPerson($this->taskPostData['CREATED_BY_PHOTO']), "IS_EXTRANET" => "N"); } return $members; }
function SendRemindEventAgent($iblockId, $taskId, $pathTemplate) { if (!CModule::IncludeModule("socialnetwork") && !CModule::IncludeModule("iblock")) { return; } $iblockId = IntVal($iblockId); $taskId = IntVal($taskId); if (!isset($GLOBALS["USER"]) || !is_object($GLOBALS["USER"])) { $bTmpUser = True; $GLOBALS["USER"] = new CUser(); } $arTasksCustomProps = array(); $dbTasksCustomProps = CIBlockProperty::GetList(array("sort" => "asc", "name" => "asc"), array("ACTIVE" => "Y", "IBLOCK_ID" => $iblockId, "CHECK_PERMISSIONS" => "N")); while ($arTasksCustomProp = $dbTasksCustomProps->Fetch()) { $ind = StrLen($arTasksCustomProp["CODE"]) > 0 ? $arTasksCustomProp["CODE"] : $arTasksCustomProp["ID"]; $arTasksCustomProps[StrToUpper($ind)] = $arTasksCustomProp; } $dbTasksList = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "ID" => $taskId, "CHECK_PERMISSIONS" => "N"), false, false, array("ID", "NAME", "IBLOCK_ID", "CREATED_BY", "PROPERTY_" . $arTasksCustomProps["TASKASSIGNEDTO"]["ID"])); while ($arTask = $dbTasksList->GetNext()) { $ar = array(); $dbElementSections = CIBlockElement::GetElementGroups($arTask["ID"]); while ($arElementSection = $dbElementSections->Fetch()) { if ($arElementSection["IBLOCK_ID"] == $iblockId) { $ar[] = $arElementSection["ID"]; } } if (Count($ar) <= 0) { continue; } $taskType = ""; $taskOwnerId = 0; $dbSectionsChain = CIBlockSection::GetNavChain($iblockId, $ar[0]); if ($arSect = $dbSectionsChain->Fetch()) { $taskType = $arSect["XML_ID"] == "users_tasks" ? "user" : "group"; $taskOwnerId = IntVal($taskType == "user" ? $arTask["PROPERTY_" . $arTasksCustomProps["TASKASSIGNEDTO"]["ID"] . "_VALUE"] : $arSect["XML_ID"]); } if (!In_Array($taskType, array("user", "group")) || $taskOwnerId <= 0) { continue; } $path2view = ($GLOBALS["APPLICATION"]->IsHTTPS() ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . CComponentEngine::MakePathFromTemplate($pathTemplate, array("owner_id" => $taskOwnerId, "task_id" => $arTask["ID"], "action" => "view")); $arMessageFields = array("=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM, "FROM_USER_ID" => $arTask["CREATED_BY"], "TO_USER_ID" => $arTask["PROPERTY_" . $arTasksCustomProps["TASKASSIGNEDTO"]["ID"] . "_VALUE"], "MESSAGE" => str_replace(array("#URL_VIEW#", "#NAME#"), array($path2view, $arTask["NAME"]), GetMessage("INTE_REMIND_TASK_MESSAGE"))); CSocNetMessages::Add($arMessageFields); //CIBlockElement::SetPropertyValueCode($arTask["ID"], $arTasksCustomProps["TASKREMIND"]["ID"], false); } if ($bTmpUser) { unset($GLOBALS["USER"]); } //return "CIntranetTasks::SendRemindEventAgent($iblockId, $taskId, \"$pathTemplate\");"; }
/** * получение результатов */ protected function getResult() { $urlTemplates = array(); if ($this->arParams['SEF_MODE'] == 'Y') { $variables = array(); $urlTemplates = \CComponentEngine::MakeComponentUrlTemplates($this->defaultUrlTemplates404, $this->arParams['SEF_URL_TEMPLATES']); $variableAliases = \CComponentEngine::MakeComponentVariableAliases($this->defaultUrlTemplates404, $this->arParams['VARIABLE_ALIASES']); $this->page = \CComponentEngine::ParseComponentPath($this->arParams['SEF_FOLDER'], $urlTemplates, $variables); if (strlen($this->page) <= 0) { $this->page = 'index'; } \CComponentEngine::InitComponentVariables($this->page, $this->componentVariables, $variableAliases, $variables); } else { $this->page = 'index'; } $this->arResult = array('FOLDER' => $this->arParams['SEF_FOLDER'], 'URL_TEMPLATES' => $urlTemplates, 'VARIABLES' => $variables, 'ALIASES' => $variableAliases); }
public function getUrl($entityID, $fieldName, $fileID = 0) { $srcFieldName = ''; /** @var EntityConversionMap|null $map */ $map = $this->getMap(); if ($map !== null) { $srcFieldName = $map->resolveSourceID($fieldName); } if ($srcFieldName !== '') { $params = array('owner_id' => $this->srcEntityID, 'field_name' => $srcFieldName); if ($fileID > 0) { $params['file_id'] = $fileID; } return \CComponentEngine::MakePathFromTemplate(self::$urlTemplates[$this->srcEntityTypeName], $params); } return parent::getUrl($entityID, $fieldName, $fileID); }
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']); } } }
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; }
/** * Set type of the page */ protected function setPage() { $urlTemplates = array(); if ($this->arParams['SEF_MODE'] === 'Y') { $variables = array(); $urlTemplates = \CComponentEngine::MakeComponentUrlTemplates($this->defaultUrlTemplates, $this->arParams['SEF_URL_TEMPLATES']); $variableAliases = \CComponentEngine::MakeComponentVariableAliases($this->defaultUrlTemplates, $this->arParams['VARIABLE_ALIASES']); $this->templatePage = \CComponentEngine::ParseComponentPath($this->arParams['SEF_FOLDER'], $urlTemplates, $variables); if (!$this->templatePage) { if ($this->arParams['SET_404'] === 'Y') { $folder404 = str_replace('\\', '/', $this->arParams['SEF_FOLDER']); if ($folder404 != '/') { $folder404 = '/' . trim($folder404, "/ \t\n\r\v") . "/"; } if (substr($folder404, -1) == '/') { $folder404 .= 'index.php'; } if ($folder404 != Main\Context::getCurrent()->getRequest()->getRequestedPage()) { $this->return404(); } } $this->templatePage = $this->defaultSefPage; } /* if ($this->isSearchRequest() && $this->arParams['USE_SEARCH'] === 'Y') { $this->templatePage = 'search'; } */ \CComponentEngine::InitComponentVariables($this->templatePage, $this->componentVariables, $variableAliases, $variables); } else { $this->templatePage = $this->defaultPage; } $this->arResult['FOLDER'] = $this->arParams['SEF_FOLDER']; $this->arResult['URL_TEMPLATES'] = $urlTemplates; $this->arResult['VARIABLES'] = $variables; $this->arResult['ALIASES'] = $variableAliases; }
function GetPost($params, $arPath) { global $USER; $postId = IntVal(CBlogMetaWeblog::DecodeParams($params[0]["#"]["value"][0]["#"])); $user = CBlogMetaWeblog::DecodeParams($params[1]["#"]["value"][0]["#"]); $password = CBlogMetaWeblog::DecodeParams($params[2]["#"]["value"][0]["#"]); if (CBlogMetaWeblog::Authorize($user, $password)) { $result = ''; $userId = $USER->GetID(); if (IntVal($postId) > 0) { $arSelectedFields = array("ID", "BLOG_ID", "TITLE", "DATE_PUBLISH", "AUTHOR_ID", "DETAIL_TEXT", "DETAIL_TEXT_TYPE", "BLOG_URL", "BLOG_OWNER_ID"); $dbPost = CBlogPost::GetList(array(), array("AUTHOR_ID" => $userId, "ID" => $postId), false, array("nTopCount" => 1), $arSelectedFields); if ($arPost = $dbPost->Fetch()) { $parser = new blogTextParser(); $dateISO = date("Y-m-d\\TH:i:s", MakeTimeStamp($arPost["DATE_PUBLISH"])); $title = htmlspecialcharsEx($arPost["TITLE"]); $arImages = array(); $res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arPost["BLOG_ID"], "IS_COMMENT" => "N")); while ($arImage = $res->Fetch()) { $arImages[$arImage['ID']] = $arImage['FILE_ID']; } if ($arPost["DETAIL_TEXT_TYPE"] == "html") { $arAllow = array("HTML" => "Y", "ANCHOR" => "Y", "IMG" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "N", "QUOTE" => "N", "CODE" => "N"); $text = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, $arAllow, false); } else { $arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "N", "CODE" => "N", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "N"); $text = $parser->convert_to_rss(htmlspecialcharsEx($arPost["DETAIL_TEXT"]), $arImages, $arAllow, false); } $text = "<![CDATA[" . $text . "]]>"; $category = ""; $dbCategory = CBlogPostCategory::GetList(array(), array("BLOG_ID" => $arPost["BLOG_ID"], "POST_ID" => $arPost["ID"])); while ($arCategory = $dbCategory->Fetch()) { $category .= '<value>' . htmlspecialcharsEx($arCategory["NAME"]) . '</value>'; } $path2Post = ""; if (strlen($arPath["PATH_TO_POST"]) > 0) { if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) { $serverName = SITE_SERVER_NAME; } else { $serverName = COption::GetOptionString("main", "server_name", "www.bitrixsoft.com"); } $path2Post = "http://" . $serverName . CComponentEngine::MakePathFromTemplate($arPath["PATH_TO_POST"], array("blog" => $arPost["BLOG_URL"], "user_id" => $arPost["BLOG_OWNER_ID"], "post_id" => $arPost["ID"])); } $result .= ' <value> <struct>'; if (strlen($category) > 0) { $result .= '<member> <name>categories</name> <value> <array> <data> ' . $category . ' </data> </array> </value> </member> '; } $result .= ' <member> <name>dateCreated</name> <value> <dateTime.iso8601>' . $dateISO . '</dateTime.iso8601> </value> </member> <member> <name>description</name> <value>' . $text . '</value> </member> <member> <name>link</name> <value>' . htmlspecialcharsEx($path2Post) . '</value> </member> <member> <name>postid</name> <value> <i4>' . $arPost["ID"] . '</i4> </value> </member> <member> <name>title</name> <value>' . $title . '</value> </member> <member> <name>publish</name> <value> <boolean>' . ($arPost["PUBLISH_STATUS"] == "D" ? "0" : "1") . '</boolean> </value> </member> </struct> </value> '; } } return '<params> <param> <value> <array> <data>' . $result . '</data> </array> </value> </param> </params>'; } else { return '<fault> <value> <struct> <member> <name>faultCode</name> <value><int>3</int></value> </member> <member> <name>faultString</name> <value><string>' . $arAuthResult["MESSAGE"] . '</string></value> </member> </struct> </value> </fault>'; } }
$pageId = "user_files"; include "util_menu.php"; include "util_profile.php"; if ($arParams["FATAL_ERROR"] == "Y") { if (!empty($arParams["ERROR_MESSAGE"])) { ShowError($arParams["ERROR_MESSAGE"]); } else { ShowNote($arParams["NOTE_MESSAGE"], "notetext-simple"); } $this->__component->__menu_values = false; return false; } if ($arResult["VARIABLES"]["PAGE_NAME"] == "WEBDAV_TASK") { $GLOBALS["APPLICATION"]->AddChainItem(GetMessage("WD_TASK"), CComponentEngine::MakePathFromTemplate($arResult['~PATH_TO_GROUP_FILES_WEBDAV_TASK_LIST'], array())); } elseif ($arResult["VARIABLES"]["PAGE_NAME"] == "PATH_TO_GROUP_FILES_WEBDAV_BIZPROC_WORKFLOW_EDIT") { $GLOBALS["APPLICATION"]->AddChainItem(GetMessage("WD_BP"), CComponentEngine::MakePathFromTemplate($arResult['~PATH_TO_GROUP_FILES_WEBDAV_BIZPROC_WORKFLOW_ADMIN'], array())); } ?> <br class="sn-br" /> <?php if ($arParams["SHOW_WEBDAV"] == "Y") { $url_help = $arResult["~PATH_TO_USER_FILES_HELP"]; $url_base = str_replace(":443", "", rtrim($arResult["VARIABLES"]["BASE_URL"], '/')); $url_base = ($GLOBALS["APPLICATION"]->IsHTTPS() ? 'https' : 'http') . '://' . str_replace("//", "/", $_SERVER['HTTP_HOST'] . "/" . $url_base . "/"); include_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/components/bitrix/webdav/templates/.default/informer.php"; } if ($arParams["PERMISSION"] >= "W" && $arParams["CHECK_CREATOR"] != "Y" && $arResult["VARIABLES"]["PAGE_NAME"] == "SECTIONS") { // $result = CSocNetUserToGroup::InitUserPerms($GLOBALS["USER"]->GetId(), $arGroup, CSocNetUser::IsCurrentUserModuleAdmin()); // if ($result["UserCanModerateGroup"] === true) // { $bNeedButton = $arParams["OBJECT"]->workflow == "bizproc";
/** * Function initializes the component. Returns true on success. * * <p>It is absolutly necessery to call this function before any component usage.</p> * @param string $componentName * @param string $componentTemplate * @return bool * */ final public function initComponent($componentName, $componentTemplate = false) { $this->__bInited = false; $componentName = trim($componentName); if (strlen($componentName) <= 0) { $this->__ShowError("Empty component name"); return false; } $path2Comp = CComponentEngine::MakeComponentPath($componentName); if (strlen($path2Comp) <= 0) { $this->__ShowError(sprintf("'%s' is not a valid component name", $componentName)); return false; } $componentPath = "/bitrix/components".$path2Comp; $this->classOfComponent = self::__getClassForPath($componentPath); if($this->classOfComponent !== "") { $componentFile = $_SERVER["DOCUMENT_ROOT"].$componentPath."/component.php"; if (!file_exists($componentFile) || !is_file($componentFile)) { $this->__ShowError(sprintf("'%s' is not a component", $componentName)); return false; } } $this->__name = $componentName; $this->__relativePath = $path2Comp; $this->__path = $componentPath; $this->arResult = array(); $this->arParams = array(); $this->__parent = null; $this->__arIncludeAreaIcons = array(); $this->__cache = null; if ($componentTemplate !== false) $this->setTemplateName($componentTemplate); $this->__bInited = true; return true; }
public static function requestGroupUser($arFields) { $groupID = $arFields['GROUP_ID']; $message = $arFields['MESSAGE']; if(intval($groupID) <= 0) throw new Exception('Wrong group ID'); $dbRes = CSocNetGroup::GetList(array(), array( "ID" => $groupID, "CHECK_PERMISSIONS" => "Y" )); $arGroup = $dbRes->Fetch(); if(is_array($arGroup)) { $url = (CMain::IsHTTPS() ? "https://" : "http://").$_SERVER["HTTP_HOST"].CComponentEngine::MakePathFromTemplate("/workgroups/group/#group_id#/requests/", array("group_id" => $arGroup["ID"])); if (!CSocNetUserToGroup::SendRequestToBeMember($GLOBALS["USER"]->GetID(), $arGroup["ID"], $message, $url, false)) throw new Exception('Cannot request to join group'); return true; } else throw new Exception('Socialnetwork group not found'); }
$ar = explode('_', $value); $arValue[CUserTypeCrm::GetLongEntityType($ar[0])][] = intval($ar[1]); } } } $arResult['VALUE'] = array(); if ($arParams['arUserField']['SETTINGS']['LEAD'] == 'Y' && isset($arValue['LEAD']) && !empty($arValue['LEAD'])) { $dbRes = CCrmLead::GetList(array('TITLE' => 'ASC', 'LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => $arValue['LEAD'])); while ($arRes = $dbRes->Fetch()) { $arResult['VALUE']['LEAD'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['TITLE'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $arRes['ID']))); } } if ($arParams['arUserField']['SETTINGS']['CONTACT'] == 'Y' && isset($arValue['CONTACT']) && !empty($arValue['CONTACT'])) { $dbRes = CCrmContact::GetList(array('LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => $arValue['CONTACT'])); while ($arRes = $dbRes->Fetch()) { $arResult['VALUE']['CONTACT'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['FULL_NAME'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $arRes['ID']))); } } if ($arParams['arUserField']['SETTINGS']['COMPANY'] == 'Y' && isset($arValue['COMPANY']) && !empty($arValue['COMPANY'])) { $dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC'), array('ID' => $arValue['COMPANY'])); while ($arRes = $dbRes->Fetch()) { $arResult['VALUE']['COMPANY'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['TITLE'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $arRes['ID']))); } } if ($arParams['arUserField']['SETTINGS']['DEAL'] == 'Y' && isset($arValue['DEAL']) && !empty($arValue['DEAL'])) { $dbRes = CCrmDeal::GetList(array('TITLE' => 'ASC'), array('ID' => $arValue['DEAL'])); while ($arRes = $dbRes->Fetch()) { $arResult['VALUE']['DEAL'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['TITLE'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $arRes['ID']))); } } }
$arParams["PATH_TO_BIZPROC_EDIT"] = trim($arParams["PATH_TO_BIZPROC_EDIT"]); if (strlen($arParams["PATH_TO_BIZPROC_EDIT"]) <= 0) { $arParams["PATH_TO_BIZPROC_EDIT"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=bizproc_edit&" . $arParams["TASK_VAR"] . "=#task_id#"); } if (!$GLOBALS["USER"]->IsAuthorized()) { $arResult["NEED_AUTH"] = "Y"; } else { if ($arParams["SET_TITLE"] == "Y") { $APPLICATION->SetTitle(GetMessage("SONET_BIZPROC_TITLE")); } if ($arParams["SET_NAV_CHAIN"] != "N") { $APPLICATION->AddChainItem(GetMessage("SONET_BIZPROC_TITLE")); } $dbResultList = CBPTaskService::GetList(array("MODIFIED" => "DESC"), array("USER_ID" => $USER->GetID()), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS")); while ($arResultItem = $dbResultList->GetNext()) { if (strlen($arResultItem["DESCRIPTION"]) > 100) { $arResultItem["DESCRIPTION"] = substr($arResultItem["DESCRIPTION"], 0, 97) . "..."; } $arResultItem["EditUrl"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BIZPROC_EDIT"], array("task_id" => $arResultItem["ID"])); $arResult["TASKS"][] = $arResultItem; } $dbTracking = CBPTrackingService::GetList(array("MODIFIED" => "DESC"), array("MODIFIED_BY" => $USER->GetID())); while ($arTracking = $dbTracking->GetNext()) { if (strlen($arTracking["WORKFLOW_ID"]) > 0) { $arTracking["STATE"] = CBPStateService::GetWorkflowState($arTracking["WORKFLOW_ID"]); $arTracking["STATE"]["Url"] = CBPDocument::GetDocumentAdminPage($arTracking["STATE"]["DOCUMENT_ID"]); } $arResult["TRACKING"][] = $arTracking; } } $this->IncludeComponentTemplate();
window.location.reload(); } } }); } this.popupWindow.close(); return false; } }, <?php } ?> { text : "<?php echo GetMessage("INTR_ISP_EDIT_USER"); ?> ", className : "profile-menu-profiledit", href : "<?php echo CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_EDIT'], array("user_id" => $arUser["ID"])); ?> " } <?php } ?> ]; <?php if ($arResult['CAN_VIDEO_CALL']) { ?> if (BXIM && BXIM.checkCallSupport()) { popupUserMenuItems.push({ text : "<?php echo GetMessage("INTR_ISP_VIDEO_CALL"); ?> ", className : "profile-menu-videocall", onclick : function() {if (BXIM) { BXIM.callTo(user_id); return false;}}});
if ($arParams["SET_TITLE"] == "Y") { $APPLICATION->SetTitle(GetMessage("LEARNING_PROFILE_TITLE")); } $currentPage = GetPagePath(false, false); $queryString = htmlspecialcharsbx(DeleteParam(array($arParams["TEST_ID_VARIABLE"]))); $arResult = array("RECORDS" => array(), "ATTEMPTS" => array(), "CURRENT_PAGE" => $currentPage . ($queryString == "" ? "" : "?") . $queryString); //GradeBook $rsGradebook = CGradeBook::GetList(array("ID" => "DESC"), array("STUDENT_ID" => intval($USER->GetID()), "SITE_ID" => LANG, "TEST_ID" => array_key_exists($arParams["TEST_ID_VARIABLE"], $_REQUEST) ? intval($_REQUEST[$arParams["TEST_ID_VARIABLE"]]) : "")); // Collection of tests' ids $arTestsIds = array(); while ($arGradebook = $rsGradebook->GetNext()) { //Test Url $arGradebook["TEST_DETAIL_URL"] = CComponentEngine::MakePathFromTemplate($arParams["TEST_DETAIL_TEMPLATE"], array("TEST_ID" => $arGradebook["TEST_ID"], "COURSE_ID" => $arGradebook["COURSE_ID"])); $arGradebook['APPROVED'] = $arGradebook['TEST_APPROVED']; //Course Url $arGradebook["COURSE_DETAIL_URL"] = CComponentEngine::MakePathFromTemplate($arParams["COURSE_DETAIL_TEMPLATE"], array("COURSE_ID" => $arGradebook["COURSE_ID"])); $arGradebook["ATTEMPT_DETAIL_URL"] = $arResult["CURRENT_PAGE"] . ($queryString == "" ? "?" : "&") . $arParams["TEST_ID_VARIABLE"] . "=" . $arGradebook["TEST_ID"]; $arResult["RECORDS"][] = $arGradebook; // collect tests' ids if (!in_array($arGradebook['TEST_ID'], $arTestsIds)) { $arTestsIds[] = $arGradebook['TEST_ID']; } } // Add info about last tests' attempts for each test $arResult['LAST_TEST_INFO'] = array(); foreach ($arTestsIds as $key => $testId) { $arAttempt = false; $attempts = CTestAttempt::GetList(array('ID' => 'DESC'), array('TEST_ID' => $testId, 'STUDENT_ID' => (int) $USER->getId()), array('ID', 'TEST_ID', 'STUDENT_ID', 'SCORE', 'COMPLETED'), array('NAV_PARAMS' => array('nPageTop' => 1))); $lastScore = false; $lastCompleted = false; if ($arAttempt = $attempts->fetch()) {
} } } // obtain a list of pictures page $arResult['IMAGES'] = array(); if (!empty($arResult['ELEMENT']['IMAGES'])) { foreach ($arResult['ELEMENT']['IMAGES'] as $_imgID) { $rsFile = CFile::GetByID($_imgID); $arFile = $rsFile->Fetch(); $aImg = array(); $aImg['ID'] = $_imgID; $aImg['ORIGINAL_NAME'] = $arFile['ORIGINAL_NAME']; $aImg['FILE_SHOW'] = CFile::ShowImage($_imgID, 100, 100, "id=\"{$_imgID}\" border=\"0\" style=\"cursor:pointer;\" onclick=\"doInsert('[File:" . CUtil::JSEscape(htmlspecialcharsbx($arFile['ORIGINAL_NAME'])) . "]','',false, '{$_imgID}')\" title='" . GetMessage('WIKI_IMAGE_INSERT') . "'"); $arResult['IMAGES'][] = $aImg; } } include_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/components/bitrix/wiki/include/nav.php'; $arResult['PATH_TO_POST_EDIT'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_POST_EDIT'], array('wiki_name' => urlencode($arParams['ELEMENT_NAME']), 'group_id' => CWikiSocnet::$iSocNetId)), $arParams['IN_COMPLEX'] == 'Y' && $arParams['SEF_MODE'] == 'N' ? array($arParams['OPER_VAR'] => $arResult['WIKI_oper']) : array()); $arResult['~PATH_TO_POST_EDIT'] = urldecode($arResult['PATH_TO_POST_EDIT']); //because it can change the page name, and hence the path for the parameter "Action" in tag "Form" if (strpos(POST_FORM_ACTION_URI, 'SEF_APPLICATION_CUR_PAGE_URL=') !== false) { $arResult['PATH_TO_POST_EDIT_SUBMIT'] = CHTTP::urlAddParams(CHTTP::urlDeleteParams(POST_FORM_ACTION_URI, array('SEF_APPLICATION_CUR_PAGE_URL')), array('SEF_APPLICATION_CUR_PAGE_URL' => urlencode($arResult['~PATH_TO_POST_EDIT']))); } else { $arResult['PATH_TO_POST_EDIT_SUBMIT'] = $arResult['PATH_TO_POST_EDIT']; } $sCatName = ''; $arResult["IS_CATEGORY_PAGE"] = CWikiUtils::IsCategoryPage($arResult['ELEMENT']['NAME_LOCALIZE'], $sCatName); } } $this->IncludeComponentTemplate(); unset($GLOBALS['arParams']);
} $arDefaultUrlTemplates404 = array("list" => "profile_list.php", "detail" => "profile_detail.php?ID=#ID#"); $arDefaultVariableAliases404 = array(); $arDefaultVariableAliases = array(); $arComponentVariables = array("ID", "del_id"); $componentPage = ""; $arVariables = array(); $this->setFramemode(false); if ($arParams["SEF_MODE"] == "Y") { $arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams["SEF_URL_TEMPLATES"]); $arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams["VARIABLE_ALIASES"]); $componentPage = CComponentEngine::ParseComponentPath($arParams["SEF_FOLDER"], $arUrlTemplates, $arVariables); CComponentEngine::InitComponentVariables($componentPage, $arComponentVariables, $arVariableAliases, $arVariables); foreach ($arUrlTemplates as $url => $value) { $arResult["PATH_TO_" . ToUpper($url)] = $arParams["SEF_FOLDER"] . $value; } if ($componentPage != "detail") { $componentPage = "list"; } $arResult = array_merge(array("SEF_FOLDER" => $arParams["SEF_FOLDER"], "URL_TEMPLATES" => $arUrlTemplates, "VARIABLES" => $arVariables, "ALIASES" => $arVariableAliases), $arResult); } else { $arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams["VARIABLE_ALIASES"]); CComponentEngine::InitComponentVariables(false, $arComponentVariables, $arVariableAliases, $arVariables); if (IntVal($_REQUEST["ID"]) > 0) { $componentPage = "detail"; } else { $componentPage = "list"; } $arResult = array("VARIABLES" => $arVariables, "ALIASES" => $arVariableAliases); } $this->IncludeComponentTemplate($componentPage);
} $url = empty($url) ? $arResult["URL_TEMPLATES"]["INDEX"] : $url; LocalRedirect($url); } // Show Page if ($this->__page !== "menu") { $sTempatePage = $this->__page; $sTempateFile = $this->__file; $this->__component->IncludeComponentTemplate("menu"); $this->__page = $sTempatePage; $this->__file = $sTempateFile; if ($arParams["SEO_USER"] == "TEXT" && strToLower($this->__page) == "profile_view" && $GLOBALS["USER"]->GetId() != $arResult["UID"] && $GLOBALS["APPLICATION"]->GetGroupRight("forum") < "W") { $APPLICATION->AuthForm(""); } if ($arParams["SHOW_FORUM_USERS"] != "N" && in_array(strToLower($this->__page), array("profile", "profile_view", "subscr_list", "user_post"))) { $GLOBALS["APPLICATION"]->AddChainItem(GetMessage("F_USERS"), CComponentEngine::MakePathFromTemplate($res["~URL_TEMPLATES_USER_LIST"], array())); } } else { return true; } /******************************************************************** Input params ********************************************************************/ $arThemes = array(); $sTemplateDirFull = preg_replace("'[\\\\/]+'", "/", dirname(realpath(__FILE__)) . "/"); $dir = $sTemplateDirFull . "themes/"; if (is_dir($dir) && ($directory = opendir($dir))) { while (($file = readdir($directory)) !== false) { if ($file != "." && $file != ".." && is_dir($dir . $file)) { $arThemes[] = $file; }