当前位置: 首页>>代码示例>>PHP>>正文


PHP CIBlockSection::getByID方法代码示例

本文整理汇总了PHP中CIBlockSection::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockSection::getByID方法的具体用法?PHP CIBlockSection::getByID怎么用?PHP CIBlockSection::getByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CIBlockSection的用法示例。


在下文中一共展示了CIBlockSection::getByID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __callStatic

 public static function __callStatic($name, $arguments)
 {
     $name = ToUpper($name);
     switch ($name) {
         case 'ADDELEMENT':
         case 'ADDSECTION':
             if ($arguments[0]["ID"] > 0 && $arguments[0]['IBLOCK_ID'] > 0 && (!isset($arguments[0]['ACTIVE']) || $arguments[0]['ACTIVE'] == 'Y')) {
                 // we recieve array reference here
                 $arFields = array();
                 foreach ($arguments[0] as $key => $value) {
                     $arFields[$key] = $value;
                 }
                 self::actionAdd($name, $arFields);
             }
             break;
         case 'BEFOREDELETEELEMENT':
         case 'BEFOREDELETESECTION':
         case 'BEFOREUPDATEELEMENT':
         case 'BEFOREUPDATESECTION':
             $ID = $arguments[0];
             if (is_array($ID)) {
                 $ID = $ID['ID'];
             }
             if ($ID > 0) {
                 $bElement = $name == 'BEFOREDELETEELEMENT' || $name == 'BEFOREUPDATEELEMENT';
                 $dbFields = $bElement ? \CIBlockElement::getByID($ID) : \CIBlockSection::getByID($ID);
                 $arFields = $dbFields->getNext();
                 if ($arFields) {
                     if ($bElement && !self::checkElement($arFields)) {
                         return;
                     }
                     $arSitemaps = SitemapIblockTable::getByIblock($arFields, $bElement ? SitemapIblockTable::TYPE_ELEMENT : SitemapIblockTable::TYPE_SECTION);
                     if (count($arSitemaps) > 0) {
                         self::$arBeforeActions[$name][intval($bElement)][$ID] = array('URL' => $bElement ? $arFields['~DETAIL_PAGE_URL'] : $arFields['~SECTION_PAGE_URL'], 'FIELDS' => $arFields, 'SITEMAPS' => $arSitemaps);
                     }
                 }
             }
             break;
         case 'DELETEELEMENT':
         case 'DELETESECTION':
         case 'UPDATEELEMENT':
         case 'UPDATESECTION':
             $arFields = $arguments[0];
             $bElement = $name == 'DELETEELEMENT' || $name == 'UPDATEELEMENT';
             if (is_array($arFields) && $arFields['ID'] > 0 && isset(self::$arBeforeActions['BEFORE' . $name][intval($bElement)][$arFields['ID']])) {
                 if ($name == 'DELETEELEMENT' || $name == 'DELETESECTION') {
                     self::actionDelete(self::$arBeforeActions['BEFORE' . $name][intval($bElement)][$arFields['ID']]);
                 } else {
                     self::actionUpdate(self::$arBeforeActions['BEFORE' . $name][intval($bElement)][$arFields['ID']], $bElement);
                 }
             }
             break;
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:54,代码来源:sitemapiblock.php

示例2: actionUpdate

 /**
  * Processes actions on IBlock element or section update
  *
  * @param array $data Data got from SitemapIblockTable::getByIblock() + element/section data + prev link data got from event handler.
  * @param bool $element Element or section.
  */
 protected static function actionUpdate($data, $element)
 {
     $fields = $data['FIELDS'];
     foreach ($data['SITEMAPS'] as $sitemap) {
         $fileName = str_replace(array('#IBLOCK_ID#', '#IBLOCK_CODE#', '#IBLOCK_XML_ID#'), array($fields['IBLOCK_ID'], $sitemap['IBLOCK_CODE'], $sitemap['IBLOCK_XML_ID']), $sitemap['SITEMAP_FILE_IBLOCK']);
         if ($element) {
             $dbRes = \CIBlockElement::getByID($fields["ID"]);
         } else {
             $dbRes = \CIBlockSection::getByID($fields["ID"]);
         }
         $newFields = $dbRes->fetch();
         $rule = array('url' => $element ? \CIBlock::replaceDetailUrl($sitemap['DETAIL_PAGE_URL'], $newFields, false, "E") : \CIBlock::replaceDetailUrl($sitemap['SECTION_PAGE_URL'], $newFields, false, "S"), 'lastmod' => MakeTimeStamp($fields['TIMESTAMP_X']));
         $sitemapFile = new SitemapFile($fileName, $sitemap);
         $sitemapFile->removeEntry($data['URL']);
         if ($newFields["ACTIVE"] !== "N") {
             $sitemapFile->appendIblockEntry($rule['url'], $rule['lastmod']);
         }
         $sitemapIndex = new SitemapIndex($sitemap['SITEMAP_FILE'], $sitemap);
         $sitemapIndex->appendIndexEntry($sitemapFile);
         if ($sitemap['ROBOTS'] == 'Y') {
             $robotsFile = new RobotsFile($sitemap['SITE_ID']);
             $robotsFile->addRule(array(RobotsFile::SITEMAP_RULE, $sitemapIndex->getUrl()));
         }
         unset($sitemapFile);
         unset($sitemapIndex);
         unset($robotsFile);
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:34,代码来源:sitemapiblock.php


注:本文中的CIBlockSection::getByID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。