コード例 #1
0
 /**
  * Returns the full page tree.
  *
  * @return array An array of the root pages with all subpages given with the key '_children' recursively.
  */
 public function &getFullPageTree()
 {
     if ($this->fullPageTree !== null) {
         return $this->fullPageTree;
     }
     $identifier = 'tx_contentstage_ContentRepository_getFullPageTree_' . $this->tag;
     if (TX_CONTENTSTAGE_USECACHE && $this->cache->has($identifier)) {
         $this->fullPageTree = $this->cache->get($identifier);
         return $this->fullPageTree;
     }
     $this->log->log($this->translate('pageTree.rebuild', array($this->tag)), Tx_CabagExtbase_Utility_Logging::INFORMATION);
     $res = $this->db->exec_SELECT_queryArray(array('SELECT' => implode(', ', $this->fieldNames), 'FROM' => 'pages', 'WHERE' => '', 'GROUPBY' => '', 'ORDERBY' => 'sorting ASC', 'LIMIT' => ''));
     $tree = array();
     $index = array();
     $index[0]['_children'] =& $tree;
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $uid = intval($row['uid']);
         if (isset($index[$uid]) && isset($index[$uid]['_children'])) {
             $row['_children'] =& $index[$uid]['_children'];
         } else {
             $row['_children'] = array();
         }
         $index[$uid] =& $row;
         $index[intval($row['pid'])]['_children'][intval($row['uid'])] =& $row;
         unset($row);
     }
     if (TX_CONTENTSTAGE_USECACHE) {
         $this->cache->set($identifier, $index, array(), TX_CONTENTSTAGE_CACHETIME);
     }
     $this->fullPageTree =& $index;
     $this->log->log($this->translate('pageTree.rebuilt', array($this->tag)), Tx_CabagExtbase_Utility_Logging::INFORMATION);
     return $index;
 }