Ejemplo n.º 1
0
 function __construct()
 {
     if (!$control) {
         $control = Control::primary();
     }
     $this->control = $control;
     $this->lt = $control->lt;
     $this->db = $this->control->db;
 }
Ejemplo n.º 2
0
 function __construct($control = null)
 {
     if (!$control) {
         $control = Control::primary();
     }
     $this->control = $control;
     $this->protocol = $_ENV['protocol'] ? $_ENV['protocol'] : 'http';
     $this->baseUrl = $this->protocol . '://' . $_ENV['httpHost'] . '/';
 }
Ejemplo n.º 3
0
 static function page($sql, $pageNumber = null, $pageBy = 50, $max = null)
 {
     $pageBy = $pageBy ? $pageBy : 50;
     if ($pageNumber === null) {
         $control = \Control::primary();
         $pageNumber = (int) $control->in['_page'] - 1;
     }
     $pageNumber = $pageNumber > 0 ? $pageNumber : 0;
     $offset = $pageBy * $pageNumber;
     $sql .= "\nLIMIT " . $offset . ', ' . $pageBy;
     list($count, $rows) = \Db::countAndRows($max ? $max + 1 : null, $sql);
     $top = $count;
     if ($max && $count > $max) {
         $top = $max;
     }
     $pages = ceil($top / $pageBy);
     self::$lastPaging = array('rows' => $rows, 'info' => array('count' => $count, 'pages' => $pages, 'top' => $top, 'page' => $pageNumber + 1));
     return self::$lastPaging;
 }
Ejemplo n.º 4
0
 function __construct($data = null, $options = null)
 {
     $this->control = \Control::primary();
     $this->in = $this->control->in;
     ///an array of keys to values used in conjuction with TO_ARRAY to serve as override values for form fields
     if (!is_array($data)) {
         if ($this->in) {
             $this->data = $this->in;
         } else {
             $this->data = $this->control->item;
         }
     } else {
         $this->data = $data;
     }
     ///the the of behavior for determining what the actual value of a form field should be
     $this->valueBehavior = $options['valueBehavior'] ? $options['valueBehavior'] : 'to_input';
     ///attribute parsers to apply when handling options on form method
     $this->additionalParsers = $options['additionalParsers'];
 }
Ejemplo n.º 5
0
 function __construct($control = null)
 {
     $this->control = $control ? $control : Control::primary();
 }