本文整理汇总了PHP中CComponentEngine类的典型用法代码示例。如果您正苦于以下问题:PHP CComponentEngine类的具体用法?PHP CComponentEngine怎么用?PHP CComponentEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CComponentEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolveComponentEngine
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;
}
示例2: resolveSocNetPathComponentEngine
/**
* 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;
}
示例3: reportViewShowTopButtons
/**
* @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();
}
示例4: getStorageBaseUrl
/**
* 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/';
}
示例5: getDataToShow
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);
}
示例6: getGridData
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;
}
示例7: createLinkFromTemplate
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;
}
示例8: getUrl
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);
}
示例9: getBreadcrumbs
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;
}
示例10: getRightsLinks
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;
}
示例11: add
public function add($data, $parameters = array())
{
global $DB, $USER;
$result = array();
if (!$USER->IsAuthorized()) {
throw new Tasks\Exception("Authentication is required.");
}
$title = isset($data["title"]) ? trim($data["title"]) : "";
$responsible = isset($data["responsible"]) ? intval($data["responsible"]) : $USER->GetID();
$deadline = isset($data["deadline"]) && $DB->FormatDate($data["deadline"], \CSite::GetDateFormat("FULL")) ? $data["deadline"] : "";
$description = isset($data["description"]) ? trim($data["description"]) : "";
$project = isset($data["project"]) ? intval($data["project"]) : 0;
$nameTemplate = isset($data["nameTemplate"]) ? trim($data["nameTemplate"]) : "";
$ganttMode = isset($data["ganttMode"]) && $data["ganttMode"] === "true";
if (strlen($nameTemplate) > 0) {
preg_match_all("/(#NAME#)|(#NOBR#)|(#\\/NOBR#)|(#LAST_NAME#)|(#SECOND_NAME#)|(#NAME_SHORT#)|(#SECOND_NAME_SHORT#)|\\s|\\,/", $nameTemplate, $matches);
$nameTemplate = implode("", $matches[0]);
} else {
$nameTemplate = \CSite::GetNameFormat(false);
}
$fields = array("TITLE" => $title, "DESCRIPTION" => $description, "RESPONSIBLE_ID" => $responsible, "DEADLINE" => $deadline, "SITE_ID" => $data["siteId"], "GROUP_ID" => $project, "NAME_TEMPLATE" => $nameTemplate, 'DESCRIPTION_IN_BBCODE' => "Y");
$taskItem = \CTaskItem::add($fields, $USER->GetId());
$task = $taskItem->getData();
$task["GROUP_NAME"] = "";
if ($task["GROUP_ID"]) {
$socGroup = \CSocNetGroup::GetByID($task["GROUP_ID"]);
if ($socGroup) {
$task["GROUP_NAME"] = $socGroup["~NAME"];
}
}
\Bitrix\Main\FinderDestTable::merge(array("CONTEXT" => "TASK_RESPONSIBLE", "CODE" => array("U" . $task["RESPONSIBLE_ID"], "SG" . $task["GROUP_ID"])));
$taskId = $taskItem->getId();
$arPaths = array("PATH_TO_TASKS_TASK" => isset($data["pathToTask"]) ? trim($data["pathToTask"]) : "", "PATH_TO_USER_PROFILE" => isset($data["pathToUser"]) ? trim($data["pathToUser"]) : "", "PATH_TO_USER_TASKS_TASK" => isset($data["pathToUserTasksTask"]) ? trim($data["pathToUserTasksTask"]) : "");
$columnsOrder = null;
if (isset($data["columnsOrder"]) && is_array($data["columnsOrder"])) {
$columnsOrder = array_map("intval", $data["columnsOrder"]);
}
$order = isset($data["order"]) && checkSerializedData($data["order"]) ? unserialize($data["order"]) : array();
$filter = isset($data["filter"]) && checkSerializedData($data["filter"]) ? unserialize($data["filter"]) : array();
$navigation = isset($data["navigation"]) && checkSerializedData($data["navigation"]) ? unserialize($data["navigation"]) : array();
$select = isset($data["select"]) && checkSerializedData($data["select"]) ? unserialize($data["select"]) : array();
$result["taskRaw"] = $task;
$result["taskId"] = $task["ID"];
$result["taskPath"] = \CComponentEngine::MakePathFromTemplate($arPaths["PATH_TO_TASKS_TASK"], array("task_id" => $task["ID"], "action" => "view"));
$result["position"] = $this->getTaskPosition($taskId, $order, $filter, $navigation, $select);
if ($ganttMode) {
$result["task"] = $this->getJson($task, $arPaths, $nameTemplate);
} else {
$result["html"] = $this->getHtml($task, $arPaths, $nameTemplate, $columnsOrder);
}
return $result;
}
示例12: getBreadcrumbs
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;
}
示例13: getDestinations
protected function getDestinations()
{
if ($this->taskPostData === null) {
return array();
}
$members = array();
if (!empty($this->taskPostData['RESPONSIBLE_ID'])) {
$members[] = array("NAME" => \CUser::formatName('#NAME# #LAST_NAME#', array('NAME' => $this->taskPostData['RESPONSIBLE_NAME'], 'LAST_NAME' => $this->taskPostData['RESPONSIBLE_LAST_NAME'], 'SECOND_NAME' => $this->taskPostData['RESPONSIBLE_SECOND_NAME'], 'ID' => $this->taskPostData['RESPONSIBLE_ID'], 'LOGIN' => $this->taskPostData['RESPONSIBLE_LOGIN']), true, false), "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $this->taskPostData['RESPONSIBLE_ID'])), 'AVATAR_SRC' => Ui\Avatar::getPerson($this->taskPostData['RESPONSIBLE_PHOTO']), "IS_EXTRANET" => "N");
}
if (!empty($this->taskPostData['CREATED_BY'])) {
$members[] = array("NAME" => \CUser::formatName('#NAME# #LAST_NAME#', array('NAME' => $this->taskPostData['CREATED_BY_NAME'], 'LAST_NAME' => $this->taskPostData['CREATED_BY_LAST_NAME'], 'SECOND_NAME' => $this->taskPostData['CREATED_BY_SECOND_NAME'], 'ID' => $this->taskPostData['CREATED_BY'], 'LOGIN' => $this->taskPostData['CREATED_BY_LOGIN']), true, false), "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $this->taskPostData['CREATED_BY'])), 'AVATAR_SRC' => Ui\Avatar::getPerson($this->taskPostData['CREATED_BY_PHOTO']), "IS_EXTRANET" => "N");
}
return $members;
}
示例14: SendRemindEventAgent
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\");";
}
示例15: getResult
/**
* получение результатов
*/
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);
}