本文整理汇总了PHP中CIBlockSection::GetSectionElementsCount方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockSection::GetSectionElementsCount方法的具体用法?PHP CIBlockSection::GetSectionElementsCount怎么用?PHP CIBlockSection::GetSectionElementsCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockSection
的用法示例。
在下文中一共展示了CIBlockSection::GetSectionElementsCount方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetSection
function GetSection($id, &$arSection, $params = array())
{
static $arResult = array();
$params = is_array($params) ? $params : array($params);
$id = intval($id);
if ($id <= 0) {
return 200;
}
$arCache = array("id" => serialize(array("iblock_id" => $this->IBlockID, "section_id" => $id, "gallery_id" => $this->Gallery && $this->Gallery['ID'] ? $this->Gallery['ID'] : "0", "site" => SITE_ID)), "path" => $this->arCache["path"], "time" => $this->arCache["time"]);
if (($tzOffset = CTimeZone::GetOffset()) != 0) {
$arCache["id"] .= "_" . $tzOffset;
}
if (empty($arResult[$arCache["id"]])) {
$cache = new CPHPCache();
if ($arCache["time"] > 0 && $cache->InitCache($arCache["time"], $arCache["id"], $arCache["path"])) {
$arResult[$arCache["id"]] = $cache->GetVars();
} else {
CModule::IncludeModule("iblock");
$arFilter = array("IBLOCK_ACTIVE" => "Y", "IBLOCK_ID" => $this->IBlockID, "ID" => $id);
$db_res = CIBlockSection::GetList(array(), $arFilter, false);
if (!($db_res && ($arSection = $db_res->GetNext()))) {
if ($this->arError["show_error"] == "Y") {
ShowError(GetMessage("P_SECTION_NOT_FOUND"));
}
if ($this->arError["set_404"] == "Y") {
@define("ERROR_404", "Y");
CHTTP::SetStatus("404 Not Found");
}
return 404;
} elseif ($arSection["ACTIVE"] != "Y" && $this->User["Permission"] < "U") {
if ($this->arError["show_error"] == "Y") {
ShowError(GetMessage("P_ALBUM_IS_BLOCKED"));
}
return 405;
} elseif ($this->Gallery && ($arSection["LEFT_MARGIN"] < $this->Gallery["LEFT_MARGIN"] || $this->Gallery["RIGHT_MARGIN"] < $arSection["RIGHT_MARGIN"])) {
return 301;
} else {
$arSection["SECTIONS_CNT"] = 0;
if ($arSection["RIGHT_MARGIN"] - $arSection["LEFT_MARGIN"] > 1) {
$arSection["SECTIONS_CNT"] = intVal(CIBlockSection::GetCount(array("SECTION_ID" => $arSection["ID"])));
}
$arSection["SECTION_ELEMENTS_CNT"] = $arSection["SECTION_ELEMENTS_CNT_ALL"] = $arSection["ELEMENTS_CNT"] = 0;
$arSection["ELEMENTS_CNT_ALL"] = intVal(CIBlockSection::GetSectionElementsCount($arSection["ID"], array("CNT_ALL" => "Y")));
// if section not empty
if ($arSection["ELEMENTS_CNT_ALL"] > 0) {
if ($arSection["SECTIONS_CNT"] > 0) {
$arSection["SECTION_ELEMENTS_CNT_ALL"] = intval(CIBlockElement::GetList(array(), array("SECTION_ID" => $arSection["ID"]), array(), false, array("ID")));
} else {
$arSection["SECTION_ELEMENTS_CNT_ALL"] = $arSection["ELEMENTS_CNT_ALL"];
}
if ($this->User["Permission"] < "U") {
$arSection["ELEMENTS_CNT"] = intVal(CIBlockSection::GetSectionElementsCount($arSection["ID"], array("CNT_ACTIVE" => "Y")));
} else {
$arSection["ELEMENTS_CNT"] = $arSection["ELEMENTS_CNT_ALL"];
}
// if not exists active elements
if ($arSection["ELEMENTS_CNT"] <= 0) {
$arSection["SECTION_ELEMENTS_CNT"] = 0;
} elseif ($arSection["ELEMENTS_CNT_ALL"] == $arSection["ELEMENTS_CNT"]) {
$arSection["SECTION_ELEMENTS_CNT"] = $arSection["SECTION_ELEMENTS_CNT_ALL"];
} elseif ($arSection["SECTIONS_CNT"] <= 0) {
$arSection["SECTION_ELEMENTS_CNT"] = $arSection["ELEMENTS_CNT"];
} else {
$arSection["SECTION_ELEMENTS_CNT"] = intval(CIBlockElement::GetList(array(), array("SECTION_ID" => $arSection["ID"], "ACTIVE" => "Y"), array(), false, array("ID")));
}
}
$arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("IBLOCK_" . $this->IBlockID . "_SECTION", $arSection["ID"], LANGUAGE_ID);
$arSection["USER_FIELDS"] = $arUserFields;
$arSection["DATE"] = $arSection["~DATE"] = $arUserFields["UF_DATE"];
$arSection["~PASSWORD"] = $arUserFields["UF_PASSWORD"];
if (is_array($arSection["~PASSWORD"])) {
$arSection["PASSWORD"] = $arSection["~PASSWORD"]["VALUE"];
}
$arSection["PICTURE"] = CFile::GetFileArray($arSection["PICTURE"]);
$arSection["DETAIL_PICTURE"] = CFile::GetFileArray($arSection["DETAIL_PICTURE"]);
$arSection["PATH"] = array();
$db_res = GetIBlockSectionPath($this->IBlockID, $arSection["ID"]);
while ($res = $db_res->GetNext()) {
$arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("IBLOCK_" . $this->IBlockID . "_SECTION", $res["ID"], LANGUAGE_ID);
$res["~PASSWORD"] = $arUserFields["UF_PASSWORD"];
if (is_array($res["~PASSWORD"])) {
$res["PASSWORD"] = $res["~PASSWORD"]["VALUE"];
}
$arSection["PATH"][$res["ID"]] = $res;
}
$arResult[$arCache["id"]] = $arSection;
if ($arCache["time"] > 0) {
$cache->StartDataCache($arCache["time"], $arCache["id"], $arCache["path"]);
$cache->EndDataCache($arSection);
}
}
}
}
$arSection = $arResult[$arCache["id"]];
return 200;
}
示例2: PhotoDateFormat
{
$res["DATE"] = $res["UF_DATE"];
$res["~DATE"] = $res["~UF_DATE"];
if (!empty($res["~DATE"]))
$res["DATE"] = PhotoDateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["~DATE"], CSite::GetDateFormat()));
$res["PASSWORD"] = $res["UF_PASSWORD"];
$res["~PASSWORD"] = $res["~UF_PASSWORD"];
$res["PICTURE"] = CFile::GetFileArray($res["PICTURE"]);
$res["DETAIL_PICTURE"] = CFile::GetFileArray($res["DETAIL_PICTURE"]);
$res["SECTIONS_CNT"] = intVal(CIBlockSection::GetCount(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "SECTION_ID" => $res["ID"])));
$res["ELEMENTS_CNT"] = intVal(CIBlockSection::GetSectionElementsCount($res["ID"], array("CNT_ACTIVE" => "Y")));
if ($arParams["PERMISSION"] >= "U")
$res["ELEMENTS_CNT_ALL"] = intVal(CIBlockSection::GetSectionElementsCount($res["ID"], array("CNT_ALL"=>"Y")));
if ($arParams["PERMISSION"] < "U" && $res["ELEMENTS_CNT"] <= 0)
continue;
$res["~LINK"] = CComponentEngine::MakePathFromTemplate($arParams["~SECTION_URL"],
array("USER_ALIAS" => $arParams["USER_ALIAS"], "SECTION_ID" => $res["ID"]));
$res["LINK"] = htmlspecialcharsbx($res["~LINK"]);
if ($arParams["PERMISSION"] >= "W")
{
$res["~NEW_LINK"] = CComponentEngine::MakePathFromTemplate($arParams["~SECTION_EDIT_URL"],
array("USER_ALIAS" => $arParams["USER_ALIAS"], "SECTION_ID" => $res["ID"], "ACTION" => "new"));
$res["NEW_LINK"] = htmlspecialcharsbx($res["~NEW_LINK"]);
$res["~EDIT_LINK"] = CComponentEngine::MakePathFromTemplate($arParams["~SECTION_EDIT_URL"],
array("USER_ALIAS" => $arParams["USER_ALIAS"], "SECTION_ID" => $res["ID"], "ACTION" => "edit"));
$res["EDIT_LINK"] = htmlspecialcharsbx($res["~EDIT_LINK"]);
示例3: array
), array(
'upload' => true,
'medialib' => false,
'file_dialog' => false,
'cloud' => true,
'del' => true,
'description' => $f_TYPE=="E",
)
);
}
if($f_TYPE=="S")
{
if(array_key_exists("ELEMENT_CNT", $arVisibleColumnsMap))
{
$row->AddViewField("ELEMENT_CNT", $f_ELEMENT_CNT.'('.IntVal(CIBlockSection::GetSectionElementsCount($f_ID, Array("CNT_ALL"=>"Y"))).')');
}
if(array_key_exists("SECTION_CNT", $arVisibleColumnsMap))
{
$arFilter = Array("IBLOCK_ID"=>$IBLOCK_ID, "SECTION_ID"=>$f_ID);
$row->AddViewField("SECTION_CNT", " ".IntVal(CIBlockSection::GetCount($arFilter)));
}
}
if($f_TYPE=="E")
{
if (array_key_exists("PREVIEW_TEXT", $arVisibleColumnsMap))
$row->AddViewField("PREVIEW_TEXT", ($arRes["PREVIEW_TEXT_TYPE"]=="text" ? htmlspecialcharsex($arRes["PREVIEW_TEXT"]) : HTMLToTxt($arRes["PREVIEW_TEXT"])));
if (array_key_exists("DETAIL_TEXT", $arVisibleColumnsMap))
$row->AddViewField("DETAIL_TEXT", ($arRes["DETAIL_TEXT_TYPE"]=="text" ? htmlspecialcharsex($arRes["DETAIL_TEXT"]) : HTMLToTxt($arRes["DETAIL_TEXT"])));
示例4: Trace
/** @var string $templateFile */
/** @var string $templateFolder */
/** @var string $componentPath */
/** @var CBitrixComponent $component */
$this->setFrameMode(true);
Trace("start");
$Fav = new wfHighLoadBlock(3);
$favList = $Fav->elemGet();
$favIds = array();
foreach ($favList as $fv) {
$favIds[$fv["ID"]] = $fv["UF_FAV_ID"];
}
$arResult["FAVS"] = array_flip($favIds);
if (!empty($arResult['ITEMS'])) {
//$countAll = 0;
$countAll = CIBlockSection::GetSectionElementsCount($arResult["ID"]);
// test_dump($countAll);
// if(!empty($_GET["item_count"])) $countAll = $_GET["item_count"];
// else $countAll = $_SESSION["mywf"]["el_cnt"];
// foreach ($arResult["ITEMS"] as $item) {
// test_dump($item["NAME"]);
// }
// test_dump(count($arResult["ITEMS"]));
//
// test_dump($arResult);
?>
<script type="text/javascript">
var page = 1;
var numPages = Math.ceil(<?php
echo $countAll;
?>
示例5: CAdminResult
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(htmlspecialcharsbx($arIBlock["SECTIONS_NAME"])));
$arRows = array();
while ($arRes = $rsData->NavNext(true, "f_")) {
$el_list_url = htmlspecialcharsbx(CIBlock::GetAdminElementListLink($IBLOCK_ID, array('find_section_section' => $f_ID)));
$el_add_url = htmlspecialcharsbx(CIBlock::GetAdminElementEditLink($IBLOCK_ID, 0, array('IBLOCK_SECTION_ID' => $arRes["ID"], 'from' => 'iblock_section_admin_inc', 'find_section_section' => $find_section_section)));
$sec_list_url = htmlspecialcharsbx(CIBlock::GetAdminSectionListLink($IBLOCK_ID, array('find_section_section' => $f_ID, 'tree' => $_GET["tree"] == "Y" ? 'Y' : null)));
$sec_add_url = htmlspecialcharsbx(CIBlock::GetAdminSectionEditLink($IBLOCK_ID, 0, array('IBLOCK_SECTION_ID' => $arRes["ID"], 'from' => 'iblock_section_admin', 'find_section_section' => $find_section_section)));
$edit_url = htmlspecialcharsbx(CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $arRes["ID"], array('from' => 'iblock_section_admin', 'find_section_section' => $find_section_section)));
$arRows[$f_ID] = $row = $lAdmin->AddRow($f_ID, $arRes, $sec_list_url, GetMessage("IBSEC_A_LIST"));
$USER_FIELD_MANAGER->AddUserFields($entity_id, $arRes, $row);
$row->AddViewField("ID", '<a href="' . $edit_url . '" title="' . GetMessage("IBSEC_A_EDIT") . '">' . $f_ID . '</a>');
$row->AddViewField("NAME", '<a href="' . $sec_list_url . '" ' . ($_GET["tree"] == "Y" ? 'style="padding-left:' . ($f_DEPTH_LEVEL - 1) * 22 . 'px"' : '') . ' class="adm-list-table-icon-link" title="' . GetMessage("IBSEC_A_LIST") . '"><span class="adm-submenu-item-link-icon adm-list-table-icon iblock-section-icon"></span><span class="adm-list-table-link">' . $f_NAME . '</span></a>');
if (array_key_exists("ELEMENT_CNT", $arVisibleColumnsMap)) {
$row->AddViewField("ELEMENT_CNT", '<a href="' . $el_list_url . '&find_el_subsections=N" title="' . GetMessage("IBSEC_A_ELLIST") . '">' . $f_ELEMENT_CNT . '</a>(' . '<a href="' . $el_list_url . '&find_el_subsections=Y" title="' . GetMessage("IBSEC_A_ELLIST_TITLE") . '">' . IntVal(CIBlockSection::GetSectionElementsCount($f_ID, array("CNT_ALL" => "Y"))) . '</a>) [<a href="' . $el_add_url . '" title="' . GetMessage("IBSEC_A_ELADD_TITLE") . '">+</a>]');
}
if (array_key_exists("SECTION_CNT", $arVisibleColumnsMap)) {
$arFilter = array("IBLOCK_ID" => $IBLOCK_ID, "SECTION_ID" => $f_ID);
$row->AddViewField("SECTION_CNT", '<a href="' . $sec_list_url . '" onclick="' . $lAdmin->ActionAjaxReload($sec_list_url) . '; return false;" title="' . GetMessage("IBSEC_A_LIST") . '">' . IntVal(CIBlockSection::GetCount($arFilter)) . '</a> [<a href="' . $sec_add_url . '" title="' . GetMessage("IBSEC_A_SECTADD_TITLE") . '">+</a>]');
}
if (array_key_exists("MODIFIED_BY", $arVisibleColumnsMap)) {
if ($html = GetUserProfileLink($f_MODIFIED_BY, GetMessage("IBSEC_A_USERINFO"))) {
$row->AddViewField("MODIFIED_BY", $html);
}
}
if (array_key_exists("CREATED_BY", $arVisibleColumnsMap)) {
if ($html = GetUserProfileLink($f_CREATED_BY, GetMessage("IBSEC_A_USERINFO"))) {
$row->AddViewField("CREATED_BY", $html);
}
}
示例6: ini_set
<?php
ini_set("display_errors", 1);
error_reporting(E_ALL);
set_time_limit(0);
ini_set('mbstring.func_overload', "2");
ini_set('mbstring.internal_encoding', "UTF-8");
$_SERVER["DOCUMENT_ROOT"] = "/home/bitrix/www";
$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"];
define("BX_UTF", true);
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
define("BX_BUFFER_USED", true);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
while (ob_get_level()) {
ob_end_flush();
}
CModule::IncludeModule("iblock");
$sections_list = CIBlockSection::GetTreeList(array(), array('IBLOCK_ID' => 4), true);
while ($arResult = $sections_list->GetNext()) {
$nav = CIBlockSection::GetNavChain(4, $arResult["ID"]);
$nav->ExtractFields("nav_");
if ($nav_ID == 59 && CIBlockSection::GetSectionElementsCount($arResult["ID"]) == 0) {
if (!CIBlockSection::Delete($arResult["ID"])) {
echo $arResult["NAME"] . " removed" . "\n";
}
}
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
示例7: while
$rsSections = CIBlockSection::GetList($arSort, $arFilter);
while ($arSection = $rsSections->GetNext()) {
$arSection["SECTION_PAGE_URL"] = CComponentEngine::MakePathFromTemplate($arParams["SECTION_URL"], array("SECTION_ID" => $arSection["ID"], "SECTION_CODE" => $arSection["CODE"]));
if (CIBlock::GetPermission($arParams["IBLOCK_ID"]) >= "W") {
$arSection["~EDIT_LINK"] = CComponentEngine::MakePathFromTemplate($arParams["~SECTION_EDIT_URL"], array("SECTION_ID" => $arSection["ID"], "ACTION" => "edit"));
$arSection["~DROP_LINK"] = CComponentEngine::MakePathFromTemplate($arParams["~SECTION_EDIT_URL"], array("SECTION_ID" => $arSection["ID"], "ACTION" => "drop"));
if (strpos($arSection["~DROP_LINK"], "?") === false) {
$arSection["~DROP_LINK"] .= "?";
}
$arSection["~DROP_LINK"] .= "&" . bitrix_sessid_get() . "&edit=Y";
$arSection["~NEW_LINK"] = CComponentEngine::MakePathFromTemplate($arParams["~SECTION_EDIT_URL"], array("SECTION_ID" => $arSection["ID"], "ACTION" => "new"));
$arSection["EDIT_LINK"] = htmlSpecialChars($arSection["~EDIT_LINK"]);
$arSection["DROP_LINK"] = htmlSpecialChars($arSection["~DROP_LINK"]);
$arSection["NEW_LINK"] = htmlSpecialChars($arSection["~NEW_LINK"]);
}
$arSection['ELEMENTS_CNT'] = intVal(CIBlockSection::GetSectionElementsCount($arSection["ID"], array("CNT_ALL" => "Y")));
$arSection['SECTIONS_CNT'] = intVal(CIBlockSection::GetCount(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "SECTION_ID" => $arSection["ID"])));
$arFilter["IBLOCK_SECTION_ID"] = $arSection["ID"];
$arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("IBLOCK_" . $arParams["IBLOCK_ID"] . "_SECTION", $arSection["ID"], LANGUAGE_ID);
$arSection["~DATE"] = $arUserFields["UF_DATE"];
if (is_array($arSection["~DATE"])) {
$arSection["DATE"] = CIBlockFormatProperties::DateFormat($arParams["DATE_FORMAT"], MakeTimeStamp($arSection["~DATE"], CSite::GetDateFormat()));
}
if (intVal($arSection["~DETAIL_PICTURE"]) > 0) {
$arSection["PICTURE"] = CFile::GetFileArray($arSection["~DETAIL_PICTURE"]);
} elseif (intVal($arSection["~PICTURE"]) > 0) {
$arSection["PICTURE"] = CFile::GetFileArray($arSection["~PICTURE"]);
}
$arResult["SECTIONS"][] = $arSection;
}
$arResult["USER_HAVE_ACCESS"] = $bUSER_HAVE_ACCESS;
示例8: ini_set
<?php
ini_set("display_errors", 1);
error_reporting(E_ALL);
set_time_limit(0);
ini_set('mbstring.func_overload', "2");
ini_set('mbstring.internal_encoding', "UTF-8");
$_SERVER["DOCUMENT_ROOT"] = "/home/bitrix/www";
$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"];
define("BX_UTF", true);
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
define("BX_BUFFER_USED", true);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
while (ob_get_level()) {
ob_end_flush();
}
CModule::IncludeModule("iblock");
$sections_list = CIBlockSection::GetTreeList(array(), array('IBLOCK_ID' => 4), true);
while ($arResult = $sections_list->GetNext()) {
if (CIBlockSection::GetSectionElementsCount($arResult["ID"]) == 0) {
if (!CIBlockSection::Delete($arResult["ID"])) {
echo $arResult["NAME"] . " removed" . "\n";
}
}
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";