1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ubiquity\controllers\crud; |
4
|
|
|
|
5
|
|
|
use Ubiquity\controllers\crud\traits\UrlsTrait; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* |
9
|
|
|
* @author jc |
10
|
|
|
* |
11
|
|
|
*/ |
12
|
|
|
class CRUDFiles { |
13
|
|
|
use UrlsTrait; |
14
|
|
|
protected $viewBase; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* To override for defining viewBase (default : @framework/crud) |
18
|
|
|
*/ |
19
|
6 |
|
public function __construct(string $viewBase='@framework/crud') { |
20
|
6 |
|
$this->viewBase = $viewBase; |
21
|
6 |
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* To override |
25
|
|
|
* Returns the template for the index route (default : @framework/crud/index.html) |
26
|
|
|
* |
27
|
|
|
* @return string |
28
|
|
|
*/ |
29
|
1 |
|
public function getViewIndex() { |
30
|
1 |
|
return $this->viewBase . '/index.html'; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* To override with MultiResourceCRUDController only |
35
|
|
|
* Returns the template for the home route (default : @framework/crud/home.html) |
36
|
|
|
* |
37
|
|
|
* @return string |
38
|
|
|
*/ |
39
|
1 |
|
public function getViewHome(){ |
40
|
1 |
|
return $this->viewBase . '/home.html'; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* To override with MultiResourceCRUDController only |
45
|
|
|
* Returns the template for an item in home route (default : @framework/crud/itemHome.html) |
46
|
|
|
* |
47
|
|
|
* @return string |
48
|
|
|
*/ |
49
|
1 |
|
public function getViewItemHome(){ |
50
|
1 |
|
return $this->viewBase . '/itemHome.html'; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* To override with MultiResourceCRUDController only |
55
|
|
|
* Returns the template for displaying models in a dropdown (default : @framework/crud/itemHome.html) |
56
|
|
|
* |
57
|
|
|
* @return string |
58
|
|
|
*/ |
59
|
1 |
|
public function getViewNav(){ |
60
|
1 |
|
return $this->viewBase . '/nav.html'; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* To override |
65
|
|
|
* Returns the template for the edit and new instance routes (default : @framework/crud/form.html) |
66
|
|
|
* |
67
|
|
|
* @return string |
68
|
|
|
*/ |
69
|
|
|
public function getViewForm() { |
70
|
|
|
return $this->viewBase . '/form.html'; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* To override |
75
|
|
|
* Returns the template for the display route (default : @framework/crud/display.html) |
76
|
|
|
* |
77
|
|
|
* @return string |
78
|
|
|
*/ |
79
|
|
|
public function getViewDisplay() { |
80
|
|
|
return $this->viewBase . '/display.html'; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Returns the base template for all Crud actions if getBaseTemplate return a base template filename |
85
|
|
|
* |
86
|
|
|
* @return string |
87
|
|
|
*/ |
88
|
|
|
public function getViewBaseTemplate() { |
89
|
|
|
return $this->viewBase . '/baseTemplate.html'; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* To override |
94
|
|
|
* Returns the base template filename, default : null |
95
|
|
|
*/ |
96
|
6 |
|
public function getBaseTemplate() { |
97
|
6 |
|
return; |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
|