Example #1
0
 public function search($params)
 {
     $query = Page::find();
     $dataProvider = new ActiveDataProvider(array('query' => $query));
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $this->addCondition($query, 'id');
     $this->addCondition($query, 'name', true);
     $this->addCondition($query, 'body', true);
     $this->addCondition($query, 'parent_pages_id');
     $this->addCondition($query, 'ord');
     $this->addCondition($query, 'time_create');
     $this->addCondition($query, 'time_update');
     //$this->addCondition($query, 'special');
     $this->addCondition($query, 'title', true);
     $this->addCondition($query, 'template', true);
     $this->addCondition($query, 'category', true);
     $this->addCondition($query, 'tags', true);
     $this->addCondition($query, 'description', true);
     $this->addCondition($query, 'date_associated');
     $this->addCondition($query, 'vars', true);
     $this->addCondition($query, 'status', true);
     return $dataProvider;
 }
Example #2
0
 /**
  * Forms an associative, multidimensional array holding only the first
  * level of nodes. Used when lazy loading is enabled and only the first
  * nodes should be shown.
  * 
  * @param int dataview_id The id of the dataview to show this tree for
  * @param User $user The user model to filter this tree for (Defaults to false, meaning no user filter)
  *
  * @return array The parent child data as associative, multidimensional array
  */
 public static function rootTreeAsArray($id)
 {
     $checkRootNode = Page::findOne($id);
     if (is_null($checkRootNode->parent_pages_id) or $checkRootNode->parent_pages_id == 0) {
         $rootNode = $checkRootNode->id;
     } else {
         $rootNode = $checkRootNode->parent_pages_id;
     }
     $roots = array();
     $roots = Page::find()->where(array('id' => $rootNode))->All();
     $out = array();
     foreach ($roots as $root) {
         $currow = array('id' => $root->id, 'child' => $root->noChildren, 'text' => $root->name);
         $out[] = $currow;
     }
     return $trees = array('id' => 0, 'item' => $out);
 }