author | Markus Bröker <broeker.markus@googlemail.com> |
Thu, 12 Nov 2015 21:59:18 +0100 | |
changeset 1 | 56e0dbd5c243 |
parent 0 | 4869aea77e21 |
permissions | -rw-r--r-- |
0
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1 |
<?php |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
2 |
|
1
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
3 |
namespace bfw\mvc\controller; |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
4 |
|
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
5 |
/** |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
6 |
* Copyright(C) 2015 Markus Bröker<broeker.markus@googlemail.com> |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
7 |
* |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
8 |
*/ |
0
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
9 |
|
1
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
10 |
use bfw\mvc\common\Controller; |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
11 |
use bfw\mvc\model\TGroup; |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
12 |
use bfw\mvc\model\THistory; |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
13 |
use bfw\mvc\model\TTicket; |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
14 |
use bfw\mvc\model\TUser; |
0
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
15 |
|
1
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
16 |
class HistoryController extends Controller { |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
17 |
|
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
18 |
private $user_id; |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
19 |
private $group_id; |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
20 |
private $currentTicket; |
0
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
21 |
|
1
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
22 |
public function __construct() { |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
23 |
$model = new THistory(); |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
24 |
parent::__construct($model); |
0
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
25 |
|
1
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
26 |
$this->currentTicket = null; |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
27 |
|
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
28 |
$request = $this->getRequest(); |
0
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
29 |
|
1
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
30 |
$this->user_id = $request->getKey('user_id', TUser::SYSTEM); |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
31 |
$this->group_id = $request->getKey('group_id', TGroup::GUEST); |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
32 |
} |
0
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
33 |
|
1
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
34 |
public function index() { |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
35 |
$request = $this->getRequest(); |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
36 |
$engine = $this->getView(); |
0
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
37 |
|
1
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
38 |
$tid = $request->session('tid'); |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
39 |
$ticket = new TTicket(); |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
40 |
|
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
41 |
if ($ticket->find($tid) == null) { |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
42 |
$request->setKey('fehler', 'Datensatz nicht gefunden.'); |
0
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
43 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
44 |
|
1
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
45 |
$history = $this->getModel(); |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
46 |
$histories = $history->findAllByField('ticket_id', $tid); |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
47 |
if ($histories == null) { |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
48 |
$request->setKey('fehler', 'Die Daten sind nicht aktuell.'); |
0
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
49 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
50 |
|
1
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
51 |
$engine->assign('ticket', $ticket); |
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
52 |
$engine->assign('histories', $histories); |
0
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
53 |
} |
1
56e0dbd5c243
Aktualisierung des Frameworks
Markus Bröker <broeker.markus@googlemail.com>
parents:
0
diff
changeset
|
54 |
|
0
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
55 |
} |