Esempio n. 1
0
 public function rebuild($parentId = null, $leftId = 0, $level = 0, $path = '')
 {
     if (!$parentId) {
         // If root not exists, create one.
         $table = JTable::getInstance('Queue', 'WebgalleryTable');
         if (!$table->load(1)) {
             $k = $this->_tbl_key;
             $table->reset();
             $table->{$k} = 1;
             $table->title = 'ROOT';
             $table->alias = 'root';
             $table->catid = 1;
             $table->_db->insertObject($this->_tbl, $table);
             $table->reset();
             $table->{$k} = null;
         }
         // If cloumn ordering exists, we need clear it, or nested sorting can't work.
         if (property_exists($this, 'ordering')) {
             $db = JFactory::getDbo();
             $q = $db->getQuery(true);
             $q->update($this->_tbl)->set('ordering = 0');
             $db->setQuery($q);
             $db->execute();
         }
     }
     return parent::rebuild($parentId, $leftId, $level, $path);
 }