Example #1
0
 /**
  * Display search form and results (if any)
  *
  * @return  void
  */
 public function displayTask($response = NULL)
 {
     if (isset($response)) {
         $this->view->query = $response->search;
         $this->view->queryString = $response->queryString;
         $this->view->results = $response->results;
     } else {
         $this->view->queryString = '';
         $this->view->results = '';
     }
     $this->view->types = Hubtype::all()->order('type', 'DESC')->rows()->toObject();
     $this->view->setLayout('display');
     $this->view->display();
 }
Example #2
0
 public function fetchHubTypeRows($type = '')
 {
     $type = Hubtype::all()->where('type', '=', $type)->row();
     require_once PATH_ROOT . DS . $type->file_path;
     $classpath = $type->get('class_path');
     if (strpos($classpath, 'Tables') === FALSE) {
         $model = new $classpath();
     } else {
         $database = App::get('db');
         $model = new $classpath($database);
     }
     // Get local model fields
     if (get_parent_class($model) == 'Hubzero\\Database\\Relational') {
         $rows = $model->all()->rows();
     } elseif (get_parent_class($model) == 'Hubzero\\Base\\Model') {
         $rows = $model;
         var_dump($this->database);
         die;
         var_dump(get_class_methods($rows));
         die;
     } elseif (get_parent_class($model) == 'JTable') {
         // MAJOR PERFORMANCE HIT
         $query = $database->getQuery(true);
         $query->select('*');
         $query->limit(10);
         $query->from($model->getTableName());
         $database->setQuery($query);
         $rows = $database->loadObjectList();
     } else {
         var_dump(get_parent_class($model));
         die;
     }
     // Get related model fields
     // Add the related and local fields
     return $rows;
 }