@@ -31,96 +31,96 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | class LogsHandler extends \XoopsPersistableObjectHandler |
| 33 | 33 | { |
| 34 | - /** |
|
| 35 | - * Constructor |
|
| 36 | - * |
|
| 37 | - * @param \XoopsDatabase $db |
|
| 38 | - */ |
|
| 39 | - public function __construct(\XoopsDatabase $db) |
|
| 40 | - { |
|
| 41 | - parent::__construct($db, 'wggithub_logs', Logs::class, 'log_id', 'log_detail'); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @param bool $isNew |
|
| 46 | - * |
|
| 47 | - * @return object |
|
| 48 | - */ |
|
| 49 | - public function create($isNew = true) |
|
| 50 | - { |
|
| 51 | - return parent::create($isNew); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * retrieve a field |
|
| 56 | - * |
|
| 57 | - * @param int $i field id |
|
| 58 | - * @param null fields |
|
| 59 | - * @return mixed reference to the {@link Get} object |
|
| 60 | - */ |
|
| 61 | - public function get($i = null, $fields = null) |
|
| 62 | - { |
|
| 63 | - return parent::get($i, $fields); |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * get inserted id |
|
| 68 | - * |
|
| 69 | - * @param null |
|
| 70 | - * @return int reference to the {@link Get} object |
|
| 71 | - */ |
|
| 72 | - public function getInsertId() |
|
| 73 | - { |
|
| 74 | - return $this->db->getInsertId(); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Get Count Logs in the database |
|
| 79 | - * @param int $start |
|
| 80 | - * @param int $limit |
|
| 81 | - * @param string $sort |
|
| 82 | - * @param string $order |
|
| 83 | - * @return int |
|
| 84 | - */ |
|
| 85 | - public function getCountLogs($start = 0, $limit = 0, $sort = 'log_id', $order = 'ASC') |
|
| 86 | - { |
|
| 87 | - $crCountLogs = new \CriteriaCompo(); |
|
| 88 | - $crCountLogs = $this->getLogsCriteria($crCountLogs, $start, $limit, $sort, $order); |
|
| 89 | - return $this->getCount($crCountLogs); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * Get All Logs in the database |
|
| 94 | - * @param int $start |
|
| 95 | - * @param int $limit |
|
| 96 | - * @param string $sort |
|
| 97 | - * @param string $order |
|
| 98 | - * @return array |
|
| 99 | - */ |
|
| 100 | - public function getAllLogs($start = 0, $limit = 0, $sort = 'log_id', $order = 'ASC') |
|
| 101 | - { |
|
| 102 | - $crAllLogs = new \CriteriaCompo(); |
|
| 103 | - $crAllLogs = $this->getLogsCriteria($crAllLogs, $start, $limit, $sort, $order); |
|
| 104 | - return $this->getAll($crAllLogs); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Get Criteria Logs |
|
| 109 | - * @param $crLogs |
|
| 110 | - * @param int $start |
|
| 111 | - * @param int $limit |
|
| 112 | - * @param string $sort |
|
| 113 | - * @param string $order |
|
| 114 | - * @return int |
|
| 115 | - */ |
|
| 116 | - private function getLogsCriteria($crLogs, $start, $limit, $sort, $order) |
|
| 117 | - { |
|
| 118 | - $crLogs->setStart($start); |
|
| 119 | - $crLogs->setLimit($limit); |
|
| 120 | - $crLogs->setSort($sort); |
|
| 121 | - $crLogs->setOrder($order); |
|
| 122 | - return $crLogs; |
|
| 123 | - } |
|
| 34 | + /** |
|
| 35 | + * Constructor |
|
| 36 | + * |
|
| 37 | + * @param \XoopsDatabase $db |
|
| 38 | + */ |
|
| 39 | + public function __construct(\XoopsDatabase $db) |
|
| 40 | + { |
|
| 41 | + parent::__construct($db, 'wggithub_logs', Logs::class, 'log_id', 'log_detail'); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @param bool $isNew |
|
| 46 | + * |
|
| 47 | + * @return object |
|
| 48 | + */ |
|
| 49 | + public function create($isNew = true) |
|
| 50 | + { |
|
| 51 | + return parent::create($isNew); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * retrieve a field |
|
| 56 | + * |
|
| 57 | + * @param int $i field id |
|
| 58 | + * @param null fields |
|
| 59 | + * @return mixed reference to the {@link Get} object |
|
| 60 | + */ |
|
| 61 | + public function get($i = null, $fields = null) |
|
| 62 | + { |
|
| 63 | + return parent::get($i, $fields); |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * get inserted id |
|
| 68 | + * |
|
| 69 | + * @param null |
|
| 70 | + * @return int reference to the {@link Get} object |
|
| 71 | + */ |
|
| 72 | + public function getInsertId() |
|
| 73 | + { |
|
| 74 | + return $this->db->getInsertId(); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Get Count Logs in the database |
|
| 79 | + * @param int $start |
|
| 80 | + * @param int $limit |
|
| 81 | + * @param string $sort |
|
| 82 | + * @param string $order |
|
| 83 | + * @return int |
|
| 84 | + */ |
|
| 85 | + public function getCountLogs($start = 0, $limit = 0, $sort = 'log_id', $order = 'ASC') |
|
| 86 | + { |
|
| 87 | + $crCountLogs = new \CriteriaCompo(); |
|
| 88 | + $crCountLogs = $this->getLogsCriteria($crCountLogs, $start, $limit, $sort, $order); |
|
| 89 | + return $this->getCount($crCountLogs); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * Get All Logs in the database |
|
| 94 | + * @param int $start |
|
| 95 | + * @param int $limit |
|
| 96 | + * @param string $sort |
|
| 97 | + * @param string $order |
|
| 98 | + * @return array |
|
| 99 | + */ |
|
| 100 | + public function getAllLogs($start = 0, $limit = 0, $sort = 'log_id', $order = 'ASC') |
|
| 101 | + { |
|
| 102 | + $crAllLogs = new \CriteriaCompo(); |
|
| 103 | + $crAllLogs = $this->getLogsCriteria($crAllLogs, $start, $limit, $sort, $order); |
|
| 104 | + return $this->getAll($crAllLogs); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Get Criteria Logs |
|
| 109 | + * @param $crLogs |
|
| 110 | + * @param int $start |
|
| 111 | + * @param int $limit |
|
| 112 | + * @param string $sort |
|
| 113 | + * @param string $order |
|
| 114 | + * @return int |
|
| 115 | + */ |
|
| 116 | + private function getLogsCriteria($crLogs, $start, $limit, $sort, $order) |
|
| 117 | + { |
|
| 118 | + $crLogs->setStart($start); |
|
| 119 | + $crLogs->setLimit($limit); |
|
| 120 | + $crLogs->setSort($sort); |
|
| 121 | + $crLogs->setOrder($order); |
|
| 122 | + return $crLogs; |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | 126 | * Update table requests |