Ejemplo n.º 1
0
 public function getRowset()
 {
     return parent::getRowset();
     // TODO: Change the autogenerated stub
 }
Ejemplo n.º 2
0
 /**
  * Get a list of items
  *
  * If the installed state is TRUE this function will return a list of the installed modules.
  *
  * @return Library\DatabaseRowsetInterface
  */
 public function getRowset()
 {
     if (!isset($this->_rowset)) {
         $state = $this->getState();
         if ($state->installed) {
             $table = $this->getObject('com:extensions.database.table.extensions');
             $query = $this->getObject('lib:database.query.select')->order('name');
             $extension = $table->select($query);
             // Iterate through the extension
             $modules = array();
             foreach ($extension as $extension) {
                 $path = Library\ClassLoader::getInstance()->getApplication('site');
                 $path .= '/component/' . substr($extension->name, 4) . '/modules';
                 if (!is_dir($path)) {
                     continue;
                 }
                 foreach (new \DirectoryIterator($path) as $folder) {
                     if ($folder->isDir()) {
                         if (file_exists($folder->getRealPath() . '/' . $folder->getFilename() . '.xml')) {
                             $modules[] = array('id' => $folder->getFilename(), 'name' => 'mod_' . $folder->getFilename(), 'application' => 'site', 'extensions_extension_id' => $extension->id, 'title' => null);
                         }
                     }
                 }
             }
             //Set the total
             $this->_total = count($modules);
             //Apply limit and offset
             if ($this->getState()->limit) {
                 $modules = array_slice($modules, $state->offset, $state->limit ? $state->limit : $this->_total);
             }
             //Apply direction
             if (strtolower($state->direction) == 'desc') {
                 $modules = array_reverse($modules);
             }
             $this->_rowset = $this->getTable()->getRowset()->addRow($modules);
         } else {
             $this->_rowset = parent::getRowset();
         }
     }
     return $this->_rowset;
 }