Ejemplo n.º 1
0
 function select($aql = null, $clause = null)
 {
     if ($aql) {
         $this->aql = $aql;
     }
     if ($clause) {
         $this->clause = $clause;
     }
     //pagination settings
     $default_limit = if_not($this->clause['default_limit'], 25);
     if (!$_GET['limit' . $this->i]) {
         $_GET['limit' . $this->i] = $default_limit;
     }
     $this->offset = $_GET['page' . $this->i] * $_GET['limit' . $this->i] - $_GET['limit' . $this->i];
     $this->clause['limit'] = $_GET['limit' . $this->i];
     $this->clause['offset'] = $this->offset;
     $this->rs = aql::select($this->aql, $this->clause);
     $this->first_row = $this->offset + 1;
     $this->last_row = count($this->rs) + $this->first_row - 1;
     $c = aql::sql($this->aql, $this->clause);
     $c = sql($c['sql_count']);
     $this->total_rows = $c->Fields('count');
     $this->num_pages = ceil($this->total_rows / $_GET['limit' . $this->i]);
     return $this->rs;
 }
Ejemplo n.º 2
0
 function __construct($class = null, $params = null)
 {
     $this->class = $class;
     $this->params = $params;
     $GLOBALS['pagination_count'][] = true;
     $this->i = count($GLOBALS['pagination_count']);
     if (!$_GET['page' . $this->i] || $_GET['page' . $this->i] < 1) {
         $_GET['page' . $this->i] = 1;
     }
     $default_limit = 25;
     $this->limit = if_not($_GET['limit' . $this->i], $default_limit);
     $this->page = $_GET['page' . $this->i];
     if ($class && $params) {
         $this->rs = $this->select();
     }
 }
Ejemplo n.º 3
0
 /**
  * @param string $model_name       name of model
  * @return string                  aql statemnt
  */
 protected function _getAql($model_name)
 {
     return if_not(aql2array::$aqls[$model_name], function () use($model_name) {
         return aql2array::$aqls[$model_name] = aql::get_aql($model_name);
     });
 }