本文整理汇总了PHP中CComponentEngine类的典型用法代码示例。如果您正苦于以下问题:PHP CComponentEngine类的具体用法?PHP CComponentEngine怎么用?PHP CComponentEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CComponentEngine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:spas-viktor,项目名称:books,代码行数:55,代码来源:comp_findtools.php
示例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;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:61,代码来源:urlmanager.php
示例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();
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:65,代码来源:template.php
示例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/';
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:11,代码来源:common.php
示例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);
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:27,代码来源:calendareventconnector.php
示例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;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:27,代码来源:class.php
示例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;
}
开发者ID:Satariall,项目名称:izurit,代码行数:8,代码来源:wiki_categories.php
示例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);
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:8,代码来源:fileviewer.php
示例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;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:10,代码来源:class.php
示例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;
}
开发者ID:rasuldev,项目名称:torino,代码行数:54,代码来源:wiki_utils.php
示例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;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:52,代码来源:listcontrols.php
示例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;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:13,代码来源:class.php
示例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;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:14,代码来源:taskconnector.php
示例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\");";
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:49,代码来源:tasks.php
示例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);
}
开发者ID:belukov,项目名称:bx-components,代码行数:20,代码来源:class.php
示例16: getUrl
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);
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:17,代码来源:entityconversionfileviewer.php
示例17: prepareData
protected function prepareData()
{
if (strlen(trim($this->arParams["NAME_TEMPLATE"])) <= 0) {
$this->arParams["NAME_TEMPLATE"] = \CSite::GetNameFormat();
}
$dbPost = \CBlogPost::GetList(array(), array("ID" => $this->arParams["postId"]), false, false, array("ID", "BLOG_ID", "PUBLISH_STATUS", "TITLE", "AUTHOR", "ENABLE_COMMENTS", "NUM_COMMENTS", "VIEWS", "CODE", "MICRO", "DETAIL_TEXT", "DATE_PUBLISH", "CATEGORY_ID", "HAS_SOCNET_ALL", "HAS_TAGS", "HAS_IMAGES", "HAS_PROPS", "HAS_COMMENT_IMAGES"));
if ($arPost = $dbPost->Fetch()) {
if (strlen($arPost['TITLE']) > 30) {
$arPost['TITLE'] = substr($arPost['TITLE'], 0, 30) . "...";
}
$this->arResult['POST'] = $arPost;
$this->arResult['POST']['PUBLISH_STATUS_DESCRIPTION'] = Loc::getMessage('BLOG_POST_PUBLISH_STATUS_' . $arPost['PUBLISH_STATUS']);
$this->arResult['POST']['AUTHOR_FORMATTED_NAME'] = \CUser::FormatName($this->arParams['NAME_TEMPLATE'], array('LOGIN' => $this->arResult['POST']['LOGIN'], 'NAME' => $this->arResult['POST']['NAME'], 'LAST_NAME' => $this->arResult['POST']['LAST_NAME']), true, false);
$this->arResult["POST"]['AUTHOR_PROFILE'] = \CComponentEngine::MakePathFromTemplate($this->arParams["PATH_TO_USER_PROFILE"], array("user_id" => $this->arResult['POST']['AUTHOR']));
$this->arResult["POST"]['AUTHOR_UNIQID'] = 'u_' . $this->randString();
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS['CACHE_MANAGER']->RegisterTag('blog_post_' . $this->arParams['postId']);
}
}
}
开发者ID:webgksupport,项目名称:alpina,代码行数:20,代码来源:class.php
示例18: Execute
public function Execute()
{
global $DB;
if (!CModule::IncludeModule("socialnetwork") || !CModule::IncludeModule("blog")) {
return CBPActivityExecutionStatus::Closed;
}
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$siteId = $this->PostSite ? $this->PostSite : SITE_ID;
$ownerId = CBPHelper::ExtractUsers($this->OwnerId, $documentId, true);
$pathToPost = COption::GetOptionString("socialnetwork", "userblogpost_page", false, $siteId);
$pathToSmile = COption::GetOptionString("socialnetwork", "smile_page", false, $siteId);
$blogGroupID = COption::GetOptionString("socialnetwork", "userbloggroup_id", false, $siteId);
$blog = CBlog::GetByOwnerID($ownerId);
if (!$blog) {
$blog = $this->createBlog($ownerId, $blogGroupID, $siteId);
}
$micro = 'N';
$title = trim($this->PostTitle);
if (!$title) {
$micro = 'Y';
$title = trim(preg_replace(array("/\n+/is" . BX_UTF_PCRE_MODIFIER, '/\\s+/is' . BX_UTF_PCRE_MODIFIER), " ", blogTextParser::killAllTags($this->PostMessage)));
}
try {
$postFields = array('TITLE' => $title, 'DETAIL_TEXT' => $this->PostMessage, 'DETAIL_TEXT_TYPE' => $this->PostMessageType == 'html' ? 'html' : 'text', '=DATE_PUBLISH' => $DB->CurrentTimeFunction(), 'PUBLISH_STATUS' => BLOG_PUBLISH_STATUS_PUBLISH, 'CATEGORY_ID' => '', 'PATH' => CComponentEngine::MakePathFromTemplate($pathToPost, array("post_id" => "#post_id#", "user_id" => $ownerId)), 'URL' => $blog['URL'], 'PERMS_POST' => array(), 'PERMS_COMMENT' => array(), 'MICRO' => $micro, 'SOCNET_RIGHTS' => $this->getSocnetRights($this->UsersTo), '=DATE_CREATE' => $DB->CurrentTimeFunction(), 'AUTHOR_ID' => $ownerId, 'BLOG_ID' => $blog['ID'], "HAS_IMAGES" => "N", "HAS_TAGS" => "N", "HAS_PROPS" => "N", "HAS_SOCNET_ALL" => "N");
if (!empty($postFields["SOCNET_RIGHTS"]) && count($postFields["SOCNET_RIGHTS"]) == 1 && in_array("UA", $postFields["SOCNET_RIGHTS"])) {
$postFields['HAS_SOCNET_ALL'] = 'Y';
}
$newId = CBlogPost::add($postFields);
$postFields["ID"] = $newId;
$arParamsNotify = array("bSoNet" => true, "UserID" => $ownerId, "allowVideo" => COption::GetOptionString("blog", "allow_video", "Y"), "PATH_TO_SMILE" => $pathToSmile, "PATH_TO_POST" => $pathToPost, "SOCNET_GROUP_ID" => $blogGroupID, "user_id" => $ownerId, "NAME_TEMPLATE" => CSite::GetNameFormat(false));
CBlogPost::Notify($postFields, $blog, $arParamsNotify);
BXClearCache(true, "/" . $siteId . "/blog/last_messages_list/");
$arFieldsIM = array("TYPE" => "POST", "TITLE" => $postFields["TITLE"], "URL" => CComponentEngine::MakePathFromTemplate($pathToPost, array("post_id" => $newId, "user_id" => $ownerId)), "ID" => $newId, "FROM_USER_ID" => $ownerId, "TO_USER_ID" => array(), "TO_SOCNET_RIGHTS" => $postFields["SOCNET_RIGHTS"], &quo
|
请发表评论