1: <?php
2:
3: /**
4: * Project sberp
5: *
6: * @file Source
7: * @author Jaromír Polášek
8: * @version 0.5.1
9: * Encoding UTF-8
10: */
11:
12: namespace App\Lib;
13:
14: use Nette\Object,
15: App\Lib\Table,
16: App\Lib\Structure,
17: App\Model\Database,
18: App\Lib\Statics\Cons;
19:
20: /**
21: * @deprecated since version 0.7.1.FORM
22: * Vytvoří objekt aktuálně prováděné akce (v podstatě struct) všechny proměnné jsou Readonly.
23: */
24: class Source extends Object {
25:
26: /* Private */
27:
28: /** @var \App\Model\Database */
29: private $database;
30:
31: /** @var int $action_id - Id akce */
32: private $source;
33:
34: /** @var string $action - Druh akce */
35: private $action;
36:
37: /** @var string $name - Název akce */
38: private $name;
39:
40: /** @var Nette\Database\Table\ActiveRow */
41: private $table;
42:
43: /** @var string $target - Typ zobrazení */
44: private $target;
45:
46: /**
47: * Konstrukto požaduje Databázi a id Akce
48: * @param integer $action_id
49: */
50: public function __construct(Database $database, $source = 0) {
51: $this->database = $database;
52: if ($source != 0) {
53: $this->source = $source;
54: $action = (new Table(Cons::TABLE_SOURCE, $this->database))->findById($source);
55: $this->action = $action[Cons::COLUMN_ACTION];
56: $this->name = $action[Cons::COLUMN_NAME];
57: $this->table = new Structure($action[Cons::TABLE_TABLE]);
58: $this->target = $action[Cons::COLUMN_TARGET];
59: }
60: }
61:
62: /**
63: * Vrací ID akce
64: * @return integer
65: */
66: public function getId() {
67: return (int) $this->source;
68: }
69:
70: /**
71: * Vrací Jméno akce
72: * @return string
73: */
74: public function getName() {
75: return (string) $this->name;
76: }
77:
78: /**
79: * Vrací Cíl akce (self - window)
80: * @return string
81: */
82: public function getTarget() {
83: return (string) $this->target;
84: }
85:
86: /**
87: * Vrací řádek z tabulky table s vlastnostmi tabulky na kterou odkazuje table
88: * @return Nette\Database\Table\ActiveRow->base_table
89: */
90: public function getTable() {
91: return $this->table;
92: }
93: }
94: