if (!CModule::IncludeModule("learning")) { ShowError(GetMessage("LEARNING_MODULE_NOT_FOUND")); return; } //Params $arParams["TEST_DETAIL_TEMPLATE"] = strlen($arParams["TEST_DETAIL_TEMPLATE"]) > 0 ? htmlspecialcharsbx($arParams["TEST_DETAIL_TEMPLATE"]) : "course/test.php?TEST_ID=#TEST_ID#"; $arParams["COURSE_DETAIL_TEMPLATE"] = strlen($arParams["COURSE_DETAIL_TEMPLATE"]) > 0 ? htmlspecialcharsbx($arParams["COURSE_DETAIL_TEMPLATE"]) : "course/index.php?COURSE_ID=#COURSE_ID#"; if (strlen($arParams["TEST_ID_VARIABLE"]) <= 0 || !preg_match("#^[A-Za-z_][A-Za-z01-9_]*\$#", $arParams["TEST_ID_VARIABLE"])) { $arParams["TEST_ID_VARIABLE"] = "TEST_ID"; } //Set Title $arParams["SET_TITLE"] = $arParams["SET_TITLE"] == "N" ? "N" : "Y"; 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
<script type="text/javascript"> function bizprocShowDelegateDialog() { window.open('/bitrix/admin/user_search.php?lang=<?php echo LANGUAGE_ID; ?> &FN=task_delegate&FC=delegate_to', '', 'scrollbars=yes,resizable=yes,width=760,height=500,top=' +Math.floor((screen.height - 560)/2-14)+',left='+Math.floor((screen.width - 760)/2-5) ); } </script> <form method="post" name="task_form1" action="<?php echo GetPagePath(false, true); ?> " enctype="multipart/form-data"> <input type="hidden" name="action" value="doTask"> <input type="hidden" name="id" value="<?php echo intval($arTask["ID"]); ?> "> <input type="hidden" name="workflow_id" value="<?php echo htmlspecialcharsbx($arTask["WORKFLOW_ID"]); ?> "> <input type="hidden" name="back_url" value="<?php echo htmlspecialcharsbx($backUrl); ?> ">
} CUtil::InitJSCore(array('ajax')); // ************************* Input params*************************************************************** $tplID = 'COMMENT_' . $arParams["ENTITY_TYPE"] . '_'; if (LANGUAGE_ID == 'ru') { $path = str_replace(array("\\", "//"), "/", __DIR__ . "/ru/script.php"); include $path; } ?> <div class="feed-wrap"> <div class="feed-comments-block"> <a name="comments"></a> <?php // *************************/Input params*************************************************************** if (!empty($arResult["MESSAGES"])) { $arResult["NAV_STRING"] = GetPagePath(false, false); if ($arResult["NAV_RESULT"]) { $strNavQueryString = htmlspecialcharsbx(DeleteParam(array("PAGEN_" . $arResult["NAV_RESULT"]->NavNum, "SIZEN_" . $arResult["NAV_RESULT"]->NavNum, "SHOWALL_" . $arResult["NAV_RESULT"]->NavNum, "MID", "result", "PHPSESSID", "clear_cache"))); if (!!$strNavQueryString) { $arResult["NAV_STRING"] .= "?" . $strNavQueryString; } } foreach ($arResult["MESSAGES"] as $res) { foreach (GetModuleEvents('forum', 'OnCommentDisplay', true) as $arEvent) { $arExt = ExecuteModuleEventEx($arEvent, array($res)); if ($arExt !== null) { foreach ($arExt as $arTpl) { $APPLICATION->AddViewContent(implode('_', array($tplID, 'ID', $res['ID'], $arTpl['DISPLAY'])), $arTpl['TEXT'], $arTpl['SORT']); } } }
if (isset($_GET["SEF_APPLICATION_CUR_PAGE_URL"]) && ( isset($_SERVER['REDIRECT_STATUS']) && $_SERVER['REDIRECT_STATUS'] == '404' || ($requestUriWithoutParams != "/bitrix/urlrewrite.php") ) ) { $url = $requestUri = $_SERVER["REQUEST_URI"] = $REQUEST_URI = ""; $_GET = array(); $_REQUEST = array(); $_SERVER["QUERY_STRING"] = $QUERY_STRING = ""; } $HTTP_GET_VARS = $_GET; $sUrlPath = GetPagePath(); $strNavQueryString = DeleteParam(array("SEF_APPLICATION_CUR_PAGE_URL")); if($strNavQueryString != "") $sUrlPath = $sUrlPath."?".$strNavQueryString; // define("POST_FORM_ACTION_URI", htmlspecialcharsbx("/bitrix/urlrewrite.php?SEF_APPLICATION_CUR_PAGE_URL=".urlencode($sUrlPath))); } if (!CHTTP::isPathTraversalUri($_SERVER["REQUEST_URI"])) { foreach($arUrlRewrite as $val) { if(preg_match($val["CONDITION"], $requestUri)) { if (strlen($val["RULE"]) > 0) $url = preg_replace($val["CONDITION"], (strlen($val["PATH"]) > 0 ? $val["PATH"]."?" : "").$val["RULE"], $requestUri); else
$dateType = isset($_REQUEST["flt_date_datesel"]) ? $_REQUEST["flt_date_datesel"] : ""; $dateDays = isset($_REQUEST["flt_date_days"]) ? $_REQUEST["flt_date_days"] : ""; $dateFrom = isset($_REQUEST["flt_date_from"]) ? $_REQUEST["flt_date_from"] : ""; $dateTo = isset($_REQUEST["flt_date_to"]) ? $_REQUEST["flt_date_to"] : ""; ?> <div id="sonet-log-filter" class="sonet-log-filter-block"> <div class="filter-block-title sonet-log-filter-title"><?php echo GetMessage("SONET_C30_T_FILTER_TITLE"); ?> </div> <form method="GET" name="log_filter" target="_self" action="<?php echo $postFormUrl !== '' ? $postFormUrl : POST_FORM_ACTION_URI; ?> "> <input type="hidden" name="SEF_APPLICATION_CUR_PAGE_URL" value="<?php echo GetPagePath(); ?> "><?php $userName = ""; if ($createdByID > 0) { $rsUser = CUser::GetByID($createdByID); if ($arUser = $rsUser->Fetch()) { $userName = CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, $arParams["SHOW_LOGIN"] != "N" ? true : false); } } ?> <div class="filter-field"> <label class="filter-field-title" for="filter-field-created-by"><?php echo GetMessage("SONET_C30_T_FILTER_CREATED_BY"); ?> </label>
function DelFilter($arName) { $md5Path = md5(GetPagePath()); unset($_SESSION["SESS_ADMIN"][$md5Path]); foreach ($arName as $name) { global ${$name}; ${$name} = ""; } }
public function GetNavPrint($title, $show_allways = false, $StyleText = "text", $template_path = false, $arDeleteParam = false) { $res = ''; $add_anchor = $this->add_anchor; $sBegin = GetMessage("nav_begin"); $sEnd = GetMessage("nav_end"); $sNext = GetMessage("nav_next"); $sPrev = GetMessage("nav_prev"); $sAll = GetMessage("nav_all"); $sPaged = GetMessage("nav_paged"); $nPageWindow = $this->nPageWindow; if (!$show_allways) { if ($this->NavRecordCount == 0 || $this->NavPageCount == 1 && $this->NavShowAll == false) { return ''; } } $sUrlPath = GetPagePath(); $arDel = array("PAGEN_" . $this->NavNum, "SIZEN_" . $this->NavNum, "SHOWALL_" . $this->NavNum, "PHPSESSID"); if (is_array($arDeleteParam)) { $arDel = array_merge($arDel, $arDeleteParam); } $strNavQueryString = DeleteParam($arDel); if ($strNavQueryString != "") { $strNavQueryString = htmlspecialcharsbx("&" . $strNavQueryString); } if ($template_path !== false && !file_exists($template_path) && file_exists($_SERVER["DOCUMENT_ROOT"] . $template_path)) { $template_path = $_SERVER["DOCUMENT_ROOT"] . $template_path; } if ($this->bDescPageNumbering === true) { if ($this->NavPageNomer + floor($nPageWindow / 2) >= $this->NavPageCount) { $nStartPage = $this->NavPageCount; } else { if ($this->NavPageNomer + floor($nPageWindow / 2) >= $nPageWindow) { $nStartPage = $this->NavPageNomer + floor($nPageWindow / 2); } else { if ($this->NavPageCount >= $nPageWindow) { $nStartPage = $nPageWindow; } else { $nStartPage = $this->NavPageCount; } } } if ($nStartPage - $nPageWindow >= 0) { $nEndPage = $nStartPage - $nPageWindow + 1; } else { $nEndPage = 1; } //echo "nEndPage = $nEndPage; nStartPage = $nStartPage;"; } else { if ($this->NavPageNomer > floor($nPageWindow / 2) + 1 && $this->NavPageCount > $nPageWindow) { $nStartPage = $this->NavPageNomer - floor($nPageWindow / 2); } else { $nStartPage = 1; } if ($this->NavPageNomer <= $this->NavPageCount - floor($nPageWindow / 2) && $nStartPage + $nPageWindow - 1 <= $this->NavPageCount) { $nEndPage = $nStartPage + $nPageWindow - 1; } else { $nEndPage = $this->NavPageCount; if ($nEndPage - $nPageWindow + 1 >= 1) { $nStartPage = $nEndPage - $nPageWindow + 1; } } } $this->nStartPage = $nStartPage; $this->nEndPage = $nEndPage; if ($template_path !== false && file_exists($template_path)) { /* $this->bFirstPrintNav - is first tiem call $this->NavPageNomer - number of current page $this->NavPageCount - total page count $this->NavPageSize - page size $this->NavRecordCount - records count $this->bShowAll - show "all" link $this->NavShowAll - is all shown $this->NavNum - number of navigation $this->bDescPageNumbering - reverse paging $this->nStartPage - first page in chain $this->nEndPage - last page in chain $strNavQueryString - query string $sUrlPath - current url Url for link to the page #PAGE_NUMBER#: $sUrlPath.'?PAGEN_'.$this->NavNum.'='.#PAGE_NUMBER#.$strNavQueryString.'#nav_start"'.$add_anchor */ ob_start(); include $template_path; $res = ob_get_contents(); ob_end_clean(); $this->bFirstPrintNav = false; return $res; } if ($this->bFirstPrintNav) { $res .= '<a name="nav_start' . $add_anchor . '"></a>'; $this->bFirstPrintNav = false; } $res .= '<font class="' . $StyleText . '">' . $title . ' '; if ($this->bDescPageNumbering === true) { $makeweight = $this->NavRecordCount % $this->NavPageSize; $NavFirstRecordShow = 0; if ($this->NavPageNomer != $this->NavPageCount) { $NavFirstRecordShow += $makeweight; } $NavFirstRecordShow += ($this->NavPageCount - $this->NavPageNomer) * $this->NavPageSize + 1; if ($this->NavPageCount == 1) { $NavLastRecordShow = $this->NavRecordCount; } else { $NavLastRecordShow = $makeweight + ($this->NavPageCount - $this->NavPageNomer + 1) * $this->NavPageSize; } $res .= $NavFirstRecordShow; $res .= ' - ' . $NavLastRecordShow; $res .= ' ' . GetMessage("nav_of") . ' '; $res .= $this->NavRecordCount; $res .= "\n<br>\n</font>"; $res .= '<font class="' . $StyleText . '">'; if ($this->NavPageNomer < $this->NavPageCount) { $res .= '<a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . $this->NavPageCount . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sBegin . '</a> | <a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . ($this->NavPageNomer + 1) . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sPrev . '</a>'; } else { $res .= $sBegin . ' | ' . $sPrev; } $res .= ' | '; $NavRecordGroup = $nStartPage; while ($NavRecordGroup >= $nEndPage) { $NavRecordGroupPrint = $this->NavPageCount - $NavRecordGroup + 1; if ($NavRecordGroup == $this->NavPageNomer) { $res .= '<b>' . $NavRecordGroupPrint . '</b> '; } else { $res .= '<a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . $NavRecordGroup . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $NavRecordGroupPrint . '</a> '; } $NavRecordGroup--; } $res .= '| '; if ($this->NavPageNomer > 1) { $res .= '<a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . ($this->NavPageNomer - 1) . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sNext . '</a> | <a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=1' . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sEnd . '</a> '; } else { $res .= $sNext . ' | ' . $sEnd . ' '; } } else { $res .= ($this->NavPageNomer - 1) * $this->NavPageSize + 1; $res .= ' - '; if ($this->NavPageNomer != $this->NavPageCount) { $res .= $this->NavPageNomer * $this->NavPageSize; } else { $res .= $this->NavRecordCount; } $res .= ' ' . GetMessage("nav_of") . ' '; $res .= $this->NavRecordCount; $res .= "\n<br>\n</font>"; $res .= '<font class="' . $StyleText . '">'; if ($this->NavPageNomer > 1) { $res .= '<a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=1' . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sBegin . '</a> | <a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . ($this->NavPageNomer - 1) . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sPrev . '</a>'; } else { $res .= $sBegin . ' | ' . $sPrev; } $res .= ' | '; $NavRecordGroup = $nStartPage; while ($NavRecordGroup <= $nEndPage) { if ($NavRecordGroup == $this->NavPageNomer) { $res .= '<b>' . $NavRecordGroup . '</b> '; } else { $res .= '<a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . $NavRecordGroup . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $NavRecordGroup . '</a> '; } $NavRecordGroup++; } $res .= '| '; if ($this->NavPageNomer < $this->NavPageCount) { $res .= '<a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . ($this->NavPageNomer + 1) . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sNext . '</a> | <a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . $this->NavPageCount . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sEnd . '</a> '; } else { $res .= $sNext . ' | ' . $sEnd . ' '; } } if ($this->bShowAll) { $res .= $this->NavShowAll ? '| <a href="' . $sUrlPath . '?SHOWALL_' . $this->NavNum . '=0' . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sPaged . '</a> ' : '| <a href="' . $sUrlPath . '?SHOWALL_' . $this->NavNum . '=1' . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sAll . '</a> '; } $res .= '</font>'; return $res; }
function DelFilter($arName) { $md5Path = md5(GetPagePath()); unset($_SESSION["SESS_ADMIN"][$md5Path]); for($i=0; $i<count($arName); $i++) { $name = $arName[$i]; global $$name; $$name = ""; } }
function SetCurPage($page, $param = false) { $this->sDocPath2 = GetPagePath($page); $this->sDirPath = GetDirPath($this->sDocPath2); if ($param !== false) { $this->sUriParam = $param; } }
function GetPageList() { global $k_aConfig; $strPagePath = GetPagePath(); $astrList = array(); if (!is_dir($strPagePath)) { return $astrList; } $dir = opendir($strPagePath); while (true) { $strEntry = readdir($dir); if ($strEntry === false) { break; } $strFullPath = $strPagePath . '/' . $strEntry; if ($strEntry != '.' && $strEntry != '..' && is_dir($strFullPath)) { $strEntry = rawurldecode($strEntry); $astrList[$strEntry] = GetLatestDate($strEntry); } } closedir($dir); return $astrList; }
/** * <p>Возвращает абсолютный путь на индексную страницу заданного сайта, для дальнейшего ее подключения при помощи require() или include(). Если ни один из сайтов не найден по хосту, то функция вернет - "false".</p> * * * * * @param string $site_id Идентификатор [link=89624]сайта[/link]. * * * * @return mixed * * * <h4>Example</h4> * <pre> * <? * require($_SERVER['DOCUMENT_ROOT']."/bitrix/modules/main/include/mainpage.php"); * * if($page = <b>CMainPage::GetIncludeSitePage</b>(CMainPage::GetSiteByHost())) * require_once($page); * * require($_SERVER['DOCUMENT_ROOT']."/bitrix/header.php");?> * <?require($_SERVER['DOCUMENT_ROOT']."/bitrix/footer.php");?> * </pre> * * * * <h4>See Also</h4> * <ul> <li> <a href="https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=43&LESSON_ID=2833" >Список * терминов</a> </li> <li> <a * href="https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=43&CHAPTER_ID=03987" * >Конфигурирование многосайтовости</a> </li> </ul><a name="examples"></a> * * * @static * @link http://dev.1c-bitrix.ru/api_help/main/reference/cmainpage/getincludesitepage.php * @author Bitrix */ public static function GetIncludeSitePage($site) { if(strlen($site)<=0) return false; $db_site = CSite::GetByID($site); if($arSite = $db_site->Fetch()) { $arSite["DIR"] = RTrim($arSite["DIR"], ' \/'); $cur_page = GetPagePath(); if(strlen($arSite["DIR"])>0) { global $REQUEST_URI; $REQUEST_URI = $arSite["DIR"].$cur_page; $_SERVER["REQUEST_URI"] = $REQUEST_URI; return $_SERVER["DOCUMENT_ROOT"].$REQUEST_URI; } } return false; }
} $arResult = array(); $arResult["NavShowAlways"] = $arParams["SHOW_ALWAYS"]; $arResult["NavTitle"] = $arParams["NAV_TITLE"]; $arResult["NavRecordCount"] = $dbresult->NavRecordCount; $arResult["NavPageCount"] = $dbresult->NavPageCount; $arResult["NavPageNomer"] = $dbresult->NavPageNomer; $arResult["NavPageSize"] = $dbresult->NavPageSize; $arResult["bShowAll"] = $dbresult->bShowAll; $arResult["NavShowAll"] = $dbresult->NavShowAll; $arResult["NavNum"] = $dbresult->NavNum; $arResult["bDescPageNumbering"] = $dbresult->bDescPageNumbering; $arResult["add_anchor"] = $dbresult->add_anchor; $arResult["nPageWindow"] = $nPageWindow = $dbresult->nPageWindow; $arResult["bSavePage"] = CPageOption::GetOptionString("main", "nav_page_in_session", "Y") == "Y"; $arResult["sUrlPath"] = GetPagePath(false, false); $arResult["NavQueryString"] = htmlspecialcharsbx(DeleteParam(array("PAGEN_" . $dbresult->NavNum, "SIZEN_" . $dbresult->NavNum, "SHOWALL_" . $dbresult->NavNum, "PHPSESSID", "clear_cache"))); $arResult['sUrlPathParams'] = $arResult['sUrlPath'] . '?' . ('' != $arResult['NavQueryString'] ? $arResult['NavQueryString'] . '&' : ''); if ($dbresult->bDescPageNumbering === true) { if ($dbresult->NavPageNomer + floor($nPageWindow / 2) >= $dbresult->NavPageCount) { $nStartPage = $dbresult->NavPageCount; } else { if ($dbresult->NavPageNomer + floor($nPageWindow / 2) >= $nPageWindow) { $nStartPage = $dbresult->NavPageNomer + floor($nPageWindow / 2); } else { if ($dbresult->NavPageCount >= $nPageWindow) { $nStartPage = $nPageWindow; } else { $nStartPage = $dbresult->NavPageCount; } }
<? if( !defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true ) die(); if( empty( $arResult ) ) return ""; $arItemLast = array(); foreach($arResult as $index => $arItem){ if($index && $arItem["LINK"] == $arItemLast["LINK"]){ unset($arResult[$index]); } else{ $arItemLast = $arItem; } } $strReturn = '<ul class="breadcrumb">'; foreach($arResult as $arItem){ $title = htmlspecialcharsex($arItem["TITLE"]); if( $arItem["LINK"] <> "" && $arItem['LINK'] != GetPagePath() && $arItem['LINK']."index.php" != GetPagePath()) $strReturn .= '<li><a href="'.$arItem["LINK"].'" title="'.$title.'">'.$title.'</a></li>'; else{ $strReturn .= '<li class="active">'.$title.'</li>'; break; } } $strReturn .= '</ul>'; return $strReturn; ?>
/** * Функция, аналогичная CMain::GetCurPageParam, только умеет работать с любой переданной ссылкой и умеет удалять массивы параметров. */ public static function getPageParam($strParam = '', $arParamKill = array(), $get_index_page = NULL, $uri = FALSE) { if (NULL === $get_index_page) { if (defined('BX_DISABLE_INDEX_PAGE')) { $get_index_page = !BX_DISABLE_INDEX_PAGE; } else { $get_index_page = TRUE; } } $sUrlPath = GetPagePath($uri, $get_index_page); $strNavQueryString = deleteParam($arParamKill, $uri); if ($strNavQueryString != '' && $strParam != '') { $strNavQueryString = '&' . $strNavQueryString; } if ($strNavQueryString == '' && $strParam == '') { return $sUrlPath; } else { return $sUrlPath . '?' . $strParam . $strNavQueryString; } }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } /** * @var array $arParams * @var array $arResult * @var CMain $APPLICATION * @var CUser $USER * @var CBitrixComponentTemplate $this */ $link = GetPagePath(false, false) . "?" . http_build_query(array_diff_key($_REQUEST, array_flip(array("MID", "sessid", "AJAX_POST", "ENTITY_XML_ID", "ENTITY_TYPE", "ENTITY_ID", "REVIEW_ACTION", "MODE", "FILTER", "result", "clear_cache")))); $arResult["OUTPUT_LIST"] = $APPLICATION->IncludeComponent("bitrix:main.post.list", "", array("TEMPLATE_ID" => $arParams["tplID"], "RATING_TYPE_ID" => $arParams["SHOW_RATING"] == "Y" ? "FORUM_POST" : "", "ENTITY_XML_ID" => $arParams["ENTITY_XML_ID"], "RECORDS" => $arResult["MESSAGES"], "NAV_STRING" => $arResult["NAV_STRING"], "NAV_RESULT" => $arResult["NAV_RESULT"], "PREORDER" => $arParams["PREORDER"], "RIGHTS" => array("MODERATE" => $arResult["PANELS"]["MODERATE"], "EDIT" => $arResult["PANELS"]["EDIT"] == "N" ? $arParams["ALLOW_EDIT_OWN_MESSAGE"] === "ALL" ? "OWN" : ($arParams["ALLOW_EDIT_OWN_MESSAGE"] === "LAST" ? "OWNLAST" : "N") : "Y", "DELETE" => $arResult["PANELS"]["EDIT"] == "N" ? $arParams["ALLOW_EDIT_OWN_MESSAGE"] === "ALL" ? "OWN" : ($arParams["ALLOW_EDIT_OWN_MESSAGE"] === "LAST" ? "OWNLAST" : "N") : "Y"), "VISIBLE_RECORDS_COUNT" => 3, "ERROR_MESSAGE" => $arResult["ERROR_MESSAGE"], "OK_MESSAGE" => $arResult["OK_MESSAGE"], "RESULT" => $arResult["RESULT"], "PUSH&PULL" => $arResult["PUSH&PULL"], "VIEW_URL" => $arParams["SHOW_LINK_TO_MESSAGE"] == "Y" ? $link : "", "EDIT_URL" => ForumAddPageParams($link, array("REVIEW_ACTION" => "GET"), false, false), "MODERATE_URL" => ForumAddPageParams($link, array("REVIEW_ACTION" => "#ACTION#"), false, false), "DELETE_URL" => ForumAddPageParams($link, array("REVIEW_ACTION" => "DEL"), false, false), "AUTHOR_URL" => $arParams["PATH_TO_USER"], "AVATAR_SIZE" => $arParams["AVATAR_SIZE_COMMENT"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams['SHOW_LOGIN'], "DATE_TIME_FORMAT" => $arParams["DATE_TIME_FORMAT"], "LAZYLOAD" => $arParams["LAZYLOAD"], "NOTIFY_TAG" => $arParams["bFromList"] ? "BLOG|COMMENT" : "", "NOTIFY_TEXT" => $arParams["bFromList"] ? TruncateText(str_replace(array("\r\n", "\n"), " ", $arParams["POST_DATA"]["~TITLE"]), 100) : "", "SHOW_MINIMIZED" => $arParams["SHOW_MINIMIZED"], "SHOW_POST_FORM" => $arResult["SHOW_POST_FORM"], "IMAGE_SIZE" => $arParams["IMAGE_SIZE"], "mfi" => $arParams["mfi"], "FORM" => array("ID" => $arParams["FORM_ID"], "URL" => $APPLICATION->GetCurPageParam("", array("sessid", "comment_post_id", "act", "post", "comment", "decode", "ENTITY_TYPE_ID", "ENTITY_ID", "empty_get_form", "empty_get_comments")), "FIELDS" => array())), $this->__component); if ($arResult["SHOW_POST_FORM"] == "Y") { ob_start(); include __DIR__ . "/form.php"; $arResult["OUTPUT_LIST"]["HTML"] = ob_get_clean() . $arResult["OUTPUT_LIST"]["HTML"]; } if ($_REQUEST["empty_get_comments"] == "Y") { $APPLICATION->RestartBuffer(); while (ob_get_clean()) { } echo CUtil::PhpToJSObject(array("TEXT" => $arResult["OUTPUT_LIST"]["HTML"], "POST_NUM_COMMENTS" => intval($arResult["Post"]["NUM_COMMENTS"]))); die; } ?> <div class="post-comments-wrap" id="post-comments-wrap"> <?php echo $arResult["OUTPUT_LIST"]["HTML"]; ?>
function GetNavPrint($title, $show_allways = false, $StyleText = "text", $template_path = false, $arDeleteParam = false) { $res = ''; $add_anchor = $this->add_anchor; $sBegin = GetMessage("nav_begin"); $sEnd = GetMessage("nav_end"); $sNext = GetMessage("nav_next"); $sPrev = GetMessage("nav_prev"); $sAll = GetMessage("nav_all"); $sPaged = GetMessage("nav_paged"); // окно, которое двигаем по страницам $nPageWindow = $this->nPageWindow; if (!$show_allways) { if ($this->NavRecordCount == 0 || $this->NavPageCount == 1 && $this->NavShowAll == false) { return; } } $sUrlPath = GetPagePath(); //Строка для формирования ссылки на следующие страницы навигации $arDel = array("PAGEN_" . $this->NavNum, "SIZEN_" . $this->NavNum, "SHOWALL_" . $this->NavNum, "PHPSESSID"); if (is_array($arDeleteParam)) { $arDel = array_merge($arDel, $arDeleteParam); } $strNavQueryString = DeleteParam($arDel); if ($strNavQueryString != "") { $strNavQueryString = htmlspecialcharsbx("&" . $strNavQueryString); } if ($template_path !== false && !file_exists($template_path) && file_exists($_SERVER["DOCUMENT_ROOT"] . $template_path)) { $template_path = $_SERVER["DOCUMENT_ROOT"] . $template_path; } if ($this->bDescPageNumbering === true) { if ($this->NavPageNomer + floor($nPageWindow / 2) >= $this->NavPageCount) { $nStartPage = $this->NavPageCount; } else { if ($this->NavPageNomer + floor($nPageWindow / 2) >= $nPageWindow) { $nStartPage = $this->NavPageNomer + floor($nPageWindow / 2); } else { if ($this->NavPageCount >= $nPageWindow) { $nStartPage = $nPageWindow; } else { $nStartPage = $this->NavPageCount; } } } if ($nStartPage - $nPageWindow >= 0) { $nEndPage = $nStartPage - $nPageWindow + 1; } else { $nEndPage = 1; } //echo "nEndPage = $nEndPage; nStartPage = $nStartPage;"; } else { // номер первой страницы в окне if ($this->NavPageNomer > floor($nPageWindow / 2) + 1 && $this->NavPageCount > $nPageWindow) { $nStartPage = $this->NavPageNomer - floor($nPageWindow / 2); } else { $nStartPage = 1; } // номер последней страницы в окне if ($this->NavPageNomer <= $this->NavPageCount - floor($nPageWindow / 2) && $nStartPage + $nPageWindow - 1 <= $this->NavPageCount) { $nEndPage = $nStartPage + $nPageWindow - 1; } else { $nEndPage = $this->NavPageCount; if ($nEndPage - $nPageWindow + 1 >= 1) { $nStartPage = $nEndPage - $nPageWindow + 1; } } } $this->nStartPage = $nStartPage; $this->nEndPage = $nEndPage; if ($template_path !== false && file_exists($template_path)) { /* $this->bFirstPrintNav - вызов в первый раз $this->NavPageNomer - номер текущей страницы $this->NavPageCount - всего страниц $this->NavPageSize - размер страницы $this->NavRecordCount - количество всего записей $this->bShowAll - разрешено ли показывать "все" $this->NavShowAll - сейчас показываются все, а не постранично $this->NavNum - номер навигации на странице $this->bDescPageNumbering - прямая или обратная постраничка $this->nStartPage - первая страница в цепочке $this->nEndPage - последняя страница в цепочке $strNavQueryString - параметры страницы без параметров навигации $sUrlPath - урл текущей страницы Url for link to the page #PAGE_NUMBER#: $sUrlPath.'?PAGEN_'.$this->NavNum.'='.#PAGE_NUMBER#.$strNavQueryString.'#nav_start"'.$add_anchor */ ob_start(); include $template_path; $res = ob_get_contents(); ob_end_clean(); $this->bFirstPrintNav = false; return $res; } if ($this->bFirstPrintNav) { $res .= '<a name="nav_start' . $add_anchor . '"></a>'; $this->bFirstPrintNav = false; } $res .= '<font class="' . $StyleText . '">' . $title . ' '; if ($this->bDescPageNumbering === true) { $makeweight = $this->NavRecordCount % $this->NavPageSize; $NavFirstRecordShow = 0; if ($this->NavPageNomer != $this->NavPageCount) { $NavFirstRecordShow += $makeweight; } $NavFirstRecordShow += ($this->NavPageCount - $this->NavPageNomer) * $this->NavPageSize + 1; if ($this->NavPageCount == 1) { $NavLastRecordShow = $this->NavRecordCount; } else { $NavLastRecordShow = $makeweight + ($this->NavPageCount - $this->NavPageNomer + 1) * $this->NavPageSize; } $res .= $NavFirstRecordShow; $res .= ' - ' . $NavLastRecordShow; $res .= ' ' . GetMessage("nav_of") . ' '; $res .= $this->NavRecordCount; $res .= "\n<br>\n</font>"; $res .= '<font class="' . $StyleText . '">'; if ($this->NavPageNomer < $this->NavPageCount) { $res .= '<a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . $this->NavPageCount . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sBegin . '</a> | <a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . ($this->NavPageNomer + 1) . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sPrev . '</a>'; } else { $res .= $sBegin . ' | ' . $sPrev; } $res .= ' | '; $NavRecordGroup = $nStartPage; while ($NavRecordGroup >= $nEndPage) { $NavRecordGroupPrint = $this->NavPageCount - $NavRecordGroup + 1; if ($NavRecordGroup == $this->NavPageNomer) { $res .= '<b>' . $NavRecordGroupPrint . '</b> '; } else { $res .= '<a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . $NavRecordGroup . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $NavRecordGroupPrint . '</a> '; } $NavRecordGroup--; } $res .= '| '; if ($this->NavPageNomer > 1) { $res .= '<a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . ($this->NavPageNomer - 1) . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sNext . '</a> | <a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=1' . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sEnd . '</a> '; } else { $res .= $sNext . ' | ' . $sEnd . ' '; } } else { $res .= ($this->NavPageNomer - 1) * $this->NavPageSize + 1; $res .= ' - '; if ($this->NavPageNomer != $this->NavPageCount) { $res .= $this->NavPageNomer * $this->NavPageSize; } else { $res .= $this->NavRecordCount; } $res .= ' ' . GetMessage("nav_of") . ' '; $res .= $this->NavRecordCount; $res .= "\n<br>\n</font>"; $res .= '<font class="' . $StyleText . '">'; if ($this->NavPageNomer > 1) { $res .= '<a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=1' . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sBegin . '</a> | <a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . ($this->NavPageNomer - 1) . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sPrev . '</a>'; } else { $res .= $sBegin . ' | ' . $sPrev; } $res .= ' | '; $NavRecordGroup = $nStartPage; while ($NavRecordGroup <= $nEndPage) { if ($NavRecordGroup == $this->NavPageNomer) { $res .= '<b>' . $NavRecordGroup . '</b> '; } else { $res .= '<a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . $NavRecordGroup . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $NavRecordGroup . '</a> '; } $NavRecordGroup++; } $res .= '| '; if ($this->NavPageNomer < $this->NavPageCount) { $res .= '<a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . ($this->NavPageNomer + 1) . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sNext . '</a> | <a href="' . $sUrlPath . '?PAGEN_' . $this->NavNum . '=' . $this->NavPageCount . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sEnd . '</a> '; } else { $res .= $sNext . ' | ' . $sEnd . ' '; } } if ($this->bShowAll) { $res .= $this->NavShowAll ? '| <a href="' . $sUrlPath . '?SHOWALL_' . $this->NavNum . '=0' . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sPaged . '</a> ' : '| <a href="' . $sUrlPath . '?SHOWALL_' . $this->NavNum . '=1' . $strNavQueryString . '#nav_start' . $add_anchor . '">' . $sAll . '</a> '; } $res .= '</font>'; return $res; }