Пример #1
0
 /**
  * /
  * @param  integer $page     [description]
  * @param  integer $per_page [description]
  * @param  string  $key      [description]
  * @param  string  $order    [description]
  * @param  string  $lang     [description]
  * @return [type]            [description]
  */
 public function find($page = 1, $per_page = 12, $key = 'name', $order = 'asc', $lang = 'pt-br')
 {
     if (!is_int($page) || !is_int($per_page) || !is_string($key) || !is_string($order) || !is_string($lang)) {
         throw new \Exception("Page and per_page must be integers, key and order must be strings.", 02);
     }
     $pagination = Pagination::paginate($page, $per_page);
     $sql = "SELECT t1.id, t1.item_name, t1.name, t2.slug, t2.title\n            FROM types t1\n            JOIN translations t2\n                ON t1.id=t2.item_id\n                AND t2.item_name=:item_name\n            WHERE t2.language=:lang\n            ORDER By {$key} {$order}\n            LIMIT {$pagination->offset},{$pagination->limit}";
     $result = $this->db->run($sql, array('item_name' => 'type', 'lang' => $lang));
     return $result;
 }
Пример #2
0
 /**
  * /
  * @param  integer $page     [description]
  * @param  integer $per_page [description]
  * @param  string  $key      [description]
  * @param  string  $order    [description]
  * @return [type]            [description]
  */
 public function find($page = 1, $per_page = 12, $key = 'created', $order = 'desc')
 {
     if (!is_int($page) || !is_int($per_page) || !is_string($key) || !is_string($order)) {
         throw new \Exception("Page and per_page must be integers, key and order must be strings", 01);
     }
     $pagination = Pagination::paginate($page, $per_page);
     $sql = "SELECT user_id, group_name, group_id, action, item_name, item_id, nonce, created\n            FROM log ORDER BY {$key} {$order} LIMIT {$pagination->offset},{$pagination->limit}";
     $result = $this->db->run($sql);
     return $result;
 }
Пример #3
0
 /**
  * /
  * @param  integer $pg       [description]
  * @param  integer $per_page [description]
  * @param  string  $key      [description]
  * @param  string  $order    [description]
  * @return [type]            [description]
  */
 public function find($pg = 1, $per_page = 12, $key = 'title', $order = 'asc')
 {
     if (!is_int($pg) || !is_int($per_page) || !is_string($key) || !is_string($order)) {
         throw new \Exception("Page and per_page must be integers, key and order must be strings.", 06);
     }
     $pagination = Pagination::paginate($pg, $per_page);
     $sql = "SELECT t1.id, t2.title AS project, t1.hours, t1.rate, t1.total, t1.activity, t1.created FROM invoices\n          JOIN projects t2\n            ON t1.project_id=t2.id\n          ORDER BY {$key} {$order}\n          LIMIT {$pagination->offset}, {$pagination->limit}";
     $result = $this->db->run($sql);
     return $result;
 }
Пример #4
0
 /**
  * /
  * @param  integer $page     [description]
  * @param  integer $per_page [description]
  * @param  string  $key      [description]
  * @param  string  $order    [description]
  * @return [type]            [description]
  */
 public function find($page = 1, $per_page = 12, $key = 'name', $order = 'asc')
 {
     if (!is_int($page) || !is_int($per_page) || !is_string($key) || !is_string($order)) {
         throw new \Exception("Invalid input type", 1);
     }
     $pagination = Pagination::paginate($page, $per_page);
     $sql = "SELECT id, name, activity \n            FROM roles \n            ORDER BY {$key} {$order} \n            LIMIT {$pagination->offset},{$pagination->limit}";
     $result = $this->db->run($sql, array());
     return $result;
 }
Пример #5
0
 /**
  * /
  * @param  integer $pg       [description]
  * @param  integer $per_page [description]
  * @return [type]            [description]
  */
 public function findAll($pg = 1, $per_page = 20)
 {
     if (!is_int($pg) || !is_int($per_page)) {
         throw new \Exception("Page and per_page must be integers.", 03);
     }
     $pagination = Pagination::paginate($pg, $per_page);
     $sql = "SELECT (dev_id, user_id, hash, priority, description, activity, created, modified) FROM tickets\n            ORDER BY modified DESC, activity DESC, priority DESC\n            LIMIT {$pagination->offset},{$pagination->limit}";
     $result = $this->db->run($sql);
     return $result;
 }
Пример #6
0
 /**
  * /
  * @param  integer $pg       [description]
  * @param  integer $per_page [description]
  * @param  string  $key      [description]
  * @param  string  $order    [description]
  * @return [type]            [description]
  */
 public function find($pg = 1, $per_page = 12, $key = 'title', $order = 'asc')
 {
     if (!is_int($pg) || !is_int($per_page) || !is_string($key) || !is_string($order)) {
         throw new \Exception("Page and per_page must be integers, key and order must be strings.", 02);
     }
     $pagination = Pagination::paginate($pg, $per_page);
     $sql = "SELECT title, description, activity FROM projects\n            ORDER BY {$key} {$order}\n            LIMIT {$pagination->offset}, {$pagination->limit}\n            WHERE activity > :activity";
     $result = $this->db->run($sql, array('activity' => 0));
     return $result;
 }
