@@ -3,308 +3,308 @@ discard block |
||
3 | 3 | date_default_timezone_set('Asia/Jakarta'); |
4 | 4 | class Tickets |
5 | 5 | { |
6 | - private $db; |
|
7 | - |
|
8 | - public function __construct($database) |
|
9 | - { |
|
10 | - $this->db = $database; |
|
11 | - } |
|
12 | - |
|
13 | - public function ticket_exists($projectid) |
|
14 | - { |
|
15 | - $query = $this->db->prepare('SELECT COUNT(`id`) FROM `tickets` WHERE `ticketnumber`= ?'); |
|
16 | - $query->bindValue(1, $projectid); |
|
17 | - |
|
18 | - try { |
|
19 | - $query->execute(); |
|
20 | - $rows = $query->fetchColumn(); |
|
21 | - if ($rows == 1) { |
|
22 | - return true; |
|
23 | - } else { |
|
24 | - return false; |
|
25 | - } |
|
26 | - } catch (PDOException $e) { |
|
27 | - die($e->getMessage()); |
|
28 | - } |
|
29 | - } |
|
30 | - |
|
31 | - public function add_ticket($ticketnumber, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $documentedby, $pro) |
|
32 | - { |
|
33 | - $current = time(); |
|
34 | - $querystring = 'INSERT INTO `tickets` (`ticketnumber`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`documentedby`,`documenteddate`,`pro`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; |
|
35 | - $query = $this->db->prepare($querystring); |
|
36 | - $query->bindValue(1, $ticketnumber); |
|
37 | - $query->bindValue(2, $sla); |
|
38 | - //$query->bindValue(3, $idcustomer); |
|
39 | - $query->bindValue(3, $reporteddate); |
|
40 | - $query->bindValue(4, $reportedby); |
|
41 | - $query->bindValue(5, $telp); |
|
42 | - $query->bindValue(6, $email); |
|
43 | - $query->bindValue(7, $problemsummary); |
|
44 | - $query->bindValue(8, $problemdetail); |
|
45 | - $query->bindValue(9, $ticketstatus); |
|
46 | - $query->bindValue(10, $assignee); |
|
47 | - $query->bindValue(11, $documentedby); |
|
48 | - $query->bindValue(12, $current); |
|
49 | - $query->bindValue(13, $pro); |
|
50 | - |
|
51 | - try { |
|
52 | - $query->execute(); |
|
53 | - } catch (PDOException $e) { |
|
54 | - die($e->getMessage()); |
|
55 | - } |
|
56 | - } |
|
57 | - |
|
58 | - public function update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate) |
|
59 | - { |
|
60 | - $querystring = 'UPDATE `tickets` SET `sla` = ? , `reporteddate` = ? , `reportedby` = ? , `telp` = ? ,`email` = ? , `problemsummary` = ? , `problemdetail` = ? ,`ticketstatus` = ?, `assignee` = ? , `assigneddate` = ?, `pendingby` = ?,`pendingdate` = ?, `resolution` = ? ,`resolvedby` = ?,`resolveddate` = ?,`closedby` = ?,`closeddate` = ? WHERE `id` = ?'; |
|
61 | - $query = $this->db->prepare($querystring); |
|
62 | - $query->bindValue(1, $sla); |
|
63 | - $query->bindValue(2, $reporteddate); |
|
64 | - $query->bindValue(3, $reportedby); |
|
65 | - $query->bindValue(4, $telp); |
|
66 | - $query->bindValue(5, $email); |
|
67 | - $query->bindValue(6, $problemsummary); |
|
68 | - $query->bindValue(7, $problemdetail); |
|
69 | - $query->bindValue(8, $ticketstatus); |
|
70 | - $query->bindValue(9, $assignee); |
|
71 | - $query->bindValue(10, $assigneddate); |
|
72 | - $query->bindValue(11, $pendingby); |
|
73 | - $query->bindValue(12, $pendingdate); |
|
74 | - $query->bindValue(13, $resolution); |
|
75 | - $query->bindValue(14, $resolvedby); |
|
76 | - $query->bindValue(15, $resolveddate); |
|
77 | - $query->bindValue(16, $closedby); |
|
78 | - $query->bindValue(17, $closeddate); |
|
79 | - $query->bindValue(18, $id); |
|
80 | - |
|
81 | - try { |
|
82 | - $query->execute(); |
|
83 | - } catch (PDOException $e) { |
|
84 | - die($e->getMessage()); |
|
85 | - } |
|
86 | - } |
|
87 | - |
|
88 | - public function delete($id) |
|
89 | - { |
|
90 | - $sql = 'DELETE FROM `tickets` WHERE `id` = ?'; |
|
91 | - $query = $this->db->prepare($sql); |
|
92 | - $query->bindValue(1, $id); |
|
93 | - |
|
94 | - try { |
|
95 | - $query->execute(); |
|
96 | - } catch (PDOException $e) { |
|
97 | - die($e->getMessage()); |
|
98 | - } |
|
99 | - } |
|
100 | - |
|
101 | - public function ticket_data($id) |
|
102 | - { |
|
103 | - $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `id`= ?'); |
|
104 | - $query->bindValue(1, $id); |
|
105 | - |
|
106 | - try { |
|
107 | - $query->execute(); |
|
108 | - |
|
109 | - return $query->fetch(); |
|
110 | - } catch (PDOException $e) { |
|
111 | - die($e->getMessage()); |
|
112 | - } |
|
113 | - } |
|
114 | - |
|
115 | - public function get_tickets() |
|
116 | - { |
|
117 | - $query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY `ticketnumber` DESC'); |
|
118 | - |
|
119 | - try { |
|
120 | - $query->execute(); |
|
121 | - } catch (PDOException $e) { |
|
122 | - die($e->getMessage()); |
|
123 | - } |
|
124 | - |
|
125 | - return $query->fetchAll(); |
|
126 | - } |
|
127 | - |
|
128 | - public function get_pro() |
|
129 | - { |
|
130 | - $query = $this->db->prepare('SELECT pro FROM `tickets`'); |
|
131 | - |
|
132 | - try { |
|
133 | - $query->execute(); |
|
134 | - } catch (PDOException $e) { |
|
135 | - die($e->getMessage()); |
|
136 | - } |
|
137 | - |
|
138 | - return $query->fetchAll(); |
|
139 | - } |
|
140 | - |
|
141 | - public function get_opened_tickets() |
|
142 | - { |
|
143 | - $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `ticketstatus` <> 'Closed' ORDER BY `ticketnumber` DESC"); |
|
144 | - |
|
145 | - try { |
|
146 | - $query->execute(); |
|
147 | - } catch (PDOException $e) { |
|
148 | - die($e->getMessage()); |
|
149 | - } |
|
150 | - |
|
151 | - return $query->fetchAll(); |
|
152 | - } |
|
153 | - |
|
154 | - public function get_tickets_by_requester($userid) |
|
155 | - { |
|
156 | - $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `documentedby`= ? ORDER BY `ticketnumber` DESC'); |
|
157 | - $query->bindValue(1, $userid); |
|
158 | - |
|
159 | - try { |
|
160 | - $query->execute(); |
|
161 | - } catch (PDOException $e) { |
|
162 | - die($e->getMessage()); |
|
163 | - } |
|
164 | - |
|
165 | - return $query->fetchAll(); |
|
166 | - } |
|
167 | - |
|
168 | - public function get_tickets_by_assignee($userid) |
|
169 | - { |
|
170 | - $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `assignee`= ? ORDER BY `ticketnumber` DESC'); |
|
171 | - $query->bindValue(1, $userid); |
|
172 | - |
|
173 | - try { |
|
174 | - $query->execute(); |
|
175 | - } catch (PDOException $e) { |
|
176 | - die($e->getMessage()); |
|
177 | - } |
|
178 | - |
|
179 | - return $query->fetchAll(); |
|
180 | - } |
|
181 | - |
|
182 | - public function get_tickets_by_resolver($username) |
|
183 | - { |
|
184 | - $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`= ? ORDER BY `ticketnumber` DESC'); |
|
185 | - $query->bindValue(1, $username); |
|
186 | - |
|
187 | - try { |
|
188 | - $query->execute(); |
|
189 | - } catch (PDOException $e) { |
|
190 | - die($e->getMessage()); |
|
191 | - } |
|
192 | - |
|
193 | - return $query->fetchAll(); |
|
194 | - } |
|
195 | - |
|
196 | - public function get_tickets_by_resolver_not_closed($username) |
|
197 | - { |
|
198 | - $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`=? and `ticketstatus` <> ? ORDER BY `ticketnumber` DESC'); |
|
199 | - $query->bindValue(1, $username); |
|
200 | - $query->bindValue(2, 'Closed'); |
|
201 | - |
|
202 | - try { |
|
203 | - $query->execute(); |
|
204 | - } catch (PDOException $e) { |
|
205 | - die($e->getMessage()); |
|
206 | - } |
|
207 | - |
|
208 | - return $query->fetchAll(); |
|
209 | - } |
|
210 | - |
|
211 | - public function get_tickets_by_status($ticketstatus) |
|
212 | - { |
|
213 | - $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `ticketstatus`=? ORDER BY `ticketnumber` DESC'); |
|
214 | - $query->bindValue(1, $ticketstatus); |
|
215 | - |
|
216 | - try { |
|
217 | - $query->execute(); |
|
218 | - } catch (PDOException $e) { |
|
219 | - die($e->getMessage()); |
|
220 | - } |
|
221 | - |
|
222 | - return $query->fetchAll(); |
|
223 | - } |
|
224 | - |
|
225 | - public function search_closed_ticket($fromperiod, $toperiod) |
|
226 | - { |
|
227 | - $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `documenteddate` >= ? AND `documenteddate` <= ? AND `ticketstatus` = 'Closed' ORDER BY `documenteddate` DESC"); |
|
228 | - $query->bindValue(1, $fromperiod); |
|
229 | - $query->bindValue(2, $toperiod); |
|
230 | - |
|
231 | - try { |
|
232 | - $query->execute(); |
|
233 | - } catch (PDOException $e) { |
|
234 | - die($e->getMessage()); |
|
235 | - } |
|
236 | - |
|
237 | - return $query->fetchAll(); |
|
238 | - } |
|
239 | - |
|
240 | - public function count_tickets_by_customer() |
|
241 | - { |
|
242 | - $query = $this->db->prepare('SELECT `idcustomer`, count(*) as `total` FROM `tickets` GROUP BY `idcustomer` ORDER BY total DESC LIMIT 5'); |
|
243 | - |
|
244 | - try { |
|
245 | - $query->execute(); |
|
246 | - } catch (PDOException $e) { |
|
247 | - die($e->getMessage()); |
|
248 | - } |
|
249 | - |
|
250 | - return $query->fetchAll(); |
|
251 | - } |
|
252 | - |
|
253 | - public function count_tickets_by_status() |
|
254 | - { |
|
255 | - $query = $this->db->prepare('SELECT ticketstatus, count(*) as total FROM `tickets` GROUP BY ticketstatus'); |
|
256 | - |
|
257 | - try { |
|
258 | - $query->execute(); |
|
259 | - } catch (PDOException $e) { |
|
260 | - die($e->getMessage()); |
|
261 | - } |
|
262 | - |
|
263 | - return $query->fetchAll(); |
|
264 | - } |
|
265 | - |
|
266 | - public function count_resolved_tickets_by_month() |
|
267 | - { |
|
268 | - $sql = "SELECT Month(FROM_UNIXTIME(`documenteddate`)) as Bulan, Count(*) as Total FROM `tickets` WHERE (`ticketstatus`='Resolved' OR `ticketstatus`='Closed') AND FROM_UNIXTIME(`documenteddate`) >= CURDATE() - INTERVAL 1 YEAR GROUP BY Month(FROM_UNIXTIME(`documenteddate`))"; |
|
269 | - $query = $this->db->prepare($sql); |
|
270 | - |
|
271 | - try { |
|
272 | - $query->execute(); |
|
273 | - } catch (PDOException $e) { |
|
274 | - die($e->getMessage()); |
|
275 | - } |
|
276 | - |
|
277 | - return $query->fetchAll(); |
|
278 | - } |
|
279 | - |
|
280 | - public function count_inprogress_tickets_by_month() |
|
281 | - { |
|
282 | - $sql = "SELECT Month(FROM_UNIXTIME(`documenteddate`)) as Bulan, Count(*) as Total FROM `tickets` WHERE (`ticketstatus`='Assigned' OR `ticketstatus`='Pending') AND FROM_UNIXTIME(`documenteddate`) >= CURDATE() - INTERVAL 1 YEAR GROUP BY Month(FROM_UNIXTIME(`documenteddate`))"; |
|
283 | - $query = $this->db->prepare($sql); |
|
284 | - |
|
285 | - try { |
|
286 | - $query->execute(); |
|
287 | - } catch (PDOException $e) { |
|
288 | - die($e->getMessage()); |
|
289 | - } |
|
290 | - |
|
291 | - return $query->fetchAll(); |
|
292 | - } |
|
293 | - |
|
294 | - public function get_last_ticket() |
|
295 | - { |
|
296 | - $query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY id DESC LIMIT 1'); |
|
297 | - |
|
298 | - try { |
|
299 | - $query->execute(); |
|
300 | - |
|
301 | - return $query->fetch(); |
|
302 | - } catch (PDOException $e) { |
|
303 | - die($e->getMessage()); |
|
304 | - } |
|
305 | - } |
|
306 | - |
|
307 | - /* |
|
6 | + private $db; |
|
7 | + |
|
8 | + public function __construct($database) |
|
9 | + { |
|
10 | + $this->db = $database; |
|
11 | + } |
|
12 | + |
|
13 | + public function ticket_exists($projectid) |
|
14 | + { |
|
15 | + $query = $this->db->prepare('SELECT COUNT(`id`) FROM `tickets` WHERE `ticketnumber`= ?'); |
|
16 | + $query->bindValue(1, $projectid); |
|
17 | + |
|
18 | + try { |
|
19 | + $query->execute(); |
|
20 | + $rows = $query->fetchColumn(); |
|
21 | + if ($rows == 1) { |
|
22 | + return true; |
|
23 | + } else { |
|
24 | + return false; |
|
25 | + } |
|
26 | + } catch (PDOException $e) { |
|
27 | + die($e->getMessage()); |
|
28 | + } |
|
29 | + } |
|
30 | + |
|
31 | + public function add_ticket($ticketnumber, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $documentedby, $pro) |
|
32 | + { |
|
33 | + $current = time(); |
|
34 | + $querystring = 'INSERT INTO `tickets` (`ticketnumber`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`documentedby`,`documenteddate`,`pro`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; |
|
35 | + $query = $this->db->prepare($querystring); |
|
36 | + $query->bindValue(1, $ticketnumber); |
|
37 | + $query->bindValue(2, $sla); |
|
38 | + //$query->bindValue(3, $idcustomer); |
|
39 | + $query->bindValue(3, $reporteddate); |
|
40 | + $query->bindValue(4, $reportedby); |
|
41 | + $query->bindValue(5, $telp); |
|
42 | + $query->bindValue(6, $email); |
|
43 | + $query->bindValue(7, $problemsummary); |
|
44 | + $query->bindValue(8, $problemdetail); |
|
45 | + $query->bindValue(9, $ticketstatus); |
|
46 | + $query->bindValue(10, $assignee); |
|
47 | + $query->bindValue(11, $documentedby); |
|
48 | + $query->bindValue(12, $current); |
|
49 | + $query->bindValue(13, $pro); |
|
50 | + |
|
51 | + try { |
|
52 | + $query->execute(); |
|
53 | + } catch (PDOException $e) { |
|
54 | + die($e->getMessage()); |
|
55 | + } |
|
56 | + } |
|
57 | + |
|
58 | + public function update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate) |
|
59 | + { |
|
60 | + $querystring = 'UPDATE `tickets` SET `sla` = ? , `reporteddate` = ? , `reportedby` = ? , `telp` = ? ,`email` = ? , `problemsummary` = ? , `problemdetail` = ? ,`ticketstatus` = ?, `assignee` = ? , `assigneddate` = ?, `pendingby` = ?,`pendingdate` = ?, `resolution` = ? ,`resolvedby` = ?,`resolveddate` = ?,`closedby` = ?,`closeddate` = ? WHERE `id` = ?'; |
|
61 | + $query = $this->db->prepare($querystring); |
|
62 | + $query->bindValue(1, $sla); |
|
63 | + $query->bindValue(2, $reporteddate); |
|
64 | + $query->bindValue(3, $reportedby); |
|
65 | + $query->bindValue(4, $telp); |
|
66 | + $query->bindValue(5, $email); |
|
67 | + $query->bindValue(6, $problemsummary); |
|
68 | + $query->bindValue(7, $problemdetail); |
|
69 | + $query->bindValue(8, $ticketstatus); |
|
70 | + $query->bindValue(9, $assignee); |
|
71 | + $query->bindValue(10, $assigneddate); |
|
72 | + $query->bindValue(11, $pendingby); |
|
73 | + $query->bindValue(12, $pendingdate); |
|
74 | + $query->bindValue(13, $resolution); |
|
75 | + $query->bindValue(14, $resolvedby); |
|
76 | + $query->bindValue(15, $resolveddate); |
|
77 | + $query->bindValue(16, $closedby); |
|
78 | + $query->bindValue(17, $closeddate); |
|
79 | + $query->bindValue(18, $id); |
|
80 | + |
|
81 | + try { |
|
82 | + $query->execute(); |
|
83 | + } catch (PDOException $e) { |
|
84 | + die($e->getMessage()); |
|
85 | + } |
|
86 | + } |
|
87 | + |
|
88 | + public function delete($id) |
|
89 | + { |
|
90 | + $sql = 'DELETE FROM `tickets` WHERE `id` = ?'; |
|
91 | + $query = $this->db->prepare($sql); |
|
92 | + $query->bindValue(1, $id); |
|
93 | + |
|
94 | + try { |
|
95 | + $query->execute(); |
|
96 | + } catch (PDOException $e) { |
|
97 | + die($e->getMessage()); |
|
98 | + } |
|
99 | + } |
|
100 | + |
|
101 | + public function ticket_data($id) |
|
102 | + { |
|
103 | + $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `id`= ?'); |
|
104 | + $query->bindValue(1, $id); |
|
105 | + |
|
106 | + try { |
|
107 | + $query->execute(); |
|
108 | + |
|
109 | + return $query->fetch(); |
|
110 | + } catch (PDOException $e) { |
|
111 | + die($e->getMessage()); |
|
112 | + } |
|
113 | + } |
|
114 | + |
|
115 | + public function get_tickets() |
|
116 | + { |
|
117 | + $query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY `ticketnumber` DESC'); |
|
118 | + |
|
119 | + try { |
|
120 | + $query->execute(); |
|
121 | + } catch (PDOException $e) { |
|
122 | + die($e->getMessage()); |
|
123 | + } |
|
124 | + |
|
125 | + return $query->fetchAll(); |
|
126 | + } |
|
127 | + |
|
128 | + public function get_pro() |
|
129 | + { |
|
130 | + $query = $this->db->prepare('SELECT pro FROM `tickets`'); |
|
131 | + |
|
132 | + try { |
|
133 | + $query->execute(); |
|
134 | + } catch (PDOException $e) { |
|
135 | + die($e->getMessage()); |
|
136 | + } |
|
137 | + |
|
138 | + return $query->fetchAll(); |
|
139 | + } |
|
140 | + |
|
141 | + public function get_opened_tickets() |
|
142 | + { |
|
143 | + $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `ticketstatus` <> 'Closed' ORDER BY `ticketnumber` DESC"); |
|
144 | + |
|
145 | + try { |
|
146 | + $query->execute(); |
|
147 | + } catch (PDOException $e) { |
|
148 | + die($e->getMessage()); |
|
149 | + } |
|
150 | + |
|
151 | + return $query->fetchAll(); |
|
152 | + } |
|
153 | + |
|
154 | + public function get_tickets_by_requester($userid) |
|
155 | + { |
|
156 | + $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `documentedby`= ? ORDER BY `ticketnumber` DESC'); |
|
157 | + $query->bindValue(1, $userid); |
|
158 | + |
|
159 | + try { |
|
160 | + $query->execute(); |
|
161 | + } catch (PDOException $e) { |
|
162 | + die($e->getMessage()); |
|
163 | + } |
|
164 | + |
|
165 | + return $query->fetchAll(); |
|
166 | + } |
|
167 | + |
|
168 | + public function get_tickets_by_assignee($userid) |
|
169 | + { |
|
170 | + $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `assignee`= ? ORDER BY `ticketnumber` DESC'); |
|
171 | + $query->bindValue(1, $userid); |
|
172 | + |
|
173 | + try { |
|
174 | + $query->execute(); |
|
175 | + } catch (PDOException $e) { |
|
176 | + die($e->getMessage()); |
|
177 | + } |
|
178 | + |
|
179 | + return $query->fetchAll(); |
|
180 | + } |
|
181 | + |
|
182 | + public function get_tickets_by_resolver($username) |
|
183 | + { |
|
184 | + $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`= ? ORDER BY `ticketnumber` DESC'); |
|
185 | + $query->bindValue(1, $username); |
|
186 | + |
|
187 | + try { |
|
188 | + $query->execute(); |
|
189 | + } catch (PDOException $e) { |
|
190 | + die($e->getMessage()); |
|
191 | + } |
|
192 | + |
|
193 | + return $query->fetchAll(); |
|
194 | + } |
|
195 | + |
|
196 | + public function get_tickets_by_resolver_not_closed($username) |
|
197 | + { |
|
198 | + $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`=? and `ticketstatus` <> ? ORDER BY `ticketnumber` DESC'); |
|
199 | + $query->bindValue(1, $username); |
|
200 | + $query->bindValue(2, 'Closed'); |
|
201 | + |
|
202 | + try { |
|
203 | + $query->execute(); |
|
204 | + } catch (PDOException $e) { |
|
205 | + die($e->getMessage()); |
|
206 | + } |
|
207 | + |
|
208 | + return $query->fetchAll(); |
|
209 | + } |
|
210 | + |
|
211 | + public function get_tickets_by_status($ticketstatus) |
|
212 | + { |
|
213 | + $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `ticketstatus`=? ORDER BY `ticketnumber` DESC'); |
|
214 | + $query->bindValue(1, $ticketstatus); |
|
215 | + |
|
216 | + try { |
|
217 | + $query->execute(); |
|
218 | + } catch (PDOException $e) { |
|
219 | + die($e->getMessage()); |
|
220 | + } |
|
221 | + |
|
222 | + return $query->fetchAll(); |
|
223 | + } |
|
224 | + |
|
225 | + public function search_closed_ticket($fromperiod, $toperiod) |
|
226 | + { |
|
227 | + $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `documenteddate` >= ? AND `documenteddate` <= ? AND `ticketstatus` = 'Closed' ORDER BY `documenteddate` DESC"); |
|
228 | + $query->bindValue(1, $fromperiod); |
|
229 | + $query->bindValue(2, $toperiod); |
|
230 | + |
|
231 | + try { |
|
232 | + $query->execute(); |
|
233 | + } catch (PDOException $e) { |
|
234 | + die($e->getMessage()); |
|
235 | + } |
|
236 | + |
|
237 | + return $query->fetchAll(); |
|
238 | + } |
|
239 | + |
|
240 | + public function count_tickets_by_customer() |
|
241 | + { |
|
242 | + $query = $this->db->prepare('SELECT `idcustomer`, count(*) as `total` FROM `tickets` GROUP BY `idcustomer` ORDER BY total DESC LIMIT 5'); |
|
243 | + |
|
244 | + try { |
|
245 | + $query->execute(); |
|
246 | + } catch (PDOException $e) { |
|
247 | + die($e->getMessage()); |
|
248 | + } |
|
249 | + |
|
250 | + return $query->fetchAll(); |
|
251 | + } |
|
252 | + |
|
253 | + public function count_tickets_by_status() |
|
254 | + { |
|
255 | + $query = $this->db->prepare('SELECT ticketstatus, count(*) as total FROM `tickets` GROUP BY ticketstatus'); |
|
256 | + |
|
257 | + try { |
|
258 | + $query->execute(); |
|
259 | + } catch (PDOException $e) { |
|
260 | + die($e->getMessage()); |
|
261 | + } |
|
262 | + |
|
263 | + return $query->fetchAll(); |
|
264 | + } |
|
265 | + |
|
266 | + public function count_resolved_tickets_by_month() |
|
267 | + { |
|
268 | + $sql = "SELECT Month(FROM_UNIXTIME(`documenteddate`)) as Bulan, Count(*) as Total FROM `tickets` WHERE (`ticketstatus`='Resolved' OR `ticketstatus`='Closed') AND FROM_UNIXTIME(`documenteddate`) >= CURDATE() - INTERVAL 1 YEAR GROUP BY Month(FROM_UNIXTIME(`documenteddate`))"; |
|
269 | + $query = $this->db->prepare($sql); |
|
270 | + |
|
271 | + try { |
|
272 | + $query->execute(); |
|
273 | + } catch (PDOException $e) { |
|
274 | + die($e->getMessage()); |
|
275 | + } |
|
276 | + |
|
277 | + return $query->fetchAll(); |
|
278 | + } |
|
279 | + |
|
280 | + public function count_inprogress_tickets_by_month() |
|
281 | + { |
|
282 | + $sql = "SELECT Month(FROM_UNIXTIME(`documenteddate`)) as Bulan, Count(*) as Total FROM `tickets` WHERE (`ticketstatus`='Assigned' OR `ticketstatus`='Pending') AND FROM_UNIXTIME(`documenteddate`) >= CURDATE() - INTERVAL 1 YEAR GROUP BY Month(FROM_UNIXTIME(`documenteddate`))"; |
|
283 | + $query = $this->db->prepare($sql); |
|
284 | + |
|
285 | + try { |
|
286 | + $query->execute(); |
|
287 | + } catch (PDOException $e) { |
|
288 | + die($e->getMessage()); |
|
289 | + } |
|
290 | + |
|
291 | + return $query->fetchAll(); |
|
292 | + } |
|
293 | + |
|
294 | + public function get_last_ticket() |
|
295 | + { |
|
296 | + $query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY id DESC LIMIT 1'); |
|
297 | + |
|
298 | + try { |
|
299 | + $query->execute(); |
|
300 | + |
|
301 | + return $query->fetch(); |
|
302 | + } catch (PDOException $e) { |
|
303 | + die($e->getMessage()); |
|
304 | + } |
|
305 | + } |
|
306 | + |
|
307 | + /* |
|
308 | 308 | public function notify_assignee($id,$ticketnumber,$email_assignee) |
309 | 309 | { if (substr(php_uname(), 0, 7) == "Windows"){ |
310 | 310 | $cmd = "D:\mowes_portable\www\helpdesk\batch\sendemail.bat"; |
@@ -318,51 +318,51 @@ discard block |
||
318 | 318 | } |
319 | 319 | }*/ |
320 | 320 | |
321 | - public function log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby) |
|
322 | - { |
|
323 | - $changedate = time(); |
|
324 | - $querystring = 'INSERT INTO `log_tickets` (`id`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`assigneddate`,`pendingby`,`pendingdate`,`resolution`,`resolvedby`,`resolveddate`,`closedby`,`closeddate`,`changes`,`changeby`,`changedate`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; |
|
325 | - $query = $this->db->prepare($querystring); |
|
326 | - $query->bindValue(1, $id); |
|
327 | - $query->bindValue(2, $sla); |
|
328 | - $query->bindValue(3, $reporteddate); |
|
329 | - $query->bindValue(4, $reportedby); |
|
330 | - $query->bindValue(5, $telp); |
|
331 | - $query->bindValue(6, $email); |
|
332 | - $query->bindValue(7, $problemsummary); |
|
333 | - $query->bindValue(8, $problemdetail); |
|
334 | - $query->bindValue(9, $ticketstatus); |
|
335 | - $query->bindValue(10, $assignee); |
|
336 | - $query->bindValue(11, $assigneddate); |
|
337 | - $query->bindValue(12, $pendingby); |
|
338 | - $query->bindValue(13, $pendingdate); |
|
339 | - $query->bindValue(14, $resolution); |
|
340 | - $query->bindValue(15, $resolvedby); |
|
341 | - $query->bindValue(16, $resolveddate); |
|
342 | - $query->bindValue(17, $closedby); |
|
343 | - $query->bindValue(18, $closeddate); |
|
344 | - $query->bindValue(19, $changes); |
|
345 | - $query->bindValue(20, $changeby); |
|
346 | - $query->bindValue(21, $changedate); |
|
347 | - |
|
348 | - try { |
|
349 | - $query->execute(); |
|
350 | - } catch (PDOException $e) { |
|
351 | - die($e->getMessage()); |
|
352 | - } |
|
353 | - } |
|
354 | - |
|
355 | - public function get_audit_trail($id) |
|
356 | - { |
|
357 | - $query = $this->db->prepare('SELECT * FROM `log_tickets` WHERE `id`= ? ORDER BY `changedate` DESC'); |
|
358 | - $query->bindValue(1, $id); |
|
359 | - |
|
360 | - try { |
|
361 | - $query->execute(); |
|
362 | - } catch (PDOException $e) { |
|
363 | - die($e->getMessage()); |
|
364 | - } |
|
365 | - |
|
366 | - return $query->fetchAll(); |
|
367 | - } |
|
321 | + public function log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby) |
|
322 | + { |
|
323 | + $changedate = time(); |
|
324 | + $querystring = 'INSERT INTO `log_tickets` (`id`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`assigneddate`,`pendingby`,`pendingdate`,`resolution`,`resolvedby`,`resolveddate`,`closedby`,`closeddate`,`changes`,`changeby`,`changedate`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; |
|
325 | + $query = $this->db->prepare($querystring); |
|
326 | + $query->bindValue(1, $id); |
|
327 | + $query->bindValue(2, $sla); |
|
328 | + $query->bindValue(3, $reporteddate); |
|
329 | + $query->bindValue(4, $reportedby); |
|
330 | + $query->bindValue(5, $telp); |
|
331 | + $query->bindValue(6, $email); |
|
332 | + $query->bindValue(7, $problemsummary); |
|
333 | + $query->bindValue(8, $problemdetail); |
|
334 | + $query->bindValue(9, $ticketstatus); |
|
335 | + $query->bindValue(10, $assignee); |
|
336 | + $query->bindValue(11, $assigneddate); |
|
337 | + $query->bindValue(12, $pendingby); |
|
338 | + $query->bindValue(13, $pendingdate); |
|
339 | + $query->bindValue(14, $resolution); |
|
340 | + $query->bindValue(15, $resolvedby); |
|
341 | + $query->bindValue(16, $resolveddate); |
|
342 | + $query->bindValue(17, $closedby); |
|
343 | + $query->bindValue(18, $closeddate); |
|
344 | + $query->bindValue(19, $changes); |
|
345 | + $query->bindValue(20, $changeby); |
|
346 | + $query->bindValue(21, $changedate); |
|
347 | + |
|
348 | + try { |
|
349 | + $query->execute(); |
|
350 | + } catch (PDOException $e) { |
|
351 | + die($e->getMessage()); |
|
352 | + } |
|
353 | + } |
|
354 | + |
|
355 | + public function get_audit_trail($id) |
|
356 | + { |
|
357 | + $query = $this->db->prepare('SELECT * FROM `log_tickets` WHERE `id`= ? ORDER BY `changedate` DESC'); |
|
358 | + $query->bindValue(1, $id); |
|
359 | + |
|
360 | + try { |
|
361 | + $query->execute(); |
|
362 | + } catch (PDOException $e) { |
|
363 | + die($e->getMessage()); |
|
364 | + } |
|
365 | + |
|
366 | + return $query->fetchAll(); |
|
367 | + } |
|
368 | 368 | } |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | $rows = $query->fetchColumn(); |
21 | 21 | if ($rows == 1) { |
22 | 22 | return true; |
23 | - } else { |
|
23 | + }else { |
|
24 | 24 | return false; |
25 | 25 | } |
26 | - } catch (PDOException $e) { |
|
26 | + }catch (PDOException $e) { |
|
27 | 27 | die($e->getMessage()); |
28 | 28 | } |
29 | 29 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | try { |
52 | 52 | $query->execute(); |
53 | - } catch (PDOException $e) { |
|
53 | + }catch (PDOException $e) { |
|
54 | 54 | die($e->getMessage()); |
55 | 55 | } |
56 | 56 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | try { |
82 | 82 | $query->execute(); |
83 | - } catch (PDOException $e) { |
|
83 | + }catch (PDOException $e) { |
|
84 | 84 | die($e->getMessage()); |
85 | 85 | } |
86 | 86 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | try { |
95 | 95 | $query->execute(); |
96 | - } catch (PDOException $e) { |
|
96 | + }catch (PDOException $e) { |
|
97 | 97 | die($e->getMessage()); |
98 | 98 | } |
99 | 99 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $query->execute(); |
108 | 108 | |
109 | 109 | return $query->fetch(); |
110 | - } catch (PDOException $e) { |
|
110 | + }catch (PDOException $e) { |
|
111 | 111 | die($e->getMessage()); |
112 | 112 | } |
113 | 113 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | try { |
120 | 120 | $query->execute(); |
121 | - } catch (PDOException $e) { |
|
121 | + }catch (PDOException $e) { |
|
122 | 122 | die($e->getMessage()); |
123 | 123 | } |
124 | 124 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | try { |
133 | 133 | $query->execute(); |
134 | - } catch (PDOException $e) { |
|
134 | + }catch (PDOException $e) { |
|
135 | 135 | die($e->getMessage()); |
136 | 136 | } |
137 | 137 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | try { |
146 | 146 | $query->execute(); |
147 | - } catch (PDOException $e) { |
|
147 | + }catch (PDOException $e) { |
|
148 | 148 | die($e->getMessage()); |
149 | 149 | } |
150 | 150 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | try { |
160 | 160 | $query->execute(); |
161 | - } catch (PDOException $e) { |
|
161 | + }catch (PDOException $e) { |
|
162 | 162 | die($e->getMessage()); |
163 | 163 | } |
164 | 164 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | try { |
174 | 174 | $query->execute(); |
175 | - } catch (PDOException $e) { |
|
175 | + }catch (PDOException $e) { |
|
176 | 176 | die($e->getMessage()); |
177 | 177 | } |
178 | 178 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | try { |
188 | 188 | $query->execute(); |
189 | - } catch (PDOException $e) { |
|
189 | + }catch (PDOException $e) { |
|
190 | 190 | die($e->getMessage()); |
191 | 191 | } |
192 | 192 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | try { |
203 | 203 | $query->execute(); |
204 | - } catch (PDOException $e) { |
|
204 | + }catch (PDOException $e) { |
|
205 | 205 | die($e->getMessage()); |
206 | 206 | } |
207 | 207 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | try { |
217 | 217 | $query->execute(); |
218 | - } catch (PDOException $e) { |
|
218 | + }catch (PDOException $e) { |
|
219 | 219 | die($e->getMessage()); |
220 | 220 | } |
221 | 221 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | try { |
232 | 232 | $query->execute(); |
233 | - } catch (PDOException $e) { |
|
233 | + }catch (PDOException $e) { |
|
234 | 234 | die($e->getMessage()); |
235 | 235 | } |
236 | 236 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | try { |
245 | 245 | $query->execute(); |
246 | - } catch (PDOException $e) { |
|
246 | + }catch (PDOException $e) { |
|
247 | 247 | die($e->getMessage()); |
248 | 248 | } |
249 | 249 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | try { |
258 | 258 | $query->execute(); |
259 | - } catch (PDOException $e) { |
|
259 | + }catch (PDOException $e) { |
|
260 | 260 | die($e->getMessage()); |
261 | 261 | } |
262 | 262 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | |
271 | 271 | try { |
272 | 272 | $query->execute(); |
273 | - } catch (PDOException $e) { |
|
273 | + }catch (PDOException $e) { |
|
274 | 274 | die($e->getMessage()); |
275 | 275 | } |
276 | 276 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | try { |
286 | 286 | $query->execute(); |
287 | - } catch (PDOException $e) { |
|
287 | + }catch (PDOException $e) { |
|
288 | 288 | die($e->getMessage()); |
289 | 289 | } |
290 | 290 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | $query->execute(); |
300 | 300 | |
301 | 301 | return $query->fetch(); |
302 | - } catch (PDOException $e) { |
|
302 | + }catch (PDOException $e) { |
|
303 | 303 | die($e->getMessage()); |
304 | 304 | } |
305 | 305 | } |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | |
348 | 348 | try { |
349 | 349 | $query->execute(); |
350 | - } catch (PDOException $e) { |
|
350 | + }catch (PDOException $e) { |
|
351 | 351 | die($e->getMessage()); |
352 | 352 | } |
353 | 353 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | try { |
361 | 361 | $query->execute(); |
362 | - } catch (PDOException $e) { |
|
362 | + }catch (PDOException $e) { |
|
363 | 363 | die($e->getMessage()); |
364 | 364 | } |
365 | 365 |
@@ -2,98 +2,98 @@ |
||
2 | 2 | |
3 | 3 | class HDNews |
4 | 4 | { |
5 | - private $db; |
|
6 | - |
|
7 | - public function __construct($database) |
|
8 | - { |
|
9 | - $this->db = $database; |
|
10 | - } |
|
11 | - |
|
12 | - public function add_news($newsdate, $title, $detail, $createdby, $createdon, $expired) |
|
13 | - { |
|
14 | - $query = $this->db->prepare('INSERT INTO `news` (`newsdate`,`title`, `detail`, `createdby`, `createdon`, `expired`) VALUES (?, ?, ?, ?, ?, ?)'); |
|
15 | - $query->bindValue(1, $newsdate); |
|
16 | - $query->bindValue(2, $title); |
|
17 | - $query->bindValue(3, $detail); |
|
18 | - $query->bindValue(4, $createdby); |
|
19 | - $query->bindValue(5, $createdon); |
|
20 | - $query->bindValue(6, $expired); |
|
21 | - |
|
22 | - try { |
|
23 | - $query->execute(); |
|
24 | - } catch (PDOException $e) { |
|
25 | - die($e->getMessage()); |
|
26 | - } |
|
27 | - } |
|
28 | - |
|
29 | - public function update_news($id, $newsdate, $title, $detail, $createdby, $createdon, $expired) |
|
30 | - { |
|
31 | - $query = $this->db->prepare('UPDATE `news` SET `newsdate` = ? , `title` = ? ,`detail` = ? , `createdby` = ? , `createdon` = ? , `expired` = ? WHERE `id` = ?'); |
|
32 | - $query->bindValue(1, $newsdate); |
|
33 | - $query->bindValue(2, $title); |
|
34 | - $query->bindValue(3, $detail); |
|
35 | - $query->bindValue(4, $createdby); |
|
36 | - $query->bindValue(5, $createdon); |
|
37 | - $query->bindValue(6, $expired); |
|
38 | - $query->bindValue(7, $id); |
|
39 | - |
|
40 | - try { |
|
41 | - $query->execute(); |
|
42 | - } catch (PDOException $e) { |
|
43 | - die($e->getMessage()); |
|
44 | - } |
|
45 | - } |
|
46 | - |
|
47 | - public function delete($id) |
|
48 | - { |
|
49 | - $sql = 'DELETE FROM `news` WHERE `id` = ?'; |
|
50 | - $query = $this->db->prepare($sql); |
|
51 | - $query->bindValue(1, $id); |
|
52 | - |
|
53 | - try { |
|
54 | - $query->execute(); |
|
55 | - } catch (PDOException $e) { |
|
56 | - die($e->getMessage()); |
|
57 | - } |
|
58 | - } |
|
59 | - |
|
60 | - public function news_data($id) |
|
61 | - { |
|
62 | - $query = $this->db->prepare('SELECT * FROM `news` WHERE `id`= ?'); |
|
63 | - $query->bindValue(1, $id); |
|
64 | - |
|
65 | - try { |
|
66 | - $query->execute(); |
|
67 | - |
|
68 | - return $query->fetch(); |
|
69 | - } catch (PDOException $e) { |
|
70 | - die($e->getMessage()); |
|
71 | - } |
|
72 | - } |
|
73 | - |
|
74 | - public function get_news() |
|
75 | - { |
|
76 | - $query = $this->db->prepare('SELECT * FROM `news` ORDER BY `newsdate` ASC'); |
|
77 | - |
|
78 | - try { |
|
79 | - $query->execute(); |
|
80 | - } catch (PDOException $e) { |
|
81 | - die($e->getMessage()); |
|
82 | - } |
|
83 | - |
|
84 | - return $query->fetchAll(); |
|
85 | - } |
|
86 | - |
|
87 | - public function get_headline_news() |
|
88 | - { |
|
89 | - $query = $this->db->prepare('SELECT * FROM `news` WHERE UNIX_TIMESTAMP( curdate( ) ) < `expired` ORDER BY `newsdate` ASC'); |
|
90 | - |
|
91 | - try { |
|
92 | - $query->execute(); |
|
93 | - } catch (PDOException $e) { |
|
94 | - die($e->getMessage()); |
|
95 | - } |
|
96 | - |
|
97 | - return $query->fetchAll(); |
|
98 | - } |
|
5 | + private $db; |
|
6 | + |
|
7 | + public function __construct($database) |
|
8 | + { |
|
9 | + $this->db = $database; |
|
10 | + } |
|
11 | + |
|
12 | + public function add_news($newsdate, $title, $detail, $createdby, $createdon, $expired) |
|
13 | + { |
|
14 | + $query = $this->db->prepare('INSERT INTO `news` (`newsdate`,`title`, `detail`, `createdby`, `createdon`, `expired`) VALUES (?, ?, ?, ?, ?, ?)'); |
|
15 | + $query->bindValue(1, $newsdate); |
|
16 | + $query->bindValue(2, $title); |
|
17 | + $query->bindValue(3, $detail); |
|
18 | + $query->bindValue(4, $createdby); |
|
19 | + $query->bindValue(5, $createdon); |
|
20 | + $query->bindValue(6, $expired); |
|
21 | + |
|
22 | + try { |
|
23 | + $query->execute(); |
|
24 | + } catch (PDOException $e) { |
|
25 | + die($e->getMessage()); |
|
26 | + } |
|
27 | + } |
|
28 | + |
|
29 | + public function update_news($id, $newsdate, $title, $detail, $createdby, $createdon, $expired) |
|
30 | + { |
|
31 | + $query = $this->db->prepare('UPDATE `news` SET `newsdate` = ? , `title` = ? ,`detail` = ? , `createdby` = ? , `createdon` = ? , `expired` = ? WHERE `id` = ?'); |
|
32 | + $query->bindValue(1, $newsdate); |
|
33 | + $query->bindValue(2, $title); |
|
34 | + $query->bindValue(3, $detail); |
|
35 | + $query->bindValue(4, $createdby); |
|
36 | + $query->bindValue(5, $createdon); |
|
37 | + $query->bindValue(6, $expired); |
|
38 | + $query->bindValue(7, $id); |
|
39 | + |
|
40 | + try { |
|
41 | + $query->execute(); |
|
42 | + } catch (PDOException $e) { |
|
43 | + die($e->getMessage()); |
|
44 | + } |
|
45 | + } |
|
46 | + |
|
47 | + public function delete($id) |
|
48 | + { |
|
49 | + $sql = 'DELETE FROM `news` WHERE `id` = ?'; |
|
50 | + $query = $this->db->prepare($sql); |
|
51 | + $query->bindValue(1, $id); |
|
52 | + |
|
53 | + try { |
|
54 | + $query->execute(); |
|
55 | + } catch (PDOException $e) { |
|
56 | + die($e->getMessage()); |
|
57 | + } |
|
58 | + } |
|
59 | + |
|
60 | + public function news_data($id) |
|
61 | + { |
|
62 | + $query = $this->db->prepare('SELECT * FROM `news` WHERE `id`= ?'); |
|
63 | + $query->bindValue(1, $id); |
|
64 | + |
|
65 | + try { |
|
66 | + $query->execute(); |
|
67 | + |
|
68 | + return $query->fetch(); |
|
69 | + } catch (PDOException $e) { |
|
70 | + die($e->getMessage()); |
|
71 | + } |
|
72 | + } |
|
73 | + |
|
74 | + public function get_news() |
|
75 | + { |
|
76 | + $query = $this->db->prepare('SELECT * FROM `news` ORDER BY `newsdate` ASC'); |
|
77 | + |
|
78 | + try { |
|
79 | + $query->execute(); |
|
80 | + } catch (PDOException $e) { |
|
81 | + die($e->getMessage()); |
|
82 | + } |
|
83 | + |
|
84 | + return $query->fetchAll(); |
|
85 | + } |
|
86 | + |
|
87 | + public function get_headline_news() |
|
88 | + { |
|
89 | + $query = $this->db->prepare('SELECT * FROM `news` WHERE UNIX_TIMESTAMP( curdate( ) ) < `expired` ORDER BY `newsdate` ASC'); |
|
90 | + |
|
91 | + try { |
|
92 | + $query->execute(); |
|
93 | + } catch (PDOException $e) { |
|
94 | + die($e->getMessage()); |
|
95 | + } |
|
96 | + |
|
97 | + return $query->fetchAll(); |
|
98 | + } |
|
99 | 99 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | try { |
23 | 23 | $query->execute(); |
24 | - } catch (PDOException $e) { |
|
24 | + }catch (PDOException $e) { |
|
25 | 25 | die($e->getMessage()); |
26 | 26 | } |
27 | 27 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | try { |
41 | 41 | $query->execute(); |
42 | - } catch (PDOException $e) { |
|
42 | + }catch (PDOException $e) { |
|
43 | 43 | die($e->getMessage()); |
44 | 44 | } |
45 | 45 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | try { |
54 | 54 | $query->execute(); |
55 | - } catch (PDOException $e) { |
|
55 | + }catch (PDOException $e) { |
|
56 | 56 | die($e->getMessage()); |
57 | 57 | } |
58 | 58 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $query->execute(); |
67 | 67 | |
68 | 68 | return $query->fetch(); |
69 | - } catch (PDOException $e) { |
|
69 | + }catch (PDOException $e) { |
|
70 | 70 | die($e->getMessage()); |
71 | 71 | } |
72 | 72 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | try { |
79 | 79 | $query->execute(); |
80 | - } catch (PDOException $e) { |
|
80 | + }catch (PDOException $e) { |
|
81 | 81 | die($e->getMessage()); |
82 | 82 | } |
83 | 83 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | try { |
92 | 92 | $query->execute(); |
93 | - } catch (PDOException $e) { |
|
93 | + }catch (PDOException $e) { |
|
94 | 94 | die($e->getMessage()); |
95 | 95 | } |
96 | 96 |
@@ -3,211 +3,211 @@ |
||
3 | 3 | date_default_timezone_set('Asia/Jakarta'); |
4 | 4 | class Emails |
5 | 5 | { |
6 | - private $db; |
|
7 | - |
|
8 | - public function __construct($database) |
|
9 | - { |
|
10 | - $this->db = $database; |
|
11 | - } |
|
12 | - |
|
13 | - public function add_email($idticket, $senddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message, $emailstatus) |
|
14 | - { |
|
15 | - $querystring = 'INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'; |
|
16 | - $query = $this->db->prepare($querystring); |
|
17 | - $query->bindValue(1, $idticket); |
|
18 | - $query->bindValue(2, $senddate); |
|
19 | - $query->bindValue(3, $emailto); |
|
20 | - $query->bindValue(4, $emailcc); |
|
21 | - $query->bindValue(5, $emailbcc); |
|
22 | - $query->bindValue(6, $emailsubject); |
|
23 | - $query->bindValue(7, $message); |
|
24 | - $query->bindValue(8, $emailstatus); |
|
25 | - |
|
26 | - try { |
|
27 | - $query->execute(); |
|
28 | - } catch (PDOException $e) { |
|
29 | - die($e->getMessage()); |
|
30 | - } |
|
31 | - } |
|
32 | - |
|
33 | - public function add_sla_remainder($idticket, $ticketnumber, $slasenddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message) |
|
34 | - { |
|
35 | - $emailsubject = "Ticket No: $ticketnumber has reached 75% of SLA Resolution Goal Time"; |
|
36 | - $message = |
|
6 | + private $db; |
|
7 | + |
|
8 | + public function __construct($database) |
|
9 | + { |
|
10 | + $this->db = $database; |
|
11 | + } |
|
12 | + |
|
13 | + public function add_email($idticket, $senddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message, $emailstatus) |
|
14 | + { |
|
15 | + $querystring = 'INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'; |
|
16 | + $query = $this->db->prepare($querystring); |
|
17 | + $query->bindValue(1, $idticket); |
|
18 | + $query->bindValue(2, $senddate); |
|
19 | + $query->bindValue(3, $emailto); |
|
20 | + $query->bindValue(4, $emailcc); |
|
21 | + $query->bindValue(5, $emailbcc); |
|
22 | + $query->bindValue(6, $emailsubject); |
|
23 | + $query->bindValue(7, $message); |
|
24 | + $query->bindValue(8, $emailstatus); |
|
25 | + |
|
26 | + try { |
|
27 | + $query->execute(); |
|
28 | + } catch (PDOException $e) { |
|
29 | + die($e->getMessage()); |
|
30 | + } |
|
31 | + } |
|
32 | + |
|
33 | + public function add_sla_remainder($idticket, $ticketnumber, $slasenddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message) |
|
34 | + { |
|
35 | + $emailsubject = "Ticket No: $ticketnumber has reached 75% of SLA Resolution Goal Time"; |
|
36 | + $message = |
|
37 | 37 | "Dear Assignee, \r\n |
38 | 38 | We remaind you that your ticket No: $ticketnumber has reached 75% of SLA Resolution Goal Time.\r\n |
39 | 39 | Please give resolution for this ticket as soon as posible.\r\n |
40 | 40 | Thank you. \r\n |
41 | 41 | Regards, \r\n |
42 | 42 | Helpdesk"; |
43 | - $querystring = 'INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'; |
|
44 | - $query = $this->db->prepare($querystring); |
|
45 | - $query->bindValue(1, $idticket); |
|
46 | - $query->bindValue(2, $slasenddate); |
|
47 | - $query->bindValue(3, $emailto); |
|
48 | - $query->bindValue(4, $emailcc); |
|
49 | - $query->bindValue(5, $emailbcc); |
|
50 | - $query->bindValue(6, $emailsubject); |
|
51 | - $query->bindValue(7, $message); |
|
52 | - $query->bindValue(8, 'SLA Remainder'); |
|
53 | - |
|
54 | - try { |
|
55 | - $query->execute(); |
|
56 | - } catch (PDOException $e) { |
|
57 | - die($e->getMessage()); |
|
58 | - } |
|
59 | - } |
|
60 | - |
|
61 | - public function update_status_email($idemail, $emailstatus) |
|
62 | - { |
|
63 | - $querystring = 'UPDATE `log_emails` SET `emailstatus` = ? WHERE `idemail` = ?'; |
|
64 | - $query = $this->db->prepare($querystring); |
|
65 | - $query->bindValue(1, $emailstatus); |
|
66 | - $query->bindValue(2, $idemail); |
|
67 | - |
|
68 | - try { |
|
69 | - $query->execute(); |
|
70 | - } catch (PDOException $e) { |
|
71 | - die($e->getMessage()); |
|
72 | - } |
|
73 | - } |
|
74 | - |
|
75 | - public function delete($idemail) |
|
76 | - { |
|
77 | - $sql = 'DELETE FROM `log_emails` WHERE `idemail` = ?'; |
|
78 | - $query = $this->db->prepare($sql); |
|
79 | - $query->bindValue(1, $idemail); |
|
80 | - |
|
81 | - try { |
|
82 | - $query->execute(); |
|
83 | - } catch (PDOException $e) { |
|
84 | - die($e->getMessage()); |
|
85 | - } |
|
86 | - } |
|
87 | - |
|
88 | - public function get_email_by_idemail($idemail) |
|
89 | - { |
|
90 | - $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idemail`= ?'); |
|
91 | - $query->bindValue(1, $idemail); |
|
92 | - |
|
93 | - try { |
|
94 | - $query->execute(); |
|
95 | - |
|
96 | - return $query->fetch(); |
|
97 | - } catch (PDOException $e) { |
|
98 | - die($e->getMessage()); |
|
99 | - } |
|
100 | - } |
|
101 | - |
|
102 | - public function get_email_by_idticket($idticket) |
|
103 | - { |
|
104 | - $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idticket`= ?'); |
|
105 | - $query->bindValue(1, $idticket); |
|
106 | - |
|
107 | - try { |
|
108 | - $query->execute(); |
|
109 | - |
|
110 | - return $query->fetch(); |
|
111 | - } catch (PDOException $e) { |
|
112 | - die($e->getMessage()); |
|
113 | - } |
|
114 | - } |
|
115 | - |
|
116 | - public function get_email_by_status($emailstatus) |
|
117 | - { |
|
118 | - $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `emailstatus`= ?'); |
|
119 | - $query->bindValue(1, $emailstatus); |
|
120 | - |
|
121 | - try { |
|
122 | - $query->execute(); |
|
123 | - } catch (PDOException $e) { |
|
124 | - die($e->getMessage()); |
|
125 | - } |
|
126 | - |
|
127 | - return $query->fetchAll(); |
|
128 | - } |
|
129 | - |
|
130 | - public function get_email_sla_remainder() |
|
131 | - { |
|
132 | - $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `emailstatus`= ? and senddate <= UNIX_TIMESTAMP(NOW())'); |
|
133 | - $query->bindValue(1, 'SLA Remainder'); |
|
134 | - |
|
135 | - try { |
|
136 | - $query->execute(); |
|
137 | - } catch (PDOException $e) { |
|
138 | - die($e->getMessage()); |
|
139 | - } |
|
140 | - |
|
141 | - return $query->fetchAll(); |
|
142 | - } |
|
143 | - |
|
144 | - public function get_email() |
|
145 | - { |
|
146 | - $query = $this->db->prepare('SELECT * FROM `log_emails` ORDER BY `idemail` ASC'); |
|
147 | - |
|
148 | - try { |
|
149 | - $query->execute(); |
|
150 | - } catch (PDOException $e) { |
|
151 | - die($e->getMessage()); |
|
152 | - } |
|
153 | - |
|
154 | - return $query->fetchAll(); |
|
155 | - } |
|
156 | - |
|
157 | - public function get_email_queue() |
|
158 | - { |
|
159 | - $query = $this->db->prepare("SELECT * FROM `log_emails` WHERE `emailstatus` <> 'Sent' AND senddate <= UNIX_TIMESTAMP(NOW()) ORDER BY `senddate` ASC"); |
|
160 | - |
|
161 | - try { |
|
162 | - $query->execute(); |
|
163 | - } catch (PDOException $e) { |
|
164 | - die($e->getMessage()); |
|
165 | - } |
|
166 | - |
|
167 | - return $query->fetchAll(); |
|
168 | - } |
|
169 | - |
|
170 | - public function get_email_queue_by_id($idemail) |
|
171 | - { |
|
172 | - $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idemail`= ?'); |
|
173 | - $query->bindValue(1, $idemail); |
|
174 | - |
|
175 | - try { |
|
176 | - $query->execute(); |
|
177 | - |
|
178 | - return $query->fetch(); |
|
179 | - } catch (PDOException $e) { |
|
180 | - die($e->getMessage()); |
|
181 | - } |
|
182 | - } |
|
183 | - |
|
184 | - public function send_new_ticket() |
|
185 | - { |
|
186 | - if (substr(php_uname(), 0, 7) == 'Windows') { |
|
187 | - //$cmd = "D:\mowes_portable\www\helpdesk\batch\sendnewticket.bat"; |
|
188 | - $cmd = "C:\xampp\htdocs\helpdesk\batch\sendnewticket.bat"; |
|
189 | - $WshShell = new COM('WScript.Shell'); |
|
190 | - $oExec = $WshShell->Run("cmd /C $cmd", 0, false); |
|
191 | - |
|
192 | - return $oExec == 0 ? true : false; |
|
193 | - } else { |
|
194 | - $cmd = 'php /batch/sendnewticket.bat'; |
|
195 | - exec($cmd.' > /dev/null &'); |
|
196 | - } |
|
197 | - } |
|
198 | - |
|
199 | - public function send_sla_remainder() |
|
200 | - { |
|
201 | - if (substr(php_uname(), 0, 7) == 'Windows') { |
|
202 | - //$cmd = "D:\mowes_portable\www\helpdesk\batch\sendslaremainder.bat"; |
|
203 | - $cmd = "C:\xampp\htdocs\helpdesk\batch\sendslaremainder.bat"; |
|
204 | - $WshShell = new COM('WScript.Shell'); |
|
205 | - $oExec = $WshShell->Run("cmd /C $cmd", 0, false); |
|
206 | - |
|
207 | - return $oExec == 0 ? true : false; |
|
208 | - } else { |
|
209 | - $cmd = 'php /batch/sendslaremainder.bat'; |
|
210 | - exec($cmd.' > /dev/null &'); |
|
211 | - } |
|
212 | - } |
|
43 | + $querystring = 'INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'; |
|
44 | + $query = $this->db->prepare($querystring); |
|
45 | + $query->bindValue(1, $idticket); |
|
46 | + $query->bindValue(2, $slasenddate); |
|
47 | + $query->bindValue(3, $emailto); |
|
48 | + $query->bindValue(4, $emailcc); |
|
49 | + $query->bindValue(5, $emailbcc); |
|
50 | + $query->bindValue(6, $emailsubject); |
|
51 | + $query->bindValue(7, $message); |
|
52 | + $query->bindValue(8, 'SLA Remainder'); |
|
53 | + |
|
54 | + try { |
|
55 | + $query->execute(); |
|
56 | + } catch (PDOException $e) { |
|
57 | + die($e->getMessage()); |
|
58 | + } |
|
59 | + } |
|
60 | + |
|
61 | + public function update_status_email($idemail, $emailstatus) |
|
62 | + { |
|
63 | + $querystring = 'UPDATE `log_emails` SET `emailstatus` = ? WHERE `idemail` = ?'; |
|
64 | + $query = $this->db->prepare($querystring); |
|
65 | + $query->bindValue(1, $emailstatus); |
|
66 | + $query->bindValue(2, $idemail); |
|
67 | + |
|
68 | + try { |
|
69 | + $query->execute(); |
|
70 | + } catch (PDOException $e) { |
|
71 | + die($e->getMessage()); |
|
72 | + } |
|
73 | + } |
|
74 | + |
|
75 | + public function delete($idemail) |
|
76 | + { |
|
77 | + $sql = 'DELETE FROM `log_emails` WHERE `idemail` = ?'; |
|
78 | + $query = $this->db->prepare($sql); |
|
79 | + $query->bindValue(1, $idemail); |
|
80 | + |
|
81 | + try { |
|
82 | + $query->execute(); |
|
83 | + } catch (PDOException $e) { |
|
84 | + die($e->getMessage()); |
|
85 | + } |
|
86 | + } |
|
87 | + |
|
88 | + public function get_email_by_idemail($idemail) |
|
89 | + { |
|
90 | + $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idemail`= ?'); |
|
91 | + $query->bindValue(1, $idemail); |
|
92 | + |
|
93 | + try { |
|
94 | + $query->execute(); |
|
95 | + |
|
96 | + return $query->fetch(); |
|
97 | + } catch (PDOException $e) { |
|
98 | + die($e->getMessage()); |
|
99 | + } |
|
100 | + } |
|
101 | + |
|
102 | + public function get_email_by_idticket($idticket) |
|
103 | + { |
|
104 | + $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idticket`= ?'); |
|
105 | + $query->bindValue(1, $idticket); |
|
106 | + |
|
107 | + try { |
|
108 | + $query->execute(); |
|
109 | + |
|
110 | + return $query->fetch(); |
|
111 | + } catch (PDOException $e) { |
|
112 | + die($e->getMessage()); |
|
113 | + } |
|
114 | + } |
|
115 | + |
|
116 | + public function get_email_by_status($emailstatus) |
|
117 | + { |
|
118 | + $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `emailstatus`= ?'); |
|
119 | + $query->bindValue(1, $emailstatus); |
|
120 | + |
|
121 | + try { |
|
122 | + $query->execute(); |
|
123 | + } catch (PDOException $e) { |
|
124 | + die($e->getMessage()); |
|
125 | + } |
|
126 | + |
|
127 | + return $query->fetchAll(); |
|
128 | + } |
|
129 | + |
|
130 | + public function get_email_sla_remainder() |
|
131 | + { |
|
132 | + $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `emailstatus`= ? and senddate <= UNIX_TIMESTAMP(NOW())'); |
|
133 | + $query->bindValue(1, 'SLA Remainder'); |
|
134 | + |
|
135 | + try { |
|
136 | + $query->execute(); |
|
137 | + } catch (PDOException $e) { |
|
138 | + die($e->getMessage()); |
|
139 | + } |
|
140 | + |
|
141 | + return $query->fetchAll(); |
|
142 | + } |
|
143 | + |
|
144 | + public function get_email() |
|
145 | + { |
|
146 | + $query = $this->db->prepare('SELECT * FROM `log_emails` ORDER BY `idemail` ASC'); |
|
147 | + |
|
148 | + try { |
|
149 | + $query->execute(); |
|
150 | + } catch (PDOException $e) { |
|
151 | + die($e->getMessage()); |
|
152 | + } |
|
153 | + |
|
154 | + return $query->fetchAll(); |
|
155 | + } |
|
156 | + |
|
157 | + public function get_email_queue() |
|
158 | + { |
|
159 | + $query = $this->db->prepare("SELECT * FROM `log_emails` WHERE `emailstatus` <> 'Sent' AND senddate <= UNIX_TIMESTAMP(NOW()) ORDER BY `senddate` ASC"); |
|
160 | + |
|
161 | + try { |
|
162 | + $query->execute(); |
|
163 | + } catch (PDOException $e) { |
|
164 | + die($e->getMessage()); |
|
165 | + } |
|
166 | + |
|
167 | + return $query->fetchAll(); |
|
168 | + } |
|
169 | + |
|
170 | + public function get_email_queue_by_id($idemail) |
|
171 | + { |
|
172 | + $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idemail`= ?'); |
|
173 | + $query->bindValue(1, $idemail); |
|
174 | + |
|
175 | + try { |
|
176 | + $query->execute(); |
|
177 | + |
|
178 | + return $query->fetch(); |
|
179 | + } catch (PDOException $e) { |
|
180 | + die($e->getMessage()); |
|
181 | + } |
|
182 | + } |
|
183 | + |
|
184 | + public function send_new_ticket() |
|
185 | + { |
|
186 | + if (substr(php_uname(), 0, 7) == 'Windows') { |
|
187 | + //$cmd = "D:\mowes_portable\www\helpdesk\batch\sendnewticket.bat"; |
|
188 | + $cmd = "C:\xampp\htdocs\helpdesk\batch\sendnewticket.bat"; |
|
189 | + $WshShell = new COM('WScript.Shell'); |
|
190 | + $oExec = $WshShell->Run("cmd /C $cmd", 0, false); |
|
191 | + |
|
192 | + return $oExec == 0 ? true : false; |
|
193 | + } else { |
|
194 | + $cmd = 'php /batch/sendnewticket.bat'; |
|
195 | + exec($cmd.' > /dev/null &'); |
|
196 | + } |
|
197 | + } |
|
198 | + |
|
199 | + public function send_sla_remainder() |
|
200 | + { |
|
201 | + if (substr(php_uname(), 0, 7) == 'Windows') { |
|
202 | + //$cmd = "D:\mowes_portable\www\helpdesk\batch\sendslaremainder.bat"; |
|
203 | + $cmd = "C:\xampp\htdocs\helpdesk\batch\sendslaremainder.bat"; |
|
204 | + $WshShell = new COM('WScript.Shell'); |
|
205 | + $oExec = $WshShell->Run("cmd /C $cmd", 0, false); |
|
206 | + |
|
207 | + return $oExec == 0 ? true : false; |
|
208 | + } else { |
|
209 | + $cmd = 'php /batch/sendslaremainder.bat'; |
|
210 | + exec($cmd.' > /dev/null &'); |
|
211 | + } |
|
212 | + } |
|
213 | 213 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | try { |
27 | 27 | $query->execute(); |
28 | - } catch (PDOException $e) { |
|
28 | + }catch (PDOException $e) { |
|
29 | 29 | die($e->getMessage()); |
30 | 30 | } |
31 | 31 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | try { |
55 | 55 | $query->execute(); |
56 | - } catch (PDOException $e) { |
|
56 | + }catch (PDOException $e) { |
|
57 | 57 | die($e->getMessage()); |
58 | 58 | } |
59 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | try { |
69 | 69 | $query->execute(); |
70 | - } catch (PDOException $e) { |
|
70 | + }catch (PDOException $e) { |
|
71 | 71 | die($e->getMessage()); |
72 | 72 | } |
73 | 73 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | try { |
82 | 82 | $query->execute(); |
83 | - } catch (PDOException $e) { |
|
83 | + }catch (PDOException $e) { |
|
84 | 84 | die($e->getMessage()); |
85 | 85 | } |
86 | 86 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $query->execute(); |
95 | 95 | |
96 | 96 | return $query->fetch(); |
97 | - } catch (PDOException $e) { |
|
97 | + }catch (PDOException $e) { |
|
98 | 98 | die($e->getMessage()); |
99 | 99 | } |
100 | 100 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $query->execute(); |
109 | 109 | |
110 | 110 | return $query->fetch(); |
111 | - } catch (PDOException $e) { |
|
111 | + }catch (PDOException $e) { |
|
112 | 112 | die($e->getMessage()); |
113 | 113 | } |
114 | 114 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | try { |
122 | 122 | $query->execute(); |
123 | - } catch (PDOException $e) { |
|
123 | + }catch (PDOException $e) { |
|
124 | 124 | die($e->getMessage()); |
125 | 125 | } |
126 | 126 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | try { |
136 | 136 | $query->execute(); |
137 | - } catch (PDOException $e) { |
|
137 | + }catch (PDOException $e) { |
|
138 | 138 | die($e->getMessage()); |
139 | 139 | } |
140 | 140 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | try { |
149 | 149 | $query->execute(); |
150 | - } catch (PDOException $e) { |
|
150 | + }catch (PDOException $e) { |
|
151 | 151 | die($e->getMessage()); |
152 | 152 | } |
153 | 153 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | try { |
162 | 162 | $query->execute(); |
163 | - } catch (PDOException $e) { |
|
163 | + }catch (PDOException $e) { |
|
164 | 164 | die($e->getMessage()); |
165 | 165 | } |
166 | 166 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $query->execute(); |
177 | 177 | |
178 | 178 | return $query->fetch(); |
179 | - } catch (PDOException $e) { |
|
179 | + }catch (PDOException $e) { |
|
180 | 180 | die($e->getMessage()); |
181 | 181 | } |
182 | 182 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $oExec = $WshShell->Run("cmd /C $cmd", 0, false); |
191 | 191 | |
192 | 192 | return $oExec == 0 ? true : false; |
193 | - } else { |
|
193 | + }else { |
|
194 | 194 | $cmd = 'php /batch/sendnewticket.bat'; |
195 | 195 | exec($cmd.' > /dev/null &'); |
196 | 196 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $oExec = $WshShell->Run("cmd /C $cmd", 0, false); |
206 | 206 | |
207 | 207 | return $oExec == 0 ? true : false; |
208 | - } else { |
|
208 | + }else { |
|
209 | 209 | $cmd = 'php /batch/sendslaremainder.bat'; |
210 | 210 | exec($cmd.' > /dev/null &'); |
211 | 211 | } |
@@ -2,37 +2,37 @@ |
||
2 | 2 | |
3 | 3 | class Reports |
4 | 4 | { |
5 | - private $db; |
|
6 | - |
|
7 | - public function __construct($database) |
|
8 | - { |
|
9 | - $this->db = $database; |
|
10 | - } |
|
11 | - |
|
12 | - public function data_report($idreport) |
|
13 | - { |
|
14 | - $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `slaid`= ?'); |
|
15 | - $query->bindValue(1, $slaid); |
|
16 | - |
|
17 | - try { |
|
18 | - $query->execute(); |
|
19 | - |
|
20 | - return $query->fetch(); |
|
21 | - } catch (PDOException $e) { |
|
22 | - die($e->getMessage()); |
|
23 | - } |
|
24 | - } |
|
25 | - |
|
26 | - public function data_report_002() |
|
27 | - { |
|
28 | - $query = $this->db->prepare('SELECT * FROM `sla` ORDER BY `slaid` ASC'); |
|
29 | - |
|
30 | - try { |
|
31 | - $query->execute(); |
|
32 | - } catch (PDOException $e) { |
|
33 | - die($e->getMessage()); |
|
34 | - } |
|
35 | - |
|
36 | - return $query->fetchAll(); |
|
37 | - } |
|
5 | + private $db; |
|
6 | + |
|
7 | + public function __construct($database) |
|
8 | + { |
|
9 | + $this->db = $database; |
|
10 | + } |
|
11 | + |
|
12 | + public function data_report($idreport) |
|
13 | + { |
|
14 | + $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `slaid`= ?'); |
|
15 | + $query->bindValue(1, $slaid); |
|
16 | + |
|
17 | + try { |
|
18 | + $query->execute(); |
|
19 | + |
|
20 | + return $query->fetch(); |
|
21 | + } catch (PDOException $e) { |
|
22 | + die($e->getMessage()); |
|
23 | + } |
|
24 | + } |
|
25 | + |
|
26 | + public function data_report_002() |
|
27 | + { |
|
28 | + $query = $this->db->prepare('SELECT * FROM `sla` ORDER BY `slaid` ASC'); |
|
29 | + |
|
30 | + try { |
|
31 | + $query->execute(); |
|
32 | + } catch (PDOException $e) { |
|
33 | + die($e->getMessage()); |
|
34 | + } |
|
35 | + |
|
36 | + return $query->fetchAll(); |
|
37 | + } |
|
38 | 38 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $query->execute(); |
19 | 19 | |
20 | 20 | return $query->fetch(); |
21 | - } catch (PDOException $e) { |
|
21 | + }catch (PDOException $e) { |
|
22 | 22 | die($e->getMessage()); |
23 | 23 | } |
24 | 24 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | try { |
31 | 31 | $query->execute(); |
32 | - } catch (PDOException $e) { |
|
32 | + }catch (PDOException $e) { |
|
33 | 33 | die($e->getMessage()); |
34 | 34 | } |
35 | 35 |
@@ -2,24 +2,24 @@ |
||
2 | 2 | |
3 | 3 | class General |
4 | 4 | { |
5 | - public function logged_in() |
|
6 | - { |
|
7 | - return(isset($_SESSION['loginid'])) ? true : false; |
|
8 | - } |
|
5 | + public function logged_in() |
|
6 | + { |
|
7 | + return(isset($_SESSION['loginid'])) ? true : false; |
|
8 | + } |
|
9 | 9 | |
10 | - public function logged_in_protect() |
|
11 | - { |
|
12 | - if ($this->logged_in() === true) { |
|
13 | - header('Location: home.php'); |
|
14 | - exit(); |
|
15 | - } |
|
16 | - } |
|
10 | + public function logged_in_protect() |
|
11 | + { |
|
12 | + if ($this->logged_in() === true) { |
|
13 | + header('Location: home.php'); |
|
14 | + exit(); |
|
15 | + } |
|
16 | + } |
|
17 | 17 | |
18 | - public function logged_out_protect() |
|
19 | - { |
|
20 | - if ($this->logged_in() === false) { |
|
21 | - header('Location: index.php'); |
|
22 | - exit(); |
|
23 | - } |
|
24 | - } |
|
18 | + public function logged_out_protect() |
|
19 | + { |
|
20 | + if ($this->logged_in() === false) { |
|
21 | + header('Location: index.php'); |
|
22 | + exit(); |
|
23 | + } |
|
24 | + } |
|
25 | 25 | } |
@@ -2,195 +2,195 @@ |
||
2 | 2 | |
3 | 3 | class Customers |
4 | 4 | { |
5 | - private $db; |
|
6 | - |
|
7 | - public function __construct($database) |
|
8 | - { |
|
9 | - $this->db = $database; |
|
10 | - } |
|
11 | - |
|
12 | - public function customer_exists($customername) |
|
13 | - { |
|
14 | - $query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `customername`= ?'); |
|
15 | - $query->bindValue(1, $customername); |
|
16 | - |
|
17 | - try { |
|
18 | - $query->execute(); |
|
19 | - $rows = $query->fetchColumn(); |
|
20 | - if ($rows == 1) { |
|
21 | - return true; |
|
22 | - } else { |
|
23 | - return false; |
|
24 | - } |
|
25 | - } catch (PDOException $e) { |
|
26 | - die($e->getMessage()); |
|
27 | - } |
|
28 | - } |
|
29 | - |
|
30 | - public function email_exists($email) |
|
31 | - { |
|
32 | - $query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `email`= ?'); |
|
33 | - $query->bindValue(1, $email); |
|
34 | - |
|
35 | - try { |
|
36 | - $query->execute(); |
|
37 | - $rows = $query->fetchColumn(); |
|
38 | - if ($rows == 1) { |
|
39 | - return true; |
|
40 | - } else { |
|
41 | - return false; |
|
42 | - } |
|
43 | - } catch (PDOException $e) { |
|
44 | - die($e->getMessage()); |
|
45 | - } |
|
46 | - } |
|
47 | - |
|
48 | - public function add_customer($namacustomer, $alamat, $Telp, $email, $PIC, $selesperson, $customerproduct) |
|
49 | - { |
|
50 | - $time = time(); |
|
51 | - $ip = $_SERVER['REMOTE_ADDR']; |
|
52 | - $query = $this->db->prepare('INSERT INTO `customers` (`namacustomer`, `alamat`, `Telp`, `email`, `PIC`,`selesperson`, `customerproduct`, `time`, `ip`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)'); |
|
53 | - $query->bindValue(1, $namacustomer); |
|
54 | - $query->bindValue(2, $alamat); |
|
55 | - $query->bindValue(3, $Telp); |
|
56 | - $query->bindValue(4, $email); |
|
57 | - $query->bindValue(5, $PIC); |
|
58 | - $query->bindValue(6, $selesperson); |
|
59 | - $query->bindValue(7, $customerproduct); |
|
60 | - $query->bindValue(8, $time); |
|
61 | - $query->bindValue(9, $ip); |
|
62 | - |
|
63 | - try { |
|
64 | - $query->execute(); |
|
65 | - } catch (PDOException $e) { |
|
66 | - die($e->getMessage()); |
|
67 | - } |
|
68 | - } |
|
69 | - |
|
70 | - public function update_customer($idcustomer, $namacustomer, $alamat, $Telp, $email, $PIC, $selesperson, $customerproduct) |
|
71 | - { |
|
72 | - $time = time(); |
|
73 | - $ip = $_SERVER['REMOTE_ADDR']; |
|
74 | - $query = $this->db->prepare('UPDATE `customers` SET `namacustomer` = ? , `alamat` = ? , `Telp` = ? , `email` = ? , `PIC` = ? , `selesperson` = ? ,`customerproduct` = ? ,`ip` = ? , `time` = ? WHERE `idcustomer` = ?'); |
|
75 | - $query->bindValue(1, $namacustomer); |
|
76 | - $query->bindValue(2, $alamat); |
|
77 | - $query->bindValue(3, $Telp); |
|
78 | - $query->bindValue(4, $email); |
|
79 | - $query->bindValue(5, $PIC); |
|
80 | - $query->bindValue(6, $selesperson); |
|
81 | - $query->bindValue(7, $customerproduct); |
|
82 | - $query->bindValue(8, $ip); |
|
83 | - $query->bindValue(9, $time); |
|
84 | - $query->bindValue(10, $idcustomer); |
|
85 | - |
|
86 | - try { |
|
87 | - $query->execute(); |
|
88 | - } catch (PDOException $e) { |
|
89 | - die($e->getMessage()); |
|
90 | - } |
|
91 | - } |
|
92 | - |
|
93 | - public function delete($id) |
|
94 | - { |
|
95 | - $sql = 'DELETE FROM `customers` WHERE `idcustomer` = ?'; |
|
96 | - $query = $this->db->prepare($sql); |
|
97 | - $query->bindValue(1, $id); |
|
98 | - |
|
99 | - try { |
|
100 | - $query->execute(); |
|
101 | - } catch (PDOException $e) { |
|
102 | - die($e->getMessage()); |
|
103 | - } |
|
104 | - } |
|
105 | - |
|
106 | - public function activate($email, $email_code) |
|
107 | - { |
|
108 | - $query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `email` = ? AND `email_code` = ? AND `confirmed` = ?'); |
|
109 | - $query->bindValue(1, $email); |
|
110 | - $query->bindValue(2, $email_code); |
|
111 | - $query->bindValue(3, 0); |
|
112 | - |
|
113 | - try { |
|
114 | - $query->execute(); |
|
115 | - $rows = $query->fetchColumn(); |
|
116 | - if ($rows == 1) { |
|
117 | - $query_2 = $this->db->prepare('UPDATE `customers` SET `confirmed` = ? WHERE `email` = ?'); |
|
118 | - $query_2->bindValue(1, 1); |
|
119 | - $query_2->bindValue(2, $email); |
|
120 | - $query_2->execute(); |
|
121 | - |
|
122 | - return true; |
|
123 | - } else { |
|
124 | - return false; |
|
125 | - } |
|
126 | - } catch (PDOException $e) { |
|
127 | - die($e->getMessage()); |
|
128 | - } |
|
129 | - } |
|
130 | - |
|
131 | - public function email_confirmed($username) |
|
132 | - { |
|
133 | - $query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `username`= ? AND `confirmed` = ?'); |
|
134 | - $query->bindValue(1, $username); |
|
135 | - $query->bindValue(2, 1); |
|
136 | - |
|
137 | - try { |
|
138 | - $query->execute(); |
|
139 | - $rows = $query->fetchColumn(); |
|
140 | - if ($rows == 1) { |
|
141 | - return true; |
|
142 | - } else { |
|
143 | - return false; |
|
144 | - } |
|
145 | - } catch (PDOException $e) { |
|
146 | - die($e->getMessage()); |
|
147 | - } |
|
148 | - } |
|
149 | - |
|
150 | - public function login_customer($username, $password) |
|
151 | - { |
|
152 | - $query = $this->db->prepare('SELECT `email`, `ticket_id` FROM `customers` WHERE `email` = ?'); |
|
153 | - $query->bindValue(1, $username); |
|
154 | - |
|
155 | - try { |
|
156 | - $query->execute(); |
|
157 | - $data = $query->fetch(); |
|
158 | - $stored_password = $data['password']; |
|
159 | - $id = $data['id']; |
|
160 | - if ($stored_password === sha1($password)) { |
|
161 | - return $id; |
|
162 | - } else { |
|
163 | - return false; |
|
164 | - } |
|
165 | - } catch (PDOException $e) { |
|
166 | - die($e->getMessage()); |
|
167 | - } |
|
168 | - } |
|
169 | - |
|
170 | - public function customer_data($id) |
|
171 | - { |
|
172 | - $query = $this->db->prepare('SELECT * FROM `customers` WHERE `idcustomer`= ?'); |
|
173 | - $query->bindValue(1, $id); |
|
174 | - |
|
175 | - try { |
|
176 | - $query->execute(); |
|
177 | - |
|
178 | - return $query->fetch(); |
|
179 | - } catch (PDOException $e) { |
|
180 | - die($e->getMessage()); |
|
181 | - } |
|
182 | - } |
|
183 | - |
|
184 | - public function get_customers() |
|
185 | - { |
|
186 | - $query = $this->db->prepare('SELECT * FROM `customers` ORDER BY `namacustomer` ASC'); |
|
187 | - |
|
188 | - try { |
|
189 | - $query->execute(); |
|
190 | - } catch (PDOException $e) { |
|
191 | - die($e->getMessage()); |
|
192 | - } |
|
193 | - |
|
194 | - return $query->fetchAll(); |
|
195 | - } |
|
5 | + private $db; |
|
6 | + |
|
7 | + public function __construct($database) |
|
8 | + { |
|
9 | + $this->db = $database; |
|
10 | + } |
|
11 | + |
|
12 | + public function customer_exists($customername) |
|
13 | + { |
|
14 | + $query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `customername`= ?'); |
|
15 | + $query->bindValue(1, $customername); |
|
16 | + |
|
17 | + try { |
|
18 | + $query->execute(); |
|
19 | + $rows = $query->fetchColumn(); |
|
20 | + if ($rows == 1) { |
|
21 | + return true; |
|
22 | + } else { |
|
23 | + return false; |
|
24 | + } |
|
25 | + } catch (PDOException $e) { |
|
26 | + die($e->getMessage()); |
|
27 | + } |
|
28 | + } |
|
29 | + |
|
30 | + public function email_exists($email) |
|
31 | + { |
|
32 | + $query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `email`= ?'); |
|
33 | + $query->bindValue(1, $email); |
|
34 | + |
|
35 | + try { |
|
36 | + $query->execute(); |
|
37 | + $rows = $query->fetchColumn(); |
|
38 | + if ($rows == 1) { |
|
39 | + return true; |
|
40 | + } else { |
|
41 | + return false; |
|
42 | + } |
|
43 | + } catch (PDOException $e) { |
|
44 | + die($e->getMessage()); |
|
45 | + } |
|
46 | + } |
|
47 | + |
|
48 | + public function add_customer($namacustomer, $alamat, $Telp, $email, $PIC, $selesperson, $customerproduct) |
|
49 | + { |
|
50 | + $time = time(); |
|
51 | + $ip = $_SERVER['REMOTE_ADDR']; |
|
52 | + $query = $this->db->prepare('INSERT INTO `customers` (`namacustomer`, `alamat`, `Telp`, `email`, `PIC`,`selesperson`, `customerproduct`, `time`, `ip`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)'); |
|
53 | + $query->bindValue(1, $namacustomer); |
|
54 | + $query->bindValue(2, $alamat); |
|
55 | + $query->bindValue(3, $Telp); |
|
56 | + $query->bindValue(4, $email); |
|
57 | + $query->bindValue(5, $PIC); |
|
58 | + $query->bindValue(6, $selesperson); |
|
59 | + $query->bindValue(7, $customerproduct); |
|
60 | + $query->bindValue(8, $time); |
|
61 | + $query->bindValue(9, $ip); |
|
62 | + |
|
63 | + try { |
|
64 | + $query->execute(); |
|
65 | + } catch (PDOException $e) { |
|
66 | + die($e->getMessage()); |
|
67 | + } |
|
68 | + } |
|
69 | + |
|
70 | + public function update_customer($idcustomer, $namacustomer, $alamat, $Telp, $email, $PIC, $selesperson, $customerproduct) |
|
71 | + { |
|
72 | + $time = time(); |
|
73 | + $ip = $_SERVER['REMOTE_ADDR']; |
|
74 | + $query = $this->db->prepare('UPDATE `customers` SET `namacustomer` = ? , `alamat` = ? , `Telp` = ? , `email` = ? , `PIC` = ? , `selesperson` = ? ,`customerproduct` = ? ,`ip` = ? , `time` = ? WHERE `idcustomer` = ?'); |
|
75 | + $query->bindValue(1, $namacustomer); |
|
76 | + $query->bindValue(2, $alamat); |
|
77 | + $query->bindValue(3, $Telp); |
|
78 | + $query->bindValue(4, $email); |
|
79 | + $query->bindValue(5, $PIC); |
|
80 | + $query->bindValue(6, $selesperson); |
|
81 | + $query->bindValue(7, $customerproduct); |
|
82 | + $query->bindValue(8, $ip); |
|
83 | + $query->bindValue(9, $time); |
|
84 | + $query->bindValue(10, $idcustomer); |
|
85 | + |
|
86 | + try { |
|
87 | + $query->execute(); |
|
88 | + } catch (PDOException $e) { |
|
89 | + die($e->getMessage()); |
|
90 | + } |
|
91 | + } |
|
92 | + |
|
93 | + public function delete($id) |
|
94 | + { |
|
95 | + $sql = 'DELETE FROM `customers` WHERE `idcustomer` = ?'; |
|
96 | + $query = $this->db->prepare($sql); |
|
97 | + $query->bindValue(1, $id); |
|
98 | + |
|
99 | + try { |
|
100 | + $query->execute(); |
|
101 | + } catch (PDOException $e) { |
|
102 | + die($e->getMessage()); |
|
103 | + } |
|
104 | + } |
|
105 | + |
|
106 | + public function activate($email, $email_code) |
|
107 | + { |
|
108 | + $query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `email` = ? AND `email_code` = ? AND `confirmed` = ?'); |
|
109 | + $query->bindValue(1, $email); |
|
110 | + $query->bindValue(2, $email_code); |
|
111 | + $query->bindValue(3, 0); |
|
112 | + |
|
113 | + try { |
|
114 | + $query->execute(); |
|
115 | + $rows = $query->fetchColumn(); |
|
116 | + if ($rows == 1) { |
|
117 | + $query_2 = $this->db->prepare('UPDATE `customers` SET `confirmed` = ? WHERE `email` = ?'); |
|
118 | + $query_2->bindValue(1, 1); |
|
119 | + $query_2->bindValue(2, $email); |
|
120 | + $query_2->execute(); |
|
121 | + |
|
122 | + return true; |
|
123 | + } else { |
|
124 | + return false; |
|
125 | + } |
|
126 | + } catch (PDOException $e) { |
|
127 | + die($e->getMessage()); |
|
128 | + } |
|
129 | + } |
|
130 | + |
|
131 | + public function email_confirmed($username) |
|
132 | + { |
|
133 | + $query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `username`= ? AND `confirmed` = ?'); |
|
134 | + $query->bindValue(1, $username); |
|
135 | + $query->bindValue(2, 1); |
|
136 | + |
|
137 | + try { |
|
138 | + $query->execute(); |
|
139 | + $rows = $query->fetchColumn(); |
|
140 | + if ($rows == 1) { |
|
141 | + return true; |
|
142 | + } else { |
|
143 | + return false; |
|
144 | + } |
|
145 | + } catch (PDOException $e) { |
|
146 | + die($e->getMessage()); |
|
147 | + } |
|
148 | + } |
|
149 | + |
|
150 | + public function login_customer($username, $password) |
|
151 | + { |
|
152 | + $query = $this->db->prepare('SELECT `email`, `ticket_id` FROM `customers` WHERE `email` = ?'); |
|
153 | + $query->bindValue(1, $username); |
|
154 | + |
|
155 | + try { |
|
156 | + $query->execute(); |
|
157 | + $data = $query->fetch(); |
|
158 | + $stored_password = $data['password']; |
|
159 | + $id = $data['id']; |
|
160 | + if ($stored_password === sha1($password)) { |
|
161 | + return $id; |
|
162 | + } else { |
|
163 | + return false; |
|
164 | + } |
|
165 | + } catch (PDOException $e) { |
|
166 | + die($e->getMessage()); |
|
167 | + } |
|
168 | + } |
|
169 | + |
|
170 | + public function customer_data($id) |
|
171 | + { |
|
172 | + $query = $this->db->prepare('SELECT * FROM `customers` WHERE `idcustomer`= ?'); |
|
173 | + $query->bindValue(1, $id); |
|
174 | + |
|
175 | + try { |
|
176 | + $query->execute(); |
|
177 | + |
|
178 | + return $query->fetch(); |
|
179 | + } catch (PDOException $e) { |
|
180 | + die($e->getMessage()); |
|
181 | + } |
|
182 | + } |
|
183 | + |
|
184 | + public function get_customers() |
|
185 | + { |
|
186 | + $query = $this->db->prepare('SELECT * FROM `customers` ORDER BY `namacustomer` ASC'); |
|
187 | + |
|
188 | + try { |
|
189 | + $query->execute(); |
|
190 | + } catch (PDOException $e) { |
|
191 | + die($e->getMessage()); |
|
192 | + } |
|
193 | + |
|
194 | + return $query->fetchAll(); |
|
195 | + } |
|
196 | 196 | } |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | $rows = $query->fetchColumn(); |
20 | 20 | if ($rows == 1) { |
21 | 21 | return true; |
22 | - } else { |
|
22 | + }else { |
|
23 | 23 | return false; |
24 | 24 | } |
25 | - } catch (PDOException $e) { |
|
25 | + }catch (PDOException $e) { |
|
26 | 26 | die($e->getMessage()); |
27 | 27 | } |
28 | 28 | } |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | $rows = $query->fetchColumn(); |
38 | 38 | if ($rows == 1) { |
39 | 39 | return true; |
40 | - } else { |
|
40 | + }else { |
|
41 | 41 | return false; |
42 | 42 | } |
43 | - } catch (PDOException $e) { |
|
43 | + }catch (PDOException $e) { |
|
44 | 44 | die($e->getMessage()); |
45 | 45 | } |
46 | 46 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | try { |
64 | 64 | $query->execute(); |
65 | - } catch (PDOException $e) { |
|
65 | + }catch (PDOException $e) { |
|
66 | 66 | die($e->getMessage()); |
67 | 67 | } |
68 | 68 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | try { |
87 | 87 | $query->execute(); |
88 | - } catch (PDOException $e) { |
|
88 | + }catch (PDOException $e) { |
|
89 | 89 | die($e->getMessage()); |
90 | 90 | } |
91 | 91 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | try { |
100 | 100 | $query->execute(); |
101 | - } catch (PDOException $e) { |
|
101 | + }catch (PDOException $e) { |
|
102 | 102 | die($e->getMessage()); |
103 | 103 | } |
104 | 104 | } |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | $query_2->execute(); |
121 | 121 | |
122 | 122 | return true; |
123 | - } else { |
|
123 | + }else { |
|
124 | 124 | return false; |
125 | 125 | } |
126 | - } catch (PDOException $e) { |
|
126 | + }catch (PDOException $e) { |
|
127 | 127 | die($e->getMessage()); |
128 | 128 | } |
129 | 129 | } |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | $rows = $query->fetchColumn(); |
140 | 140 | if ($rows == 1) { |
141 | 141 | return true; |
142 | - } else { |
|
142 | + }else { |
|
143 | 143 | return false; |
144 | 144 | } |
145 | - } catch (PDOException $e) { |
|
145 | + }catch (PDOException $e) { |
|
146 | 146 | die($e->getMessage()); |
147 | 147 | } |
148 | 148 | } |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | $id = $data['id']; |
160 | 160 | if ($stored_password === sha1($password)) { |
161 | 161 | return $id; |
162 | - } else { |
|
162 | + }else { |
|
163 | 163 | return false; |
164 | 164 | } |
165 | - } catch (PDOException $e) { |
|
165 | + }catch (PDOException $e) { |
|
166 | 166 | die($e->getMessage()); |
167 | 167 | } |
168 | 168 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $query->execute(); |
177 | 177 | |
178 | 178 | return $query->fetch(); |
179 | - } catch (PDOException $e) { |
|
179 | + }catch (PDOException $e) { |
|
180 | 180 | die($e->getMessage()); |
181 | 181 | } |
182 | 182 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | try { |
189 | 189 | $query->execute(); |
190 | - } catch (PDOException $e) { |
|
190 | + }catch (PDOException $e) { |
|
191 | 191 | die($e->getMessage()); |
192 | 192 | } |
193 | 193 |
@@ -2,133 +2,133 @@ |
||
2 | 2 | |
3 | 3 | class Projects |
4 | 4 | { |
5 | - private $db; |
|
6 | - |
|
7 | - public function __construct($database) |
|
8 | - { |
|
9 | - $this->db = $database; |
|
10 | - } |
|
11 | - |
|
12 | - public function project_exists($projectid) |
|
13 | - { |
|
14 | - $query = $this->db->prepare('SELECT COUNT(`id`) FROM `projects` WHERE `projectid`= ?'); |
|
15 | - $query->bindValue(1, $projectid); |
|
16 | - |
|
17 | - try { |
|
18 | - $query->execute(); |
|
19 | - $rows = $query->fetchColumn(); |
|
20 | - if ($rows == 1) { |
|
21 | - return true; |
|
22 | - } else { |
|
23 | - return false; |
|
24 | - } |
|
25 | - } catch (PDOException $e) { |
|
26 | - die($e->getMessage()); |
|
27 | - } |
|
28 | - } |
|
29 | - |
|
30 | - public function add_project($projectname, $idcustomer, $deliverybegin, $deliveryend, $installbegin, $installend, $uatbegin, $uatend, $billstartdate, $billduedate, $warrantyperiod, $contractstartdate, $contractperiod) |
|
31 | - { |
|
32 | - $querystring = 'INSERT INTO `projects` (`projectname`,`idcustomer`, `deliverybegin`, `deliveryend`, `installbegin`, `installend`,`uatbegin`,`uatend`,`billstartdate`, `billduedate`, `warrantyperiod`, `contractstartdate`, `contractperiod`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; |
|
33 | - $query = $this->db->prepare($querystring); |
|
34 | - $query->bindValue(1, $projectname); |
|
35 | - $query->bindValue(2, $idcustomer); |
|
36 | - $query->bindValue(3, $deliverybegin); |
|
37 | - $query->bindValue(4, $deliveryend); |
|
38 | - $query->bindValue(5, $installbegin); |
|
39 | - $query->bindValue(6, $installend); |
|
40 | - $query->bindValue(7, $uatbegin); |
|
41 | - $query->bindValue(8, $uatend); |
|
42 | - $query->bindValue(9, $billstartdate); |
|
43 | - $query->bindValue(10, $billduedate); |
|
44 | - $query->bindValue(11, $warrantyperiod); |
|
45 | - $query->bindValue(12, $contractstartdate); |
|
46 | - $query->bindValue(13, $contractperiod); |
|
47 | - |
|
48 | - try { |
|
49 | - $query->execute(); |
|
50 | - } catch (PDOException $e) { |
|
51 | - die($e->getMessage()); |
|
52 | - } |
|
53 | - } |
|
54 | - |
|
55 | - public function update_project($projectid, $projectname, $idcustomer, $deliverybegin, $deliveryend, $installbegin, $installend, $uatbegin, $uatend, $billstartdate, $billduedate, $warrantyperiod, $contractstartdate, $contractperiod) |
|
56 | - { |
|
57 | - $querystring = 'UPDATE `projects` SET `projectname` = ? , `idcustomer` = ? , `deliverybegin` = ? , `deliveryend` = ? , `installbegin` = ? ,`installend` = ? , `uatbegin` = ? , `uatend` = ? ,`billstartdate` = ?, `billduedate` = ? , `warrantyperiod` = ? ,`contractstartdate` = ?,`contractperiod` = ? WHERE `projectid` = ?'; |
|
58 | - $query = $this->db->prepare($querystring); |
|
59 | - $query->bindValue(1, $projectname); |
|
60 | - $query->bindValue(2, $idcustomer); |
|
61 | - $query->bindValue(3, $deliverybegin); |
|
62 | - $query->bindValue(4, $deliveryend); |
|
63 | - $query->bindValue(5, $installbegin); |
|
64 | - $query->bindValue(6, $installend); |
|
65 | - $query->bindValue(7, $uatbegin); |
|
66 | - $query->bindValue(8, $uatend); |
|
67 | - $query->bindValue(9, $billstartdate); |
|
68 | - $query->bindValue(10, $billduedate); |
|
69 | - $query->bindValue(11, $warrantyperiod); |
|
70 | - $query->bindValue(12, $contractstartdate); |
|
71 | - $query->bindValue(13, $contractperiod); |
|
72 | - $query->bindValue(14, $projectid); |
|
73 | - |
|
74 | - try { |
|
75 | - $query->execute(); |
|
76 | - } catch (PDOException $e) { |
|
77 | - die($e->getMessage()); |
|
78 | - } |
|
79 | - } |
|
80 | - |
|
81 | - public function delete($id) |
|
82 | - { |
|
83 | - $sql = 'DELETE FROM `projects` WHERE `projectid` = ?'; |
|
84 | - $query = $this->db->prepare($sql); |
|
85 | - $query->bindValue(1, $id); |
|
86 | - |
|
87 | - try { |
|
88 | - $query->execute(); |
|
89 | - } catch (PDOException $e) { |
|
90 | - die($e->getMessage()); |
|
91 | - } |
|
92 | - } |
|
93 | - |
|
94 | - public function project_data($id) |
|
95 | - { |
|
96 | - $query = $this->db->prepare('SELECT * FROM `projects` WHERE `projectid`= ?'); |
|
97 | - $query->bindValue(1, $id); |
|
98 | - |
|
99 | - try { |
|
100 | - $query->execute(); |
|
101 | - |
|
102 | - return $query->fetch(); |
|
103 | - } catch (PDOException $e) { |
|
104 | - die($e->getMessage()); |
|
105 | - } |
|
106 | - } |
|
107 | - |
|
108 | - public function get_projects() |
|
109 | - { |
|
110 | - $query = $this->db->prepare('SELECT * FROM `projects` ORDER BY `projectid` DESC'); |
|
111 | - |
|
112 | - try { |
|
113 | - $query->execute(); |
|
114 | - } catch (PDOException $e) { |
|
115 | - die($e->getMessage()); |
|
116 | - } |
|
117 | - |
|
118 | - return $query->fetchAll(); |
|
119 | - } |
|
120 | - |
|
121 | - public function get_project_customer($id) //get project_data by idcustomer |
|
122 | - { |
|
123 | - $query = $this->db->prepare('SELECT * FROM `projects` WHERE `idcustomer`= ? ORDER BY `contractstartdate` DESC LIMIT 1'); |
|
124 | - $query->bindValue(1, $id); |
|
125 | - |
|
126 | - try { |
|
127 | - $query->execute(); |
|
128 | - |
|
129 | - return $query->fetch(); |
|
130 | - } catch (PDOException $e) { |
|
131 | - die($e->getMessage()); |
|
132 | - } |
|
133 | - } |
|
5 | + private $db; |
|
6 | + |
|
7 | + public function __construct($database) |
|
8 | + { |
|
9 | + $this->db = $database; |
|
10 | + } |
|
11 | + |
|
12 | + public function project_exists($projectid) |
|
13 | + { |
|
14 | + $query = $this->db->prepare('SELECT COUNT(`id`) FROM `projects` WHERE `projectid`= ?'); |
|
15 | + $query->bindValue(1, $projectid); |
|
16 | + |
|
17 | + try { |
|
18 | + $query->execute(); |
|
19 | + $rows = $query->fetchColumn(); |
|
20 | + if ($rows == 1) { |
|
21 | + return true; |
|
22 | + } else { |
|
23 | + return false; |
|
24 | + } |
|
25 | + } catch (PDOException $e) { |
|
26 | + die($e->getMessage()); |
|
27 | + } |
|
28 | + } |
|
29 | + |
|
30 | + public function add_project($projectname, $idcustomer, $deliverybegin, $deliveryend, $installbegin, $installend, $uatbegin, $uatend, $billstartdate, $billduedate, $warrantyperiod, $contractstartdate, $contractperiod) |
|
31 | + { |
|
32 | + $querystring = 'INSERT INTO `projects` (`projectname`,`idcustomer`, `deliverybegin`, `deliveryend`, `installbegin`, `installend`,`uatbegin`,`uatend`,`billstartdate`, `billduedate`, `warrantyperiod`, `contractstartdate`, `contractperiod`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; |
|
33 | + $query = $this->db->prepare($querystring); |
|
34 | + $query->bindValue(1, $projectname); |
|
35 | + $query->bindValue(2, $idcustomer); |
|
36 | + $query->bindValue(3, $deliverybegin); |
|
37 | + $query->bindValue(4, $deliveryend); |
|
38 | + $query->bindValue(5, $installbegin); |
|
39 | + $query->bindValue(6, $installend); |
|
40 | + $query->bindValue(7, $uatbegin); |
|
41 | + $query->bindValue(8, $uatend); |
|
42 | + $query->bindValue(9, $billstartdate); |
|
43 | + $query->bindValue(10, $billduedate); |
|
44 | + $query->bindValue(11, $warrantyperiod); |
|
45 | + $query->bindValue(12, $contractstartdate); |
|
46 | + $query->bindValue(13, $contractperiod); |
|
47 | + |
|
48 | + try { |
|
49 | + $query->execute(); |
|
50 | + } catch (PDOException $e) { |
|
51 | + die($e->getMessage()); |
|
52 | + } |
|
53 | + } |
|
54 | + |
|
55 | + public function update_project($projectid, $projectname, $idcustomer, $deliverybegin, $deliveryend, $installbegin, $installend, $uatbegin, $uatend, $billstartdate, $billduedate, $warrantyperiod, $contractstartdate, $contractperiod) |
|
56 | + { |
|
57 | + $querystring = 'UPDATE `projects` SET `projectname` = ? , `idcustomer` = ? , `deliverybegin` = ? , `deliveryend` = ? , `installbegin` = ? ,`installend` = ? , `uatbegin` = ? , `uatend` = ? ,`billstartdate` = ?, `billduedate` = ? , `warrantyperiod` = ? ,`contractstartdate` = ?,`contractperiod` = ? WHERE `projectid` = ?'; |
|
58 | + $query = $this->db->prepare($querystring); |
|
59 | + $query->bindValue(1, $projectname); |
|
60 | + $query->bindValue(2, $idcustomer); |
|
61 | + $query->bindValue(3, $deliverybegin); |
|
62 | + $query->bindValue(4, $deliveryend); |
|
63 | + $query->bindValue(5, $installbegin); |
|
64 | + $query->bindValue(6, $installend); |
|
65 | + $query->bindValue(7, $uatbegin); |
|
66 | + $query->bindValue(8, $uatend); |
|
67 | + $query->bindValue(9, $billstartdate); |
|
68 | + $query->bindValue(10, $billduedate); |
|
69 | + $query->bindValue(11, $warrantyperiod); |
|
70 | + $query->bindValue(12, $contractstartdate); |
|
71 | + $query->bindValue(13, $contractperiod); |
|
72 | + $query->bindValue(14, $projectid); |
|
73 | + |
|
74 | + try { |
|
75 | + $query->execute(); |
|
76 | + } catch (PDOException $e) { |
|
77 | + die($e->getMessage()); |
|
78 | + } |
|
79 | + } |
|
80 | + |
|
81 | + public function delete($id) |
|
82 | + { |
|
83 | + $sql = 'DELETE FROM `projects` WHERE `projectid` = ?'; |
|
84 | + $query = $this->db->prepare($sql); |
|
85 | + $query->bindValue(1, $id); |
|
86 | + |
|
87 | + try { |
|
88 | + $query->execute(); |
|
89 | + } catch (PDOException $e) { |
|
90 | + die($e->getMessage()); |
|
91 | + } |
|
92 | + } |
|
93 | + |
|
94 | + public function project_data($id) |
|
95 | + { |
|
96 | + $query = $this->db->prepare('SELECT * FROM `projects` WHERE `projectid`= ?'); |
|
97 | + $query->bindValue(1, $id); |
|
98 | + |
|
99 | + try { |
|
100 | + $query->execute(); |
|
101 | + |
|
102 | + return $query->fetch(); |
|
103 | + } catch (PDOException $e) { |
|
104 | + die($e->getMessage()); |
|
105 | + } |
|
106 | + } |
|
107 | + |
|
108 | + public function get_projects() |
|
109 | + { |
|
110 | + $query = $this->db->prepare('SELECT * FROM `projects` ORDER BY `projectid` DESC'); |
|
111 | + |
|
112 | + try { |
|
113 | + $query->execute(); |
|
114 | + } catch (PDOException $e) { |
|
115 | + die($e->getMessage()); |
|
116 | + } |
|
117 | + |
|
118 | + return $query->fetchAll(); |
|
119 | + } |
|
120 | + |
|
121 | + public function get_project_customer($id) //get project_data by idcustomer |
|
122 | + { |
|
123 | + $query = $this->db->prepare('SELECT * FROM `projects` WHERE `idcustomer`= ? ORDER BY `contractstartdate` DESC LIMIT 1'); |
|
124 | + $query->bindValue(1, $id); |
|
125 | + |
|
126 | + try { |
|
127 | + $query->execute(); |
|
128 | + |
|
129 | + return $query->fetch(); |
|
130 | + } catch (PDOException $e) { |
|
131 | + die($e->getMessage()); |
|
132 | + } |
|
133 | + } |
|
134 | 134 | } |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | $rows = $query->fetchColumn(); |
20 | 20 | if ($rows == 1) { |
21 | 21 | return true; |
22 | - } else { |
|
22 | + }else { |
|
23 | 23 | return false; |
24 | 24 | } |
25 | - } catch (PDOException $e) { |
|
25 | + }catch (PDOException $e) { |
|
26 | 26 | die($e->getMessage()); |
27 | 27 | } |
28 | 28 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | try { |
49 | 49 | $query->execute(); |
50 | - } catch (PDOException $e) { |
|
50 | + }catch (PDOException $e) { |
|
51 | 51 | die($e->getMessage()); |
52 | 52 | } |
53 | 53 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | try { |
75 | 75 | $query->execute(); |
76 | - } catch (PDOException $e) { |
|
76 | + }catch (PDOException $e) { |
|
77 | 77 | die($e->getMessage()); |
78 | 78 | } |
79 | 79 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | try { |
88 | 88 | $query->execute(); |
89 | - } catch (PDOException $e) { |
|
89 | + }catch (PDOException $e) { |
|
90 | 90 | die($e->getMessage()); |
91 | 91 | } |
92 | 92 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $query->execute(); |
101 | 101 | |
102 | 102 | return $query->fetch(); |
103 | - } catch (PDOException $e) { |
|
103 | + }catch (PDOException $e) { |
|
104 | 104 | die($e->getMessage()); |
105 | 105 | } |
106 | 106 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | try { |
113 | 113 | $query->execute(); |
114 | - } catch (PDOException $e) { |
|
114 | + }catch (PDOException $e) { |
|
115 | 115 | die($e->getMessage()); |
116 | 116 | } |
117 | 117 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $query->execute(); |
128 | 128 | |
129 | 129 | return $query->fetch(); |
130 | - } catch (PDOException $e) { |
|
130 | + }catch (PDOException $e) { |
|
131 | 131 | die($e->getMessage()); |
132 | 132 | } |
133 | 133 | } |
@@ -2,102 +2,102 @@ |
||
2 | 2 | |
3 | 3 | class SLA |
4 | 4 | { |
5 | - private $db; |
|
6 | - |
|
7 | - public function __construct($database) |
|
8 | - { |
|
9 | - $this->db = $database; |
|
10 | - } |
|
11 | - |
|
12 | - public function sla_exists($slaid) |
|
13 | - { |
|
14 | - $query = $this->db->prepare('SELECT COUNT(`slaid`) FROM `sla` WHERE `slaid`= ?'); |
|
15 | - $query->bindValue(1, $slaid); |
|
16 | - |
|
17 | - try { |
|
18 | - $query->execute(); |
|
19 | - $rows = $query->fetchColumn(); |
|
20 | - if ($rows == 1) { |
|
21 | - return true; |
|
22 | - } else { |
|
23 | - return false; |
|
24 | - } |
|
25 | - } catch (PDOException $e) { |
|
26 | - die($e->getMessage()); |
|
27 | - } |
|
28 | - } |
|
29 | - |
|
30 | - public function add_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning) |
|
31 | - { |
|
32 | - $querystring = 'INSERT INTO `sla` (`slaid`,`namasla`,`responsetime`, `resolutiontime`, `slawarning`) VALUES (?, ?, ?, ?, ?)'; |
|
33 | - $query = $this->db->prepare($querystring); |
|
34 | - $query->bindValue(1, $slaid); |
|
35 | - $query->bindValue(2, $namasla); |
|
36 | - $query->bindValue(3, $responsetime); |
|
37 | - $query->bindValue(4, $resolutiontime); |
|
38 | - $query->bindValue(5, $slawarning); |
|
39 | - |
|
40 | - try { |
|
41 | - $query->execute(); |
|
42 | - } catch (PDOException $e) { |
|
43 | - die($e->getMessage()); |
|
44 | - } |
|
45 | - } |
|
46 | - |
|
47 | - public function update_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning) |
|
48 | - { |
|
49 | - $querystring = 'UPDATE `sla` SET `namasla` = ? , `responsetime` = ? , `resolutiontime` = ?, `slawarning` = ? WHERE `slaid` = ?'; |
|
50 | - $query = $this->db->prepare($querystring); |
|
51 | - $query->bindValue(1, $namasla); |
|
52 | - $query->bindValue(2, $responsetime); |
|
53 | - $query->bindValue(3, $resolutiontime); |
|
54 | - $query->bindValue(4, $slawarning); |
|
55 | - $query->bindValue(5, $slaid); |
|
56 | - |
|
57 | - try { |
|
58 | - $query->execute(); |
|
59 | - } catch (PDOException $e) { |
|
60 | - die($e->getMessage()); |
|
61 | - } |
|
62 | - } |
|
63 | - |
|
64 | - public function delete($id) |
|
65 | - { |
|
66 | - $sql = 'DELETE FROM `sla` WHERE `slaid` = ?'; |
|
67 | - $query = $this->db->prepare($sql); |
|
68 | - $query->bindValue(1, $id); |
|
69 | - |
|
70 | - try { |
|
71 | - $query->execute(); |
|
72 | - } catch (PDOException $e) { |
|
73 | - die($e->getMessage()); |
|
74 | - } |
|
75 | - } |
|
76 | - |
|
77 | - public function sla_data($slaid) |
|
78 | - { |
|
79 | - $query = $this->db->prepare('SELECT * FROM `sla` WHERE `slaid`= ?'); |
|
80 | - $query->bindValue(1, $slaid); |
|
81 | - |
|
82 | - try { |
|
83 | - $query->execute(); |
|
84 | - |
|
85 | - return $query->fetch(); |
|
86 | - } catch (PDOException $e) { |
|
87 | - die($e->getMessage()); |
|
88 | - } |
|
89 | - } |
|
90 | - |
|
91 | - public function get_sla() |
|
92 | - { |
|
93 | - $query = $this->db->prepare('SELECT * FROM `sla` ORDER BY `slaid` ASC'); |
|
94 | - |
|
95 | - try { |
|
96 | - $query->execute(); |
|
97 | - } catch (PDOException $e) { |
|
98 | - die($e->getMessage()); |
|
99 | - } |
|
100 | - |
|
101 | - return $query->fetchAll(); |
|
102 | - } |
|
5 | + private $db; |
|
6 | + |
|
7 | + public function __construct($database) |
|
8 | + { |
|
9 | + $this->db = $database; |
|
10 | + } |
|
11 | + |
|
12 | + public function sla_exists($slaid) |
|
13 | + { |
|
14 | + $query = $this->db->prepare('SELECT COUNT(`slaid`) FROM `sla` WHERE `slaid`= ?'); |
|
15 | + $query->bindValue(1, $slaid); |
|
16 | + |
|
17 | + try { |
|
18 | + $query->execute(); |
|
19 | + $rows = $query->fetchColumn(); |
|
20 | + if ($rows == 1) { |
|
21 | + return true; |
|
22 | + } else { |
|
23 | + return false; |
|
24 | + } |
|
25 | + } catch (PDOException $e) { |
|
26 | + die($e->getMessage()); |
|
27 | + } |
|
28 | + } |
|
29 | + |
|
30 | + public function add_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning) |
|
31 | + { |
|
32 | + $querystring = 'INSERT INTO `sla` (`slaid`,`namasla`,`responsetime`, `resolutiontime`, `slawarning`) VALUES (?, ?, ?, ?, ?)'; |
|
33 | + $query = $this->db->prepare($querystring); |
|
34 | + $query->bindValue(1, $slaid); |
|
35 | + $query->bindValue(2, $namasla); |
|
36 | + $query->bindValue(3, $responsetime); |
|
37 | + $query->bindValue(4, $resolutiontime); |
|
38 | + $query->bindValue(5, $slawarning); |
|
39 | + |
|
40 | + try { |
|
41 | + $query->execute(); |
|
42 | + } catch (PDOException $e) { |
|
43 | + die($e->getMessage()); |
|
44 | + } |
|
45 | + } |
|
46 | + |
|
47 | + public function update_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning) |
|
48 | + { |
|
49 | + $querystring = 'UPDATE `sla` SET `namasla` = ? , `responsetime` = ? , `resolutiontime` = ?, `slawarning` = ? WHERE `slaid` = ?'; |
|
50 | + $query = $this->db->prepare($querystring); |
|
51 | + $query->bindValue(1, $namasla); |
|
52 | + $query->bindValue(2, $responsetime); |
|
53 | + $query->bindValue(3, $resolutiontime); |
|
54 | + $query->bindValue(4, $slawarning); |
|
55 | + $query->bindValue(5, $slaid); |
|
56 | + |
|
57 | + try { |
|
58 | + $query->execute(); |
|
59 | + } catch (PDOException $e) { |
|
60 | + die($e->getMessage()); |
|
61 | + } |
|
62 | + } |
|
63 | + |
|
64 | + public function delete($id) |
|
65 | + { |
|
66 | + $sql = 'DELETE FROM `sla` WHERE `slaid` = ?'; |
|
67 | + $query = $this->db->prepare($sql); |
|
68 | + $query->bindValue(1, $id); |
|
69 | + |
|
70 | + try { |
|
71 | + $query->execute(); |
|
72 | + } catch (PDOException $e) { |
|
73 | + die($e->getMessage()); |
|
74 | + } |
|
75 | + } |
|
76 | + |
|
77 | + public function sla_data($slaid) |
|
78 | + { |
|
79 | + $query = $this->db->prepare('SELECT * FROM `sla` WHERE `slaid`= ?'); |
|
80 | + $query->bindValue(1, $slaid); |
|
81 | + |
|
82 | + try { |
|
83 | + $query->execute(); |
|
84 | + |
|
85 | + return $query->fetch(); |
|
86 | + } catch (PDOException $e) { |
|
87 | + die($e->getMessage()); |
|
88 | + } |
|
89 | + } |
|
90 | + |
|
91 | + public function get_sla() |
|
92 | + { |
|
93 | + $query = $this->db->prepare('SELECT * FROM `sla` ORDER BY `slaid` ASC'); |
|
94 | + |
|
95 | + try { |
|
96 | + $query->execute(); |
|
97 | + } catch (PDOException $e) { |
|
98 | + die($e->getMessage()); |
|
99 | + } |
|
100 | + |
|
101 | + return $query->fetchAll(); |
|
102 | + } |
|
103 | 103 | } |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | $rows = $query->fetchColumn(); |
20 | 20 | if ($rows == 1) { |
21 | 21 | return true; |
22 | - } else { |
|
22 | + }else { |
|
23 | 23 | return false; |
24 | 24 | } |
25 | - } catch (PDOException $e) { |
|
25 | + }catch (PDOException $e) { |
|
26 | 26 | die($e->getMessage()); |
27 | 27 | } |
28 | 28 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | try { |
41 | 41 | $query->execute(); |
42 | - } catch (PDOException $e) { |
|
42 | + }catch (PDOException $e) { |
|
43 | 43 | die($e->getMessage()); |
44 | 44 | } |
45 | 45 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | try { |
58 | 58 | $query->execute(); |
59 | - } catch (PDOException $e) { |
|
59 | + }catch (PDOException $e) { |
|
60 | 60 | die($e->getMessage()); |
61 | 61 | } |
62 | 62 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | try { |
71 | 71 | $query->execute(); |
72 | - } catch (PDOException $e) { |
|
72 | + }catch (PDOException $e) { |
|
73 | 73 | die($e->getMessage()); |
74 | 74 | } |
75 | 75 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $query->execute(); |
84 | 84 | |
85 | 85 | return $query->fetch(); |
86 | - } catch (PDOException $e) { |
|
86 | + }catch (PDOException $e) { |
|
87 | 87 | die($e->getMessage()); |
88 | 88 | } |
89 | 89 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | try { |
96 | 96 | $query->execute(); |
97 | - } catch (PDOException $e) { |
|
97 | + }catch (PDOException $e) { |
|
98 | 98 | die($e->getMessage()); |
99 | 99 | } |
100 | 100 |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $config = [ |
4 | - 'host' => 'localhost', |
|
5 | - 'username' => 'root', |
|
6 | - 'password' => 'root', |
|
7 | - 'dbname' => 'helpdesk', |
|
4 | + 'host' => 'localhost', |
|
5 | + 'username' => 'root', |
|
6 | + 'password' => 'root', |
|
7 | + 'dbname' => 'helpdesk', |
|
8 | 8 | ]; |
9 | 9 | |
10 | 10 | $db = new PDO('mysql:host='.$config['host'].';dbname='.$config['dbname'], $config['username'], $config['password']); |