Exemple #1
0
 protected function get_list()
 {
     if (!empty($this->order_by)) {
         $this->basic_model->order_by($this->order_by[0], $this->order_by[1]);
     }
     if (!empty($this->where)) {
         foreach ($this->where as $where) {
             $this->basic_model->where($where[0], $where[1], $where[2]);
         }
     }
     if (!empty($this->or_where)) {
         foreach ($this->or_where as $or_where) {
             $this->basic_model->or_where($or_where[0], $or_where[1], $or_where[2]);
         }
     }
     if (!empty($this->like)) {
         foreach ($this->like as $like) {
             $this->basic_model->like($like[0], $like[1], $like[2]);
         }
     }
     if (!empty($this->or_like)) {
         foreach ($this->or_like as $or_like) {
             $this->basic_model->or_like($or_like[0], $or_like[1], $or_like[2]);
         }
     }
     if (!empty($this->relation)) {
         foreach ($this->relation as $relation) {
             $this->basic_model->join_relation($relation[0], $relation[1], $relation[2]);
         }
     }
     if ($this->config['crud_paging'] === true) {
         if ($this->limit == null) {
             $this->basic_model->limit(10);
         } else {
             $this->basic_model->limit($this->limit[0], $this->limit[1]);
         }
     }
     $results = $this->basic_model->get_list();
     return $results;
 }
Exemple #2
0
 protected function get_list()
 {
     if (!empty($this->order_by)) {
         $this->basic_model->order_by($this->order_by[0], $this->order_by[1]);
     }
     if (!empty($this->where)) {
         foreach ($this->where as $where) {
             $this->basic_model->where($where[0], $where[1], $where[2]);
         }
     }
     if (!empty($this->or_where)) {
         foreach ($this->or_where as $or_where) {
             $this->basic_model->or_where($or_where[0], $or_where[1], $or_where[2]);
         }
     }
     if (!empty($this->like)) {
         foreach ($this->like as $like) {
             $this->basic_model->like($like[0], $like[1], $like[2]);
         }
     }
     if (!empty($this->or_like)) {
         foreach ($this->or_like as $or_like) {
             $this->basic_model->or_like($or_like[0], $or_like[1], $or_like[2]);
         }
     }
     if (!empty($this->having)) {
         foreach ($this->having as $having) {
             $this->basic_model->having($having[0], $having[1], $having[2]);
         }
     }
     if (!empty($this->or_having)) {
         foreach ($this->or_having as $or_having) {
             $this->basic_model->or_having($or_having[0], $or_having[1], $or_having[2]);
         }
     }
     if (!empty($this->relation)) {
         foreach ($this->relation as $relation) {
             $this->basic_model->join_relation($relation[0], $relation[1], $relation[2]);
         }
     }
     if (!empty($this->relation_n_n)) {
         $columns = $this->get_columns();
         foreach ($columns as $column) {
             //Use the relation_n_n ONLY if the column is called . The set_relation_n_n are slow and it will make the table slower without any reason as we don't need those queries.
             if (isset($this->relation_n_n[$column->field_name])) {
                 $this->basic_model->set_relation_n_n_field($this->relation_n_n[$column->field_name]);
             }
         }
     }
     if ($this->theme_config['crud_paging'] === true) {
         if ($this->limit === null) {
             $default_per_page = $this->config->default_per_page;
             if (is_numeric($default_per_page) && $default_per_page > 1) {
                 $this->basic_model->limit($default_per_page);
             } else {
                 $this->basic_model->limit(10);
             }
         } else {
             $this->basic_model->limit($this->limit[0], $this->limit[1]);
         }
     }
     $results = $this->basic_model->get_list();
     return $results;
 }
 public function get_list_data()
 {
     $this->pre_render();
     if (!empty($this->order_by)) {
         $this->basic_model->order_by($this->order_by[0], $this->order_by[1]);
     }
     if (!empty($this->where)) {
         foreach ($this->where as $where) {
             $this->basic_model->where($where[0], $where[1], $where[2]);
         }
     }
     if (!empty($this->or_where)) {
         foreach ($this->or_where as $or_where) {
             $this->basic_model->or_where($or_where[0], $or_where[1], $or_where[2]);
         }
     }
     if (!empty($this->like)) {
         foreach ($this->like as $like) {
             $this->basic_model->like($like[0], $like[1], $like[2]);
         }
     }
     if (!empty($this->or_like)) {
         foreach ($this->or_like as $or_like) {
             $this->basic_model->or_like($or_like[0], $or_like[1], $or_like[2]);
         }
     }
     if (!empty($this->having)) {
         foreach ($this->having as $having) {
             $this->basic_model->having($having[0], $having[1], $having[2]);
         }
     }
     if (!empty($this->or_having)) {
         foreach ($this->or_having as $or_having) {
             $this->basic_model->or_having($or_having[0], $or_having[1], $or_having[2]);
         }
     }
     if (!empty($this->relation)) {
         foreach ($this->relation as $relation) {
             $this->basic_model->join_relation($relation[0], $relation[1], $relation[2]);
         }
     }
     if (!empty($this->relation_n_n)) {
         $columns = $this->get_columns();
         foreach ($columns as $column) {
             //Use the relation_n_n ONLY if the column is called . The set_relation_n_n are slow and it will make the table slower without any reason as we don't need those queries.
             if (isset($this->relation_n_n[$column->field_name])) {
                 $this->basic_model->set_relation_n_n_field($this->relation_n_n[$column->field_name]);
             }
         }
     }
     //		if($this->theme_config['crud_paging'] === true)
     //		{
     if ($this->limit === null) {
         //				$default_per_page = $this->config->default_per_page;
         //				if(is_numeric($default_per_page) && $default_per_page >1)
         //				{
         //					$this->basic_model->limit($default_per_page);
         //				}
         //				else
         //				{
         //					$this->basic_model->limit(10);
         //				}
     } else {
         $this->basic_model->limit($this->limit[0], $this->limit[1]);
     }
     //		}
     $data = $this->get_common_data();
     //		$data->order_by 	= $this->order_by;
     //		$data->types 		= $this->get_field_types();
     //		$data->list = $this->get_list();
     //		$data->list = $this->change_list($data->list , $data->types);
     //		$data->list = $this->change_list_add_actions($data->list);
     //		$data->total_results = $this->get_total_results();
     $data->columns = $this->get_columns();
     $results = $this->basic_model->get_list();
     return $results;
 }