Exemple #1
0
 /**
  *   -------------------------------------------------------------------------------------------
  *   Получает данные
  * @return
  *   -------------------------------------------------------------------------------------------
  */
 public function getData()
 {
     try {
         $this->aItem = Sitemap_PagesOperations::selectChildWithAdditional($this->nParent, $this->nPagingSize, intval($this->nPage) * $this->nPagingSize, $this->orderCondition);
         $this->nTotalCount = ceil(Sitemap_PagesOperations::$nTotalCount / $this->nPagingSize);
     } catch (Exception $e) {
         CMSLog::addMessage('data-list', $e);
         throw $e;
     }
     $this->aItem = $this->filterNotEditableDocuments($this->aItem);
     if (empty($this->aItem) && $this->nPage > 0) {
         $this->jump('index.php' . '?page=0');
     }
 }
Exemple #2
0
 /**
  * Возвращает полное меню для указанного документа
  * @param bool $nId обозначает индекс страницы, от которой меню генерировать
  * @param bool $bWithAdditional обозначает необходимость подгрузки доп. информации из моделей
  */
 public static function selectFullMenu($nId = 0, $bWithAdditional = false, $aExcludeSitemapEntity = array())
 {
     $aUrlInfo = self::getCurrentUrlInfo();
     $aResult = array();
     if ($bWithAdditional) {
         $aData = Sitemap_PagesOperations::selectChildWithAdditional($nId);
     } else {
         $aData = Sitemap_PagesOperations::selectChildWithoutAdditional($nId);
     }
     // Перебор по рекурсии, спускаемся ниже, чтобы найти следующие документы
     $aResult = array();
     foreach ($aData as &$row) {
         // Определяем, что текущий элемент активный
         $isCurrent = SitemapMisc::urlsMatch($aUrlInfo['full_url'], $row['full_url']);
         if ($isCurrent) {
             $row['active'] = 1;
         }
         if ($row['full_url'] == $aUrlInfo['full_url']) {
             $row['active'] = 1;
         }
         // Определяем, что текущий элемент активный
         $excludeDocument = !empty($row['document_name']) && in_Array($row['document_name'], $aExcludeSitemapEntity);
         $excludeScript = !empty($row['script']) && in_Array($row['script'], $aExcludeSitemapEntity);
         if ($excludeDocument || $excludeScript) {
             // Не включаем дерево ненужные документы
             continue;
         }
         if (!empty($row['count'])) {
             $row['aChild'] = self::selectFullMenu($row['id'], $bWithAdditional, $aExcludeSitemapEntity);
         } else {
             $row['aChild'] = array();
         }
         $aResult[] = $row;
     }
     unset($row);
     return $aResult;
 }