コード例 #1
0
ファイル: assets.php プロジェクト: ravenlife/Ninjaboard
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
 }
コード例 #2
0
ファイル: forums.php プロジェクト: ravenlife/Ninjaboard
 public function getList()
 {
     if (!isset($this->_list)) {
         parent::getList();
         if ($this->_state->levels) {
             $copied = array();
             $list = $this->_list->getIterator()->getArrayCopy();
             $table = $this->getTable();
             //usort($list, array($this, '_sort'));
             foreach ($list as $row) {
                 if ($row->level == 1) {
                     continue;
                 }
                 $parent = end(array_filter(explode('/', $row->path)));
                 //If this forum havent been queried yet, then do a select count
                 if (!isset($this->_parent_count[$parent])) {
                     $this->_parent_count[$parent] = $table->count(array('id' => $parent, 'enabled' => 1));
                 }
                 //If parent isn't enabled, don't try to find it
                 if (!$this->_parent_count[$parent]) {
                     continue;
                 }
                 $parent = $this->_list->find($parent);
                 //@TODO perhaps move this into the table object instead, as it's a virtual property
                 if (!isset($parent->subforums)) {
                     $parent->subforums = array();
                 }
                 $subforums = $parent->subforums;
                 $subforums[] = $row;
                 $parent->subforums = $subforums;
                 $copied[] = $row;
             }
             // Remove copied forums from main list
             foreach ($copied as $row) {
                 $this->_list->extract($row);
             }
         }
         if ($this->_state->indent) {
             foreach ($this->_list as $item) {
                 $item->title = str_repeat('    ', $item->level - 1) . $item->title;
             }
         }
         if ($this->_state->recurse) {
             $this->_total = count($this->_list);
         }
     }
     return $this->_list;
 }