예제 #1
0
 public function getList()
 {
     $state = $this->_state;
     $filter = $this->getService('koowa:filter.slug');
     //		$this->redis->flushall();
     //
     //		$this->_state->limit = 100;
     //
     //		parent::getList();
     //
     //
     //		foreach($this->_list as $key => $row) {
     //			$this->redis->set('event:'.$key, serialize($row->toArray()));
     //			$this->redis->rpush('events', $key);
     //			$this->redis->sadd('ctas_involvement:'. $filter->sanitize($row->ctas_involvement), $key);
     //		}
     if ($state->search) {
         parent::getList();
     } else {
         if ($state->ctas_involvement) {
             $list = $this->redis->smembers('ctas_involvement:' . $filter->sanitize($state->ctas_involvement));
         } else {
             $list = $this->redis->lrange('events', 0, 19);
         }
         foreach ($list as $item) {
             $rows[] = array_merge(unserialize($this->redis->get('event:' . $item)), array('cached' => 1));
         }
         $this->_list = $this->getTable()->getRowset()->addData($rows, false);
     }
     return $this->_list;
 }
예제 #2
0
 public function getList()
 {
     if (!isset($this->_list)) {
         foreach (parent::getList() as $item) {
             //@TODO store broken links in a separate array allowing us to list missing/deleted attachments
             if (!$item->exists()) {
                 continue;
             }
             if ($item->isImage()) {
                 $this->_images[] = $item;
             } elseif ($item->isFile()) {
                 $this->_files[] = $item;
             }
         }
     }
     return $this->_list;
 }
예제 #3
0
    /**
     * Get a list of items
     * 
     * If the installed state is TRUE this function will return a list of the installed
     * modules.
     *
     * @return KDatabaseRowsetInterface
     */
    public function getList()
    { 
        if(!isset($this->_list))
        {
            $state = $this->_state;
            
            if($state->installed)
            {
            	$client	= JApplicationHelper::getClientInfo($state->application, true);
            	if(!empty($client)) 
			    {
            	    $modules = array();
            	    $path = $client->path.'/modules';
            	    
			        foreach(new DirectoryIterator($path) as $folder)
                    {
                        if($folder->isDir())
                        {
                            if(file_exists($folder->getRealPath().'/'.$folder->getFilename().'.xml')) 
                            { 
                                $modules[] = array(
                                    'id'          => $folder->getFilename(),
                       				'type'        => $folder->getFilename(),
                        			'application' => $client->name,
                                    'title'		  => null
	                                );
                            }
                        }
                    }
                    
            	    $this->_list = $this->getTable()->getRowset()->addData($modules);
			    }
            }
            else $this->_list = parent::getList();
        }

        return $this->_list;
    }
예제 #4
0
 /**
  * Get a list of items
  * 
  * If the installed state is TRUE this function will return a list of the installed
  * modules.
  *
  * @return KDatabaseRowsetInterface
  */
 public function getList()
 {
     if (!isset($this->_list)) {
         $state = $this->_state;
         if ($state->installed) {
             $modules = array();
             $ids = parent::getList()->getColumn('type');
             foreach ((array) KConfig::unbox($state->application) as $application) {
                 $client = JApplicationHelper::getClientInfo($application, true);
                 if (!empty($client)) {
                     $path = $client->path . '/modules';
                     foreach (new DirectoryIterator($path) as $folder) {
                         if ($folder->isDir()) {
                             if (file_exists($folder->getRealPath() . '/' . $folder->getFilename() . '.xml')) {
                                 $modules[] = array('id' => array_search($folder->getFilename(), $ids), 'type' => $folder->getFilename(), 'application' => $client->name, 'title' => null);
                             }
                         }
                     }
                 }
             }
             //Set the total
             $this->_total = count($modules);
             //Apply limit and offset
             if ($this->_state->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->_list = $this->getTable()->getRowset()->addData($modules);
         } else {
             $this->_list = parent::getList();
         }
     }
     return $this->_list;
 }
예제 #5
0
    /**
     * Get a list of items which represents a table rowset
     *
     * Overridden to add itemid to the returned results
     *
     * @return KDatabaseRowsetInterface
     */
    public function getList()
    {
        $list = parent::getList();

        if ($list)
        {
            foreach ($list as $item) {
                $item->itemid = $this->_findPage($item);
            }
        }

        return $list;
    }
예제 #6
0
 /**
  * Get a list of items which represnts a  table rowset
  *
  * @return KDatabaseRowset
  */
 public function getList()
 {
     if (!isset($this->_list)) {
         parent::getList();
         $table = $this->getTable();
         $types = array('forum' => $table->getTypeIdFromName('forum'), 'topic' => $table->getTypeIdFromName('topic'), 'person' => $table->getTypeIdFromName('person'));
         //@TODO optimize this to 3 queries in total, instead of multiple
         foreach ($this->_list as $item) {
             //@TODO speed this up by adding it as a db column
             $item->modified_by = false;
             $item->modified_name = JText::_('n/a');
             if ($item->subscription_type == $types['forum']) {
                 $item->type = 'forum';
                 $item->title = KFactory::tmp('admin::com.ninjaboard.model.forums')->id($item->subscription_type_id)->getItem()->title;
                 $icon = '/forums/default.png';
                 $link = '&view=forum&id=' . $item->subscription_type_id;
             }
             if ($item->subscription_type == $types['topic']) {
                 $item->type = 'topic';
                 $topic = KFactory::tmp('admin::com.ninjaboard.model.topics')->id($item->subscription_type_id)->getItem();
                 $item->title = $topic->subject;
                 $icon = '/topic/32__default.png';
                 $link = '&view=topic&id=' . $item->subscription_type_id;
             }
             if ($item->subscription_type == $types['person']) {
                 $item->type = 'person';
                 $item->title = KFactory::tmp('admin::com.ninjaboard.model.people')->id($item->subscription_type_id)->getItem()->display_name;
                 $icon = '/16/users.png';
                 $link = '&view=person&id=' . $item->subscription_type_id;
             }
             $item->link = JRoute::_('index.php?option=com_ninjaboard' . $link);
             $item->icon = KFactory::get('admin::com.ninja.helper.default')->img($icon);
         }
     }
     return $this->_list;
 }