1
|
|
|
<?php |
|
|
|
|
2
|
|
|
namespace App\Controller\Admin; |
|
|
|
|
3
|
|
|
|
4
|
|
|
use App\Controller\AppController; |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* Ticketstatuses Controller |
8
|
|
|
* |
9
|
|
|
* @property \App\Model\Table\TicketstatusesTable $Ticketstatuses |
10
|
|
|
*/ |
|
|
|
|
11
|
|
|
class TicketstatusesController extends AppController |
12
|
|
|
{ |
|
|
|
|
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Index method |
16
|
|
|
* |
17
|
|
|
* @return \Cake\Network\Response|null |
|
|
|
|
18
|
|
|
*/ |
19
|
1 |
|
public function index() |
20
|
|
|
{ |
|
|
|
|
21
|
1 |
|
$ticketstatuses = $this->paginate($this->Ticketstatuses); |
22
|
|
|
|
23
|
1 |
|
$this->set(compact('ticketstatuses')); |
24
|
1 |
|
$this->set('_serialize', ['ticketstatuses']); |
25
|
1 |
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* View method |
29
|
|
|
* |
30
|
|
|
* @param string|null $id Ticketstatus id. |
|
|
|
|
31
|
|
|
* @return \Cake\Network\Response|null |
|
|
|
|
32
|
|
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. |
|
|
|
|
33
|
|
|
*/ |
34
|
|
|
public function view($id = null) |
35
|
|
|
{ |
|
|
|
|
36
|
|
|
$ticketstatus = $this->Ticketstatuses->get($id, [ |
37
|
|
|
'contain' => [] |
|
|
|
|
38
|
|
|
]); |
39
|
|
|
|
40
|
|
|
$this->set('ticketstatus', $ticketstatus); |
41
|
|
|
$this->set('_serialize', ['ticketstatus']); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Add method |
46
|
|
|
* |
47
|
|
|
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise. |
48
|
|
|
*/ |
49
|
|
|
public function add() |
50
|
|
|
{ |
|
|
|
|
51
|
|
|
$ticketstatus = $this->Ticketstatuses->newEmptyEntity(); |
52
|
|
|
if ($this->request->is('post')) { |
53
|
|
|
$ticketstatus = $this->Ticketstatuses->patchEntity($ticketstatus, $this->getRequest()->getData()); |
54
|
|
|
if ($this->Ticketstatuses->save($ticketstatus)) { |
55
|
|
|
$this->Flash->success(__('The ticketstatus has been saved.')); |
56
|
|
|
|
57
|
|
|
return $this->redirect(['prefix'=>'Admin', 'controller'=>'Ticketstatuses', 'action' => 'index']); |
|
|
|
|
58
|
|
|
} |
|
|
|
|
59
|
|
|
$this->Flash->error(__('The ticketstatus could not be saved. Please, try again.')); |
60
|
|
|
} |
|
|
|
|
61
|
|
|
$this->set(compact('ticketstatus')); |
62
|
|
|
$this->set('_serialize', ['ticketstatus']); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Edit method |
67
|
|
|
* |
68
|
|
|
* @param string|null $id Ticketstatus id. |
|
|
|
|
69
|
|
|
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise. |
|
|
|
|
70
|
|
|
* @throws \Cake\Network\Exception\NotFoundException When record not found. |
|
|
|
|
71
|
|
|
*/ |
72
|
|
|
public function edit($id = null) |
73
|
|
|
{ |
|
|
|
|
74
|
|
|
$ticketstatus = $this->Ticketstatuses->get($id, [ |
75
|
|
|
'contain' => [] |
|
|
|
|
76
|
|
|
]); |
77
|
|
|
if ($this->request->is(['patch', 'post', 'put'])) { |
78
|
|
|
$ticketstatus = $this->Ticketstatuses->patchEntity($ticketstatus, $this->request->data); |
79
|
|
|
if ($this->Ticketstatuses->save($ticketstatus)) { |
80
|
|
|
$this->Flash->success(__('The ticketstatus has been saved.')); |
81
|
|
|
|
82
|
|
|
return $this->redirect(['prefix'=>false, 'controller'=>'Ticketstatuses', 'action' => 'index']); |
|
|
|
|
83
|
|
|
} |
|
|
|
|
84
|
|
|
$this->Flash->error(__('The ticketstatus could not be saved. Please, try again.')); |
85
|
|
|
} |
|
|
|
|
86
|
|
|
$this->set(compact('ticketstatus')); |
87
|
|
|
$this->set('_serialize', ['ticketstatus']); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Delete method |
92
|
|
|
* |
93
|
|
|
* @param string|null $id Ticketstatus id. |
|
|
|
|
94
|
|
|
* @return \Cake\Network\Response|null Redirects to index. |
|
|
|
|
95
|
|
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. |
|
|
|
|
96
|
|
|
*/ |
97
|
|
|
public function delete($id = null) |
98
|
|
|
{ |
|
|
|
|
99
|
|
|
$this->request->allowMethod(['post', 'delete']); |
100
|
|
|
$ticketstatus = $this->Ticketstatuses->get($id); |
101
|
|
|
if ($this->Ticketstatuses->delete($ticketstatus)) { |
102
|
|
|
$this->Flash->success(__('The ticketstatus has been deleted.')); |
103
|
|
|
} else { |
|
|
|
|
104
|
|
|
$this->Flash->error(__('The ticketstatus could not be deleted. Please, try again.')); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
return $this->redirect(['prefix'=>false, 'controller'=>'Ticketstatuses', 'action' => 'index']); |
|
|
|
|
108
|
|
|
} |
|
|
|
|
109
|
|
|
} |
110
|
|
|
|