Esempio n. 1
0
 /**
  * Load stuff
  * @return $this
  */
 function load_attachs()
 {
     $this->attachs = $this->get_attach_model()->set_where("pid = %d", $this->model->id)->with_deps($this->deps);
     if ($this->with_ctype && ($ctype = $this->model->get_ctype_id())) {
         $this->attachs->where('ctype_id', $ctype);
     }
     $this->load_attachs_before();
     $this->attachs->load();
     $this->load_attachs_after();
     return $this->attachs;
 }
Esempio n. 2
0
 /**
  * @param boolean load/or just return collection
  */
 protected function _load($load = true)
 {
     $this->collection->clear();
     if ($this->_where) {
         $this->collection->set_where($this->_where);
     }
     if ($this->_order) {
         $this->collection->set_order($this->_order);
     }
     return $load ? $this->collection->load() : $this->collection;
 }
Esempio n. 3
0
 /**
  * Apply without render
  */
 function apply_filters()
 {
     $this->_apply();
     if ($this->pagination_limit * $this->pagination_start > $this->count + $this->pagination_limit) {
         throw new collection_filter_exception('Invalid range ' . $this->pagination_limit * $this->pagination_start . ' > ' . $this->count);
     }
     // real page 0=1, 2...
     $real_page = $this->pagination_start > 1 ? $this->pagination_start - 1 : 0;
     $this->collection->set_limit($this->pagination_limit, $real_page * $this->pagination_limit);
     $this->collection->load();
     // Run callback
     if ($this->on_apply_callback instanceof Closure) {
         call_user_func($this->on_apply_callback, $this->collection);
         $this->on_apply_callback = null;
     }
     // generate_pagination
     $this->pagination = $this->paginate($this->base_url, $this->count, $this->pagination_limit, $this->pagination_start);
     return $this;
 }