本文整理汇总了PHP中CIBlockSection::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockSection::GetByID方法的具体用法?PHP CIBlockSection::GetByID怎么用?PHP CIBlockSection::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockSection
的用法示例。
在下文中一共展示了CIBlockSection::GetByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStructure
function getStructure($id, $section=false, $arUf=array()) {
$id = (int)$id;
if (!$id) { return false; }
if ($section) {
$res = CIBlockSection::GetByID($id);
if ( $ar = $res->GetNext() ) {
$res = CIBlockSection::GetList(array(), array('IBLOCK_ID'=>$ar['IBLOCK_ID'], 'ID'=>$ar['ID']), false, $arUf);
} else { return false; }
} else {
$res = CIBlockElement::GetByID($id);
if ( $ar = $res->GetNext() ) {
$res = CIBlockSection::GetList(array(), array('IBLOCK_ID'=>$ar['IBLOCK_ID'], 'ID'=>$ar['IBLOCK_SECTION_ID']), false, $arUf);
} else { return false; }
}
// херню подсунули
if ( !$res->SelectedRowsCount() ) { return false; }
$arSect = $res->GetNext();
$arStructure = array();
$res = CIBlockSection::GetList(array('LEFT_MARGIN'=>'ASC'), array(
'IBLOCK_ID' => $arSect['IBLOCK_ID'],
'<=LEFT_BORDER' => $arSect['LEFT_MARGIN'],
'>=RIGHT_BORDER' => $arSect['RIGHT_MARGIN'],
'<DEPTH_LEVEL' => $arSect['DEPTH_LEVEL'],
), false, $arUf);
while($ar = $res->GetNext()){
$arStructure[] = $ar;
}
$arStructure[] = $arSect;
return $arStructure;
}
示例2: onBeforeElementAddHandler
static function onBeforeElementAddHandler($arFields)
{
$IBLOCK_ID = Config\Option::get("citfact.replaceurl", "IBLOCK_ID", "");
$SECTION_ID = Config\Option::get("citfact.replaceurl", "SECTION_BREND_ID", "BRENDI");
$CODE_PROP = Config\Option::get("citfact.replaceurl", "PROPERTY_CODE_BRENDI", "BRENDI");
if ($IBLOCK_ID == $arFields["IBLOCK_ID"]) {
$propertyBrand = \CIBlockProperty::GetByID($CODE_PROP, $arFields["IBLOCK_ID"]);
if ($arResultProperty = $propertyBrand->GetNext()) {
$propertyBrandValue = \CIBlockPropertyEnum::GetByID($arFields["PROPERTY_VALUES"][$arResultProperty["ID"]][0]["VALUE"]);
}
$rqParentSection = \CIBlockSection::GetByID($SECTION_ID);
if ($arParentSection = $rqParentSection->GetNext()) {
$arFilter = array('IBLOCK_ID' => $arParentSection['IBLOCK_ID'], '>LEFT_MARGIN' => $arParentSection['LEFT_MARGIN'], '<RIGHT_MARGIN' => $arParentSection['RIGHT_MARGIN'], '>DEPTH_LEVEL' => $arParentSection['DEPTH_LEVEL']);
// выберет потомков без учета активности
$rqSectChild = \CIBlockSection::GetList(array('left_margin' => 'asc'), $arFilter);
while ($arSectChild = $rqSectChild->GetNext()) {
$arSections[$arSectChild["NAME"]] = $arSectChild["ID"];
}
}
if (array_key_exists($propertyBrandValue["VALUE"], $arSections)) {
$arFields["IBLOCK_SECTION"][] = $arSections[$propertyBrandValue["VALUE"]];
} else {
$arParams = array("replace_space" => "-", "replace_other" => "-");
$trans = \Cutil::translit($propertyBrandValue["VALUE"], "ru", $arParams);
$bs = new \CIBlockSection();
$arFieldsNewSection = array("ACTIVE" => "Y", "IBLOCK_SECTION_ID" => $SECTION_ID, "IBLOCK_ID" => $IBLOCK_ID, "NAME" => $propertyBrandValue["VALUE"], "CODE" => $trans);
$resultAdd = $bs->Add($arFieldsNewSection);
$arFields["IBLOCK_SECTION"][] = $resultAdd;
}
}
return true;
}
示例3: get_ib_section
private static function get_ib_section($id)
{
$result = false;
$res = CIBlockSection::GetByID($id);
if ($ar_res = $res->GetNext()) {
$result = $ar_res;
}
return $result;
}
示例4: getSectionNameById
public static function getSectionNameById($SECTION_ID)
{
$ret = NULL;
$res = CIBlockSection::GetByID($SECTION_ID);
if ($ar_res = $res->GetNext()) {
$ret = $ar_res["NAME"];
}
return $ret;
}
示例5: PathSections
function PathSections($id)
{
$res = CIBlockSection::GetByID($id);
if($ar_res = $res->GetNext())
{
$section_id = $ar_res['IBLOCK_SECTION_ID'];
$name_section = $ar_res['NAME'];
$url_section = $ar_res['SECTION_PAGE_URL'];
if (intval($section_id) > 0)
{
$path = "<a href='$url_section'>$name_section</a>";
return PathSections($section_id)." / ".$path;
}
else
{
return "<a href='$url_section'>$name_section</a>";
}
}
return "";
}?>
示例6: _GetProductUrl
public static function _GetProductUrl($OF_ELEMENT_ID, $OF_IBLOCK_ID, $server_name = false, $arrType = false)
{
static $arIBlockCache = array();
static $arElementCache = array();
$product_url = "";
$OF_ELEMENT_ID = intval($OF_ELEMENT_ID);
$OF_IBLOCK_ID = intval($OF_IBLOCK_ID);
if ($arrType === "E" && $OF_IBLOCK_ID > 0 && $OF_ELEMENT_ID > 0 && CModule::IncludeModule("catalog")) {
if (!array_key_exists($OF_IBLOCK_ID, $arIBlockCache)) {
$rsProducts = CCatalog::GetList(array(), array('IBLOCK_ID' => $OF_IBLOCK_ID), false, false, array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID', 'SKU_PROPERTY_ID'));
$arIBlockCache[$OF_IBLOCK_ID] = $rsProducts->Fetch();
if (is_array($arIBlockCache[$OF_IBLOCK_ID])) {
$arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"] = CIBlock::GetArrayByID($arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK_ID"]);
}
}
if (is_array($arIBlockCache[$OF_IBLOCK_ID])) {
if (!array_key_exists($OF_ELEMENT_ID, $arElementCache)) {
$OF_PROP_ID = $arIBlockCache[$OF_IBLOCK_ID]["SKU_PROPERTY_ID"];
$rsOffer = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $arIBlockCache[$OF_IBLOCK_ID]["IBLOCK_ID"], "=ID" => $OF_ELEMENT_ID), false, false, array("LANG_DIR", "PROPERTY_" . $OF_PROP_ID . ".ID", "PROPERTY_" . $OF_PROP_ID . ".CODE", "PROPERTY_" . $OF_PROP_ID . ".XML_ID", "PROPERTY_" . $OF_PROP_ID . ".IBLOCK_ID", "PROPERTY_" . $OF_PROP_ID . ".IBLOCK_SECTION_ID"));
if ($arOffer = $rsOffer->Fetch()) {
$arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_CODE"] = '';
if (intval($arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_ID"]) > 0) {
$rsSections = CIBlockSection::GetByID($arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_ID"]);
if ($arSection = $rsSections->Fetch()) {
$arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_CODE"] = $arSection['CODE'];
}
}
$arElementCache[$OF_ELEMENT_ID] = array("LANG_DIR" => $arOffer["LANG_DIR"], "ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_ID"], "ELEMENT_ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_ID"], "CODE" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_CODE"], "ELEMENT_CODE" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_CODE"], "EXTERNAL_ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_XML_ID"], "IBLOCK_TYPE_ID" => $arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"]["IBLOCK_TYPE_ID"], "IBLOCK_ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_ID"], "IBLOCK_CODE" => $arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"]["CODE"], "IBLOCK_EXTERNAL_ID" => $arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"]["XML_ID"], "IBLOCK_SECTION_ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_ID"], "SECTION_CODE" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_CODE"]);
}
}
if (is_array($arElementCache[$OF_ELEMENT_ID])) {
$product_url = CIBlock::ReplaceDetailUrl($arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"]["DETAIL_PAGE_URL"], $arElementCache[$OF_ELEMENT_ID], $server_name, $arrType);
}
}
}
return $product_url;
}
示例7: Update
//.........这里部分代码省略.........
$PARENT_ID = isset($arFields["IBLOCK_SECTION_ID"]) ? intval($arFields["IBLOCK_SECTION_ID"]) : intval($db_record["IBLOCK_SECTION_ID"]);
$NAME = isset($arFields["NAME"]) ? $arFields["NAME"] : $db_record["NAME"];
$SORT = isset($arFields["SORT"]) ? intval($arFields["SORT"]) : intval($db_record["SORT"]);
$arParents = array();
$strSql = "\n\t\t\t\t\t\tSELECT BS.ID, BS.ACTIVE, BS.GLOBAL_ACTIVE, BS.DEPTH_LEVEL, BS.LEFT_MARGIN, BS.RIGHT_MARGIN\n\t\t\t\t\t\tFROM b_iblock_section BS\n\t\t\t\t\t\tWHERE BS.IBLOCK_ID = " . $db_record["IBLOCK_ID"] . "\n\t\t\t\t\t\tAND BS.ID in (" . intval($db_record["IBLOCK_SECTION_ID"]) . ", " . $PARENT_ID . ")\n\t\t\t\t\t";
$rsParents = $DB->Query($strSql);
while ($arParent = $rsParents->Fetch()) {
$arParents[$arParent["ID"]] = $arParent;
}
//Find rightmost child of the parent
$strSql = "\n\t\t\t\t\t\tSELECT BS.ID, BS.RIGHT_MARGIN, BS.DEPTH_LEVEL\n\t\t\t\t\t\tFROM b_iblock_section BS\n\t\t\t\t\t\tWHERE BS.IBLOCK_ID = " . $db_record["IBLOCK_ID"] . "\n\t\t\t\t\t\tAND " . ($PARENT_ID > 0 ? "BS.IBLOCK_SECTION_ID=" . $PARENT_ID : "BS.IBLOCK_SECTION_ID IS NULL") . "\n\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t(BS.SORT < " . $SORT . ")\n\t\t\t\t\t\t\tOR (BS.SORT = " . $SORT . " AND BS.NAME < '" . $DB->ForSQL($NAME) . "')\n\t\t\t\t\t\t)\n\t\t\t\t\t\tAND BS.ID <> " . $ID . "\n\t\t\t\t\t\tORDER BY BS.SORT DESC, BS.NAME DESC\n\t\t\t\t\t";
$rsChild = $DB->Query($strSql);
if ($arChild = $rsChild->Fetch()) {
//We found the left neighbour
$arUpdate = array("LEFT_MARGIN" => intval($arChild["RIGHT_MARGIN"]) + 1, "DEPTH_LEVEL" => intval($arChild["DEPTH_LEVEL"]));
} else {
//If we have parent, when take its left_margin
if (isset($arParents[$PARENT_ID]) && $arParents[$PARENT_ID]) {
$arUpdate = array("LEFT_MARGIN" => intval($arParents[$PARENT_ID]["LEFT_MARGIN"]) + 1, "DEPTH_LEVEL" => intval($arParents[$PARENT_ID]["DEPTH_LEVEL"]) + 1);
} else {
//We are only one/leftmost section in the iblock.
$arUpdate = array("LEFT_MARGIN" => 1, "DEPTH_LEVEL" => 1);
}
}
$move_distance = intval($db_record["LEFT_MARGIN"]) - $arUpdate["LEFT_MARGIN"];
$DB->Query("\n\t\t\t\t\t\tUPDATE b_iblock_section SET\n\t\t\t\t\t\t\tTIMESTAMP_X=" . ($DB->type == "ORACLE" ? "NULL" : "TIMESTAMP_X") . "\n\t\t\t\t\t\t\t,LEFT_MARGIN = LEFT_MARGIN + " . $distance . "\n\t\t\t\t\t\t\t,RIGHT_MARGIN = RIGHT_MARGIN + " . $distance . "\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tIBLOCK_ID = " . $db_record["IBLOCK_ID"] . "\n\t\t\t\t\t\t\tAND LEFT_MARGIN >= " . $arUpdate["LEFT_MARGIN"] . "\n\t\t\t\t\t");
$DB->Query("\n\t\t\t\t\t\tUPDATE b_iblock_section SET\n\t\t\t\t\t\t\tTIMESTAMP_X=" . ($DB->type == "ORACLE" ? "NULL" : "TIMESTAMP_X") . "\n\t\t\t\t\t\t\t,LEFT_MARGIN = -LEFT_MARGIN - " . $move_distance . "\n\t\t\t\t\t\t\t,RIGHT_MARGIN = -RIGHT_MARGIN - " . $move_distance . "\n\t\t\t\t\t\t\t" . ($arUpdate["DEPTH_LEVEL"] != intval($db_record["DEPTH_LEVEL"]) ? ",DEPTH_LEVEL = DEPTH_LEVEL - " . ($db_record["DEPTH_LEVEL"] - $arUpdate["DEPTH_LEVEL"]) : "") . "\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tIBLOCK_ID = " . $db_record["IBLOCK_ID"] . "\n\t\t\t\t\t\t\tAND LEFT_MARGIN <= " . -intval($db_record["LEFT_MARGIN"]) . "\n\t\t\t\t\t\t\tAND LEFT_MARGIN >= " . -intval($db_record["RIGHT_MARGIN"]) . "\n\t\t\t\t\t");
if (isset($arParents[$PARENT_ID])) {
$DB->Query("\n\t\t\t\t\t\t\tUPDATE b_iblock_section SET\n\t\t\t\t\t\t\t\tTIMESTAMP_X=" . ($DB->type == "ORACLE" ? "NULL" : "TIMESTAMP_X") . "\n\t\t\t\t\t\t\t\t,RIGHT_MARGIN = RIGHT_MARGIN + " . $distance . "\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tIBLOCK_ID = " . $db_record["IBLOCK_ID"] . "\n\t\t\t\t\t\t\t\tAND LEFT_MARGIN <= " . $arParents[$PARENT_ID]["LEFT_MARGIN"] . "\n\t\t\t\t\t\t\t\tAND RIGHT_MARGIN >= " . $arParents[$PARENT_ID]["RIGHT_MARGIN"] . "\n\t\t\t\t\t\t");
}
}
//Check if parent was changed
if (isset($arFields["IBLOCK_SECTION_ID"]) && $arFields["IBLOCK_SECTION_ID"] != $db_record["IBLOCK_SECTION_ID"]) {
$rsSection = CIBlockSection::GetByID($ID);
$arSection = $rsSection->Fetch();
$strSql = "\n\t\t\t\t\t\tSELECT ID, GLOBAL_ACTIVE\n\t\t\t\t\t\tFROM b_iblock_section\n\t\t\t\t\t\tWHERE IBLOCK_ID = " . $arSection["IBLOCK_ID"] . "\n\t\t\t\t\t\tAND ID = " . intval($arFields["IBLOCK_SECTION_ID"]) . "\n\t\t\t\t\t";
$rsParent = $DB->Query($strSql);
$arParent = $rsParent->Fetch();
//If new parent is not globally active
//or we are not active either
//we must be not globally active too
if ($arParent && $arParent["GLOBAL_ACTIVE"] == "N" || $arFields["ACTIVE"] == "N") {
$DB->Query("\n\t\t\t\t\t\t\tUPDATE b_iblock_section SET\n\t\t\t\t\t\t\t\tTIMESTAMP_X=" . ($DB->type == "ORACLE" ? "NULL" : "TIMESTAMP_X") . "\n\t\t\t\t\t\t\t\t,GLOBAL_ACTIVE = 'N'\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tIBLOCK_ID = " . $arSection["IBLOCK_ID"] . "\n\t\t\t\t\t\t\t\tAND LEFT_MARGIN >= " . intval($arSection["LEFT_MARGIN"]) . "\n\t\t\t\t\t\t\t\tAND RIGHT_MARGIN <= " . intval($arSection["RIGHT_MARGIN"]) . "\n\t\t\t\t\t\t");
} elseif ($arSection["ACTIVE"] == "N" && $arFields["ACTIVE"] == "Y") {
$this->RecalcGlobalActiveFlag($arSection);
} elseif ((!$arParent || $arParent["GLOBAL_ACTIVE"] == "Y") && $arSection["GLOBAL_ACTIVE"] == "N" && ($arSection["ACTIVE"] == "Y" || $arFields["ACTIVE"] == "Y")) {
$this->RecalcGlobalActiveFlag($arSection);
}
//Otherwise we may not to change anything
} elseif (isset($arFields["ACTIVE"]) && $arFields["ACTIVE"] != $db_record["ACTIVE"]) {
//Make all children globally inactive
if ($arFields["ACTIVE"] == "N") {
$DB->Query("\n\t\t\t\t\t\t\tUPDATE b_iblock_section SET\n\t\t\t\t\t\t\t\tTIMESTAMP_X=" . ($DB->type == "ORACLE" ? "NULL" : "TIMESTAMP_X") . "\n\t\t\t\t\t\t\t\t,GLOBAL_ACTIVE = 'N'\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tIBLOCK_ID = " . $db_record["IBLOCK_ID"] . "\n\t\t\t\t\t\t\t\tAND LEFT_MARGIN >= " . intval($db_record["LEFT_MARGIN"]) . "\n\t\t\t\t\t\t\t\tAND RIGHT_MARGIN <= " . intval($db_record["RIGHT_MARGIN"]) . "\n\t\t\t\t\t\t");
} else {
//Check for parent activity
$strSql = "\n\t\t\t\t\t\t\tSELECT ID, GLOBAL_ACTIVE\n\t\t\t\t\t\t\tFROM b_iblock_section\n\t\t\t\t\t\t\tWHERE IBLOCK_ID = " . $db_record["IBLOCK_ID"] . "\n\t\t\t\t\t\t\tAND ID = " . intval($db_record["IBLOCK_SECTION_ID"]) . "\n\t\t\t\t\t\t";
$rsParent = $DB->Query($strSql);
$arParent = $rsParent->Fetch();
//Parent is active
//and we changed
//so need to recalc
if (!$arParent || $arParent["GLOBAL_ACTIVE"] == "Y") {
$this->RecalcGlobalActiveFlag($db_record);
}
}
}
示例8: subSubTags
/**
* Категории типаов товаров (3-й уровень)
* @return string HTML код на вывод
*/
public function subSubTags()
{
if (isset($_GET['section'])) {
$res = CIBlockSection::GetByID(intval($_GET["section"]));
if ($ar_res = $res->GetNext()) {
if ($ar_res['DEPTH_LEVEL'] > 3) {
$res = CIBlockSection::GetByID($ar_res['IBLOCK_SECTION_ID']);
$ar_res = $res->GetNext();
} elseif ($ar_res['DEPTH_LEVEL'] < 3) {
return;
}
return $this->drawSectionChain($ar_res['ID']);
}
}
if (isset($_GET['facility'])) {
$res = CIBlockSection::GetByID(intval($_GET["facility"]));
if ($ar_res = $res->GetNext()) {
if ($ar_res['DEPTH_LEVEL'] == 3) {
$res = CIBlockSection::GetByID($ar_res['IBLOCK_SECTION_ID']);
$ar_res = $res->GetNext();
}
return $this->drawSectionChain($ar_res['ID']);
}
}
if (isset($_GET['gift'])) {
$res = CIBlockSection::GetByID(intval($_GET["gift"]));
if ($ar_res = $res->GetNext()) {
if ($ar_res['DEPTH_LEVEL'] == 3) {
$res = CIBlockSection::GetByID($ar_res['IBLOCK_SECTION_ID']);
$ar_res = $res->GetNext();
}
return $this->drawSectionChain($ar_res['ID']);
}
}
}
示例9: GetListItemChangesSinceToken
function GetListItemChangesSinceToken($listName, $viewFields = '', $query = '', $rowLimit = 0, $changeToken = '')
{
global $APPLICATION, $USER;
if (!($listName_original = CIntranetUtils::checkGUID($listName))) {
return new CSoapFault('Data error', 'Wrong GUID - ' . $listName);
}
if (!$USER->IsAdmin() && (!defined("IS_EXTRANET") || IS_EXTRANET != "Y")) {
$rsUsers = CUser::GetList($by = "id", $order = "asc", array("ID" => $USER->GetID()), array("SELECT" => array("UF_DEPARTMENT")));
if ($arUser = $rsUsers->Fetch()) {
if (intval($arUser["UF_DEPARTMENT"][0]) > 0) {
$bUserIntranet = true;
}
}
if (!$bUserIntranet) {
return new CSoapFault('Data error', 'User has no permissions to read intranet contacts');
}
}
$listName = ToUpper(CIntranetUtils::makeGUID($listName_original));
$arFilter = array('ACTIVE' => 'Y');
$page = 1;
$bUpdateFields = false;
$tsLastFieldsChange = COption::GetOptionString('intranet', 'ws_contacts_last_fields_change', false);
$this->bGetImages = COption::GetOptionString('intranet', 'ws_contacts_get_images', 'Y') == 'Y';
if (strlen($changeToken) > 0) {
if ($pos = strpos($changeToken, ';')) {
list($newChangeToken, $page, $last_change) = explode(';', $changeToken);
$page++;
$changeToken = $newChangeToken;
}
$arFilter['TIMESTAMP_X_1'] = ConvertTimeStamp($changeToken, 'FULL');
if (!$arFilter['TIMESTAMP_X_1']) {
return new CSoapFault('Params error', 'Wrong changeToken: ' . $changeToken);
}
if ($tsLastFieldsChange !== false && $tsLastFieldsChange > $changeToken) {
$bUpdateFields = true;
}
}
if (CModule::IncludeModule('extranet') && defined("IS_EXTRANET") && IS_EXTRANET == "Y") {
$arFilter["GROUPS_ID"] = array(COption::GetOptionInt("extranet", "extranet_group"));
}
if (!CModule::IncludeModule('extranet') || defined("IS_EXTRANET") && IS_EXTRANET == "Y" && defined("IS_EMPLOYEES") && IS_EMPLOYEES == "Y" || (!defined("IS_EXTRANET") || IS_EXTRANET != "Y")) {
$arFilter["!UF_DEPARTMENT"] = false;
} else {
$arFilter["UF_DEPARTMENT"] = false;
}
// it's needed to check is current user an intranet user if he requested intranet script
$arListParams = array("SELECT" => array("UF_DEPARTMENT"));
if ($rowLimit > 0) {
$arListParams["NAV_PARAMS"] = array("nPageSize" => $rowLimit, "bShowAll" => false, "iNumPage" => $page);
}
$obUsers = CUser::GetList($by = 'id', $order = 'asc', $arFilter, $arListParams);
if (!isset($last_change)) {
$last_change = 0;
}
$data = new CXMLCreator('listitems');
$data->setAttribute('MinTimeBetweenSyncs', 0);
$data->setAttribute('RecommendedTimeBetweenSyncs', 180);
$data->setAttribute('TimeStamp', $this->__makeDateTime());
$data->setAttribute('EffectivePermMask', 'FullMask');
$data->addChild($obChanges = new CXMLCreator('Changes'));
if ((!$changeToken || $bUpdateFields) && $page <= 1) {
$arGetListResult = $this->GetList($listName);
$obChanges->addChild($arGetListResult['GetListResult']);
}
//TODO: the next thing is to do something like this for all deleted events.
//$obChanges->addChild($obId = new CXMLCreator('Id'));
//$obId->setAttribute('ChangeType', 'Delete');
//$obId->setData('702');
//<Id ChangeType="Delete">14</Id>
$data->addChild($obData = new CXMLCreator('rs:data'));
$counter = 0;
if (CModule::IncludeModule('extranet') && defined("IS_EXTRANET") && IS_EXTRANET == "Y") {
$arUsersInMyGroupsID = CExtranet::GetMyGroupsUsers(CExtranet::GetExtranetSiteID());
$arPublicUsersID = CExtranet::GetPublicUsers();
}
while ($arUser = $obUsers->Fetch()) {
if (CModule::IncludeModule('extranet') && !CExtranet::IsExtranetAdmin()) {
if (defined("IS_EXTRANET") && IS_EXTRANET == "Y" && (!in_array($arUser["ID"], $arUsersInMyGroupsID) && !in_array($arUser["ID"], $arPublicUsersID) || $arUser["ID"] == $USER->GetID())) {
continue;
}
}
if (is_array($arUser['UF_DEPARTMENT']) && count($arUser['UF_DEPARTMENT']) > 0) {
if ($this->arDepartmentsCache[$arUser['UF_DEPARTMENT'][0]]) {
$arUser['WORK_COMPANY'] = $this->arDepartmentsTopCache[$arUser['UF_DEPARTMENT'][0]];
$arUser['UF_DEPARTMENT'] = $this->arDepartmentsCache[$arUser['UF_DEPARTMENT'][0]];
} else {
$dbRes = CIBlockSection::GetByID($arUser['UF_DEPARTMENT'][0]);
if ($arRes = $dbRes->Fetch()) {
if (!defined("IS_EXTRANET") || IS_EXTRANET != "Y" || defined("IS_EMPLOYEES") && IS_EMPLOYEES == "Y") {
$arUser['DEPARTMENT'] = $this->arDepartmentsCache[$arUser['UF_DEPARTMENT'][0]] = $arRes['NAME'];
}
// this case crashes inner cache of top departments
//if (!$arUser['WORK_COMPANY'])
//{
if ($top_section = CIntranetUtils::GetIBlockTopSection($arUser['UF_DEPARTMENT'])) {
$dbRes = CIBlockSection::GetByID($top_section);
if ($arRes = $dbRes->Fetch()) {
$arUser['WORK_COMPANY'] = $this->arDepartmentsTopCache[$arUser['UF_DEPARTMENT'][0]] = $arRes['NAME'];
}
}
//.........这里部分代码省略.........
示例10: ajaxsearch_cat
</div>
<div class="pad_50_0 text-center">
<?echo $arr[0]['PREVIEW_TEXT']?>
</div>
<?}else{?>
<?/*если выбрана страница Занятия в секциях*/?>
<div class="search">
<input type="text" id="ajax-search" onkeypress="if (event.keyCode == 13) ajaxsearch_cat()" placeholder="Быстрый поиск"/>
<input type="submit" id="ajax-search-button" onclick="ajaxsearch_cat()" value="Искать"/>
</div>
<?
//Получаем свойства раздела
$sect_sport = CIBlockSection::GetByID(1);
if($ar_sect_sport = $sect_sport->GetNext())
{
//Получаем СЕО текст раздела
$ipropValues = new \Bitrix\Iblock\InheritedProperty\SectionValues(
$ar_sect_sport["IBLOCK_ID"],
$ar_sect_sport["ID"]
);
$ar_sect_sport["IPROPERTY_VALUES"] = $ipropValues->getValues();
//echo "<pre>"; print_r($ar_sect_sport); echo '</pre>';
}
$iblok_id = '2';
$category = $_SERVER['REQUEST_URI'];
示例11: Array
{
if ($arSection["IBLOCK_SECTION_ID"]!="")
{
$parentItems[] = $arSection["IBLOCK_SECTION_ID"];
}
}
$isOpen = Array();
$res = CIBlockSection::GetByID($_REQUEST["SECTION_ID"]);
if($arSection = $res->GetNext())
$res = CIBlockSection::GetByID($arSection["IBLOCK_SECTION_ID"]);
if($ar_res = $res->GetNext())
$isOpen[] = $ar_res['ID'];
for ($i==0; $i<$arSection["DEPTH_LEVEL"]; $i++)
{
$res = CIBlockSection::GetByID($ar_res["IBLOCK_SECTION_ID"]);
if($ar_res = $res->GetNext())
$isOpen[] = $ar_res['ID'];
}
/*foreach($arResult["SECTIONS"] as $arSection)
{
if($arSection["ID"]==$_REQUEST["SECTION_ID"])
{
$isOpen[] = $arSection["IBLOCK_SECTION_ID"];
if ($arSection["DEPTH_LEVEL"]==3)
{
foreach($arResult["SECTIONS"] as $arSection_1)
{
if($arSection_1["ID"]==$arSection["IBLOCK_SECTION_ID"])
{
示例12: OnAfterPhotoCommentAddBlog
public function OnAfterPhotoCommentAddBlog($ID, $arFields)
{
if (!CModule::IncludeModule('iblock')) {
return;
}
if (!$this->IsSocnet) {
return;
}
if (intval($this->PhotoElementID) > 0) {
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "photo_photo", "SOURCE_ID" => $this->PhotoElementID), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID", "TMP_ID", "TITLE", "URL", "USER_ID", "PARAMS"));
$bSocNetLogRecordExists = false;
if ($arRes = $dbRes->Fetch()) {
$log_id = $arRes["ID"];
$entity_type = $arRes["ENTITY_TYPE"];
$entity_id = $arRes["ENTITY_ID"];
$log_title = $arRes["TITLE"];
$log_url = $arRes["URL"];
$log_user_id = $arRes["USER_ID"];
$bSocNetLogRecordExists = true;
if (strlen($arRes["PARAMS"]) > 0) {
$arTmp = unserialize($arRes["PARAMS"]);
if ($arTmp) {
if (array_key_exists("SECTION_NAME", $arTmp) && strlen($arTmp["SECTION_NAME"]) > 0) {
$log_section_name = $arTmp["SECTION_NAME"];
}
if (array_key_exists("SECTION_URL", $arTmp) && strlen($arTmp["SECTION_URL"]) > 0) {
$log_section_url = $arTmp["SECTION_URL"];
}
}
}
} else {
$rsElement = CIBlockElement::GetByID($this->PhotoElementID);
if ($arElement = $rsElement->Fetch()) {
$url = $this->arPath["DETAIL_URL"];
$sAuthorName = GetMessage("SONET_PHOTO_LOG_GUEST");
if (intval($arElement["CREATED_BY"]) > 0) {
$rsUser = CUser::GetByID($arElement["CREATED_BY"]);
if ($arUser = $rsUser->Fetch()) {
$sAuthorName = CUser::FormatName(CSite::GetNameFormat(false), $arUser, true, false);
}
}
if (in_array($this->entity_type, array(SONET_ENTITY_USER, SONET_ENTITY_GROUP)) && intval($this->entity_id) > 0) {
$entity_type = $this->entity_type;
$entity_id = $this->entity_id;
$alias = ($this->entity_type == SONET_ENTITY_GROUP ? "group" : "user") . "_" . $this->entity_id;
}
$arLogParams = array("BLOG_ID" => intval($this->BlogID));
$rsIBlock = CIBlock::GetByID($arElement["IBLOCK_ID"]);
if ($arIBlock = $rsIBlock->Fetch()) {
$arLogParams["IBLOCK_ID"] = $arIBlock["ID"];
$arLogParams["IBLOCK_TYPE"] = $arIBlock["IBLOCK_TYPE_ID"];
}
$rsSection = CIBlockSection::GetByID($arElement["IBLOCK_SECTION_ID"]);
if ($arSection = $rsSection->Fetch()) {
$arLogParams["SECTION_ID"] = $arSection["ID"];
$arLogParams["SECTION_NAME"] = $arSection["NAME"];
$arLogParams["SECTION_URL"] = str_replace("#SECTION_ID#", $arSection["ID"], $this->arPath["SECTION_URL"]);
$arSectionPath = array();
$bPassword = false;
$dbSectionPath = CIBlockSection::GetList(array("LEFT_MARGIN" => "ASC"), array("IBLOCK_ID" => intval($arLogParams["IBLOCK_ID"]), "<=LEFT_BORDER" => intval($arSection["LEFT_MARGIN"]), ">=RIGHT_BORDER" => intval($arSection["RIGHT_MARGIN"]), "<=DEPTH_LEVEL" => intval($arSection["DEPTH_LEVEL"])), false, array("ID", "IBLOCK_ID", "NAME", "CREATED_BY", "DEPTH_LEVEL", "LEFT_MARGIN", "RIGHT_MARGIN", "UF_PASSWORD"));
while ($arPath = $dbSectionPath->Fetch()) {
$arSectionPath[] = $arPath;
if (strlen(trim($arPath["UF_PASSWORD"])) > 0) {
$bPassword = true;
break;
}
}
if (!$alias) {
$entity_type = SONET_ENTITY_USER;
$entity_id = $arSectionPath[0]["CREATED_BY"];
$alias = $arSectionPath[0]["CODE"];
}
}
$arLogParams["ALIAS"] = $alias;
$arSonetFields = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "photo_photo", "LOG_DATE" => $arElement["TIMESTAMP_X"], "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $sAuthorName, GetMessage("SONET_PHOTOPHOTO_LOG_1")), "TITLE" => $arElement["NAME"], "MESSAGE" => "", "TEXT_MESSAGE" => "", "URL" => CComponentEngine::MakePathFromTemplate($url, array("ELEMENT_ID" => $arElement["ID"], "element_id" => $arElement["ID"], "SECTION_ID" => $arElement["IBLOCK_SECTION_ID"], "section_id" => $arElement["IBLOCK_SECTION_ID"])), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $arElement["ID"], "PARAMS" => serialize($arLogParams), "RATING_TYPE_ID" => "IBLOCK_ELEMENT", "RATING_ENTITY_ID" => $arElement["ID"]);
if (intval($arElement["CREATED_BY"]) > 0) {
$arSonetFields["USER_ID"] = $arElement["CREATED_BY"];
}
$log_id = CSocNetLog::Add($arSonetFields, false);
if (intval($log_id) > 0) {
$log_title = $arSonetFields["TITLE"];
$log_url = $arSonetFields["URL"];
$log_section_name = $arLogParams["SECTION_NAME"];
$log_section_url = $arLogParams["SECTION_URL"];
$log_user_id = $arSonetFields["USER_ID"];
CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
if ($bPassword) {
CSocNetLogRights::DeleteByLogID($log_id);
CSocNetLogRights::Add($log_id, array("U" . $GLOBALS["USER"]->GetID(), "SA"));
} else {
CSocNetLogRights::SetForSonet($log_id, $entity_type, $entity_id, "photo", "view", true);
}
}
}
}
if (intval($log_id) > 0) {
$parserBlog = new blogTextParser(false, $this->arPath["PATH_TO_SMILE"]);
$arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N");
if ($bSocNetLogRecordExists) {
$text4message = $parserBlog->convert($arFields["POST_TEXT"], true, array(), $arAllow);
//.........这里部分代码省略.........
示例13: elseif
$bVarsFromForm = true;
} else {
$err = $GLOBALS['APPLICATION']->GetException();
if ($err) {
$strWarning .= $err->GetString();
}
$bVarsFromForm = true;
}
} elseif ($arParams["ACTION"] == "NEW") {
$arFields = array("ACTIVE" => "Y", "IBLOCK_ID" => $arParams["IBLOCK_ID"], "DATE" => $_REQUEST["UF_DATE"], "UF_DATE" => $_REQUEST["UF_DATE"], "NAME" => $_REQUEST["NAME"], "DESCRIPTION" => $_REQUEST["DESCRIPTION"]);
if (isset($_REQUEST["ACTIVE"])) {
$arFields["ACTIVE"] = $_REQUEST["ACTIVE"];
}
if ($arParams["BEHAVIOUR"] == "USER") {
if ($_REQUEST["IBLOCK_SECTION_ID"] > 0) {
$db_res = CIBlockSection::GetByID($_REQUEST["IBLOCK_SECTION_ID"]);
if ($db_res && ($res = $db_res->Fetch())) {
if ($res["LEFT_MARGIN"] > $arResult["GALLERY"]["LEFT_MARGIN"] && $res["RIGHT_MARGIN"] < $arResult["GALLERY"]["RIGHT_MARGIN"]) {
$arFields["IBLOCK_SECTION_ID"] = $_REQUEST["IBLOCK_SECTION_ID"];
}
}
}
if (empty($arFields["IBLOCK_SECTION_ID"])) {
$arFields["IBLOCK_SECTION_ID"] = $arResult["GALLERY"]["ID"];
}
} elseif (intVal($_REQUEST["IBLOCK_SECTION_ID"]) > 0) {
$arFields["IBLOCK_SECTION_ID"] = $_REQUEST["IBLOCK_SECTION_ID"];
}
if (!empty($_REQUEST["PASSWORD"])) {
$arFields["UF_PASSWORD"] = md5($_REQUEST["PASSWORD"]);
$GLOBALS["UF_PASSWORD"] = md5($_REQUEST["PASSWORD"]);
示例14: LocalRedirect
} else {
LocalRedirect("/bitrix/admin/" . CIBlock::GetAdminSectionEditLink($IBLOCK_ID, 0, array("find_section_section" => intval($find_section_section), "IBLOCK_SECTION_ID" => $IBLOCK_SECTION_ID, "return_url" => strlen($return_url) > 0 ? $return_url : null), "&" . $tabControl->ActiveTabParam()));
}
} else {
LocalRedirect("/bitrix/admin/" . CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $ID, array('find_section_section' => intval($find_section_section), 'return_url' => strlen($return_url) > 0 ? $return_url : null), "&" . $tabControl->ActiveTabParam()));
}
}
}
ClearVars("str_");
$str_ACTIVE = "Y";
$str_NAME = htmlspecialcharsbx($arIBlock["FIELDS"]["SECTION_NAME"]["DEFAULT_VALUE"]);
$str_DESCRIPTION_TYPE = $arIBlock["FIELDS"]["SECTION_DESCRIPTION_TYPE"]["DEFAULT_VALUE"] !== "html" ? "text" : "html";
$str_DESCRIPTION = htmlspecialcharsbx($arIBlock["FIELDS"]["SECTION_DESCRIPTION"]["DEFAULT_VALUE"]);
$str_SORT = "500";
$str_IBLOCK_SECTION_ID = $IBLOCK_SECTION_ID;
$result = CIBlockSection::GetByID($ID);
$arSection = $result->ExtractFields("str_");
if (!$arSection) {
$ID = 0;
$ipropTemlates = new \Bitrix\Iblock\InheritedProperty\SectionTemplates($IBLOCK_ID, 0);
} else {
$ipropTemlates = new \Bitrix\Iblock\InheritedProperty\SectionTemplates($IBLOCK_ID, $ID);
}
if ($bVarsFromForm) {
$DB->InitTableVarsForEdit("b_iblock_section", "", "str_");
$str_IPROPERTY_TEMPLATES = $_POST["IPROPERTY_TEMPLATES"];
} else {
$str_IPROPERTY_TEMPLATES = $ipropTemlates->findTemplates();
$str_IPROPERTY_TEMPLATES["SECTION_PICTURE_FILE_NAME"] = \Bitrix\Iblock\Template\Helper::convertModifiersToArray($str_IPROPERTY_TEMPLATES["SECTION_PICTURE_FILE_NAME"]);
$str_IPROPERTY_TEMPLATES["SECTION_DETAIL_PICTURE_FILE_NAME"] = \Bitrix\Iblock\Template\Helper::convertModifiersToArray($str_IPROPERTY_TEMPLATES["SECTION_DETAIL_PICTURE_FILE_NAME"]);
$str_IPROPERTY_TEMPLATES["ELEMENT_PREVIEW_PICTURE_FILE_NAME"] = \Bitrix\Iblock\Template\Helper::convertModifiersToArray($str_IPROPERTY_TEMPLATES["ELEMENT_PREVIEW_PICTURE_FILE_NAME"]);
示例15: GetMessage
$arFields["SOCNET_GROUP_ID"] = $arResult["VARIABLES"]["group_id"];
$arFields["NAME"] = GetMessage("SONET_GROUP_PREFIX") . $res["NAME"];
$arFields["CODE"] = "group_" . $arResult["VARIABLES"]["group_id"];
}
if (!empty($arFiles)) {
$arFields["PICTURE"] = $arFiles["PICTURE"];
}
$bs = new CIBlockSection();
if ($bs->CheckFields($arFields)) {
if (!empty($arFiles)) {
$arFields["DETAIL_PICTURE"] = $arFiles["DETAIL_PICTURE"];
}
$GLOBALS["UF_DEFAULT"] = $arFields["UF_DEFAULT"];
$GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $arParams["IBLOCK_ID"] . "_SECTION", $arFields);
$res = $bs->Add($arFields);
$db_res = $bs->GetByID($res);
if ($db_res && ($res = $db_res->Fetch())) {
$arResult["VARIABLES"]["GALLERY"] = $res;
$arUserIds = array();
if ($object == "user") {
$arUserIds[] = $USER->GetId();
}
PClearComponentCacheEx($arParams["IBLOCK_ID"], array(0, $res['ID']), array(0, $res['CODE']), $arUserIds);
}
if (!empty($arFiles)) {
@unlink($arFiles["PICTURE"]["tmp_name"]);
@unlink($arFiles["DETAIL_PICTURE"]["tmp_name"]);
}
}
}
}