@@ -2,9 +2,9 @@ discard block |
||
2 | 2 | require 'core/init.php'; |
3 | 3 | $general->logged_out_protect(); |
4 | 4 | $user = $users->userdata($_SESSION['loginid']); |
5 | -if($user['level'] != "Admin") |
|
5 | +if ($user['level'] != "Admin") |
|
6 | 6 | { exit("You don't have permission to access this page!"); } |
7 | -$news = $hdnews->get_news(); |
|
7 | +$news = $hdnews->get_news(); |
|
8 | 8 | ?> |
9 | 9 | <!DOCTYPE HTML> |
10 | 10 | <html> |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | <?php |
59 | 59 | foreach ($news as $thenews) |
60 | 60 | { |
61 | - echo '<td>'.date('d-M-Y',$thenews['newsdate']).'</td>'. |
|
62 | - '<td>'.'<a href=hdnewsedit.php?id='.$thenews['id']. '>'.$thenews['title'].'</td>'. |
|
61 | + echo '<td>'.date('d-M-Y', $thenews['newsdate']).'</td>'. |
|
62 | + '<td>'.'<a href=hdnewsedit.php?id='.$thenews['id'].'>'.$thenews['title'].'</td>'. |
|
63 | 63 | '<td>'.$thenews['createdby'].'</td>'. |
64 | - '<td>'.date('d-M-Y',$thenews['createdon']).'</td>'. |
|
65 | - '<td>'.date('d-M-Y',$thenews['expired']).'</td>'. |
|
66 | - '<td><a href=hdnewsdel.php?id='.$thenews['id']. ' onclick="return delete_confirm();">del</a></td></tr>'; |
|
64 | + '<td>'.date('d-M-Y', $thenews['createdon']).'</td>'. |
|
65 | + '<td>'.date('d-M-Y', $thenews['expired']).'</td>'. |
|
66 | + '<td><a href=hdnewsdel.php?id='.$thenews['id'].' onclick="return delete_confirm();">del</a></td></tr>'; |
|
67 | 67 | } |
68 | 68 | ?> |
69 | 69 | </tbody> |
@@ -11,13 +11,13 @@ |
||
11 | 11 | require_once 'classes/sla.php'; |
12 | 12 | require_once 'classes/emails.php'; |
13 | 13 | |
14 | -$general = new General(); |
|
15 | -$users = new Users($db); |
|
16 | -$customers = new Customers($db); |
|
17 | -$projects = new Projects($db); |
|
18 | -$tickets = new Tickets($db); |
|
14 | +$general = new General(); |
|
15 | +$users = new Users($db); |
|
16 | +$customers = new Customers($db); |
|
17 | +$projects = new Projects($db); |
|
18 | +$tickets = new Tickets($db); |
|
19 | 19 | $hdnews = new HDNews($db); |
20 | -$slas = new SLA($db); |
|
20 | +$slas = new SLA($db); |
|
21 | 21 | $emails = new Emails($db); |
22 | 22 | |
23 | 23 | $errors = array(); |
@@ -17,6 +17,6 @@ |
||
17 | 17 | $slas = new SLA($db); |
18 | 18 | $emails = new Emails($db); |
19 | 19 | } catch (Exception $e) { |
20 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
20 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
21 | 21 | } |
22 | 22 | ?> |
23 | 23 | \ No newline at end of file |
@@ -8,15 +8,15 @@ |
||
8 | 8 | } |
9 | 9 | spl_autoload_register('my_autoload'); |
10 | 10 | try { |
11 | - $general = new General(); |
|
12 | - $users = new Users($db); |
|
13 | - $customers = new Customers($db); |
|
14 | - $projects = new Projects($db); |
|
15 | - $tickets = new Tickets($db); |
|
11 | + $general = new General(); |
|
12 | + $users = new Users($db); |
|
13 | + $customers = new Customers($db); |
|
14 | + $projects = new Projects($db); |
|
15 | + $tickets = new Tickets($db); |
|
16 | 16 | $hdnews = new HDNews($db); |
17 | - $slas = new SLA($db); |
|
17 | + $slas = new SLA($db); |
|
18 | 18 | $emails = new Emails($db); |
19 | -} catch (Exception $e) { |
|
20 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
19 | +}catch (Exception $e) { |
|
20 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
21 | 21 | } |
22 | 22 | ?> |
23 | 23 | \ No newline at end of file |
@@ -6,7 +6,7 @@ |
||
6 | 6 | 'dbname' => 'helpdesk' |
7 | 7 | ); |
8 | 8 | |
9 | -$db = new PDO('mysql:host=' . $config['host'] . ';dbname=' . $config['dbname'], $config['username'], $config['password']); |
|
9 | +$db = new PDO('mysql:host='.$config['host'].';dbname='.$config['dbname'], $config['username'], $config['password']); |
|
10 | 10 | $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
11 | 11 | |
12 | 12 | ?> |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | class General |
3 | -{ public function logged_in () { |
|
3 | +{ public function logged_in() { |
|
4 | 4 | return(isset($_SESSION['loginid'])) ? true : false; |
5 | 5 | } |
6 | 6 | public function logged_in_protect() { |
@@ -1,24 +1,24 @@ discard block |
||
1 | 1 | <?php |
2 | -class HDNews{ |
|
2 | +class HDNews { |
|
3 | 3 | private $db; |
4 | 4 | public function __construct($database) |
5 | 5 | { $this->db = $database; } |
6 | - public function add_news($newsdate,$title,$detail,$createdby,$createdon,$expired) |
|
7 | - { $query = $this->db->prepare("INSERT INTO `news` (`newsdate`,`title`, `detail`, `createdby`, `createdon`, `expired`) VALUES (?, ?, ?, ?, ?, ?)"); |
|
6 | + public function add_news($newsdate, $title, $detail, $createdby, $createdon, $expired) |
|
7 | + { $query = $this->db->prepare("INSERT INTO `news` (`newsdate`,`title`, `detail`, `createdby`, `createdon`, `expired`) VALUES (?, ?, ?, ?, ?, ?)"); |
|
8 | 8 | $query->bindValue(1, $newsdate); |
9 | 9 | $query->bindValue(2, $title); |
10 | 10 | $query->bindValue(3, $detail); |
11 | 11 | $query->bindValue(4, $createdby); |
12 | 12 | $query->bindValue(5, $createdon); |
13 | 13 | $query->bindValue(6, $expired); |
14 | - try{ |
|
14 | + try { |
|
15 | 15 | $query->execute(); |
16 | - }catch(PDOException $e){ |
|
16 | + }catch (PDOException $e) { |
|
17 | 17 | die($e->getMessage()); |
18 | 18 | } |
19 | 19 | } |
20 | - public function update_news($id,$newsdate,$title,$detail,$createdby,$createdon,$expired) |
|
21 | - { $query = $this->db->prepare("UPDATE `news` SET `newsdate` = ? , `title` = ? ,`detail` = ? , `createdby` = ? , `createdon` = ? , `expired` = ? WHERE `id` = ?"); |
|
20 | + public function update_news($id, $newsdate, $title, $detail, $createdby, $createdon, $expired) |
|
21 | + { $query = $this->db->prepare("UPDATE `news` SET `newsdate` = ? , `title` = ? ,`detail` = ? , `createdby` = ? , `createdon` = ? , `expired` = ? WHERE `id` = ?"); |
|
22 | 22 | $query->bindValue(1, $newsdate); |
23 | 23 | $query->bindValue(2, $title); |
24 | 24 | $query->bindValue(3, $detail); |
@@ -26,21 +26,21 @@ discard block |
||
26 | 26 | $query->bindValue(5, $createdon); |
27 | 27 | $query->bindValue(6, $expired); |
28 | 28 | $query->bindValue(7, $id); |
29 | - try{ |
|
29 | + try { |
|
30 | 30 | $query->execute(); |
31 | 31 | } |
32 | - catch(PDOException $e){ |
|
32 | + catch (PDOException $e) { |
|
33 | 33 | die($e->getMessage()); |
34 | 34 | } |
35 | 35 | } |
36 | - public function delete($id){ |
|
37 | - $sql="DELETE FROM `news` WHERE `id` = ?"; |
|
36 | + public function delete($id) { |
|
37 | + $sql = "DELETE FROM `news` WHERE `id` = ?"; |
|
38 | 38 | $query = $this->db->prepare($sql); |
39 | 39 | $query->bindValue(1, $id); |
40 | - try{ |
|
40 | + try { |
|
41 | 41 | $query->execute(); |
42 | 42 | } |
43 | - catch(PDOException $e){ |
|
43 | + catch (PDOException $e) { |
|
44 | 44 | die($e->getMessage()); |
45 | 45 | } |
46 | 46 | } |
@@ -48,27 +48,27 @@ discard block |
||
48 | 48 | public function news_data($id) |
49 | 49 | { $query = $this->db->prepare("SELECT * FROM `news` WHERE `id`= ?"); |
50 | 50 | $query->bindValue(1, $id); |
51 | - try{ |
|
51 | + try { |
|
52 | 52 | $query->execute(); |
53 | 53 | return $query->fetch(); |
54 | - } catch(PDOException $e){ |
|
54 | + }catch (PDOException $e) { |
|
55 | 55 | die($e->getMessage()); |
56 | 56 | } |
57 | 57 | } |
58 | 58 | public function get_news() |
59 | 59 | { $query = $this->db->prepare("SELECT * FROM `news` ORDER BY `newsdate` ASC"); |
60 | - try{ |
|
60 | + try { |
|
61 | 61 | $query->execute(); |
62 | - }catch(PDOException $e){ |
|
62 | + }catch (PDOException $e) { |
|
63 | 63 | die($e->getMessage()); |
64 | 64 | } |
65 | 65 | return $query->fetchAll(); |
66 | 66 | } |
67 | 67 | public function get_headline_news() |
68 | 68 | { $query = $this->db->prepare("SELECT * FROM `news` WHERE UNIX_TIMESTAMP( curdate( ) ) < `expired` ORDER BY `newsdate` ASC"); |
69 | - try{ |
|
69 | + try { |
|
70 | 70 | $query->execute(); |
71 | - }catch(PDOException $e){ |
|
71 | + }catch (PDOException $e) { |
|
72 | 72 | die($e->getMessage()); |
73 | 73 | } |
74 | 74 | return $query->fetchAll(); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | $query->bindValue(6, $expired); |
14 | 14 | try{ |
15 | 15 | $query->execute(); |
16 | - }catch(PDOException $e){ |
|
16 | + } catch(PDOException $e){ |
|
17 | 17 | die($e->getMessage()); |
18 | 18 | } |
19 | 19 | } |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | $query->bindValue(7, $id); |
29 | 29 | try{ |
30 | 30 | $query->execute(); |
31 | - } |
|
32 | - catch(PDOException $e){ |
|
31 | + } catch(PDOException $e){ |
|
33 | 32 | die($e->getMessage()); |
34 | 33 | } |
35 | 34 | } |
@@ -39,8 +38,7 @@ discard block |
||
39 | 38 | $query->bindValue(1, $id); |
40 | 39 | try{ |
41 | 40 | $query->execute(); |
42 | - } |
|
43 | - catch(PDOException $e){ |
|
41 | + } catch(PDOException $e){ |
|
44 | 42 | die($e->getMessage()); |
45 | 43 | } |
46 | 44 | } |
@@ -59,7 +57,7 @@ discard block |
||
59 | 57 | { $query = $this->db->prepare("SELECT * FROM `news` ORDER BY `newsdate` ASC"); |
60 | 58 | try{ |
61 | 59 | $query->execute(); |
62 | - }catch(PDOException $e){ |
|
60 | + } catch(PDOException $e){ |
|
63 | 61 | die($e->getMessage()); |
64 | 62 | } |
65 | 63 | return $query->fetchAll(); |
@@ -68,7 +66,7 @@ discard block |
||
68 | 66 | { $query = $this->db->prepare("SELECT * FROM `news` WHERE UNIX_TIMESTAMP( curdate( ) ) < `expired` ORDER BY `newsdate` ASC"); |
69 | 67 | try{ |
70 | 68 | $query->execute(); |
71 | - }catch(PDOException $e){ |
|
69 | + } catch(PDOException $e){ |
|
72 | 70 | die($e->getMessage()); |
73 | 71 | } |
74 | 72 | return $query->fetchAll(); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | date_default_timezone_set('Asia/Jakarta'); |
3 | -class Emails{ |
|
3 | +class Emails { |
|
4 | 4 | private $db; |
5 | 5 | public function __construct($database) |
6 | 6 | { $this->db = $database; } |
7 | - public function add_email($idticket,$senddate,$emailto,$emailcc,$emailbcc,$emailsubject,$message,$emailstatus) |
|
7 | + public function add_email($idticket, $senddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message, $emailstatus) |
|
8 | 8 | { $querystring = "INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; |
9 | - $query = $this->db->prepare($querystring); |
|
9 | + $query = $this->db->prepare($querystring); |
|
10 | 10 | $query->bindValue(1, $idticket); |
11 | 11 | $query->bindValue(2, $senddate); |
12 | 12 | $query->bindValue(3, $emailto); |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | $query->bindValue(6, $emailsubject); |
16 | 16 | $query->bindValue(7, $message); |
17 | 17 | $query->bindValue(8, $emailstatus); |
18 | - try{ |
|
18 | + try { |
|
19 | 19 | $query->execute(); |
20 | - }catch(PDOException $e){ |
|
20 | + }catch (PDOException $e) { |
|
21 | 21 | die($e->getMessage()); |
22 | 22 | } |
23 | 23 | } |
24 | - public function add_sla_remainder($idticket,$ticketnumber,$slasenddate,$emailto,$emailcc,$emailbcc,$emailsubject,$message) |
|
24 | + public function add_sla_remainder($idticket, $ticketnumber, $slasenddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message) |
|
25 | 25 | { $emailsubject = "Ticket No: $ticketnumber has reached 75% of SLA Resolution Goal Time"; |
26 | 26 | $message = |
27 | 27 | "Dear Assignee, \r\n |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | Regards, \r\n |
32 | 32 | Helpdesk"; |
33 | 33 | $querystring = "INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; |
34 | - $query = $this->db->prepare($querystring); |
|
34 | + $query = $this->db->prepare($querystring); |
|
35 | 35 | $query->bindValue(1, $idticket); |
36 | 36 | $query->bindValue(2, $slasenddate); |
37 | 37 | $query->bindValue(3, $emailto); |
@@ -40,90 +40,90 @@ discard block |
||
40 | 40 | $query->bindValue(6, $emailsubject); |
41 | 41 | $query->bindValue(7, $message); |
42 | 42 | $query->bindValue(8, 'SLA Remainder'); |
43 | - try{ |
|
43 | + try { |
|
44 | 44 | $query->execute(); |
45 | - }catch(PDOException $e){ |
|
45 | + }catch (PDOException $e) { |
|
46 | 46 | die($e->getMessage()); |
47 | 47 | } |
48 | 48 | } |
49 | - public function update_status_email($idemail,$emailstatus) |
|
49 | + public function update_status_email($idemail, $emailstatus) |
|
50 | 50 | { $querystring = "UPDATE `log_emails` SET `emailstatus` = ? WHERE `idemail` = ?"; |
51 | - $query = $this->db->prepare($querystring); |
|
51 | + $query = $this->db->prepare($querystring); |
|
52 | 52 | $query->bindValue(1, $emailstatus); |
53 | 53 | $query->bindValue(2, $idemail); |
54 | - try{ |
|
54 | + try { |
|
55 | 55 | $query->execute(); |
56 | 56 | } |
57 | - catch(PDOException $e){ |
|
57 | + catch (PDOException $e) { |
|
58 | 58 | die($e->getMessage()); |
59 | 59 | } |
60 | 60 | |
61 | 61 | } |
62 | - public function delete($idemail){ |
|
63 | - $sql="DELETE FROM `log_emails` WHERE `idemail` = ?"; |
|
62 | + public function delete($idemail) { |
|
63 | + $sql = "DELETE FROM `log_emails` WHERE `idemail` = ?"; |
|
64 | 64 | $query = $this->db->prepare($sql); |
65 | 65 | $query->bindValue(1, $idemail); |
66 | - try{ |
|
66 | + try { |
|
67 | 67 | $query->execute(); |
68 | 68 | } |
69 | - catch(PDOException $e){ |
|
69 | + catch (PDOException $e) { |
|
70 | 70 | die($e->getMessage()); |
71 | 71 | } |
72 | 72 | } |
73 | 73 | public function get_email_by_idemail($idemail) |
74 | 74 | { $query = $this->db->prepare("SELECT * FROM `log_emails` WHERE `idemail`= ?"); |
75 | 75 | $query->bindValue(1, $idemail); |
76 | - try{ |
|
76 | + try { |
|
77 | 77 | $query->execute(); |
78 | 78 | return $query->fetch(); |
79 | - } catch(PDOException $e){ |
|
79 | + }catch (PDOException $e) { |
|
80 | 80 | die($e->getMessage()); |
81 | 81 | } |
82 | 82 | } |
83 | 83 | public function get_email_by_idticket($idticket) |
84 | 84 | { $query = $this->db->prepare("SELECT * FROM `log_emails` WHERE `idticket`= ?"); |
85 | 85 | $query->bindValue(1, $idticket); |
86 | - try{ |
|
86 | + try { |
|
87 | 87 | $query->execute(); |
88 | 88 | return $query->fetch(); |
89 | - } catch(PDOException $e){ |
|
89 | + }catch (PDOException $e) { |
|
90 | 90 | die($e->getMessage()); |
91 | 91 | } |
92 | 92 | } |
93 | 93 | public function get_email_by_status($emailstatus) |
94 | 94 | { $query = $this->db->prepare("SELECT * FROM `log_emails` WHERE `emailstatus`= ?"); |
95 | 95 | $query->bindValue(1, $emailstatus); |
96 | - try{ |
|
96 | + try { |
|
97 | 97 | $query->execute(); |
98 | - }catch(PDOException $e){ |
|
98 | + }catch (PDOException $e) { |
|
99 | 99 | die($e->getMessage()); |
100 | 100 | } |
101 | 101 | return $query->fetchAll(); |
102 | 102 | } |
103 | 103 | public function get_email_sla_remainder() |
104 | 104 | { $query = $this->db->prepare("SELECT * FROM `log_emails` WHERE `emailstatus`= ? and senddate <= UNIX_TIMESTAMP(NOW())"); |
105 | - $query->bindValue(1,'SLA Remainder'); |
|
106 | - try{ |
|
105 | + $query->bindValue(1, 'SLA Remainder'); |
|
106 | + try { |
|
107 | 107 | $query->execute(); |
108 | - }catch(PDOException $e){ |
|
108 | + }catch (PDOException $e) { |
|
109 | 109 | die($e->getMessage()); |
110 | 110 | } |
111 | 111 | return $query->fetchAll(); |
112 | 112 | } |
113 | 113 | public function get_email() |
114 | 114 | { $query = $this->db->prepare("SELECT * FROM `log_emails` ORDER BY `idemail` ASC"); |
115 | - try{ |
|
115 | + try { |
|
116 | 116 | $query->execute(); |
117 | - }catch(PDOException $e){ |
|
117 | + }catch (PDOException $e) { |
|
118 | 118 | die($e->getMessage()); |
119 | 119 | } |
120 | 120 | return $query->fetchAll(); |
121 | 121 | } |
122 | 122 | public function get_email_queue() |
123 | 123 | { $query = $this->db->prepare("SELECT * FROM `log_emails` WHERE `emailstatus` <> 'Sent' AND senddate <= UNIX_TIMESTAMP(NOW()) ORDER BY `senddate` ASC"); |
124 | - try{ |
|
124 | + try { |
|
125 | 125 | $query->execute(); |
126 | - }catch(PDOException $e){ |
|
126 | + }catch (PDOException $e) { |
|
127 | 127 | die($e->getMessage()); |
128 | 128 | } |
129 | 129 | return $query->fetchAll(); |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | public function get_email_queue_by_id($idemail) |
132 | 132 | { $query = $this->db->prepare("SELECT * FROM `log_emails` WHERE `idemail`= ?"); |
133 | 133 | $query->bindValue(1, $idemail); |
134 | - try{ |
|
134 | + try { |
|
135 | 135 | $query->execute(); |
136 | 136 | return $query->fetch(); |
137 | - } catch(PDOException $e){ |
|
137 | + }catch (PDOException $e) { |
|
138 | 138 | die($e->getMessage()); |
139 | 139 | } |
140 | 140 | } |
141 | 141 | public function send_new_ticket() |
142 | - { if (substr(php_uname(), 0, 7) == "Windows"){ |
|
142 | + { if (substr(php_uname(), 0, 7) == "Windows") { |
|
143 | 143 | //$cmd = "D:\mowes_portable\www\helpdesk\batch\sendnewticket.bat"; |
144 | 144 | $cmd = "C:\xampp\htdocs\helpdesk\batch\sendnewticket.bat"; |
145 | 145 | $WshShell = new COM("WScript.Shell"); |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | } |
149 | 149 | else { |
150 | 150 | $cmd = "php /batch/sendnewticket.bat"; |
151 | - exec($cmd . " > /dev/null &"); |
|
151 | + exec($cmd." > /dev/null &"); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | public function send_sla_remainder() |
155 | - { if (substr(php_uname(), 0, 7) == "Windows"){ |
|
155 | + { if (substr(php_uname(), 0, 7) == "Windows") { |
|
156 | 156 | //$cmd = "D:\mowes_portable\www\helpdesk\batch\sendslaremainder.bat"; |
157 | 157 | $cmd = "C:\xampp\htdocs\helpdesk\batch\sendslaremainder.bat"; |
158 | 158 | $WshShell = new COM("WScript.Shell"); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } |
162 | 162 | else { |
163 | 163 | $cmd = "php /batch/sendslaremainder.bat"; |
164 | - exec($cmd . " > /dev/null &"); |
|
164 | + exec($cmd." > /dev/null &"); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
168 | 168 | \ No newline at end of file |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | $query->bindValue(8, $emailstatus); |
18 | 18 | try{ |
19 | 19 | $query->execute(); |
20 | - }catch(PDOException $e){ |
|
20 | + } catch(PDOException $e){ |
|
21 | 21 | die($e->getMessage()); |
22 | 22 | } |
23 | 23 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $query->bindValue(8, 'SLA Remainder'); |
43 | 43 | try{ |
44 | 44 | $query->execute(); |
45 | - }catch(PDOException $e){ |
|
45 | + } catch(PDOException $e){ |
|
46 | 46 | die($e->getMessage()); |
47 | 47 | } |
48 | 48 | } |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | $query->bindValue(2, $idemail); |
54 | 54 | try{ |
55 | 55 | $query->execute(); |
56 | - } |
|
57 | - catch(PDOException $e){ |
|
56 | + } catch(PDOException $e){ |
|
58 | 57 | die($e->getMessage()); |
59 | 58 | } |
60 | 59 | |
@@ -65,8 +64,7 @@ discard block |
||
65 | 64 | $query->bindValue(1, $idemail); |
66 | 65 | try{ |
67 | 66 | $query->execute(); |
68 | - } |
|
69 | - catch(PDOException $e){ |
|
67 | + } catch(PDOException $e){ |
|
70 | 68 | die($e->getMessage()); |
71 | 69 | } |
72 | 70 | } |
@@ -95,7 +93,7 @@ discard block |
||
95 | 93 | $query->bindValue(1, $emailstatus); |
96 | 94 | try{ |
97 | 95 | $query->execute(); |
98 | - }catch(PDOException $e){ |
|
96 | + } catch(PDOException $e){ |
|
99 | 97 | die($e->getMessage()); |
100 | 98 | } |
101 | 99 | return $query->fetchAll(); |
@@ -105,7 +103,7 @@ discard block |
||
105 | 103 | $query->bindValue(1,'SLA Remainder'); |
106 | 104 | try{ |
107 | 105 | $query->execute(); |
108 | - }catch(PDOException $e){ |
|
106 | + } catch(PDOException $e){ |
|
109 | 107 | die($e->getMessage()); |
110 | 108 | } |
111 | 109 | return $query->fetchAll(); |
@@ -114,7 +112,7 @@ discard block |
||
114 | 112 | { $query = $this->db->prepare("SELECT * FROM `log_emails` ORDER BY `idemail` ASC"); |
115 | 113 | try{ |
116 | 114 | $query->execute(); |
117 | - }catch(PDOException $e){ |
|
115 | + } catch(PDOException $e){ |
|
118 | 116 | die($e->getMessage()); |
119 | 117 | } |
120 | 118 | return $query->fetchAll(); |
@@ -123,7 +121,7 @@ discard block |
||
123 | 121 | { $query = $this->db->prepare("SELECT * FROM `log_emails` WHERE `emailstatus` <> 'Sent' AND senddate <= UNIX_TIMESTAMP(NOW()) ORDER BY `senddate` ASC"); |
124 | 122 | try{ |
125 | 123 | $query->execute(); |
126 | - }catch(PDOException $e){ |
|
124 | + } catch(PDOException $e){ |
|
127 | 125 | die($e->getMessage()); |
128 | 126 | } |
129 | 127 | return $query->fetchAll(); |
@@ -145,8 +143,7 @@ discard block |
||
145 | 143 | $WshShell = new COM("WScript.Shell"); |
146 | 144 | $oExec = $WshShell->Run("cmd /C $cmd", 0, false); |
147 | 145 | return $oExec == 0 ? true : false; |
148 | - } |
|
149 | - else { |
|
146 | + } else { |
|
150 | 147 | $cmd = "php /batch/sendnewticket.bat"; |
151 | 148 | exec($cmd . " > /dev/null &"); |
152 | 149 | } |
@@ -158,8 +155,7 @@ discard block |
||
158 | 155 | $WshShell = new COM("WScript.Shell"); |
159 | 156 | $oExec = $WshShell->Run("cmd /C $cmd", 0, false); |
160 | 157 | return $oExec == 0 ? true : false; |
161 | - } |
|
162 | - else { |
|
158 | + } else { |
|
163 | 159 | $cmd = "php /batch/sendslaremainder.bat"; |
164 | 160 | exec($cmd . " > /dev/null &"); |
165 | 161 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | date_default_timezone_set('Asia/Jakarta'); |
3 | -class Tickets{ |
|
3 | +class Tickets { |
|
4 | 4 | private $db; |
5 | 5 | public function __construct($database) |
6 | 6 | { $this->db = $database; } |
@@ -10,19 +10,19 @@ discard block |
||
10 | 10 | try |
11 | 11 | { $query->execute(); |
12 | 12 | $rows = $query->fetchColumn(); |
13 | - if($rows == 1){ |
|
13 | + if ($rows == 1) { |
|
14 | 14 | return true; |
15 | - }else{ |
|
15 | + }else { |
|
16 | 16 | return false; |
17 | 17 | } |
18 | - } catch (PDOException $e){ |
|
18 | + }catch (PDOException $e) { |
|
19 | 19 | die($e->getMessage()); |
20 | 20 | } |
21 | 21 | } |
22 | - public function add_ticket($ticketnumber,$sla,$reporteddate,$reportedby,$telp,$email,$problemsummary,$problemdetail,$ticketstatus,$assignee,$documentedby,$pro) |
|
23 | - { $current = time(); |
|
22 | + public function add_ticket($ticketnumber, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $documentedby, $pro) |
|
23 | + { $current = time(); |
|
24 | 24 | $querystring = "INSERT INTO `tickets` (`ticketnumber`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`documentedby`,`documenteddate`,`pro`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
25 | - $query = $this->db->prepare($querystring); |
|
25 | + $query = $this->db->prepare($querystring); |
|
26 | 26 | $query->bindValue(1, $ticketnumber); |
27 | 27 | $query->bindValue(2, $sla); |
28 | 28 | //$query->bindValue(3, $idcustomer); |
@@ -37,15 +37,15 @@ discard block |
||
37 | 37 | $query->bindValue(11, $documentedby); |
38 | 38 | $query->bindValue(12, $current); |
39 | 39 | $query->bindValue(13, $pro); |
40 | - try{ |
|
40 | + try { |
|
41 | 41 | $query->execute(); |
42 | - }catch(PDOException $e){ |
|
42 | + }catch (PDOException $e) { |
|
43 | 43 | die($e->getMessage()); |
44 | 44 | } |
45 | 45 | } |
46 | - public function update_ticket($id,$sla,$reporteddate,$reportedby,$telp,$email,$problemsummary,$problemdetail,$ticketstatus,$assignee,$assigneddate,$pendingby, $pendingdate, $resolution,$resolvedby,$resolveddate,$closedby,$closeddate) |
|
46 | + public function update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate) |
|
47 | 47 | { $querystring = "UPDATE `tickets` SET `sla` = ? , `reporteddate` = ? , `reportedby` = ? , `telp` = ? ,`email` = ? , `problemsummary` = ? , `problemdetail` = ? ,`ticketstatus` = ?, `assignee` = ? , `assigneddate` = ?, `pendingby` = ?,`pendingdate` = ?, `resolution` = ? ,`resolvedby` = ?,`resolveddate` = ?,`closedby` = ?,`closeddate` = ? WHERE `id` = ?"; |
48 | - $query = $this->db->prepare($querystring); |
|
48 | + $query = $this->db->prepare($querystring); |
|
49 | 49 | $query->bindValue(1, $sla); |
50 | 50 | $query->bindValue(2, $reporteddate); |
51 | 51 | $query->bindValue(3, $reportedby); |
@@ -64,57 +64,57 @@ discard block |
||
64 | 64 | $query->bindValue(16, $closedby); |
65 | 65 | $query->bindValue(17, $closeddate); |
66 | 66 | $query->bindValue(18, $id); |
67 | - try{ |
|
67 | + try { |
|
68 | 68 | $query->execute(); |
69 | 69 | } |
70 | - catch(PDOException $e){ |
|
70 | + catch (PDOException $e) { |
|
71 | 71 | die($e->getMessage()); |
72 | 72 | } |
73 | 73 | } |
74 | - public function delete($id){ |
|
75 | - $sql="DELETE FROM `tickets` WHERE `id` = ?"; |
|
74 | + public function delete($id) { |
|
75 | + $sql = "DELETE FROM `tickets` WHERE `id` = ?"; |
|
76 | 76 | $query = $this->db->prepare($sql); |
77 | 77 | $query->bindValue(1, $id); |
78 | - try{ |
|
78 | + try { |
|
79 | 79 | $query->execute(); |
80 | 80 | } |
81 | - catch(PDOException $e){ |
|
81 | + catch (PDOException $e) { |
|
82 | 82 | die($e->getMessage()); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | public function ticket_data($id) |
86 | 86 | { $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `id`= ?"); |
87 | 87 | $query->bindValue(1, $id); |
88 | - try{ |
|
88 | + try { |
|
89 | 89 | $query->execute(); |
90 | 90 | return $query->fetch(); |
91 | - } catch(PDOException $e){ |
|
91 | + }catch (PDOException $e) { |
|
92 | 92 | die($e->getMessage()); |
93 | 93 | } |
94 | 94 | } |
95 | 95 | public function get_tickets() |
96 | 96 | { $query = $this->db->prepare("SELECT * FROM `tickets` ORDER BY `ticketnumber` DESC"); |
97 | - try{ |
|
97 | + try { |
|
98 | 98 | $query->execute(); |
99 | - }catch(PDOException $e){ |
|
99 | + }catch (PDOException $e) { |
|
100 | 100 | die($e->getMessage()); |
101 | 101 | } |
102 | 102 | return $query->fetchAll(); |
103 | 103 | } |
104 | 104 | public function get_pro() |
105 | 105 | { $query = $this->db->prepare("SELECT pro FROM `tickets`"); |
106 | - try{ |
|
106 | + try { |
|
107 | 107 | $query->execute(); |
108 | - }catch(PDOException $e){ |
|
108 | + }catch (PDOException $e) { |
|
109 | 109 | die($e->getMessage()); |
110 | 110 | } |
111 | 111 | return $query->fetchAll(); |
112 | 112 | } |
113 | 113 | public function get_opened_tickets() |
114 | 114 | { $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `ticketstatus` <> 'Closed' ORDER BY `ticketnumber` DESC"); |
115 | - try{ |
|
115 | + try { |
|
116 | 116 | $query->execute(); |
117 | - }catch(PDOException $e){ |
|
117 | + }catch (PDOException $e) { |
|
118 | 118 | die($e->getMessage()); |
119 | 119 | } |
120 | 120 | return $query->fetchAll(); |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | public function get_tickets_by_requester($userid) |
123 | 123 | { $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `documentedby`= ? ORDER BY `ticketnumber` DESC"); |
124 | 124 | $query->bindValue(1, $userid); |
125 | - try{ |
|
125 | + try { |
|
126 | 126 | $query->execute(); |
127 | - }catch(PDOException $e){ |
|
127 | + }catch (PDOException $e) { |
|
128 | 128 | die($e->getMessage()); |
129 | 129 | } |
130 | 130 | return $query->fetchAll(); |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | public function get_tickets_by_assignee($userid) |
133 | 133 | { $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `assignee`= ? ORDER BY `ticketnumber` DESC"); |
134 | 134 | $query->bindValue(1, $userid); |
135 | - try{ |
|
135 | + try { |
|
136 | 136 | $query->execute(); |
137 | - }catch(PDOException $e){ |
|
137 | + }catch (PDOException $e) { |
|
138 | 138 | die($e->getMessage()); |
139 | 139 | } |
140 | 140 | return $query->fetchAll(); |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | public function get_tickets_by_resolver($username) |
143 | 143 | { $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `resolvedby`= ? ORDER BY `ticketnumber` DESC"); |
144 | 144 | $query->bindValue(1, $username); |
145 | - try{ |
|
145 | + try { |
|
146 | 146 | $query->execute(); |
147 | - }catch(PDOException $e){ |
|
147 | + }catch (PDOException $e) { |
|
148 | 148 | die($e->getMessage()); |
149 | 149 | } |
150 | 150 | return $query->fetchAll(); |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | { $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `resolvedby`=? and `ticketstatus` <> ? ORDER BY `ticketnumber` DESC"); |
154 | 154 | $query->bindValue(1, $username); |
155 | 155 | $query->bindValue(2, 'Closed'); |
156 | - try{ |
|
156 | + try { |
|
157 | 157 | $query->execute(); |
158 | - }catch(PDOException $e){ |
|
158 | + }catch (PDOException $e) { |
|
159 | 159 | die($e->getMessage()); |
160 | 160 | } |
161 | 161 | return $query->fetchAll(); |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | public function get_tickets_by_status($ticketstatus) |
164 | 164 | { $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `ticketstatus`=? ORDER BY `ticketnumber` DESC"); |
165 | 165 | $query->bindValue(1, $ticketstatus); |
166 | - try{ |
|
166 | + try { |
|
167 | 167 | $query->execute(); |
168 | - }catch(PDOException $e){ |
|
168 | + }catch (PDOException $e) { |
|
169 | 169 | die($e->getMessage()); |
170 | 170 | } |
171 | 171 | return $query->fetchAll(); |
@@ -174,57 +174,57 @@ discard block |
||
174 | 174 | { $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `documenteddate` >= ? AND `documenteddate` <= ? AND `ticketstatus` = 'Closed' ORDER BY `documenteddate` DESC"); |
175 | 175 | $query->bindValue(1, $fromperiod); |
176 | 176 | $query->bindValue(2, $toperiod); |
177 | - try{ |
|
177 | + try { |
|
178 | 178 | $query->execute(); |
179 | - }catch(PDOException $e){ |
|
179 | + }catch (PDOException $e) { |
|
180 | 180 | die($e->getMessage()); |
181 | 181 | } |
182 | 182 | return $query->fetchAll(); |
183 | 183 | } |
184 | 184 | public function count_tickets_by_customer() |
185 | 185 | { $query = $this->db->prepare("SELECT `idcustomer`, count(*) as `total` FROM `tickets` GROUP BY `idcustomer` ORDER BY total DESC LIMIT 5"); |
186 | - try{ |
|
186 | + try { |
|
187 | 187 | $query->execute(); |
188 | - }catch(PDOException $e){ |
|
188 | + }catch (PDOException $e) { |
|
189 | 189 | die($e->getMessage()); |
190 | 190 | } |
191 | 191 | return $query->fetchAll(); |
192 | 192 | } |
193 | 193 | public function count_tickets_by_status() |
194 | 194 | { $query = $this->db->prepare("SELECT ticketstatus, count(*) as total FROM `tickets` GROUP BY ticketstatus"); |
195 | - try{ |
|
195 | + try { |
|
196 | 196 | $query->execute(); |
197 | - }catch(PDOException $e){ |
|
197 | + }catch (PDOException $e) { |
|
198 | 198 | die($e->getMessage()); |
199 | 199 | } |
200 | 200 | return $query->fetchAll(); |
201 | 201 | } |
202 | 202 | public function count_resolved_tickets_by_month() |
203 | - { $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`))"; |
|
203 | + { $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`))"; |
|
204 | 204 | $query = $this->db->prepare($sql); |
205 | - try{ |
|
205 | + try { |
|
206 | 206 | $query->execute(); |
207 | - }catch(PDOException $e){ |
|
207 | + }catch (PDOException $e) { |
|
208 | 208 | die($e->getMessage()); |
209 | 209 | } |
210 | 210 | return $query->fetchAll(); |
211 | 211 | } |
212 | 212 | public function count_inprogress_tickets_by_month() |
213 | - { $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`))"; |
|
213 | + { $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`))"; |
|
214 | 214 | $query = $this->db->prepare($sql); |
215 | - try{ |
|
215 | + try { |
|
216 | 216 | $query->execute(); |
217 | - }catch(PDOException $e){ |
|
217 | + }catch (PDOException $e) { |
|
218 | 218 | die($e->getMessage()); |
219 | 219 | } |
220 | 220 | return $query->fetchAll(); |
221 | 221 | } |
222 | 222 | public function get_last_ticket() |
223 | 223 | { $query = $this->db->prepare("SELECT * FROM `tickets` ORDER BY id DESC LIMIT 1"); |
224 | - try{ |
|
224 | + try { |
|
225 | 225 | $query->execute(); |
226 | 226 | return $query->fetch(); |
227 | - } catch(PDOException $e){ |
|
227 | + }catch (PDOException $e) { |
|
228 | 228 | die($e->getMessage()); |
229 | 229 | } |
230 | 230 | }/* |
@@ -240,10 +240,10 @@ discard block |
||
240 | 240 | exec($cmd . " > /dev/null &"); |
241 | 241 | } |
242 | 242 | }*/ |
243 | - public function log_tickets($id,$sla,$reporteddate,$reportedby,$telp,$email,$problemsummary,$problemdetail,$ticketstatus,$assignee,$assigneddate,$pendingby, $pendingdate, $resolution,$resolvedby,$resolveddate,$closedby,$closeddate,$changes,$changeby) |
|
244 | - { $changedate = time(); |
|
243 | + public function log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby) |
|
244 | + { $changedate = time(); |
|
245 | 245 | $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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
246 | - $query = $this->db->prepare($querystring); |
|
246 | + $query = $this->db->prepare($querystring); |
|
247 | 247 | $query->bindValue(1, $id); |
248 | 248 | $query->bindValue(2, $sla); |
249 | 249 | $query->bindValue(3, $reporteddate); |
@@ -265,18 +265,18 @@ discard block |
||
265 | 265 | $query->bindValue(19, $changes); |
266 | 266 | $query->bindValue(20, $changeby); |
267 | 267 | $query->bindValue(21, $changedate); |
268 | - try{ |
|
268 | + try { |
|
269 | 269 | $query->execute(); |
270 | - }catch(PDOException $e){ |
|
270 | + }catch (PDOException $e) { |
|
271 | 271 | die($e->getMessage()); |
272 | 272 | } |
273 | 273 | } |
274 | 274 | public function get_audit_trail($id) |
275 | 275 | { $query = $this->db->prepare("SELECT * FROM `log_tickets` WHERE `id`= ? ORDER BY `changedate` DESC"); |
276 | 276 | $query->bindValue(1, $id); |
277 | - try{ |
|
277 | + try { |
|
278 | 278 | $query->execute(); |
279 | - }catch(PDOException $e){ |
|
279 | + }catch (PDOException $e) { |
|
280 | 280 | die($e->getMessage()); |
281 | 281 | } |
282 | 282 | return $query->fetchAll(); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $rows = $query->fetchColumn(); |
13 | 13 | if($rows == 1){ |
14 | 14 | return true; |
15 | - }else{ |
|
15 | + } else{ |
|
16 | 16 | return false; |
17 | 17 | } |
18 | 18 | } catch (PDOException $e){ |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $query->bindValue(13, $pro); |
40 | 40 | try{ |
41 | 41 | $query->execute(); |
42 | - }catch(PDOException $e){ |
|
42 | + } catch(PDOException $e){ |
|
43 | 43 | die($e->getMessage()); |
44 | 44 | } |
45 | 45 | } |
@@ -66,8 +66,7 @@ discard block |
||
66 | 66 | $query->bindValue(18, $id); |
67 | 67 | try{ |
68 | 68 | $query->execute(); |
69 | - } |
|
70 | - catch(PDOException $e){ |
|
69 | + } catch(PDOException $e){ |
|
71 | 70 | die($e->getMessage()); |
72 | 71 | } |
73 | 72 | } |
@@ -77,8 +76,7 @@ discard block |
||
77 | 76 | $query->bindValue(1, $id); |
78 | 77 | try{ |
79 | 78 | $query->execute(); |
80 | - } |
|
81 | - catch(PDOException $e){ |
|
79 | + } catch(PDOException $e){ |
|
82 | 80 | die($e->getMessage()); |
83 | 81 | } |
84 | 82 | } |
@@ -96,7 +94,7 @@ discard block |
||
96 | 94 | { $query = $this->db->prepare("SELECT * FROM `tickets` ORDER BY `ticketnumber` DESC"); |
97 | 95 | try{ |
98 | 96 | $query->execute(); |
99 | - }catch(PDOException $e){ |
|
97 | + } catch(PDOException $e){ |
|
100 | 98 | die($e->getMessage()); |
101 | 99 | } |
102 | 100 | return $query->fetchAll(); |
@@ -105,7 +103,7 @@ discard block |
||
105 | 103 | { $query = $this->db->prepare("SELECT pro FROM `tickets`"); |
106 | 104 | try{ |
107 | 105 | $query->execute(); |
108 | - }catch(PDOException $e){ |
|
106 | + } catch(PDOException $e){ |
|
109 | 107 | die($e->getMessage()); |
110 | 108 | } |
111 | 109 | return $query->fetchAll(); |
@@ -114,7 +112,7 @@ discard block |
||
114 | 112 | { $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `ticketstatus` <> 'Closed' ORDER BY `ticketnumber` DESC"); |
115 | 113 | try{ |
116 | 114 | $query->execute(); |
117 | - }catch(PDOException $e){ |
|
115 | + } catch(PDOException $e){ |
|
118 | 116 | die($e->getMessage()); |
119 | 117 | } |
120 | 118 | return $query->fetchAll(); |
@@ -124,7 +122,7 @@ discard block |
||
124 | 122 | $query->bindValue(1, $userid); |
125 | 123 | try{ |
126 | 124 | $query->execute(); |
127 | - }catch(PDOException $e){ |
|
125 | + } catch(PDOException $e){ |
|
128 | 126 | die($e->getMessage()); |
129 | 127 | } |
130 | 128 | return $query->fetchAll(); |
@@ -134,7 +132,7 @@ discard block |
||
134 | 132 | $query->bindValue(1, $userid); |
135 | 133 | try{ |
136 | 134 | $query->execute(); |
137 | - }catch(PDOException $e){ |
|
135 | + } catch(PDOException $e){ |
|
138 | 136 | die($e->getMessage()); |
139 | 137 | } |
140 | 138 | return $query->fetchAll(); |
@@ -144,7 +142,7 @@ discard block |
||
144 | 142 | $query->bindValue(1, $username); |
145 | 143 | try{ |
146 | 144 | $query->execute(); |
147 | - }catch(PDOException $e){ |
|
145 | + } catch(PDOException $e){ |
|
148 | 146 | die($e->getMessage()); |
149 | 147 | } |
150 | 148 | return $query->fetchAll(); |
@@ -155,7 +153,7 @@ discard block |
||
155 | 153 | $query->bindValue(2, 'Closed'); |
156 | 154 | try{ |
157 | 155 | $query->execute(); |
158 | - }catch(PDOException $e){ |
|
156 | + } catch(PDOException $e){ |
|
159 | 157 | die($e->getMessage()); |
160 | 158 | } |
161 | 159 | return $query->fetchAll(); |
@@ -165,7 +163,7 @@ discard block |
||
165 | 163 | $query->bindValue(1, $ticketstatus); |
166 | 164 | try{ |
167 | 165 | $query->execute(); |
168 | - }catch(PDOException $e){ |
|
166 | + } catch(PDOException $e){ |
|
169 | 167 | die($e->getMessage()); |
170 | 168 | } |
171 | 169 | return $query->fetchAll(); |
@@ -176,7 +174,7 @@ discard block |
||
176 | 174 | $query->bindValue(2, $toperiod); |
177 | 175 | try{ |
178 | 176 | $query->execute(); |
179 | - }catch(PDOException $e){ |
|
177 | + } catch(PDOException $e){ |
|
180 | 178 | die($e->getMessage()); |
181 | 179 | } |
182 | 180 | return $query->fetchAll(); |
@@ -185,7 +183,7 @@ discard block |
||
185 | 183 | { $query = $this->db->prepare("SELECT `idcustomer`, count(*) as `total` FROM `tickets` GROUP BY `idcustomer` ORDER BY total DESC LIMIT 5"); |
186 | 184 | try{ |
187 | 185 | $query->execute(); |
188 | - }catch(PDOException $e){ |
|
186 | + } catch(PDOException $e){ |
|
189 | 187 | die($e->getMessage()); |
190 | 188 | } |
191 | 189 | return $query->fetchAll(); |
@@ -194,7 +192,7 @@ discard block |
||
194 | 192 | { $query = $this->db->prepare("SELECT ticketstatus, count(*) as total FROM `tickets` GROUP BY ticketstatus"); |
195 | 193 | try{ |
196 | 194 | $query->execute(); |
197 | - }catch(PDOException $e){ |
|
195 | + } catch(PDOException $e){ |
|
198 | 196 | die($e->getMessage()); |
199 | 197 | } |
200 | 198 | return $query->fetchAll(); |
@@ -204,7 +202,7 @@ discard block |
||
204 | 202 | $query = $this->db->prepare($sql); |
205 | 203 | try{ |
206 | 204 | $query->execute(); |
207 | - }catch(PDOException $e){ |
|
205 | + } catch(PDOException $e){ |
|
208 | 206 | die($e->getMessage()); |
209 | 207 | } |
210 | 208 | return $query->fetchAll(); |
@@ -214,7 +212,7 @@ discard block |
||
214 | 212 | $query = $this->db->prepare($sql); |
215 | 213 | try{ |
216 | 214 | $query->execute(); |
217 | - }catch(PDOException $e){ |
|
215 | + } catch(PDOException $e){ |
|
218 | 216 | die($e->getMessage()); |
219 | 217 | } |
220 | 218 | return $query->fetchAll(); |
@@ -267,7 +265,7 @@ discard block |
||
267 | 265 | $query->bindValue(21, $changedate); |
268 | 266 | try{ |
269 | 267 | $query->execute(); |
270 | - }catch(PDOException $e){ |
|
268 | + } catch(PDOException $e){ |
|
271 | 269 | die($e->getMessage()); |
272 | 270 | } |
273 | 271 | } |
@@ -276,7 +274,7 @@ discard block |
||
276 | 274 | $query->bindValue(1, $id); |
277 | 275 | try{ |
278 | 276 | $query->execute(); |
279 | - }catch(PDOException $e){ |
|
277 | + } catch(PDOException $e){ |
|
280 | 278 | die($e->getMessage()); |
281 | 279 | } |
282 | 280 | return $query->fetchAll(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -class SLA{ |
|
2 | +class SLA { |
|
3 | 3 | private $db; |
4 | 4 | public function __construct($database) |
5 | 5 | { $this->db = $database; } |
@@ -9,71 +9,71 @@ discard block |
||
9 | 9 | try |
10 | 10 | { $query->execute(); |
11 | 11 | $rows = $query->fetchColumn(); |
12 | - if($rows == 1){ |
|
12 | + if ($rows == 1) { |
|
13 | 13 | return true; |
14 | - }else{ |
|
14 | + }else { |
|
15 | 15 | return false; |
16 | 16 | } |
17 | - } catch (PDOException $e){ |
|
17 | + }catch (PDOException $e) { |
|
18 | 18 | die($e->getMessage()); |
19 | 19 | } |
20 | 20 | } |
21 | - public function add_sla($slaid,$namasla,$responsetime,$resolutiontime,$slawarning) |
|
21 | + public function add_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning) |
|
22 | 22 | { $querystring = "INSERT INTO `sla` (`slaid`,`namasla`,`responsetime`, `resolutiontime`, `slawarning`) VALUES (?, ?, ?, ?, ?)"; |
23 | - $query = $this->db->prepare($querystring); |
|
23 | + $query = $this->db->prepare($querystring); |
|
24 | 24 | $query->bindValue(1, $slaid); |
25 | 25 | $query->bindValue(2, $namasla); |
26 | 26 | $query->bindValue(3, $responsetime); |
27 | 27 | $query->bindValue(4, $resolutiontime); |
28 | 28 | $query->bindValue(5, $slawarning); |
29 | - try{ |
|
29 | + try { |
|
30 | 30 | $query->execute(); |
31 | - }catch(PDOException $e){ |
|
31 | + }catch (PDOException $e) { |
|
32 | 32 | die($e->getMessage()); |
33 | 33 | } |
34 | 34 | } |
35 | - public function update_sla($slaid,$namasla,$responsetime,$resolutiontime,$slawarning) |
|
35 | + public function update_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning) |
|
36 | 36 | { $querystring = "UPDATE `sla` SET `namasla` = ? , `responsetime` = ? , `resolutiontime` = ?, `slawarning` = ? WHERE `slaid` = ?"; |
37 | - $query = $this->db->prepare($querystring); |
|
37 | + $query = $this->db->prepare($querystring); |
|
38 | 38 | $query->bindValue(1, $namasla); |
39 | 39 | $query->bindValue(2, $responsetime); |
40 | 40 | $query->bindValue(3, $resolutiontime); |
41 | 41 | $query->bindValue(4, $slawarning); |
42 | 42 | $query->bindValue(5, $slaid); |
43 | - try{ |
|
43 | + try { |
|
44 | 44 | $query->execute(); |
45 | 45 | } |
46 | - catch(PDOException $e){ |
|
46 | + catch (PDOException $e) { |
|
47 | 47 | die($e->getMessage()); |
48 | 48 | } |
49 | 49 | |
50 | 50 | } |
51 | - public function delete($id){ |
|
52 | - $sql="DELETE FROM `sla` WHERE `slaid` = ?"; |
|
51 | + public function delete($id) { |
|
52 | + $sql = "DELETE FROM `sla` WHERE `slaid` = ?"; |
|
53 | 53 | $query = $this->db->prepare($sql); |
54 | 54 | $query->bindValue(1, $id); |
55 | - try{ |
|
55 | + try { |
|
56 | 56 | $query->execute(); |
57 | 57 | } |
58 | - catch(PDOException $e){ |
|
58 | + catch (PDOException $e) { |
|
59 | 59 | die($e->getMessage()); |
60 | 60 | } |
61 | 61 | } |
62 | 62 | public function sla_data($slaid) |
63 | 63 | { $query = $this->db->prepare("SELECT * FROM `sla` WHERE `slaid`= ?"); |
64 | 64 | $query->bindValue(1, $slaid); |
65 | - try{ |
|
65 | + try { |
|
66 | 66 | $query->execute(); |
67 | 67 | return $query->fetch(); |
68 | - } catch(PDOException $e){ |
|
68 | + }catch (PDOException $e) { |
|
69 | 69 | die($e->getMessage()); |
70 | 70 | } |
71 | 71 | } |
72 | 72 | public function get_sla() |
73 | 73 | { $query = $this->db->prepare("SELECT * FROM `sla` ORDER BY `slaid` ASC"); |
74 | - try{ |
|
74 | + try { |
|
75 | 75 | $query->execute(); |
76 | - }catch(PDOException $e){ |
|
76 | + }catch (PDOException $e) { |
|
77 | 77 | die($e->getMessage()); |
78 | 78 | } |
79 | 79 | return $query->fetchAll(); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | $rows = $query->fetchColumn(); |
12 | 12 | if($rows == 1){ |
13 | 13 | return true; |
14 | - }else{ |
|
14 | + } else{ |
|
15 | 15 | return false; |
16 | 16 | } |
17 | 17 | } catch (PDOException $e){ |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $query->bindValue(5, $slawarning); |
29 | 29 | try{ |
30 | 30 | $query->execute(); |
31 | - }catch(PDOException $e){ |
|
31 | + } catch(PDOException $e){ |
|
32 | 32 | die($e->getMessage()); |
33 | 33 | } |
34 | 34 | } |
@@ -42,8 +42,7 @@ discard block |
||
42 | 42 | $query->bindValue(5, $slaid); |
43 | 43 | try{ |
44 | 44 | $query->execute(); |
45 | - } |
|
46 | - catch(PDOException $e){ |
|
45 | + } catch(PDOException $e){ |
|
47 | 46 | die($e->getMessage()); |
48 | 47 | } |
49 | 48 | |
@@ -54,8 +53,7 @@ discard block |
||
54 | 53 | $query->bindValue(1, $id); |
55 | 54 | try{ |
56 | 55 | $query->execute(); |
57 | - } |
|
58 | - catch(PDOException $e){ |
|
56 | + } catch(PDOException $e){ |
|
59 | 57 | die($e->getMessage()); |
60 | 58 | } |
61 | 59 | } |
@@ -73,7 +71,7 @@ discard block |
||
73 | 71 | { $query = $this->db->prepare("SELECT * FROM `sla` ORDER BY `slaid` ASC"); |
74 | 72 | try{ |
75 | 73 | $query->execute(); |
76 | - }catch(PDOException $e){ |
|
74 | + } catch(PDOException $e){ |
|
77 | 75 | die($e->getMessage()); |
78 | 76 | } |
79 | 77 | return $query->fetchAll(); |