@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | interface Constants |
30 | 30 | { |
31 | - // Constants for tables |
|
31 | + // Constants for tables |
|
32 | 32 | public const TABLE_SETTINGS = 0; |
33 | 33 | public const TABLE_REPOSITORIES = 1; |
34 | 34 | public const TABLE_DIRECTORIES = 2; |
@@ -39,17 +39,17 @@ discard block |
||
39 | 39 | public const DIRECTORY_TYPE_USER = 1; |
40 | 40 | public const DIRECTORY_TYPE_ORG = 2; |
41 | 41 | |
42 | - // Constants for status |
|
43 | - public const STATUS_NONE = 0; |
|
42 | + // Constants for status |
|
43 | + public const STATUS_NONE = 0; |
|
44 | 44 | public const STATUS_NEW = 1; |
45 | 45 | public const STATUS_UPDATED = 2; |
46 | - public const STATUS_UPTODATE = 3; |
|
46 | + public const STATUS_UPTODATE = 3; |
|
47 | 47 | |
48 | - // Constants for permissions |
|
49 | - public const PERM_GLOBAL_NONE = 0; |
|
50 | - public const PERM_GLOBAL_VIEW = 1; |
|
51 | - public const PERM_GLOBAL_READ = 2; |
|
52 | - public const PERM_README_UPDATE = 3; |
|
48 | + // Constants for permissions |
|
49 | + public const PERM_GLOBAL_NONE = 0; |
|
50 | + public const PERM_GLOBAL_VIEW = 1; |
|
51 | + public const PERM_GLOBAL_READ = 2; |
|
52 | + public const PERM_README_UPDATE = 3; |
|
53 | 53 | |
54 | 54 | // Constants for log type |
55 | 55 | public const LOG_TYPE_NONE = 0; |
@@ -52,7 +52,7 @@ |
||
52 | 52 | public const PERM_README_UPDATE = 3; |
53 | 53 | |
54 | 54 | // Constants for log type |
55 | - public const LOG_TYPE_NONE = 0; |
|
55 | + public const LOG_TYPE_NONE = 0; |
|
56 | 56 | public const LOG_TYPE_UPDATE_START = 1; |
57 | 57 | public const LOG_TYPE_UPDATE_END = 2; |
58 | 58 | public const LOG_TYPE_REQUEST = 3; |
@@ -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 |
@@ -142,7 +142,7 @@ |
||
142 | 142 | $logsObj->setVar('log_type', $type); |
143 | 143 | $logsObj->setVar('log_details', $detail); |
144 | 144 | $logsObj->setVar('log_result', $result); |
145 | - $logsObj->setVar('log_datecreated',time()); |
|
145 | + $logsObj->setVar('log_datecreated', time()); |
|
146 | 146 | $logsObj->setVar('log_submitter', $submitter); |
147 | 147 | // Insert Data |
148 | 148 | if ($logsHandler->insert($logsObj)) { |