1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Backpack\CRUD\PanelTraits; |
4
|
|
|
|
5
|
|
|
trait Views |
6
|
|
|
{ |
7
|
|
|
protected $createView = 'crud::create'; |
8
|
|
|
protected $editView = 'crud::edit'; |
9
|
|
|
protected $showView = 'crud::show'; |
10
|
|
|
protected $detailsRowView = 'crud::details_row'; |
11
|
|
|
protected $revisionsView = 'crud::revisions'; |
12
|
|
|
protected $revisionsTimelineView = 'crud::inc.revision_timeline'; |
13
|
|
|
protected $reorderView = 'crud::reorder'; |
14
|
|
|
protected $listView = 'crud::list'; |
15
|
|
|
|
16
|
|
|
// ------- |
17
|
|
|
// CREATE |
18
|
|
|
// ------- |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Sets the list template. |
22
|
|
|
* @param string $view name of the template file |
23
|
|
|
* @return string $view name of the template file |
24
|
|
|
*/ |
25
|
|
|
public function setCreateView($view) |
26
|
|
|
{ |
27
|
|
|
$this->createView = $view; |
28
|
|
|
|
29
|
|
|
return $this->createView; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Gets the create template. |
34
|
|
|
* @return string name of the template file |
35
|
|
|
*/ |
36
|
|
|
public function getCreateView() |
37
|
|
|
{ |
38
|
|
|
return $this->createView; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
// ------- |
42
|
|
|
// READ |
43
|
|
|
// ------- |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Sets the list template. |
47
|
|
|
* @param string $view name of the template file |
48
|
|
|
* @return string $view name of the template file |
49
|
|
|
*/ |
50
|
|
|
public function setListView($view) |
51
|
|
|
{ |
52
|
|
|
$this->listView = $view; |
53
|
|
|
|
54
|
|
|
return $this->listView; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Gets the list template. |
59
|
|
|
* @return string name of the template file |
60
|
|
|
*/ |
61
|
|
|
public function getListView() |
62
|
|
|
{ |
63
|
|
|
return $this->listView; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Sets the details row template. |
68
|
|
|
* @param string $view name of the template file |
69
|
|
|
* @return string $view name of the template file |
70
|
|
|
*/ |
71
|
|
|
public function setDetailsRowView($view) |
72
|
|
|
{ |
73
|
|
|
$this->detailsRowView = $view; |
74
|
|
|
|
75
|
|
|
return $this->detailsRowView; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Gets the details row template. |
80
|
|
|
* @return string name of the template file |
81
|
|
|
*/ |
82
|
|
|
public function getDetailsRowView() |
83
|
|
|
{ |
84
|
|
|
return $this->detailsRowView; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Sets the show template. |
89
|
|
|
* @param string $view name of the template file |
90
|
|
|
* @return string $view name of the template file |
91
|
|
|
*/ |
92
|
|
|
public function setShowView($view) |
93
|
|
|
{ |
94
|
|
|
$this->showView = $view; |
95
|
|
|
|
96
|
|
|
return $this->showView; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Gets the show template. |
101
|
|
|
* @return string name of the template file |
102
|
|
|
*/ |
103
|
|
|
public function getShowView() |
104
|
|
|
{ |
105
|
|
|
return $this->showView; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
// ------- |
109
|
|
|
// UPDATE |
110
|
|
|
// ------- |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Sets the edit template. |
114
|
|
|
* @param string $view name of the template file |
115
|
|
|
* @return string $view name of the template file |
116
|
|
|
*/ |
117
|
|
|
public function setEditView($view) |
118
|
|
|
{ |
119
|
|
|
$this->editView = $view; |
120
|
|
|
|
121
|
|
|
return $this->editView; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Gets the edit template. |
126
|
|
|
* @return string name of the template file |
127
|
|
|
*/ |
128
|
|
|
public function getEditView() |
129
|
|
|
{ |
130
|
|
|
return $this->editView; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Sets the reorder template. |
135
|
|
|
* @param string $view name of the template file |
136
|
|
|
* @return string $view name of the template file |
137
|
|
|
*/ |
138
|
|
|
public function setReorderView($view) |
139
|
|
|
{ |
140
|
|
|
$this->reorderView = $view; |
141
|
|
|
|
142
|
|
|
return $this->reorderView; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Gets the reorder template. |
147
|
|
|
* @return string name of the template file |
148
|
|
|
*/ |
149
|
|
|
public function getReorderView() |
150
|
|
|
{ |
151
|
|
|
return $this->reorderView; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Sets the revision template. |
156
|
|
|
* @param string $view name of the template file |
157
|
|
|
* @return string $view name of the template file |
158
|
|
|
*/ |
159
|
|
|
public function setRevisionsView($view) |
160
|
|
|
{ |
161
|
|
|
$this->revisionsView = $view; |
162
|
|
|
|
163
|
|
|
return $this->revisionsView; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Sets the revision template. |
168
|
|
|
* @param string $view name of the template file |
169
|
|
|
* @return string $view name of the template file |
170
|
|
|
*/ |
171
|
|
|
public function setRevisionsTimelineView($view) |
172
|
|
|
{ |
173
|
|
|
$this->revisionsTimelineView = $view; |
174
|
|
|
|
175
|
|
|
return $this->revisionsTimelineView; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* Gets the revisions template. |
180
|
|
|
* @return string name of the template file |
181
|
|
|
*/ |
182
|
|
|
public function getRevisionsView() |
183
|
|
|
{ |
184
|
|
|
return $this->revisionsView; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* Gets the revisions template. |
189
|
|
|
* @return string name of the template file |
190
|
|
|
*/ |
191
|
|
|
public function getRevisionsTimelineView() |
192
|
|
|
{ |
193
|
|
|
return $this->revisionsTimelineView; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
// ------- |
197
|
|
|
// ALIASES |
198
|
|
|
// ------- |
199
|
|
|
|
200
|
|
|
public function getPreviewView() |
201
|
|
|
{ |
202
|
|
|
return $this->getShowView(); |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
public function setPreviewView($view) |
206
|
|
|
{ |
207
|
|
|
return $this->setShowView($view); |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
public function getUpdateView() |
211
|
|
|
{ |
212
|
|
|
return $this->getEditView(); |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
public function setUpdateView($view) |
216
|
|
|
{ |
217
|
|
|
return $this->setEditView($view); |
218
|
|
|
} |
219
|
|
|
} |
220
|
|
|
|