Пример #7
0
 /**
  * /
  * @param  [type]  $type     [description]
  * @param  integer $page     [description]
  * @param  integer $per_page [description]
  * @param  string  $key      [description]
  * @param  string  $order    [description]
  * @param  string  $lang     [description]
  * @return [type]            [description]
  */
 public function findByType($type, $page = 1, $per_page = 12, $key = 'type', $order = 'desc', $lang = 'pt-br')
 {
     if (!is_string($type) || !is_int($page) || !is_int($per_page) || !is_string($key) || !is_string($order) || !is_string($lang)) {
         throw new \Exception("Invalid input type", 1);
     }
     $pagination = Pagination::paginate($page, $per_page);
     $sql = "SELECT t1.id AS id, t1.activity AS activity, t1.created AS created, t1.modified AS modified, t2.slug AS slug, t2.title AS title, t2.description AS description, t3.name AS type\n        FROM collections t1\n            JOIN translations t2\n                ON t1.id=t2.item_id\n                AND t2.item_name=:item_name\n            JOIN types t3\n                ON t1.type_id=t3.id\n            WHERE t3.name=:type\n            AND t1.activity > 0\n            AND t2.language=:language\n            ORDER BY {$key} {$order}\n            LIMIT {$pagination->offset},{$pagination->limit}";
     $result = $this->db->run($sql, array('item_name' => 'collection', 'type' => $type, 'language' => $lang));
     return $result;
 }
Пример #8
0
 /**
  * /
  * @param  [type]  $type     [description]
  * @param  integer $page     [description]
  * @param  integer $per_page [description]
  * @param  string  $key      [description]
  * @param  string  $order    [description]
  * @param  string  $lang     [description]
  * @return [type]            [description]
  */
 public function findByType($type, $page = 1, $per_page = 12, $key = 'name', $order = 'asc', $lang = 'pt-br')
 {
     if (!is_string($type) || !is_int($page) || !is_int($per_page) || !is_string($key) || !is_string($order) || !is_string($lang)) {
         throw new \Exception("Invalid input type", 1);
     }
     $pagination = Pagination::paginate($page, $per_page);
     $sql = "SELECT t1.id AS id, t1.parent_id AS parent_id, t1.name AS name, t1.value AS value, t3.name AS type \n        FROM terms t1 \n            JOIN translations t2\n                ON t1.id=t2.item_id\n                AND t2.item_name=:item_name\n            JOIN types t3 \n                ON t1.type_id=t3.id \n            WHERE t3.name=:type\n            AND t1.activity > 0\n            AND t2.language=:lang\n            ORDER BY {$key} {$order}\n            LIMIT {$pagination->offset},{$pagination->limit}";
     $result = $this->db->run($sql, array('type' => $type, 'lang' => $lang));
     return $result;
 }
Пример #9
0
 /**
  * /
  * @param  integer $page     [description]
  * @param  integer $per_page [description]
  * @param  string  $key      [description]
  * @param  string  $order    [description]
  * @return [type]            [description]
  */
 public function find($page = 1, $per_page = 12, $key = 'key', $order = 'asc')
 {
     if (!is_int($page) || !is_int($per_page) || !is_string($key) || !is_string($order)) {
         throw new \Exception("Page and per_page must be integers, key and order must be strings.", 01);
     }
     $pagination = Pagination::paginate($page, $per_page);
     $sql = "SELECT id, `key`, value, format, activity, modified, created \n            FROM config \n            ORDER BY {$key} {$order} \n            LIMIT {$pagination->offset},{$pagination->limit}";
     $result = $this->db->run($sql, array());
     return $result;
 }
Пример #10
0
 /**
  * /
  * @param  integer $page     [description]
  * @param  integer $per_page [description]
  * @param  string  $key      [description]
  * @param  string  $order    [description]
  * @return [type]            [description]
  */
 public function find($page = 1, $per_page = 12, $key = 'username', $order = 'asc')
 {
     if (!is_int($page) || !is_int($per_page) || !is_string($key) || !is_string($order)) {
         throw new \Exception("Page and per_page must be integers, key and order must be strings.", 02);
     }
     $pagination = Pagination::paginate($page, $per_page);
     $sql = "SELECT id, username, email, password, activity, created\n            FROM users ORDER BY {$key} {$order} LIMIT {$pagination->offset},{$pagination->limit}";
     $result = $this->db->run($sql);
     return $result;
 }
Пример #11
0
 /**
  * /
  * @param  integer $page     [description]
  * @param  integer $per_page [description]
  * @param  string  $key      [description]
  * @param  string  $order    [description]
  * @param  string  $lang     [description]
  * @return [type]            [description]
  */
 public function find($page = 1, $per_page = 12, $key = 'title', $order = 'asc', $lang = 'pt-br')
 {
     $pagination = Pagination::paginate($page, $per_page);
     $sql = "SELECT t1.id, t1.area_id, t2.title, t2.description \n        FROM blocks \n            JOIN translations t2\n                ON t1.id=t2.item_id\n                AND t2.item_name=:item_name\n            WHERE t2.language=:lang\n            AND t1.activity > 0\n            ORDER BY {$key} {$order} \n            LIMIT {$pagination->offset},{$pagination->limit}";
     $result = $this->db->run($sql, array('item_name' => 'block', 'lang' => $lang));
     return $result;
 }