本文整理汇总了PHP中CPageOption类的典型用法代码示例。如果您正苦于以下问题:PHP CPageOption类的具体用法?PHP CPageOption怎么用?PHP CPageOption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPageOption类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setNavStartParams
protected function setNavStartParams()
{
if ($this->arParams['PAGER_SAVE_SESSION'] !== 'Y') {
\CPageOption::SetOptionString('main', 'nav_page_in_session', 'N');
}
$this->arParams['PAGER_DESC_NUMBERING'] = $this->arParams['PAGER_DESC_NUMBERING'] === 'Y';
if ($this->arParams['DISPLAY_BOTTOM_PAGER'] === 'Y' || $this->arParams['DISPLAY_TOP_PAGER'] === 'Y') {
$this->navStartParams = ['nPageSize' => $this->arParams['ELEMENTS_COUNT'], 'bDescPageNumbering' => $this->arParams['PAGER_DESC_NUMBERING'], 'bShowAll' => $this->arParams['PAGER_SHOW_ALL']];
$this->addCacheAdditionalId(\CDBResult::GetNavParams($this->navStartParams));
} elseif ($this->arParams['ELEMENTS_COUNT'] > 0) {
$this->navStartParams = ['nTopCount' => $this->arParams['ELEMENTS_COUNT'], 'bDescPageNumbering' => $this->arParams['PAGER_DESC_NUMBERING']];
} else {
$this->navStartParams = false;
}
}
示例2: GetComponentProps
//.........这里部分代码省略.........
foreach ($arTemplateValue["VARIABLES"] as $variable) {
$arComponentParameters["PARAMETERS"]["SEF_URL_TEMPLATES_" . $templateKey]["VARIABLES"]["#" . $variable . "#"] = $arVariableAliasesSettings[$variable]["NAME"];
}
}
}
}
} elseif ($arParamKeys[$i] == "VARIABLE_ALIASES") {
$arComponentParameters["GROUPS"]["SEF_MODE"] = array("NAME" => GetMessage("COMP_GROUP_SEF_MODE"), "SORT" => 500);
$arVariableAliasesSettings = $arComponentParameters["PARAMETERS"]["VARIABLE_ALIASES"];
unset($arComponentParameters["PARAMETERS"]["VARIABLE_ALIASES"]);
foreach ($arVariableAliasesSettings as $aliaseKey => $arAliaseValue) {
$arComponentParameters["PARAMETERS"]["VARIABLE_ALIASES_" . $aliaseKey] = array("PARENT" => "SEF_MODE", "NAME" => $arAliaseValue["NAME"], "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => $aliaseKey, "COLS" => 20);
}
} elseif (isset($arComponentParameters["PARAMETERS"][$arParamKeys[$i]]["PARENT"]) && strlen($arComponentParameters["PARAMETERS"][$arParamKeys[$i]]["PARENT"]) > 0) {
if ($arComponentParameters["PARAMETERS"][$arParamKeys[$i]]["PARENT"] == "URL_TEMPLATES") {
$arComponentParameters["GROUPS"]["URL_TEMPLATES"] = array("NAME" => GetMessage("COMP_GROUP_URL_TEMPLATES"), "SORT" => 400);
} elseif ($arComponentParameters["PARAMETERS"][$arParamKeys[$i]]["PARENT"] == "VISUAL") {
$arComponentParameters["GROUPS"]["VISUAL"] = array("NAME" => GetMessage("COMP_GROUP_VISUAL"), "SORT" => 300);
} elseif ($arComponentParameters["PARAMETERS"][$arParamKeys[$i]]["PARENT"] == "DATA_SOURCE") {
$arComponentParameters["GROUPS"]["DATA_SOURCE"] = array("NAME" => GetMessage("COMP_GROUP_DATA_SOURCE"), "SORT" => 200);
} elseif ($arComponentParameters["PARAMETERS"][$arParamKeys[$i]]["PARENT"] == "BASE") {
$arComponentParameters["GROUPS"]["BASE"] = array("NAME" => GetMessage("COMP_GROUP_BASE"), "SORT" => 100);
} elseif ($arComponentParameters["PARAMETERS"][$arParamKeys[$i]]["PARENT"] == "ADDITIONAL_SETTINGS") {
$arComponentParameters["GROUPS"]["ADDITIONAL_SETTINGS"] = array("NAME" => GetMessage("COMP_GROUP_ADDITIONAL_SETTINGS"), "SORT" => 700);
}
} elseif ($arParamKeys[$i] == "AJAX_MODE") {
$arComponentParameters["GROUPS"]["AJAX_SETTINGS"] = array("NAME" => GetMessage("COMP_GROUP_AJAX_SETTINGS"), "SORT" => 550);
$arComponentParameters["PARAMETERS"]["AJAX_MODE"] = array("PARENT" => "AJAX_SETTINGS", "NAME" => GetMessage("COMP_PROP_AJAX_MODE"), "TYPE" => "CHECKBOX", "DEFAULT" => "N", "ADDITIONAL_VALUES" => "N");
// $arComponentParameters["PARAMETERS"]["AJAX_OPTION_SHADOW"] = array(
// "PARENT" => "AJAX_SETTINGS",
// "NAME" => GetMessage("COMP_PROP_AJAX_OPTIONS_SHADOW"),
// "TYPE" => "CHECKBOX",
// "MULTIPLE" => "N",
// "DEFAULT" => "Y",
// "ADDITIONAL_VALUES" => "N"
// );
$arComponentParameters["PARAMETERS"]["AJAX_OPTION_JUMP"] = array("PARENT" => "AJAX_SETTINGS", "NAME" => GetMessage("COMP_PROP_AJAX_OPTIONS_JUMP"), "TYPE" => "CHECKBOX", "MULTIPLE" => "N", "DEFAULT" => "N", "ADDITIONAL_VALUES" => "N");
$arComponentParameters["PARAMETERS"]["AJAX_OPTION_STYLE"] = array("PARENT" => "AJAX_SETTINGS", "NAME" => GetMessage("COMP_PROP_AJAX_OPTIONS_STYLE"), "TYPE" => "CHECKBOX", "MULTIPLE" => "N", "DEFAULT" => "Y", "ADDITIONAL_VALUES" => "N");
$arComponentParameters["PARAMETERS"]["AJAX_OPTION_HISTORY"] = array("PARENT" => "AJAX_SETTINGS", "NAME" => GetMessage("COMP_PROP_AJAX_OPTIONS_HISTORY"), "TYPE" => "CHECKBOX", "MULTIPLE" => "N", "DEFAULT" => "N", "ADDITIONAL_VALUES" => "N");
$arComponentParameters["PARAMETERS"]["AJAX_OPTION_ADDITIONAL"] = array("PARENT" => "AJAX_SETTINGS", "NAME" => GetMessage("COMP_PROP_AJAX_OPTIONS_ADDITIONAL"), "TYPE" => "STRING", "HIDDEN" => "Y", "MULTIPLE" => "N", "DEFAULT" => "", "ADDITIONAL_VALUES" => "N");
} else {
$parent = $arComponentParameters["PARAMETERS"][$arParamKeys[$i]]["PARENT"];
if (!isset($parent) || !isset($arComponentParameters["GROUPS"][$parent])) {
$arComponentParameters["PARAMETERS"][$arParamKeys[$i]]["PARENT"] = "ADDITIONAL_SETTINGS";
if (!isset($arComponentParameters["GROUPS"]["ADDITIONAL_SETTINGS"])) {
$arComponentParameters["GROUPS"]["ADDITIONAL_SETTINGS"] = array("NAME" => GetMessage("COMP_GROUP_ADDITIONAL_SETTINGS"), "SORT" => 700);
}
}
}
}
if (CPageOption::GetOptionString("main", "tips_creation", "no") == "allowed" && strpos($componentPath, "/forum") !== false) {
//Create directories
$help_lang_path = $_SERVER["DOCUMENT_ROOT"] . $componentPath . "/lang";
if (!file_exists($help_lang_path)) {
mkdir($help_lang_path);
}
$help_lang_path .= "/ru";
if (!file_exists($help_lang_path)) {
mkdir($help_lang_path);
}
$help_lang_path .= "/help";
if (!file_exists($help_lang_path)) {
mkdir($help_lang_path);
}
if (is_dir($help_lang_path)) {
//Create files if none exists
$lang_filename = $help_lang_path . "/.tooltips.php";
if (!file_exists($lang_filename)) {
$handle = fopen($lang_filename, "w");
fwrite($handle, "<?\n?>");
fclose($handle);
}
$handle = fopen($lang_filename, "r");
$lang_contents = fread($handle, filesize($lang_filename));
fclose($handle);
$lang_file_modified = false;
//Bug fix
if (strpos($lang_contents, "\$MESS['") !== false) {
$lang_contents = str_replace("\$MESS['", "\$MESS ['", $lang_contents);
$lang_file_modified = true;
}
//Check out parameters
foreach ($arComponentParameters["PARAMETERS"] as $strName => $arParameter) {
if (strpos($lang_contents, "\$MESS ['{$strName}_TIP'] = ") === false) {
$lang_contents = str_replace("?>", "\$MESS ['{$strName}_TIP'] = \"" . str_replace("\$", "\\\$", str_replace('"', '\\"', $arParameter["NAME"])) . "\";\n?>", $lang_contents);
$lang_file_modified = true;
}
}
//Save the result of the work
if ($lang_file_modified) {
$handle = fopen($lang_filename, "w");
fwrite($handle, $lang_contents);
fclose($handle);
}
}
reset($arComponentParameters["PARAMETERS"]);
}
uasort($arComponentParameters["GROUPS"], array("CComponentUtil", "__GroupParamsCompare"));
return $arComponentParameters;
}
示例3: SetOptionInt
/**
* <p>Устанавливает числовое значение параметра <i>page_option_id</i> для модуля <i>module_id</i>. Возвращает "true", если операция прошла успешна, в противном случае - "false". Статичный метод.</p>
*
*
* @param string $module_id <a href="http://dev.1c-bitrix.ru/api_help/main/general/identifiers.php">Идентификатор модуля</a>.
*
* @param string $name Произвольный идентификатор параметра страницы.
*
* @param mixed $value = "" Значение параметра.<br>Необязательный. По умолчанию - "".
*
* @param des $c = ""
*
* @param string $site = false Идентификатор сайта. Значение по умолчанию - "false".
*
* @return bool
*
* <h4>Example</h4>
* <pre>
* <?
* <b>CPageOption::SetOptionInt</b>("main", "MY_PARAMETER", 2);
* ?>
* </pre>
*
*
* <h4>See Also</h4>
* <ul> <li> <a href="https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=43&LESSON_ID=2814#params"
* >Параметры страницы</a> </li> <li> <a
* href="http://dev.1c-bitrix.ru/api_help/main/reference/cpageoption/setoptionstring.php">CPageOption::SetOptionString</a>
* </li> </ul> </ht<a name="examples"></a>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/main/reference/cpageoption/setoptionint.php
* @author Bitrix
*/
public static function SetOptionInt($module_id, $name, $value = "", $desc = "", $site = "")
{
return CPageOption::SetOptionString($module_id, $name, IntVal($value), $desc, $site);
}
示例4: __construct
public function __construct($component = null)
{
parent::__construct($component);
CPageOption::SetOptionString("main", "nav_page_in_session", "N");
$this->dateFormat = CSite::GetDateFormat("FULL", SITE_ID);
Localization\Loc::loadMessages(__FILE__);
}
示例5: array
$dbresult->NavPageSize = 10;
}
$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;
}
示例6: executeProlog
/**
* выполяет действия перед кешированием
*/
protected function executeProlog()
{
if ($this->arParams['COUNT'] > 0) {
if ($this->arParams['SHOW_NAV'] == 'Y') {
\CPageOption::SetOptionString('main', 'nav_page_in_session', 'N');
$this->navParams = array('nPageSize' => $this->arParams['COUNT']);
$arNavigation = \CDBResult::GetNavParams($this->navParams);
$this->cacheAddon = array($arNavigation);
} else {
$this->navParams = array('nTopCount' => $this->arParams['COUNT']);
}
}
}
示例7: GetNavSize
function GetNavSize($table_id=false, $nPageSize=20)
{
/** @global CMain $APPLICATION */
global $APPLICATION;
$bSess = (CPageOption::GetOptionString("main", "nav_page_in_session", "Y")=="Y");
if(is_array($nPageSize))
$sNavID = $nPageSize["sNavID"];
$unique = md5((isset($sNavID)? $sNavID : $APPLICATION->GetCurPage()));
if(isset($_REQUEST["SIZEN_".($GLOBALS["NavNum"]+1)]))
{
$nSize = intval($_REQUEST["SIZEN_".($GLOBALS["NavNum"]+1)]);
if($bSess)
$_SESSION["NAV_PAGE_SIZE"][$unique] = $nSize;
}
elseif($bSess && isset($_SESSION["NAV_PAGE_SIZE"][$unique]))
{
$nSize = $_SESSION["NAV_PAGE_SIZE"][$unique];
}
else
{
$aOptions = array();
if($table_id)
$aOptions = CUserOptions::GetOption("list", $table_id);
if(intval($aOptions["page_size"]) > 0)
$nSize = intval($aOptions["page_size"]);
else
$nSize = (is_array($nPageSize)? $nPageSize["nPageSize"]:$nPageSize);
}
return $nSize;
}
示例8: GetList
function GetList($arOrder = array("SORT" => "ASC"), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
{
/*
Filter combinations:
CHECK_PERMISSIONS="N" - check permissions of the current user to the infoblock
MIN_PERMISSION="R" - when permissions check, then minimal access level
SHOW_HISTORY="N" - add history items to list
SHOW_NEW="N" - if not add history items, then add new, but not published elements
*/
global $DB, $USER, $APPLICATION;
$MAX_LOCK = intval(COption::GetOptionString("workflow", "MAX_LOCK_TIME", "60"));
$uid = is_object($USER) ? intval($USER->GetID()) : 0;
$arIblockElementFields = array("ID" => "BE.ID", "TIMESTAMP_X" => $DB->DateToCharFunction("BE.TIMESTAMP_X"), "TIMESTAMP_X_UNIX" => 'UNIX_TIMESTAMP(BE.TIMESTAMP_X)', "MODIFIED_BY" => "BE.MODIFIED_BY", "DATE_CREATE" => $DB->DateToCharFunction("BE.DATE_CREATE"), "DATE_CREATE_UNIX" => 'UNIX_TIMESTAMP(BE.DATE_CREATE)', "CREATED_BY" => "BE.CREATED_BY", "IBLOCK_ID" => "BE.IBLOCK_ID", "IBLOCK_SECTION_ID" => "BE.IBLOCK_SECTION_ID", "ACTIVE" => "BE.ACTIVE", "ACTIVE_FROM" => CPageOption::GetOptionString("iblock", "FORMAT_ACTIVE_DATES", "-") != "-" ? $DB->DateToCharFunction("BE.ACTIVE_FROM", CPageOption::GetOptionString("iblock", "FORMAT_ACTIVE_DATES", "SHORT")) : "IF(EXTRACT(HOUR_SECOND FROM BE.ACTIVE_FROM)>0, " . $DB->DateToCharFunction("BE.ACTIVE_FROM", "FULL") . ", " . $DB->DateToCharFunction("BE.ACTIVE_FROM", "SHORT") . ")", "ACTIVE_TO" => CPageOption::GetOptionString("iblock", "FORMAT_ACTIVE_DATES", "-") != "-" ? $DB->DateToCharFunction("BE.ACTIVE_TO", CPageOption::GetOptionString("iblock", "FORMAT_ACTIVE_DATES", "SHORT")) : "IF(EXTRACT(HOUR_SECOND FROM BE.ACTIVE_TO)>0, " . $DB->DateToCharFunction("BE.ACTIVE_TO", "FULL") . ", " . $DB->DateToCharFunction("BE.ACTIVE_TO", "SHORT") . ")", "DATE_ACTIVE_FROM" => CPageOption::GetOptionString("iblock", "FORMAT_ACTIVE_DATES", "-") != "-" ? $DB->DateToCharFunction("BE.ACTIVE_FROM", CPageOption::GetOptionString("iblock", "FORMAT_ACTIVE_DATES", "SHORT")) : "IF(EXTRACT(HOUR_SECOND FROM BE.ACTIVE_FROM)>0, " . $DB->DateToCharFunction("BE.ACTIVE_FROM", "FULL") . ", " . $DB->DateToCharFunction("BE.ACTIVE_FROM", "SHORT") . ")", "DATE_ACTIVE_TO" => CPageOption::GetOptionString("iblock", "FORMAT_ACTIVE_DATES", "-") != "-" ? $DB->DateToCharFunction("BE.ACTIVE_TO", CPageOption::GetOptionString("iblock", "FORMAT_ACTIVE_DATES", "SHORT")) : "IF(EXTRACT(HOUR_SECOND FROM BE.ACTIVE_TO)>0, " . $DB->DateToCharFunction("BE.ACTIVE_TO", "FULL") . ", " . $DB->DateToCharFunction("BE.ACTIVE_TO", "SHORT") . ")", "SORT" => "BE.SORT", "NAME" => "BE.NAME", "PREVIEW_PICTURE" => "BE.PREVIEW_PICTURE", "PREVIEW_TEXT" => "BE.PREVIEW_TEXT", "PREVIEW_TEXT_TYPE" => "BE.PREVIEW_TEXT_TYPE", "DETAIL_PICTURE" => "BE.DETAIL_PICTURE", "DETAIL_TEXT" => "BE.DETAIL_TEXT", "DETAIL_TEXT_TYPE" => "BE.DETAIL_TEXT_TYPE", "SEARCHABLE_CONTENT" => "BE.SEARCHABLE_CONTENT", "WF_STATUS_ID" => "BE.WF_STATUS_ID", "WF_PARENT_ELEMENT_ID" => "BE.WF_PARENT_ELEMENT_ID", "WF_LAST_HISTORY_ID" => "BE.WF_LAST_HISTORY_ID", "WF_NEW" => "BE.WF_NEW", "LOCK_STATUS" => "if (BE.WF_DATE_LOCK is null, 'green', if(DATE_ADD(BE.WF_DATE_LOCK, interval " . $MAX_LOCK . " MINUTE)<now(), 'green', if(BE.WF_LOCKED_BY=" . $uid . ", 'yellow', 'red')))", "WF_LOCKED_BY" => "BE.WF_LOCKED_BY", "WF_DATE_LOCK" => $DB->DateToCharFunction("BE.WF_DATE_LOCK"), "WF_COMMENTS" => "BE.WF_COMMENTS", "IN_SECTIONS" => "BE.IN_SECTIONS", "SHOW_COUNTER" => "BE.SHOW_COUNTER", "SHOW_COUNTER_START" => "BE.SHOW_COUNTER_START", "CODE" => "BE.CODE", "TAGS" => "BE.TAGS", "XML_ID" => "BE.XML_ID", "EXTERNAL_ID" => "BE.XML_ID", "TMP_ID" => "BE.TMP_ID", "USER_NAME" => "concat('(',U.LOGIN,') ',ifnull(U.NAME,''),' ',ifnull(U.LAST_NAME,''))", "LOCKED_USER_NAME" => "concat('(',UL.LOGIN,') ',ifnull(UL.NAME,''),' ',ifnull(UL.LAST_NAME,''))", "CREATED_USER_NAME" => "concat('(',UC.LOGIN,') ',ifnull(UC.NAME,''),' ',ifnull(UC.LAST_NAME,''))", "LANG_DIR" => "L.DIR", "LID" => "B.LID", "IBLOCK_TYPE_ID" => "B.IBLOCK_TYPE_ID", "IBLOCK_CODE" => "B.CODE", "IBLOCK_NAME" => "B.NAME", "IBLOCK_EXTERNAL_ID" => "B.XML_ID", "DETAIL_PAGE_URL" => "B.DETAIL_PAGE_URL", "LIST_PAGE_URL" => "B.LIST_PAGE_URL", "CREATED_DATE" => $DB->DateFormatToDB("YYYY.MM.DD", "BE.DATE_CREATE"), "BP_PUBLISHED" => "if(BE.WF_STATUS_ID = 1, 'Y', 'N')");
$bDistinct = false;
CIBlockElement::PrepareGetList($arIblockElementFields, $arJoinProps, $bOnlyCount, $bDistinct, $arSelectFields, $sSelect, $arAddSelectFields, $arFilter, $sWhere, $sSectionWhere, $arAddWhereFields, $arGroupBy, $sGroupBy, $arOrder, $arSqlOrder, $arAddOrderByFields, $arIBlockFilter, $arIBlockMultProps, $arIBlockConvProps, $arIBlockAllProps, $arIBlockNumProps, $arIBlockLongProps);
$arFilterIBlocks = isset($arFilter["IBLOCK_ID"]) ? array($arFilter["IBLOCK_ID"]) : array();
//******************FROM PART********************************************
$sFrom = "";
foreach ($arJoinProps["FPS"] as $iblock_id => $iPropCnt) {
$sFrom .= "\t\t\tINNER JOIN b_iblock_element_prop_s" . $iblock_id . " FPS" . $iPropCnt . " ON FPS" . $iPropCnt . ".IBLOCK_ELEMENT_ID = BE.ID\n";
$arFilterIBlocks[$iblock_id] = $iblock_id;
}
foreach ($arJoinProps["FP"] as $propID => $db_prop) {
$i = $db_prop["CNT"];
if ($db_prop["bFullJoin"]) {
$sFrom .= "\t\t\tINNER JOIN b_iblock_property FP" . $i . " ON FP" . $i . ".IBLOCK_ID = B.ID AND " . (IntVal($propID) > 0 ? " FP" . $i . ".ID=" . IntVal($propID) . "\n" : " FP" . $i . ".CODE='" . $DB->ForSQL($propID, 200) . "'\n");
} else {
$sFrom .= "\t\t\tLEFT JOIN b_iblock_property FP" . $i . " ON FP" . $i . ".IBLOCK_ID = B.ID AND " . (IntVal($propID) > 0 ? " FP" . $i . ".ID=" . IntVal($propID) . "\n" : " FP" . $i . ".CODE='" . $DB->ForSQL($propID, 200) . "'\n");
}
if ($db_prop["IBLOCK_ID"]) {
$arFilterIBlocks[$db_prop["IBLOCK_ID"]] = $db_prop["IBLOCK_ID"];
}
}
foreach ($arJoinProps["FPV"] as $propID => $db_prop) {
$i = $db_prop["CNT"];
if ($db_prop["MULTIPLE"] == "Y") {
$bDistinct = true;
}
if ($db_prop["VERSION"] == 2) {
$strTable = "b_iblock_element_prop_m" . $db_prop["IBLOCK_ID"];
} else {
$strTable = "b_iblock_element_property";
}
if ($db_prop["bFullJoin"]) {
$sFrom .= "\t\t\tINNER JOIN " . $strTable . " FPV" . $i . " ON FPV" . $i . ".IBLOCK_PROPERTY_ID = FP" . $db_prop["JOIN"] . ".ID AND FPV" . $i . ".IBLOCK_ELEMENT_ID = BE.ID\n";
} else {
$sFrom .= "\t\t\tLEFT JOIN " . $strTable . " FPV" . $i . " ON FPV" . $i . ".IBLOCK_PROPERTY_ID = FP" . $db_prop["JOIN"] . ".ID AND FPV" . $i . ".IBLOCK_ELEMENT_ID = BE.ID\n";
}
if ($db_prop["IBLOCK_ID"]) {
$arFilterIBlocks[$db_prop["IBLOCK_ID"]] = $db_prop["IBLOCK_ID"];
}
}
foreach ($arJoinProps["FPEN"] as $propID => $db_prop) {
$i = $db_prop["CNT"];
if ($db_prop["VERSION"] == 2 && $db_prop["MULTIPLE"] == "N") {
if ($db_prop["bFullJoin"]) {
$sFrom .= "\t\t\tINNER JOIN b_iblock_property_enum FPEN" . $i . " ON FPEN" . $i . ".PROPERTY_ID = " . $db_prop["ORIG_ID"] . " AND FPS" . $db_prop["JOIN"] . ".PROPERTY_" . $db_prop["ORIG_ID"] . " = FPEN" . $i . ".ID\n";
} else {
$sFrom .= "\t\t\tLEFT JOIN b_iblock_property_enum FPEN" . $i . " ON FPEN" . $i . ".PROPERTY_ID = " . $db_prop["ORIG_ID"] . " AND FPS" . $db_prop["JOIN"] . ".PROPERTY_" . $db_prop["ORIG_ID"] . " = FPEN" . $i . ".ID\n";
}
} else {
if ($db_prop["bFullJoin"]) {
$sFrom .= "\t\t\tINNER JOIN b_iblock_property_enum FPEN" . $i . " ON FPEN" . $i . ".PROPERTY_ID = FPV" . $db_prop["JOIN"] . ".IBLOCK_PROPERTY_ID AND FPV" . $db_prop["JOIN"] . ".VALUE_ENUM = FPEN" . $i . ".ID\n";
} else {
$sFrom .= "\t\t\tLEFT JOIN b_iblock_property_enum FPEN" . $i . " ON FPEN" . $i . ".PROPERTY_ID = FPV" . $db_prop["JOIN"] . ".IBLOCK_PROPERTY_ID AND FPV" . $db_prop["JOIN"] . ".VALUE_ENUM = FPEN" . $i . ".ID\n";
}
}
if ($db_prop["IBLOCK_ID"]) {
$arFilterIBlocks[$db_prop["IBLOCK_ID"]] = $db_prop["IBLOCK_ID"];
}
}
foreach ($arJoinProps["BE"] as $propID => $db_prop) {
$i = $db_prop["CNT"];
$sFrom .= "\t\t\tLEFT JOIN b_iblock_element BE" . $i . " ON BE" . $i . ".ID = " . ($db_prop["VERSION"] == 2 && $db_prop["MULTIPLE"] == "N" ? "FPS" . $db_prop["JOIN"] . ".PROPERTY_" . $db_prop["ORIG_ID"] : "FPV" . $db_prop["JOIN"] . ".VALUE_NUM") . ($arFilter["SHOW_HISTORY"] != "Y" ? " AND ((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL)" . ($arFilter["SHOW_NEW"] == "Y" ? " OR BE.WF_NEW='Y'" : "") . ")" : "") . "\n";
if ($db_prop["bJoinIBlock"]) {
$sFrom .= "\t\t\tLEFT JOIN b_iblock B" . $i . " ON B" . $i . ".ID = BE" . $i . ".IBLOCK_ID\n";
}
if ($db_prop["bJoinSection"]) {
$sFrom .= "\t\t\tLEFT JOIN b_iblock_section BS" . $i . " ON BS" . $i . ".ID = BE" . $i . ".IBLOCK_SECTION_ID\n";
}
if ($db_prop["IBLOCK_ID"]) {
$arFilterIBlocks[$db_prop["IBLOCK_ID"]] = $db_prop["IBLOCK_ID"];
}
}
foreach ($arJoinProps["BE_FPS"] as $iblock_id => $db_prop) {
$sFrom .= "\t\t\tLEFT JOIN b_iblock_element_prop_s" . $iblock_id . " JFPS" . $db_prop["CNT"] . " ON JFPS" . $db_prop["CNT"] . ".IBLOCK_ELEMENT_ID = BE" . $db_prop["JOIN"] . ".ID\n";
if ($db_prop["IBLOCK_ID"]) {
$arFilterIBlocks[$db_prop["IBLOCK_ID"]] = $db_prop["IBLOCK_ID"];
}
}
foreach ($arJoinProps["BE_FP"] as $propID => $db_prop) {
$i = $db_prop["CNT"];
list($propID, $link) = explode("~", $propID, 2);
if ($db_prop["bFullJoin"]) {
$sFrom .= "\t\t\tINNER JOIN b_iblock_property JFP" . $i . " ON JFP" . $i . ".IBLOCK_ID = BE" . $db_prop["JOIN"] . ".IBLOCK_ID AND " . (IntVal($propID) > 0 ? " JFP" . $i . ".ID=" . IntVal($propID) . "\n" : " JFP" . $i . ".CODE='" . $DB->ForSQL($propID, 200) . "'\n");
} else {
$sFrom .= "\t\t\tLEFT JOIN b_iblock_property JFP" . $i . " ON JFP" . $i . ".IBLOCK_ID = BE" . $db_prop["JOIN"] . ".IBLOCK_ID AND " . (IntVal($propID) > 0 ? " JFP" . $i . ".ID=" . IntVal($propID) . "\n" : " JFP" . $i . ".CODE='" . $DB->ForSQL($propID, 200) . "'\n");
}
if ($db_prop["IBLOCK_ID"]) {
$arFilterIBlocks[$db_prop["IBLOCK_ID"]] = $db_prop["IBLOCK_ID"];
//.........这里部分代码省略.........
示例9: setPagerParamsFromOptions
private function setPagerParamsFromOptions($tableId)
{
$unique = md5($tableId);
$bSess = \CPageOption::GetOptionString("main", "nav_page_in_session", "Y") == "Y";
if (isset($_REQUEST["SIZEN_"])) {
$this->_elementsInPage = (int) $_REQUEST["SIZEN_"];
if ($bSess) {
$_SESSION["NAV_PAGE_SIZE"][$unique] = $this->_elementsInPage;
}
} elseif ($bSess && isset($_SESSION["NAV_PAGE_SIZE"][$unique])) {
$this->_elementsInPage = $_SESSION["NAV_PAGE_SIZE"][$unique];
} else {
$aOptions = array();
if ($tableId) {
$aOptions = \CUserOptions::GetOption("list", $tableId);
}
if (intval($aOptions["page_size"]) > 0) {
$this->_elementsInPage = intval($aOptions["page_size"]);
}
}
}
示例10: onPrepareComponentParams
/**
* @inheritdoc
*/
public function onPrepareComponentParams($arParams)
{
$arParams = parent::onPrepareComponentParams($arParams);
$arParams['IBLOCK_CODE'] = htmlspecialchars(trim($arParams['IBLOCK_CODE']));
$arParams['SECTION_CODE'] = htmlspecialchars(trim($arParams['SECTION_CODE']));
$arParams['SECTION_ID'] = intval($arParams['SECTION_ID']);
if (strlen($arParams['ELEMENT_SORT_BY1']) <= 0) {
$arParams['ELEMENT_SORT_BY1'] = 'SORT';
}
if ($arParams['ELEMENT_SORT_ORDER1'] != 'DESC') {
$arParams['ELEMENT_SORT_ORDER1'] = 'ASC';
}
if (strlen($arParams['ELEMENT_SORT_BY2']) <= 0) {
$arParams['ELEMENT_SORT_BY2'] = 'ID';
}
if ($arParams['ELEMENT_SORT_ORDER2'] != 'DESC') {
$arParams['ELEMENT_SORT_ORDER2'] = 'ASC';
}
if (strlen($arParams['ELEMENT_SORT_BY3']) <= 0) {
$arParams['ELEMENT_SORT_BY3'] = 'ID';
}
if ($arParams['ELEMENT_SORT_ORDER3'] != 'DESC') {
$arParams['ELEMENT_SORT_ORDER3'] = 'ASC';
}
if (strlen($arParams['SECTION_SORT_BY1']) <= 0) {
$arParams['SECTION_SORT_BY1'] = 'SORT';
}
if ($arParams['SECTION_SORT_ORDER1'] != 'DESC') {
$arParams['SECTION_SORT_ORDER1'] = 'ASC';
}
if (strlen($arParams['SECTION_SORT_BY2']) <= 0) {
$arParams['SECTION_SORT_BY2'] = 'ID';
}
if ($arParams['SECTION_SORT_ORDER2'] != 'DESC') {
$arParams['SECTION_SORT_ORDER2'] = 'ASC';
}
if ($arParams['PAGE']) {
$arParams['PAGE'] = intval($_GET['page']);
}
if ($arParams['PAGING'] == 'Y') {
\CPageOption::SetOptionString('main', 'nav_page_in_session', 'N');
//не сохраняем в сессии параметры пагинации потому что это сбивает с толку пользователей
$nav = \CDBResult::GetNavParams();
if ($nav) {
$arParams['PAGE'] = intval($nav['PAGEN']);
} else {
if ($arParams['PAGE']) {
$arParams['PAGE'] = intval($_GET['page']);
}
}
}
$arParams['PREPROD_SERVER'] = defined('PREPROD_SERVER') && PREPROD_SERVER;
if (strlen($arParams['FILTER_NAME']) > 0 && preg_match('/^[A-Za-z_][A-Za-z01-9_]*$/', $arParams['FILTER_NAME'])) {
$this->elementsFilter = array_merge($this->elementsFilter, $GLOBALS[$arParams['FILTER_NAME']]);
$this->addCacheAdditionalId($GLOBALS[$arParams['FILTER_NAME']]);
}
//удаляем пустые элементы массива
if (!empty($arParams['ELEMENT_PROPERTIES'])) {
$arParams['ELEMENT_PROPERTIES'] = array_filter($arParams['ELEMENT_PROPERTIES']);
}
if (!empty($arParams['ELEMENT_FIELDS'])) {
$arParams['ELEMENT_FIELDS'] = array_filter($arParams['ELEMENT_FIELDS']);
}
return $arParams;
}
示例11: define
<?php
// �������������� ���������
define('LOG_FILENAME', $_SERVER['DOCUMENT_ROOT'] . '/_sb/mh_log.txt');
include_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/all/libraries/Site.php';
require_once 'FrontSite.php';
//require_once 'classes/Facebook/facebook.php';
// ������� �������������� ����� ������
\MH\FrontSite::o()->setErrorLevel();
AddEventHandler('main', 'OnEpilog', array(\MH\FrontSite::o()->meta, 'setupBitrixMeta'));
//AddEventHandler( 'iblock', 'OnBeforeIBlockElementAdd', Array( \MH\FrontSite::o()->url, 'getBitrixCodeByName' ) );
AddEventHandler('main', 'OnBeforeUserAdd', 'OnBeforeUserAddHandler');
AddEventHandler('main', 'OnAfterUserAuthorize', array(\MH\FrontSite::o()->social, 'OnBeforePrologHandler'));
CPageOption::setOptionString('main', 'nav_page_in_session', 'N');
COption::SetOptionString('main', 'component_cache_on', 'N', false, SITE_ID);
function OnBeforeUserAddHandler(&$arFields)
{
if ($arFields['UF_RULES'] != '1' && empty($arFields['EXTERNAL_AUTH_ID'])) {
global $APPLICATION;
$APPLICATION->throwException("�� ������ ������� ������������ ����������");
return false;
}
}
function OnAfterUserAuthorizeHandler(&$arFields)
{
$f = fopen($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/md/log.txt', 'a+');
global $USER;
$rsUser = CUser::GetByID($USER->GetId());
$arUser = $rsUser->Fetch();
fwrite($f, "---start\n");
if ($arUser['ID'] > 0 && $arUser['EXTERNAL_AUTH_ID'] == 'Facebook' && $arUser['UF_RULES'] != '1') {
示例12: customNavStart
/**
* Выполняет CDBResult::NavNext с той разницей, что общее количество элементов берется не из count($arResult),
* а из нашего параметра, полученного из SQL-запроса.
* array_slice также не делается.
*
* @param \CAdminResult $res
*/
protected function customNavStart(&$res)
{
$res->NavStart($this->navParams['nPageSize'], $this->navParams['navParams']['SHOW_ALL'], (int) $this->navParams['navParams']['PAGEN']);
$res->NavRecordCount = $this->totalRowsCount;
if ($res->NavRecordCount < 1) {
return;
}
if ($res->NavShowAll) {
$res->NavPageSize = $res->NavRecordCount;
}
$res->NavPageCount = floor($res->NavRecordCount / $res->NavPageSize);
if ($res->NavRecordCount % $res->NavPageSize > 0) {
$res->NavPageCount++;
}
$res->NavPageNomer = $res->PAGEN < 1 || $res->PAGEN > $res->NavPageCount ? \CPageOption::GetOptionString("main", "nav_page_in_session", "Y") != "Y" || $_SESSION[$res->SESS_PAGEN] < 1 || $_SESSION[$res->SESS_PAGEN] > $res->NavPageCount ? 1 : $_SESSION[$res->SESS_PAGEN] : $res->PAGEN;
}
示例13: array
if ($arParams["CAN_EXPAND_TABS"] !== 'N' && $arParams["CAN_EXPAND_TABS"] !== false) {
$arParams["CAN_EXPAND_TABS"] = true;
} else {
$arParams["CAN_EXPAND_TABS"] = false;
}
if ($arParams["SHOW_FORM_TAG"] !== 'N' && $arParams["SHOW_FORM_TAG"] !== false) {
$arParams["SHOW_FORM_TAG"] = true;
} else {
$arParams["SHOW_FORM_TAG"] = false;
}
if ($arParams["SHOW_SETTINGS"] !== 'N' && $arParams["SHOW_SETTINGS"] !== false) {
$arParams["SHOW_SETTINGS"] = true;
} else {
$arParams["SHOW_SETTINGS"] = false;
}
if ($arParams["USE_THEMES"] !== 'N' && $arParams["USE_THEMES"] !== false && CPageOption::GetOptionString("main.interface", "use_themes", "Y") !== "N") {
$arParams["USE_THEMES"] = true;
} else {
$arParams["USE_THEMES"] = false;
}
if ($arParams["MAX_FILE_SIZE"] == '') {
$arParams["MAX_FILE_SIZE"] = 102400;
}
$arParams["FORM_ID"] = preg_replace("/[^a-z0-9_]/i", "", $arParams["FORM_ID"]);
//*********************
//get saved options
//*********************
$aOptions = CUserOptions::GetOption("main.interface.form", $arParams["FORM_ID"], array());
if (!is_array($aOptions["tabs"])) {
$aOptions["tabs"] = array();
}
示例14: GetNavSize
function GetNavSize($table_id = false, $nPageSize = 20, $list_url)
{
$bSess = CPageOption::GetOptionString("main", "nav_page_in_session", "Y") == "Y";
if ($bSess) {
if (is_array($nPageSize)) {
$sNavID = $nPageSize["sNavID"];
}
$unique = md5(isset($sNavID) ? $sNavID : $list_url);
}
if (isset($_REQUEST["SIZEN_" . ($GLOBALS["NavNum"] + 1)])) {
$nSize = intval($_REQUEST["SIZEN_" . ($GLOBALS["NavNum"] + 1)]);
if ($bSess) {
$_SESSION["NAV_PAGE_SIZE"][$unique] = $nSize;
}
} elseif ($bSess && isset($_SESSION["NAV_PAGE_SIZE"][$unique])) {
$nSize = $_SESSION["NAV_PAGE_SIZE"][$unique];
} else {
$aOptions = array();
if ($table_id) {
$aOptions = CUserOptions::GetOption("list", $table_id);
}
if (intval($aOptions["page_size"]) > 0) {
$nSize = intval($aOptions["page_size"]);
} else {
$nSize = is_array($nPageSize) ? $nPageSize["nPageSize"] : $nPageSize;
}
}
return $nSize;
}
示例15: NavStart
/**
* <p>Метод разбивает результат выборки на страницы.</p> <p> Для встраивания системы автоматической постраничной навигации необходимо сначала вызвать данный метод <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/navstart.php">CDBResult::NavStart</a>. После ее вызова, методы </p> <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/fetch.php">CDBResult::Fetch</a> </li> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/getnext.php">CDBResult::GetNext</a> </li> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/extractfields.php">CDBResult::ExtractFields</a> </li> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/navnext.php">CDBResult::NavNext</a> </li> </ul> будут ограничены только текущей страницей (а не всей выборкой). Для вывода ссылок постраничной навигации необходимо воспользоваться методом <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/navprint.php">CDBResult::NavPrint</a>. <p> Динамичный метод.</p>
*
*
* @param int $page_size = 10 Размер страницы (от 1 и более). Необязательный. По умолчанию 10.
*
* @param bool $show_all = true Разрешить показывать все записи (и выводить ссылку "Все" в
* навигации).<br>Необязательный. По умолчанию - "true".
*
* @return mixed
*
* <h4>Example</h4>
* <pre>
* <?
* $rsBanners = CAdvBanner::GetList($by, $order, $arFilter, $is_filtered);
* <b>$rsBanners->NavStart(20)</b>;
* echo $rsBanners->NavPrint("Баннеры");
* while($rsBanners->NavNext(true, "f_")):
* echo "[".$f_ID."] ".$f_NAME."<br>";
* endwhile;
* echo $rsBanners->NavPrint("Баннеры");
* ?>
* </pre>
*
*
* <h4>See Also</h4>
* <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/navnext.php">CDBResult::NavNext</a> </li>
* <li> <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/navprint.php">CDBResult::NavPrint</a> </li> <li>
* <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/isnavprint.php">CDBResult::IsNavPrint</a> </li> <li>
* <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/fetch.php">CDBResult::Fetch</a> </li> <li> <a
* href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/getnext.php">CDBResult::GetNext</a> </li> <li> <a
* href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/extractfields.php">CDBResult::ExtractFields</a> </li>
* </ul><a name="examples"></a>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/navstart.php
* @author Bitrix
*/
public function NavStart($nPageSize = 0, $bShowAll = true, $iNumPage = false)
{
if ($this->bFromLimited) {
return;
}
if (is_array($nPageSize)) {
$this->InitNavStartVars($nPageSize);
} else {
$this->InitNavStartVars(intval($nPageSize), $bShowAll, $iNumPage);
}
if ($this->bFromArray) {
$this->NavRecordCount = count($this->arResult);
if ($this->NavRecordCount < 1) {
return;
}
if ($this->NavShowAll) {
$this->NavPageSize = $this->NavRecordCount;
}
$this->NavPageCount = floor($this->NavRecordCount / $this->NavPageSize);
if ($this->NavRecordCount % $this->NavPageSize > 0) {
$this->NavPageCount++;
}
$this->NavPageNomer = $this->PAGEN < 1 || $this->PAGEN > $this->NavPageCount ? CPageOption::GetOptionString("main", "nav_page_in_session", "Y") != "Y" || $_SESSION[$this->SESS_PAGEN] < 1 || $_SESSION[$this->SESS_PAGEN] > $this->NavPageCount ? 1 : $_SESSION[$this->SESS_PAGEN] : $this->PAGEN;
$NavFirstRecordShow = $this->NavPageSize * ($this->NavPageNomer - 1);
$NavLastRecordShow = $this->NavPageSize * $this->NavPageNomer;
$this->arResult = array_slice($this->arResult, $NavFirstRecordShow, $NavLastRecordShow - $NavFirstRecordShow);
} else {
$this->DBNavStart();
}
}