1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,314 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+namespace eSM_clients; |
|
14 |
+ |
|
15 |
+ |
|
16 |
+/** |
|
17 |
+ * Class tl_esm_clients |
|
18 |
+ * Provide miscellaneous methods that are used by the data configuration array. |
|
19 |
+ */ |
|
20 |
+class tl_esm_clients extends \Backend |
|
21 |
+{ |
|
22 |
+ /** |
|
23 |
+ * Import the back end user object |
|
24 |
+ */ |
|
25 |
+ public function __construct() |
|
26 |
+ { |
|
27 |
+ parent::__construct(); |
|
28 |
+ $this->import('BackendUser', 'User'); |
|
29 |
+ } |
|
30 |
+ |
|
31 |
+ /** |
|
32 |
+ * Return the file picker wizard |
|
33 |
+ * @param \DataContainer |
|
34 |
+ * @return string |
|
35 |
+ */ |
|
36 |
+ public function filePicker(\DataContainer $dc) |
|
37 |
+ { |
|
38 |
+ return ' <a href="contao/file.php?do='.\Input::get('do').'&table='.$dc->table.'&field='.$dc->field.'&value='.$dc->value.'" title="'.specialchars(str_replace("'", "\\'", $GLOBALS['TL_LANG']['MSC']['filepicker'])).'" onclick="Backend.getScrollOffset();Backend.openModalSelector({\'width\':768,\'title\':\''.specialchars($GLOBALS['TL_LANG']['MOD']['files'][0]).'\',\'url\':this.href,\'id\':\''.$dc->field.'\',\'tag\':\'ctrl_'.$dc->field . ((\Input::get('act') == 'editAll') ? '_' . $dc->id : '').'\',\'self\':this});return false">' . \Image::getHtml('pickfile.gif', $GLOBALS['TL_LANG']['MSC']['filepicker'], 'style="vertical-align:top;cursor:pointer"') . '</a>'; |
|
39 |
+ } |
|
40 |
+ |
|
41 |
+ /** |
|
42 |
+ * Return the "toggle visibility" button |
|
43 |
+ * @param array |
|
44 |
+ * @param string |
|
45 |
+ * @param string |
|
46 |
+ * @param string |
|
47 |
+ * @param string |
|
48 |
+ * @param string |
|
49 |
+ * @return string |
|
50 |
+ */ |
|
51 |
+ public function toggleIcon($row, $href, $label, $title, $icon, $attributes) |
|
52 |
+ { |
|
53 |
+ if (strlen(\Input::get('tid'))) |
|
54 |
+ { |
|
55 |
+ $this->toggleVisibility(\Input::get('tid'), (\Input::get('state') == 1)); |
|
56 |
+ $this->redirect($this->getReferer()); |
|
57 |
+ } |
|
58 |
+ |
|
59 |
+ // Check permissions AFTER checking the tid, so hacking attempts are logged |
|
60 |
+ if (!$this->User->hasAccess('tl_esm_clients::invisible', 'alexf')) |
|
61 |
+ { |
|
62 |
+ return ''; |
|
63 |
+ } |
|
64 |
+ |
|
65 |
+ $href .= '&id='.\Input::get('id').'&tid='.$row['id'].'&state='.$row['invisible']; |
|
66 |
+ |
|
67 |
+ if ($row['invisible']) |
|
68 |
+ { |
|
69 |
+ $icon = 'invisible.gif'; |
|
70 |
+ } |
|
71 |
+ |
|
72 |
+ return '<a href="'.$this->addToUrl($href).'" title="'.specialchars($title).'"'.$attributes.'>'.\Image::getHtml($icon, $label).'</a> '; |
|
73 |
+ } |
|
74 |
+ |
|
75 |
+ |
|
76 |
+ /** |
|
77 |
+ * Toggle the visibility of an element |
|
78 |
+ * @param integer |
|
79 |
+ * @param boolean |
|
80 |
+ */ |
|
81 |
+ public function toggleVisibility($intId, $blnVisible) |
|
82 |
+ { |
|
83 |
+ // Check permissions to edit |
|
84 |
+ \Input::setGet('id', $intId); |
|
85 |
+ \Input::setGet('act', 'toggle'); |
|
86 |
+ |
|
87 |
+ // The onload_callbacks vary depending on the dynamic parent table (see #4894) |
|
88 |
+ if (is_array($GLOBALS['TL_DCA']['tl_esm_clients']['config']['onload_callback'])) |
|
89 |
+ { |
|
90 |
+ foreach ($GLOBALS['TL_DCA']['tl_esm_clients']['config']['onload_callback'] as $callback) |
|
91 |
+ { |
|
92 |
+ if (is_array($callback)) |
|
93 |
+ { |
|
94 |
+ $this->import($callback[0]); |
|
95 |
+ $this->$callback[0]->$callback[1]($this); |
|
96 |
+ } |
|
97 |
+ elseif (is_callable($callback)) |
|
98 |
+ { |
|
99 |
+ $callback($this); |
|
100 |
+ } |
|
101 |
+ } |
|
102 |
+ } |
|
103 |
+ |
|
104 |
+ // Check permissions to publish |
|
105 |
+ if (!$this->User->hasAccess('tl_esm_clients::invisible', 'alexf')) |
|
106 |
+ { |
|
107 |
+ $this->log('Not enough permissions to show/hide content element ID "'.$intId.'"', __METHOD__, TL_ERROR); |
|
108 |
+ $this->redirect('contao/main.php?act=error'); |
|
109 |
+ } |
|
110 |
+ |
|
111 |
+ $objVersions = new \Versions('tl_esm_clients', $intId); |
|
112 |
+ $objVersions->initialize(); |
|
113 |
+ |
|
114 |
+ // Trigger the save_callback |
|
115 |
+ if (is_array($GLOBALS['TL_DCA']['tl_esm_clients']['fields']['invisible']['save_callback'])) |
|
116 |
+ { |
|
117 |
+ foreach ($GLOBALS['TL_DCA']['tl_esm_clients']['fields']['invisible']['save_callback'] as $callback) |
|
118 |
+ { |
|
119 |
+ if (is_array($callback)) |
|
120 |
+ { |
|
121 |
+ $this->import($callback[0]); |
|
122 |
+ $blnVisible = $this->$callback[0]->$callback[1]($blnVisible, $this); |
|
123 |
+ } |
|
124 |
+ elseif (is_callable($callback)) |
|
125 |
+ { |
|
126 |
+ $blnVisible = $callback($blnVisible, $this); |
|
127 |
+ } |
|
128 |
+ } |
|
129 |
+ } |
|
130 |
+ |
|
131 |
+ // Update the database |
|
132 |
+ $this->Database->prepare("UPDATE tl_esm_clients SET tstamp=". time() .", invisible='" . ($blnVisible ? '' : 1) . "' WHERE id=?") |
|
133 |
+ ->execute($intId); |
|
134 |
+ |
|
135 |
+ $objVersions->create(); |
|
136 |
+ $this->log('A new version of record "tl_esm_clients.id='.$intId.'" has been created', __METHOD__, TL_GENERAL); |
|
137 |
+ } |
|
138 |
+ |
|
139 |
+ public function getBranches(\DataContainer $dc) |
|
140 |
+ { |
|
141 |
+ $arrOptions = array(); |
|
142 |
+ |
|
143 |
+ $Branches = \EsmClientsSettingsModel::findByType('branch'); |
|
144 |
+ |
|
145 |
+ if (!is_null($Branches)) |
|
146 |
+ { |
|
147 |
+ while($Branches->next()) |
|
148 |
+ { |
|
149 |
+ $arrOptions[$Branches->id] = $Branches->title; |
|
150 |
+ } |
|
151 |
+ } |
|
152 |
+ |
|
153 |
+ return $arrOptions; |
|
154 |
+ } |
|
155 |
+ |
|
156 |
+ /** |
|
157 |
+ * Auto-generate alias if it has not been set yet |
|
158 |
+ * @param $varValue |
|
159 |
+ * @param \DataContainer $dc |
|
160 |
+ * @return string |
|
161 |
+ * @throws \Exception |
|
162 |
+ * @internal param $mixed |
|
163 |
+ * @internal param $ \DataContainer |
|
164 |
+ */ |
|
165 |
+ public function generateAlias($varValue, \DataContainer $dc) |
|
166 |
+ { |
|
167 |
+ $autoAlias = false; |
|
168 |
+ |
|
169 |
+ // Generate alias if there is none |
|
170 |
+ if ($varValue == '') |
|
171 |
+ { |
|
172 |
+ $autoAlias = true; |
|
173 |
+ $varValue = standardize(\String::restoreBasicEntities($dc->activeRecord->title)); |
|
174 |
+ } |
|
175 |
+ |
|
176 |
+ $objAlias = $this->Database->prepare("SELECT id FROM tl_esm_clients_projects WHERE alias=?") |
|
177 |
+ ->execute($varValue); |
|
178 |
+ |
|
179 |
+ // Check whether the alias exists |
|
180 |
+ if ($objAlias->numRows > 1 && !$autoAlias) |
|
181 |
+ { |
|
182 |
+ throw new \Exception(sprintf($GLOBALS['TL_LANG']['ERR']['aliasExists'], $varValue)); |
|
183 |
+ } |
|
184 |
+ |
|
185 |
+ // Add ID to alias |
|
186 |
+ if ($objAlias->numRows && $autoAlias) |
|
187 |
+ { |
|
188 |
+ $varValue .= '-' . $dc->id; |
|
189 |
+ } |
|
190 |
+ |
|
191 |
+ return $varValue; |
|
192 |
+ } |
|
193 |
+ |
|
194 |
+ /** |
|
195 |
+ * Automatically generate the folder URL aliases |
|
196 |
+ * @param array |
|
197 |
+ * @param \DataContainer |
|
198 |
+ * @return array |
|
199 |
+ */ |
|
200 |
+ public function addAliasButton($arrButtons, \DataContainer $dc) |
|
201 |
+ { |
|
202 |
+ // Generate the aliases |
|
203 |
+ if (\Input::post('FORM_SUBMIT') == 'tl_select' && isset($_POST['alias'])) |
|
204 |
+ { |
|
205 |
+ $session = $this->Session->getData(); |
|
206 |
+ $ids = $session['CURRENT']['IDS']; |
|
207 |
+ |
|
208 |
+ foreach ($ids as $id) |
|
209 |
+ { |
|
210 |
+ $objClients = EsmClientsModel::findByPk($id); |
|
211 |
+ |
|
212 |
+ if ($objClients === null) |
|
213 |
+ { |
|
214 |
+ continue; |
|
215 |
+ } |
|
216 |
+ |
|
217 |
+ $dc->id = $id; |
|
218 |
+ $dc->activeRecord = $objClients; |
|
219 |
+ |
|
220 |
+ $strAlias = ''; |
|
221 |
+ |
|
222 |
+ // Generate new alias through save callbacks |
|
223 |
+ foreach ($GLOBALS['TL_DCA'][$dc->table]['fields']['alias']['save_callback'] as $callback) |
|
224 |
+ { |
|
225 |
+ if (is_array($callback)) |
|
226 |
+ { |
|
227 |
+ $this->import($callback[0]); |
|
228 |
+ $strAlias = $this->$callback[0]->$callback[1]($strAlias, $dc); |
|
229 |
+ } |
|
230 |
+ elseif (is_callable($callback)) |
|
231 |
+ { |
|
232 |
+ $strAlias = $callback($strAlias, $dc); |
|
233 |
+ } |
|
234 |
+ } |
|
235 |
+ |
|
236 |
+ // The alias has not changed |
|
237 |
+ if ($strAlias == $objClients->alias) |
|
238 |
+ { |
|
239 |
+ continue; |
|
240 |
+ } |
|
241 |
+ |
|
242 |
+ // Initialize the version manager |
|
243 |
+ $objVersions = new \Versions($dc->table, $id); |
|
244 |
+ $objVersions->initialize(); |
|
245 |
+ |
|
246 |
+ // Store the new alias |
|
247 |
+ $this->Database->prepare("UPDATE tl_esm_clients SET alias=? WHERE id=?") |
|
248 |
+ ->execute($strAlias, $id); |
|
249 |
+ |
|
250 |
+ // Create a new version |
|
251 |
+ $objVersions->create(); |
|
252 |
+ } |
|
253 |
+ |
|
254 |
+ $this->redirect($this->getReferer()); |
|
255 |
+ } |
|
256 |
+ |
|
257 |
+ // Add the button |
|
258 |
+ $arrButtons['alias'] = '<input type="submit" name="alias" id="alias" class="tl_submit" accesskey="a" value="'.specialchars($GLOBALS['TL_LANG']['MSC']['aliasSelected']).'"> '; |
|
259 |
+ |
|
260 |
+ return $arrButtons; |
|
261 |
+ } |
|
262 |
+ |
|
263 |
+ public function renderSortingPage() |
|
264 |
+ { |
|
265 |
+ // Load Template |
|
266 |
+ $objTemplate = new \BackendTemplate('be_clientsShowcase_sorting'); |
|
267 |
+ |
|
268 |
+ $Clients = EsmClientsModel::getReferenceClients(); |
|
269 |
+ |
|
270 |
+ $arrClients = array(); |
|
271 |
+ if (!is_null($Clients)) |
|
272 |
+ { |
|
273 |
+ while($Clients->next()) |
|
274 |
+ { |
|
275 |
+ $arrClients[] = array('label'=>$Clients->title, 'value'=>$Clients->id); |
|
276 |
+ } |
|
277 |
+ } |
|
278 |
+ |
|
279 |
+ $Sortfield = new \SortWizard(array |
|
280 |
+ ( |
|
281 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['sort'][0], |
|
282 |
+ 'name' => 'sorting', |
|
283 |
+ 'id' => 'sorting', |
|
284 |
+ 'options' => $arrClients |
|
285 |
+ )); |
|
286 |
+ |
|
287 |
+ if (\Input::post('FORM_SUBMIT') == 'tl_esm_clients__sorting' && \Input::post('sorting') && is_array(\Input::post('sorting'))) |
|
288 |
+ { |
|
289 |
+ $Clients = EsmClientsModel::findMultipleByIds(\Input::post('sorting')); |
|
290 |
+ |
|
291 |
+ if (!is_null($Clients)) |
|
292 |
+ { |
|
293 |
+ $iterator = 1; |
|
294 |
+ foreach ($Clients as $client) |
|
295 |
+ { |
|
296 |
+ $client->sorting = 128 * $iterator++; |
|
297 |
+ $client->save(); |
|
298 |
+ } |
|
299 |
+ } |
|
300 |
+ |
|
301 |
+ if (isset($_POST['saveNclose'])) |
|
302 |
+ { |
|
303 |
+ $this->redirect($this->getReferer()); |
|
304 |
+ } |
|
305 |
+ |
|
306 |
+ $this->reload(); |
|
307 |
+ } |
|
308 |
+ |
|
309 |
+ |
|
310 |
+ $objTemplate->fields = $Sortfield->parse(); |
|
311 |
+ |
|
312 |
+ return $objTemplate->parse(); |
|
313 |
+ } |
|
314 |
+} |
|
0 | 315 |
\ No newline at end of file |
1 | 316 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,314 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+namespace eSM_clients; |
|
14 |
+ |
|
15 |
+ |
|
16 |
+/** |
|
17 |
+ * Class tl_module_esm_clients |
|
18 |
+ * Provide miscellaneous methods that are used by the data configuration array. |
|
19 |
+ */ |
|
20 |
+class tl_esm_clients_projects extends \Backend |
|
21 |
+{ |
|
22 |
+ /** |
|
23 |
+ * Import the back end user object |
|
24 |
+ */ |
|
25 |
+ public function __construct() |
|
26 |
+ { |
|
27 |
+ parent::__construct(); |
|
28 |
+ $this->import('BackendUser', 'User'); |
|
29 |
+ } |
|
30 |
+ |
|
31 |
+ public function addProjects($arrRow) |
|
32 |
+ { |
|
33 |
+ return '<div>'.$arrRow['title'].'</div>' . "\n"; |
|
34 |
+ } |
|
35 |
+ |
|
36 |
+ /** |
|
37 |
+ * Return the file picker wizard |
|
38 |
+ * @param \DataContainer |
|
39 |
+ * @return string |
|
40 |
+ */ |
|
41 |
+ public function filePicker(\DataContainer $dc) |
|
42 |
+ { |
|
43 |
+ return ' <a href="contao/file.php?do='.\Input::get('do').'&table='.$dc->table.'&field='.$dc->field.'&value='.$dc->value.'" title="'.specialchars(str_replace("'", "\\'", $GLOBALS['TL_LANG']['MSC']['filepicker'])).'" onclick="Backend.getScrollOffset();Backend.openModalSelector({\'width\':768,\'title\':\''.specialchars($GLOBALS['TL_LANG']['MOD']['files'][0]).'\',\'url\':this.href,\'id\':\''.$dc->field.'\',\'tag\':\'ctrl_'.$dc->field . ((\Input::get('act') == 'editAll') ? '_' . $dc->id : '').'\',\'self\':this});return false">' . \Image::getHtml('pickfile.gif', $GLOBALS['TL_LANG']['MSC']['filepicker'], 'style="vertical-align:top;cursor:pointer"') . '</a>'; |
|
44 |
+ } |
|
45 |
+ |
|
46 |
+ /** |
|
47 |
+ * Return the link picker wizard |
|
48 |
+ * @param \DataContainer |
|
49 |
+ * @return string |
|
50 |
+ */ |
|
51 |
+ public function pagePicker(\DataContainer $dc) |
|
52 |
+ { |
|
53 |
+ return ' <a href="contao/page.php?do=' . \Input::get('do') . '&table=' . $dc->table . '&field=' . $dc->field . '&value=' . str_replace(array('{{link_url::', '}}'), '', $dc->value) . '" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['pagepicker']) . '" onclick="Backend.getScrollOffset();Backend.openModalSelector({\'width\':768,\'title\':\'' . specialchars(str_replace("'", "\\'", $GLOBALS['TL_LANG']['MOD']['page'][0])) . '\',\'url\':this.href,\'id\':\'' . $dc->field . '\',\'tag\':\'ctrl_'. $dc->field . ((\Input::get('act') == 'editAll') ? '_' . $dc->id : '') . '\',\'self\':this});return false">' . \Image::getHtml('pickpage.gif', $GLOBALS['TL_LANG']['MSC']['pagepicker'], 'style="vertical-align:top;cursor:pointer"') . '</a>'; |
|
54 |
+ } |
|
55 |
+ |
|
56 |
+ /** |
|
57 |
+ * Return the "toggle visibility" button |
|
58 |
+ * @param array |
|
59 |
+ * @param string |
|
60 |
+ * @param string |
|
61 |
+ * @param string |
|
62 |
+ * @param string |
|
63 |
+ * @param string |
|
64 |
+ * @return string |
|
65 |
+ */ |
|
66 |
+ public function toggleIcon($row, $href, $label, $title, $icon, $attributes) |
|
67 |
+ { |
|
68 |
+ if (strlen(\Input::get('tid'))) |
|
69 |
+ { |
|
70 |
+ $this->toggleVisibility(\Input::get('tid'), (\Input::get('state') == 1)); |
|
71 |
+ $this->redirect($this->getReferer()); |
|
72 |
+ } |
|
73 |
+ |
|
74 |
+ // Check permissions AFTER checking the tid, so hacking attempts are logged |
|
75 |
+ if (!$this->User->hasAccess('tl_esm_clients_projects::invisible', 'alexf')) |
|
76 |
+ { |
|
77 |
+ return ''; |
|
78 |
+ } |
|
79 |
+ |
|
80 |
+ $href .= '&id='.\Input::get('id').'&tid='.$row['id'].'&state='.$row['invisible']; |
|
81 |
+ |
|
82 |
+ if ($row['invisible']) |
|
83 |
+ { |
|
84 |
+ $icon = 'invisible.gif'; |
|
85 |
+ } |
|
86 |
+ |
|
87 |
+ return '<a href="'.$this->addToUrl($href).'" title="'.specialchars($title).'"'.$attributes.'>'.\Image::getHtml($icon, $label).'</a> '; |
|
88 |
+ } |
|
89 |
+ |
|
90 |
+ |
|
91 |
+ /** |
|
92 |
+ * Toggle the visibility of an element |
|
93 |
+ * @param integer |
|
94 |
+ * @param boolean |
|
95 |
+ */ |
|
96 |
+ public function toggleVisibility($intId, $blnVisible) |
|
97 |
+ { |
|
98 |
+ // Check permissions to edit |
|
99 |
+ \Input::setGet('id', $intId); |
|
100 |
+ \Input::setGet('act', 'toggle'); |
|
101 |
+ |
|
102 |
+ // The onload_callbacks vary depending on the dynamic parent table (see #4894) |
|
103 |
+ if (is_array($GLOBALS['TL_DCA']['tl_esm_clients_projects']['config']['onload_callback'])) |
|
104 |
+ { |
|
105 |
+ foreach ($GLOBALS['TL_DCA']['tl_esm_clients_projects']['config']['onload_callback'] as $callback) |
|
106 |
+ { |
|
107 |
+ if (is_array($callback)) |
|
108 |
+ { |
|
109 |
+ $this->import($callback[0]); |
|
110 |
+ $this->$callback[0]->$callback[1]($this); |
|
111 |
+ } |
|
112 |
+ elseif (is_callable($callback)) |
|
113 |
+ { |
|
114 |
+ $callback($this); |
|
115 |
+ } |
|
116 |
+ } |
|
117 |
+ } |
|
118 |
+ |
|
119 |
+ // Check permissions to publish |
|
120 |
+ if (!$this->User->hasAccess('tl_esm_clients_projects::invisible', 'alexf')) |
|
121 |
+ { |
|
122 |
+ $this->log('Not enough permissions to show/hide content element ID "'.$intId.'"', __METHOD__, TL_ERROR); |
|
123 |
+ $this->redirect('contao/main.php?act=error'); |
|
124 |
+ } |
|
125 |
+ |
|
126 |
+ $objVersions = new \Versions('tl_esm_clients_projects', $intId); |
|
127 |
+ $objVersions->initialize(); |
|
128 |
+ |
|
129 |
+ // Trigger the save_callback |
|
130 |
+ if (is_array($GLOBALS['TL_DCA']['tl_esm_clients_projects']['fields']['invisible']['save_callback'])) |
|
131 |
+ { |
|
132 |
+ foreach ($GLOBALS['TL_DCA']['tl_esm_clients_projects']['fields']['invisible']['save_callback'] as $callback) |
|
133 |
+ { |
|
134 |
+ if (is_array($callback)) |
|
135 |
+ { |
|
136 |
+ $this->import($callback[0]); |
|
137 |
+ $blnVisible = $this->$callback[0]->$callback[1]($blnVisible, $this); |
|
138 |
+ } |
|
139 |
+ elseif (is_callable($callback)) |
|
140 |
+ { |
|
141 |
+ $blnVisible = $callback($blnVisible, $this); |
|
142 |
+ } |
|
143 |
+ } |
|
144 |
+ } |
|
145 |
+ |
|
146 |
+ // Update the database |
|
147 |
+ $this->Database->prepare("UPDATE tl_esm_clients_projects SET tstamp=". time() .", invisible='" . ($blnVisible ? '' : 1) . "' WHERE id=?") |
|
148 |
+ ->execute($intId); |
|
149 |
+ |
|
150 |
+ $objVersions->create(); |
|
151 |
+ $this->log('A new version of record "tl_esm_clients_projects.id='.$intId.'" has been created', __METHOD__, TL_GENERAL); |
|
152 |
+ } |
|
153 |
+ |
|
154 |
+ public function getTypes(\DataContainer $dc) |
|
155 |
+ { |
|
156 |
+ $arrOptions = array(); |
|
157 |
+ |
|
158 |
+ $Types = \EsmClientsSettingsModel::findByType('type'); |
|
159 |
+ |
|
160 |
+ if (!is_null($Types)) |
|
161 |
+ { |
|
162 |
+ while($Types->next()) |
|
163 |
+ { |
|
164 |
+ $arrOptions[$Types->id] = $Types->title; |
|
165 |
+ } |
|
166 |
+ } |
|
167 |
+ |
|
168 |
+ return $arrOptions; |
|
169 |
+ } |
|
170 |
+ |
|
171 |
+ public function getServices(\DataContainer $dc) |
|
172 |
+ { |
|
173 |
+ $arrOptions = array(); |
|
174 |
+ |
|
175 |
+ $Services = \EsmClientsSettingsModel::findByType('services'); |
|
176 |
+ |
|
177 |
+ if (!is_null($Services)) |
|
178 |
+ { |
|
179 |
+ while($Services->next()) |
|
180 |
+ { |
|
181 |
+ $arrOptions[$Services->id] = $Services->title; |
|
182 |
+ } |
|
183 |
+ } |
|
184 |
+ |
|
185 |
+ return $arrOptions; |
|
186 |
+ } |
|
187 |
+ |
|
188 |
+ public function getTech(\DataContainer $dc) |
|
189 |
+ { |
|
190 |
+ $arrOptions = array(); |
|
191 |
+ |
|
192 |
+ $Tech = \EsmClientsSettingsModel::findByType('tech'); |
|
193 |
+ |
|
194 |
+ if (!is_null($Tech)) |
|
195 |
+ { |
|
196 |
+ while($Tech->next()) |
|
197 |
+ { |
|
198 |
+ $arrOptions[$Tech->id] = $Tech->title; |
|
199 |
+ } |
|
200 |
+ } |
|
201 |
+ |
|
202 |
+ return $arrOptions; |
|
203 |
+ } |
|
204 |
+ |
|
205 |
+ /** |
|
206 |
+ * Auto-generate alias if it has not been set yet |
|
207 |
+ * @param $varValue |
|
208 |
+ * @param \DataContainer $dc |
|
209 |
+ * @return string |
|
210 |
+ * @throws \Exception |
|
211 |
+ * @internal param $mixed |
|
212 |
+ * @internal param $ \DataContainer |
|
213 |
+ */ |
|
214 |
+ public function generateAlias($varValue, \DataContainer $dc) |
|
215 |
+ { |
|
216 |
+ $autoAlias = false; |
|
217 |
+ |
|
218 |
+ // Generate alias if there is none |
|
219 |
+ if ($varValue == '') |
|
220 |
+ { |
|
221 |
+ $autoAlias = true; |
|
222 |
+ |
|
223 |
+ $objParent = EsmClientsModel::findByPk($dc->activeRecord->pid); |
|
224 |
+ |
|
225 |
+ $varValue = standardize(\String::restoreBasicEntities($dc->activeRecord->title).(($objParent !== null) ? '__'.($objParent->alias != '' ? $objParent->alias : \String::restoreBasicEntities($objParent->title)) : '')); |
|
226 |
+ } |
|
227 |
+ |
|
228 |
+ $objAlias = $this->Database->prepare("SELECT id FROM tl_esm_clients_projects WHERE alias=?") |
|
229 |
+ ->execute($varValue); |
|
230 |
+ |
|
231 |
+ // Check whether the alias exists |
|
232 |
+ if ($objAlias->numRows > 1 && !$autoAlias) |
|
233 |
+ { |
|
234 |
+ throw new \Exception(sprintf($GLOBALS['TL_LANG']['ERR']['aliasExists'], $varValue)); |
|
235 |
+ } |
|
236 |
+ |
|
237 |
+ // Add ID to alias |
|
238 |
+ if ($objAlias->numRows && $autoAlias) |
|
239 |
+ { |
|
240 |
+ $varValue .= '-' . $dc->id; |
|
241 |
+ } |
|
242 |
+ |
|
243 |
+ return $varValue; |
|
244 |
+ } |
|
245 |
+ |
|
246 |
+ /** |
|
247 |
+ * Automatically generate the folder URL aliases |
|
248 |
+ * @param array |
|
249 |
+ * @param \DataContainer |
|
250 |
+ * @return array |
|
251 |
+ */ |
|
252 |
+ public function addAliasButton($arrButtons, \DataContainer $dc) |
|
253 |
+ { |
|
254 |
+ // Generate the aliases |
|
255 |
+ if (\Input::post('FORM_SUBMIT') == 'tl_select' && isset($_POST['alias'])) |
|
256 |
+ { |
|
257 |
+ $session = $this->Session->getData(); |
|
258 |
+ $ids = $session['CURRENT']['IDS']; |
|
259 |
+ |
|
260 |
+ foreach ($ids as $id) |
|
261 |
+ { |
|
262 |
+ $objProjects = EsmClientsProjectsModel::findByPk($id); |
|
263 |
+ |
|
264 |
+ if ($objProjects === null) |
|
265 |
+ { |
|
266 |
+ continue; |
|
267 |
+ } |
|
268 |
+ |
|
269 |
+ $dc->id = $id; |
|
270 |
+ $dc->activeRecord = $objProjects; |
|
271 |
+ |
|
272 |
+ $strAlias = ''; |
|
273 |
+ |
|
274 |
+ // Generate new alias through save callbacks |
|
275 |
+ foreach ($GLOBALS['TL_DCA'][$dc->table]['fields']['alias']['save_callback'] as $callback) |
|
276 |
+ { |
|
277 |
+ if (is_array($callback)) |
|
278 |
+ { |
|
279 |
+ $this->import($callback[0]); |
|
280 |
+ $strAlias = $this->$callback[0]->$callback[1]($strAlias, $dc); |
|
281 |
+ } |
|
282 |
+ elseif (is_callable($callback)) |
|
283 |
+ { |
|
284 |
+ $strAlias = $callback($strAlias, $dc); |
|
285 |
+ } |
|
286 |
+ } |
|
287 |
+ |
|
288 |
+ // The alias has not changed |
|
289 |
+ if ($strAlias == $objProjects->alias) |
|
290 |
+ { |
|
291 |
+ continue; |
|
292 |
+ } |
|
293 |
+ |
|
294 |
+ // Initialize the version manager |
|
295 |
+ $objVersions = new \Versions($dc->table, $id); |
|
296 |
+ $objVersions->initialize(); |
|
297 |
+ |
|
298 |
+ // Store the new alias |
|
299 |
+ $this->Database->prepare("UPDATE tl_esm_clients_projects SET alias=? WHERE id=?") |
|
300 |
+ ->execute($strAlias, $id); |
|
301 |
+ |
|
302 |
+ // Create a new version |
|
303 |
+ $objVersions->create(); |
|
304 |
+ } |
|
305 |
+ |
|
306 |
+ $this->redirect($this->getReferer()); |
|
307 |
+ } |
|
308 |
+ |
|
309 |
+ // Add the button |
|
310 |
+ $arrButtons['alias'] = '<input type="submit" name="alias" id="alias" class="tl_submit" accesskey="a" value="'.specialchars($GLOBALS['TL_LANG']['MSC']['aliasSelected']).'"> '; |
|
311 |
+ |
|
312 |
+ return $arrButtons; |
|
313 |
+ } |
|
314 |
+} |
|
0 | 315 |
\ No newline at end of file |
1 | 316 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,44 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+namespace eSM_clients; |
|
14 |
+ |
|
15 |
+ |
|
16 |
+/** |
|
17 |
+ * Class tl_module_esm_clients |
|
18 |
+ * Provide miscellaneous methods that are used by the data configuration array. |
|
19 |
+ */ |
|
20 |
+class tl_module_esm_clients extends \Backend |
|
21 |
+{ |
|
22 |
+ /** |
|
23 |
+ * Return all clientsShowcase snippet templates as array |
|
24 |
+ * @return array |
|
25 |
+ */ |
|
26 |
+ public function getClientsShowcaseTemplates() |
|
27 |
+ { |
|
28 |
+ return $this->getTemplateGroup('_clientsShowcase_'); |
|
29 |
+ } |
|
30 |
+ |
|
31 |
+ public function getClients() |
|
32 |
+ { |
|
33 |
+ $arrClients = array(); |
|
34 |
+ |
|
35 |
+ $Clients = \EsmClientsModel::findAll(); |
|
36 |
+ |
|
37 |
+ if (!is_null($Clients)) |
|
38 |
+ { |
|
39 |
+ $arrClients = array_combine($Clients->fetchEach('id'),$Clients->fetchEach('title')); |
|
40 |
+ } |
|
41 |
+ |
|
42 |
+ return $arrClients; |
|
43 |
+ } |
|
44 |
+} |
|
0 | 45 |
\ No newline at end of file |
0 | 8 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,53 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+ |
|
14 |
+/** |
|
15 |
+ * Register the namespaces |
|
16 |
+ */ |
|
17 |
+ClassLoader::addNamespaces(array |
|
18 |
+( |
|
19 |
+ 'eSM_clients', |
|
20 |
+)); |
|
21 |
+ |
|
22 |
+ |
|
23 |
+/** |
|
24 |
+ * Register the classes |
|
25 |
+ */ |
|
26 |
+ClassLoader::addClasses(array |
|
27 |
+( |
|
28 |
+ // Classes |
|
29 |
+ 'eSM_clients\tl_module_esm_clients' => 'system/modules/eSM_clients/classes/tl_module_esm_clients.php', |
|
30 |
+ 'eSM_clients\tl_esm_clients_projects' => 'system/modules/eSM_clients/classes/tl_esm_clients_projects.php', |
|
31 |
+ 'eSM_clients\tl_esm_clients' => 'system/modules/eSM_clients/classes/tl_esm_clients.php', |
|
32 |
+ |
|
33 |
+ // Models |
|
34 |
+ 'eSM_clients\EsmClientsModel' => 'system/modules/eSM_clients/models/EsmClientsModel.php', |
|
35 |
+ 'eSM_clients\EsmClientsProjectsModel' => 'system/modules/eSM_clients/models/EsmClientsProjectsModel.php', |
|
36 |
+ 'eSM_clients\EsmClientsSettingsModel' => 'system/modules/eSM_clients/models/EsmClientsSettingsModel.php', |
|
37 |
+ |
|
38 |
+ // Modules |
|
39 |
+ 'eSM_clients\ModuleClientsShowcase' => 'system/modules/eSM_clients/modules/ModuleClientsShowcase.php', |
|
40 |
+ 'eSM_clients\ModuleClientsProject' => 'system/modules/eSM_clients/modules/ModuleClientsProject.php', |
|
41 |
+ |
|
42 |
+)); |
|
43 |
+ |
|
44 |
+/** |
|
45 |
+ * Register the templates |
|
46 |
+ */ |
|
47 |
+TemplateLoader::addFiles(array |
|
48 |
+( |
|
49 |
+ '_clientsShowcase_default' => 'system/modules/eSM_clients/templates/modules/inc', |
|
50 |
+ 'mod_clientsShowcase' => 'system/modules/eSM_clients/templates/modules', |
|
51 |
+ 'mod_clientsProject' => 'system/modules/eSM_clients/templates/modules', |
|
52 |
+ 'be_clientsShowcase_sorting' => 'system/modules/eSM_clients/templates/backend', |
|
53 |
+)); |
0 | 54 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,32 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+ |
|
14 |
+array_insert($GLOBALS['BE_MOD'], 1, array |
|
15 |
+( |
|
16 |
+ 'esales' => array |
|
17 |
+ ( |
|
18 |
+ 'clients' => array |
|
19 |
+ ( |
|
20 |
+ 'tables' => array('tl_esm_clients','tl_esm_clients_projects','tl_esm_clients_settings'), |
|
21 |
+ 'icon' => '/system/themes/default/images/article.gif', |
|
22 |
+ 'sort' => array('\\tl_esm_clients','renderSortingPage') |
|
23 |
+ ) |
|
24 |
+ ) |
|
25 |
+)); |
|
26 |
+ |
|
27 |
+ |
|
28 |
+$GLOBALS['FE_MOD']['esalesClients'] = array |
|
29 |
+( |
|
30 |
+ 'clientsShowcase' => 'ModuleClientsShowcase', |
|
31 |
+ 'clientsProject' => 'ModuleClientsProject' |
|
32 |
+); |
|
0 | 33 |
\ No newline at end of file |
1 | 34 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,245 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+/** |
|
14 |
+ * Table tl_esm_clients |
|
15 |
+ */ |
|
16 |
+$GLOBALS['TL_DCA']['tl_esm_clients'] = array |
|
17 |
+( |
|
18 |
+ |
|
19 |
+ // Config |
|
20 |
+ 'config' => array |
|
21 |
+ ( |
|
22 |
+ 'dataContainer' => 'Table', |
|
23 |
+ 'ctable' => array('tl_esm_clients_projects'), |
|
24 |
+ 'switchToEdit' => true, |
|
25 |
+ 'enableVersioning' => true, |
|
26 |
+ 'doNotCopyRecords' => true, |
|
27 |
+ 'onload_callback' => array |
|
28 |
+ ( |
|
29 |
+ ), |
|
30 |
+ 'oncopy_callback' => array |
|
31 |
+ ( |
|
32 |
+ ), |
|
33 |
+ 'onsubmit_callback' => array |
|
34 |
+ ( |
|
35 |
+ ), |
|
36 |
+ 'sql' => array |
|
37 |
+ ( |
|
38 |
+ 'keys' => array |
|
39 |
+ ( |
|
40 |
+ 'id' => 'primary', |
|
41 |
+ ) |
|
42 |
+ ) |
|
43 |
+ ), |
|
44 |
+ |
|
45 |
+ // List |
|
46 |
+ 'list' => array |
|
47 |
+ ( |
|
48 |
+ 'sorting' => array |
|
49 |
+ ( |
|
50 |
+ 'mode' => 2, |
|
51 |
+ 'fields' => array('title'), |
|
52 |
+ 'panelLayout' => 'filter;search,limit', |
|
53 |
+ ), |
|
54 |
+ 'label' => array |
|
55 |
+ ( |
|
56 |
+ 'fields' => array('title'), |
|
57 |
+ 'showColumns' => true, |
|
58 |
+// 'label_callback' => array('tl_member', 'addIcon') |
|
59 |
+ ), |
|
60 |
+ 'global_operations' => array |
|
61 |
+ ( |
|
62 |
+ 'settings' => array |
|
63 |
+ ( |
|
64 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['settings'], |
|
65 |
+ 'href' => 'table=tl_esm_clients_settings', |
|
66 |
+ 'icon' => 'settings.gif', |
|
67 |
+ ), |
|
68 |
+ 'sort' => array |
|
69 |
+ ( |
|
70 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['sort'], |
|
71 |
+ 'href' => 'key=sort', |
|
72 |
+ 'icon' => 'tablewizard.gif', |
|
73 |
+ ), |
|
74 |
+ 'all' => array |
|
75 |
+ ( |
|
76 |
+ 'label' => &$GLOBALS['TL_LANG']['MSC']['all'], |
|
77 |
+ 'href' => 'act=select', |
|
78 |
+ 'class' => 'header_edit_all', |
|
79 |
+ 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"' |
|
80 |
+ ) |
|
81 |
+ ), |
|
82 |
+ 'operations' => array |
|
83 |
+ ( |
|
84 |
+ 'edit' => array |
|
85 |
+ ( |
|
86 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['edit'], |
|
87 |
+ 'href' => 'table=tl_esm_clients_projects', |
|
88 |
+ 'icon' => 'edit.gif', |
|
89 |
+ ), |
|
90 |
+ 'editheader' => array |
|
91 |
+ ( |
|
92 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['editheader'], |
|
93 |
+ 'href' => 'act=edit', |
|
94 |
+ 'icon' => 'header.gif', |
|
95 |
+ ), |
|
96 |
+ 'copy' => array |
|
97 |
+ ( |
|
98 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['copy'], |
|
99 |
+ 'href' => 'act=copy', |
|
100 |
+ 'icon' => 'copy.gif' |
|
101 |
+ ), |
|
102 |
+ 'delete' => array |
|
103 |
+ ( |
|
104 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['delete'], |
|
105 |
+ 'href' => 'act=delete', |
|
106 |
+ 'icon' => 'delete.gif', |
|
107 |
+ 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"' |
|
108 |
+ ), |
|
109 |
+ 'toggle' => array |
|
110 |
+ ( |
|
111 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['toggle'], |
|
112 |
+ 'icon' => 'visible.gif', |
|
113 |
+ 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', |
|
114 |
+ 'button_callback' => array('tl_esm_clients', 'toggleIcon') |
|
115 |
+ ), |
|
116 |
+ 'show' => array |
|
117 |
+ ( |
|
118 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['show'], |
|
119 |
+ 'href' => 'act=show', |
|
120 |
+ 'icon' => 'show.gif' |
|
121 |
+ ) |
|
122 |
+ ) |
|
123 |
+ ), |
|
124 |
+ |
|
125 |
+ // Select |
|
126 |
+ 'select' => array |
|
127 |
+ ( |
|
128 |
+ 'buttons_callback' => array |
|
129 |
+ ( |
|
130 |
+ array('tl_esm_clients', 'addAliasButton') |
|
131 |
+ ) |
|
132 |
+ ), |
|
133 |
+ |
|
134 |
+ // Palettes |
|
135 |
+ 'palettes' => array |
|
136 |
+ ( |
|
137 |
+ 'default' => '{title_legend},title,alias;{categorize_legend},branch;{teaser_legend},text;{style_legend},basecolor,logo_neutral,logo_original;{invisible_legend:hide},invisible,start,stop' |
|
138 |
+ ), |
|
139 |
+ |
|
140 |
+ // Fields |
|
141 |
+ 'fields' => array |
|
142 |
+ ( |
|
143 |
+ 'id' => array |
|
144 |
+ ( |
|
145 |
+ 'sql' => "int(10) unsigned NOT NULL auto_increment" |
|
146 |
+ ), |
|
147 |
+ 'sorting' => array |
|
148 |
+ ( |
|
149 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
150 |
+ ), |
|
151 |
+ 'tstamp' => array |
|
152 |
+ ( |
|
153 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
154 |
+ ), |
|
155 |
+ 'alias' => array |
|
156 |
+ ( |
|
157 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['alias'], |
|
158 |
+ 'exclude' => true, |
|
159 |
+ 'search' => true, |
|
160 |
+ 'inputType' => 'text', |
|
161 |
+ 'eval' => array('rgxp'=>'alias', 'unique'=>true, 'maxlength'=>128, 'tl_class'=>'w50'), |
|
162 |
+ 'save_callback' => array |
|
163 |
+ ( |
|
164 |
+ array('tl_esm_clients', 'generateAlias') |
|
165 |
+ ), |
|
166 |
+ 'sql' => "varchar(128) COLLATE utf8_bin NOT NULL default ''" |
|
167 |
+ ), |
|
168 |
+ 'title' => array |
|
169 |
+ ( |
|
170 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['title'], |
|
171 |
+ 'inputType' => 'text', |
|
172 |
+ 'exclude' => true, |
|
173 |
+ 'search' => true, |
|
174 |
+ 'flag' => 1, |
|
175 |
+ 'eval' => array('mandatory'=>true, 'maxlength'=>128, 'tl_class'=>'w50'), |
|
176 |
+ 'sql' => "varchar(128) NOT NULL default ''" |
|
177 |
+ ), |
|
178 |
+ 'branch' => array |
|
179 |
+ ( |
|
180 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['branch'], |
|
181 |
+ 'inputType' => 'checkbox', |
|
182 |
+ 'exclude' => true, |
|
183 |
+ 'options_callback' => array('tl_esm_clients','getBranches'), |
|
184 |
+ 'eval' => array('mandatory'=>true, 'multiple'=>true, 'csv'=>','), |
|
185 |
+ 'sql' => "text NULL", |
|
186 |
+ 'relation' => array('type'=>'hasOne','load'=>'lazy','table'=>'tl_esm_clients_settings') |
|
187 |
+ ), |
|
188 |
+ 'text' => array |
|
189 |
+ ( |
|
190 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['text'], |
|
191 |
+ 'inputType' => 'textarea', |
|
192 |
+ 'exclude' => true, |
|
193 |
+ 'eval' => array('mandatory'=>true, 'maxlength'=>1024, 'rte'=>'tinyMCE'), |
|
194 |
+ 'sql' => "varchar(1024) NOT NULL default ''" |
|
195 |
+ ), |
|
196 |
+ 'basecolor' => array |
|
197 |
+ ( |
|
198 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['basecolor'], |
|
199 |
+ 'inputType' => 'text', |
|
200 |
+ 'eval' => array('mandatory'=>true,'maxlength'=>6, 'multiple'=>true, 'size'=>2, 'colorpicker'=>true, 'isHexColor'=>true, 'decodeEntities'=>true, 'tl_class'=>'w50 wizard'), |
|
201 |
+ 'sql' => "varchar(64) NOT NULL default ''" |
|
202 |
+ ), |
|
203 |
+ 'logo_neutral' => array |
|
204 |
+ ( |
|
205 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['logo_neutral'], |
|
206 |
+ 'exclude' => true, |
|
207 |
+ 'inputType' => 'fileTree', |
|
208 |
+ 'eval' => array('filesOnly'=>true, 'fieldType'=>'radio', 'mandatory'=>true, 'tl_class'=>'clr', 'extensions'=>Config::get('validImageTypes')), |
|
209 |
+ 'sql' => "binary(16) NULL", |
|
210 |
+ ), |
|
211 |
+ 'logo_original' => array |
|
212 |
+ ( |
|
213 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['logo_original'], |
|
214 |
+ 'exclude' => true, |
|
215 |
+ 'inputType' => 'fileTree', |
|
216 |
+ 'eval' => array('filesOnly'=>true, 'fieldType'=>'radio', 'mandatory'=>true, 'tl_class'=>'clr', 'extensions'=>Config::get('validImageTypes')), |
|
217 |
+ 'sql' => "binary(16) NULL", |
|
218 |
+ ), |
|
219 |
+ 'invisible' => array |
|
220 |
+ ( |
|
221 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['invisible'], |
|
222 |
+ 'exclude' => true, |
|
223 |
+ 'filter' => true, |
|
224 |
+ 'inputType' => 'checkbox', |
|
225 |
+ 'eval' => array('doNotCopy'=>true), |
|
226 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
227 |
+ ), |
|
228 |
+ 'start' => array |
|
229 |
+ ( |
|
230 |
+ 'exclude' => true, |
|
231 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['start'], |
|
232 |
+ 'inputType' => 'text', |
|
233 |
+ 'eval' => array('rgxp'=>'datim', 'datepicker'=>true, 'tl_class'=>'w50 wizard'), |
|
234 |
+ 'sql' => "varchar(10) NOT NULL default ''" |
|
235 |
+ ), |
|
236 |
+ 'stop' => array |
|
237 |
+ ( |
|
238 |
+ 'exclude' => true, |
|
239 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients']['stop'], |
|
240 |
+ 'inputType' => 'text', |
|
241 |
+ 'eval' => array('rgxp'=>'datim', 'datepicker'=>true, 'tl_class'=>'w50 wizard'), |
|
242 |
+ 'sql' => "varchar(10) NOT NULL default ''" |
|
243 |
+ ) |
|
244 |
+ ) |
|
245 |
+); |
|
0 | 246 |
\ No newline at end of file |
1 | 247 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,247 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+/** |
|
14 |
+ * Table tl_esm_clients_projects |
|
15 |
+ */ |
|
16 |
+$GLOBALS['TL_DCA']['tl_esm_clients_projects'] = array |
|
17 |
+( |
|
18 |
+ |
|
19 |
+ // Config |
|
20 |
+ 'config' => array |
|
21 |
+ ( |
|
22 |
+ 'dataContainer' => 'Table', |
|
23 |
+ 'ptable' => 'tl_esm_clients', |
|
24 |
+ 'enableVersioning' => true, |
|
25 |
+ 'onload_callback' => array |
|
26 |
+ ( |
|
27 |
+ ), |
|
28 |
+ 'oncopy_callback' => array |
|
29 |
+ ( |
|
30 |
+ ), |
|
31 |
+ 'onsubmit_callback' => array |
|
32 |
+ ( |
|
33 |
+ ), |
|
34 |
+ 'sql' => array |
|
35 |
+ ( |
|
36 |
+ 'keys' => array |
|
37 |
+ ( |
|
38 |
+ 'id' => 'primary', |
|
39 |
+ ) |
|
40 |
+ ) |
|
41 |
+ ), |
|
42 |
+ |
|
43 |
+ // List |
|
44 |
+ 'list' => array |
|
45 |
+ ( |
|
46 |
+ 'sorting' => array |
|
47 |
+ ( |
|
48 |
+ 'mode' => 4, |
|
49 |
+ 'fields' => array('sorting'), |
|
50 |
+ 'panelLayout' => 'filter;search,limit', |
|
51 |
+ 'headerFields' => array('title'), |
|
52 |
+ 'child_record_callback' => array('tl_esm_clients_projects', 'addProjects') |
|
53 |
+ ), |
|
54 |
+ 'global_operations' => array |
|
55 |
+ ( |
|
56 |
+ 'all' => array |
|
57 |
+ ( |
|
58 |
+ 'label' => &$GLOBALS['TL_LANG']['MSC']['all'], |
|
59 |
+ 'href' => 'act=select', |
|
60 |
+ 'class' => 'header_edit_all', |
|
61 |
+ 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"' |
|
62 |
+ ) |
|
63 |
+ ), |
|
64 |
+ 'operations' => array |
|
65 |
+ ( |
|
66 |
+ 'edit' => array |
|
67 |
+ ( |
|
68 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['edit'], |
|
69 |
+ 'href' => 'act=edit', |
|
70 |
+ 'icon' => 'edit.gif', |
|
71 |
+ ), |
|
72 |
+ 'copy' => array |
|
73 |
+ ( |
|
74 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['copy'], |
|
75 |
+ 'href' => 'act=copy', |
|
76 |
+ 'icon' => 'copy.gif' |
|
77 |
+ ), |
|
78 |
+ 'delete' => array |
|
79 |
+ ( |
|
80 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['delete'], |
|
81 |
+ 'href' => 'act=delete', |
|
82 |
+ 'icon' => 'delete.gif', |
|
83 |
+ 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"' |
|
84 |
+ ), |
|
85 |
+ 'toggle' => array |
|
86 |
+ ( |
|
87 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['toggle'], |
|
88 |
+ 'icon' => 'visible.gif', |
|
89 |
+ 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', |
|
90 |
+ 'button_callback' => array('tl_esm_clients_projects', 'toggleIcon') |
|
91 |
+ ), |
|
92 |
+ 'show' => array |
|
93 |
+ ( |
|
94 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['show'], |
|
95 |
+ 'href' => 'act=show', |
|
96 |
+ 'icon' => 'show.gif' |
|
97 |
+ ) |
|
98 |
+ ) |
|
99 |
+ ), |
|
100 |
+ |
|
101 |
+ // Select |
|
102 |
+ 'select' => array |
|
103 |
+ ( |
|
104 |
+ 'buttons_callback' => array |
|
105 |
+ ( |
|
106 |
+ array('tl_esm_clients_projects', 'addAliasButton') |
|
107 |
+ ) |
|
108 |
+ ), |
|
109 |
+ |
|
110 |
+ // Palettes |
|
111 |
+ 'palettes' => array |
|
112 |
+ ( |
|
113 |
+ 'default' => '{title_legend},title,alias;{categorize_legend},type;{details_legend},text,projectUrl,services,features,tech;{images_legend},gallerySRC;{invisible_legend:hide},invisible,start,stop' |
|
114 |
+ ), |
|
115 |
+ |
|
116 |
+ // Fields |
|
117 |
+ 'fields' => array |
|
118 |
+ ( |
|
119 |
+ 'id' => array |
|
120 |
+ ( |
|
121 |
+ 'sql' => "int(10) unsigned NOT NULL auto_increment" |
|
122 |
+ ), |
|
123 |
+ 'pid' => array |
|
124 |
+ ( |
|
125 |
+ 'foreignKey' => 'tl_esm_clients.title', |
|
126 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'", |
|
127 |
+ 'relation' => array('type'=>'belongsTo', 'load'=>'lazy') |
|
128 |
+ ), |
|
129 |
+ 'sorting' => array |
|
130 |
+ ( |
|
131 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
132 |
+ ), |
|
133 |
+ 'tstamp' => array |
|
134 |
+ ( |
|
135 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
136 |
+ ), |
|
137 |
+ 'alias' => array |
|
138 |
+ ( |
|
139 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['alias'], |
|
140 |
+ 'exclude' => true, |
|
141 |
+ 'search' => true, |
|
142 |
+ 'inputType' => 'text', |
|
143 |
+ 'eval' => array('rgxp'=>'alias', 'unique'=>true, 'maxlength'=>128, 'tl_class'=>'w50'), |
|
144 |
+ 'save_callback' => array |
|
145 |
+ ( |
|
146 |
+ array('tl_esm_clients_projects', 'generateAlias') |
|
147 |
+ ), |
|
148 |
+ 'sql' => "varchar(128) COLLATE utf8_bin NOT NULL default ''" |
|
149 |
+ ), |
|
150 |
+ 'title' => array |
|
151 |
+ ( |
|
152 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['title'], |
|
153 |
+ 'inputType' => 'text', |
|
154 |
+ 'exclude' => true, |
|
155 |
+ 'eval' => array('mandatory'=>true, 'maxlength'=>128,'tl_class'=>'w50'), |
|
156 |
+ 'sql' => "varchar(128) NOT NULL default ''" |
|
157 |
+ ), |
|
158 |
+ 'text' => array |
|
159 |
+ ( |
|
160 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['text'], |
|
161 |
+ 'inputType' => 'textarea', |
|
162 |
+ 'exclude' => true, |
|
163 |
+ 'eval' => array('mandatory'=>true, 'maxlength'=>1024, 'rte'=>'tinyMCE'), |
|
164 |
+ 'sql' => "varchar(1024) NOT NULL default ''" |
|
165 |
+ ), |
|
166 |
+ 'type' => array |
|
167 |
+ ( |
|
168 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['type'], |
|
169 |
+ 'inputType' => 'select', |
|
170 |
+ 'exclude' => true, |
|
171 |
+ 'options_callback' => array('tl_esm_clients_projects','getTypes'), |
|
172 |
+ 'eval' => array('mandatory'=>true, 'includeBlankOption'=>true,'csv'=>','), |
|
173 |
+ 'sql' => "text NULL" |
|
174 |
+ ), |
|
175 |
+ 'projectUrl' => array |
|
176 |
+ ( |
|
177 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['projectUrl'], |
|
178 |
+ 'inputType' => 'text', |
|
179 |
+ 'exclude' => true, |
|
180 |
+ 'eval' => array('rgxp'=>'url', 'maxlength'=>128), |
|
181 |
+ 'sql' => "varchar(128) NOT NULL default ''" |
|
182 |
+ ), |
|
183 |
+ 'services' => array |
|
184 |
+ ( |
|
185 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['services'], |
|
186 |
+ 'inputType' => 'checkboxWizard', |
|
187 |
+ 'exclude' => true, |
|
188 |
+ 'options_callback' => array('tl_esm_clients_projects','getServices'), |
|
189 |
+ 'eval' => array('mandatory'=>true, 'multiple'=>true, 'csv'=>','), |
|
190 |
+ 'sql' => "text NULL" |
|
191 |
+ ), |
|
192 |
+ 'features' => array |
|
193 |
+ ( |
|
194 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['features'], |
|
195 |
+ 'inputType' => 'listWizard', |
|
196 |
+ 'exclude' => true, |
|
197 |
+ 'eval' => array('mandatory'=>true), |
|
198 |
+ 'sql' => "text NULL" |
|
199 |
+ ), |
|
200 |
+ 'tech' => array |
|
201 |
+ ( |
|
202 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['tech'], |
|
203 |
+ 'inputType' => 'checkboxWizard', |
|
204 |
+ 'exclude' => true, |
|
205 |
+ 'options_callback' => array('tl_esm_clients_projects','getTech'), |
|
206 |
+ 'eval' => array('mandatory'=>true, 'multiple'=>true, 'csv'=>','), |
|
207 |
+ 'sql' => "text NULL" |
|
208 |
+ ), |
|
209 |
+ 'gallerySRC' => array |
|
210 |
+ ( |
|
211 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['gallerySRC'], |
|
212 |
+ 'exclude' => true, |
|
213 |
+ 'inputType' => 'fileTree', |
|
214 |
+ 'eval' => array('multiple'=>true, 'fieldType'=>'checkbox', 'orderField'=>'galleryOrder', 'files'=>true, 'mandatory'=>true, 'extensions'=>\Config::get('validImageTypes'), 'isGallery'=>true), |
|
215 |
+ 'sql' => "blob NULL" |
|
216 |
+ ), |
|
217 |
+ 'galleryOrder' => array |
|
218 |
+ ( |
|
219 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['galleryOrder'], |
|
220 |
+ 'sql' => "blob NULL" |
|
221 |
+ ), |
|
222 |
+ 'invisible' => array |
|
223 |
+ ( |
|
224 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['invisible'], |
|
225 |
+ 'exclude' => true, |
|
226 |
+ 'filter' => true, |
|
227 |
+ 'inputType' => 'checkbox', |
|
228 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
229 |
+ ), |
|
230 |
+ 'start' => array |
|
231 |
+ ( |
|
232 |
+ 'exclude' => true, |
|
233 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['start'], |
|
234 |
+ 'inputType' => 'text', |
|
235 |
+ 'eval' => array('rgxp'=>'datim', 'datepicker'=>true, 'tl_class'=>'w50 wizard'), |
|
236 |
+ 'sql' => "varchar(10) NOT NULL default ''" |
|
237 |
+ ), |
|
238 |
+ 'stop' => array |
|
239 |
+ ( |
|
240 |
+ 'exclude' => true, |
|
241 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['stop'], |
|
242 |
+ 'inputType' => 'text', |
|
243 |
+ 'eval' => array('rgxp'=>'datim', 'datepicker'=>true, 'tl_class'=>'w50 wizard'), |
|
244 |
+ 'sql' => "varchar(10) NOT NULL default ''" |
|
245 |
+ ) |
|
246 |
+ ) |
|
247 |
+); |
|
0 | 248 |
\ No newline at end of file |
1 | 249 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,305 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+/** |
|
14 |
+ * Table tl_esm_clients_settings |
|
15 |
+ */ |
|
16 |
+$GLOBALS['TL_DCA']['tl_esm_clients_settings'] = array |
|
17 |
+( |
|
18 |
+ |
|
19 |
+ // Config |
|
20 |
+ 'config' => array |
|
21 |
+ ( |
|
22 |
+ 'dataContainer' => 'Table', |
|
23 |
+ 'enableVersioning' => true, |
|
24 |
+ 'onload_callback' => array |
|
25 |
+ ( |
|
26 |
+ ), |
|
27 |
+ 'oncopy_callback' => array |
|
28 |
+ ( |
|
29 |
+ ), |
|
30 |
+ 'onsubmit_callback' => array |
|
31 |
+ ( |
|
32 |
+ ), |
|
33 |
+ 'sql' => array |
|
34 |
+ ( |
|
35 |
+ 'keys' => array |
|
36 |
+ ( |
|
37 |
+ 'id' => 'primary', |
|
38 |
+ ) |
|
39 |
+ ) |
|
40 |
+ ), |
|
41 |
+ |
|
42 |
+ // List |
|
43 |
+ 'list' => array |
|
44 |
+ ( |
|
45 |
+ 'sorting' => array |
|
46 |
+ ( |
|
47 |
+ 'mode' => 1, |
|
48 |
+ 'flag' => 11, |
|
49 |
+ 'fields' => array('type','title'), |
|
50 |
+ 'panelLayout' => 'filter,search,limit', |
|
51 |
+ ), |
|
52 |
+ 'label' => array |
|
53 |
+ ( |
|
54 |
+ 'fields' => array('title'), |
|
55 |
+ 'format' => '%s' |
|
56 |
+// 'showColumns' => true, |
|
57 |
+// 'label_callback' => array('tl_member', 'addIcon') |
|
58 |
+ ), |
|
59 |
+ 'global_operations' => array |
|
60 |
+ ( |
|
61 |
+ 'all' => array |
|
62 |
+ ( |
|
63 |
+ 'label' => &$GLOBALS['TL_LANG']['MSC']['all'], |
|
64 |
+ 'href' => 'act=select', |
|
65 |
+ 'class' => 'header_edit_all', |
|
66 |
+ 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"' |
|
67 |
+ ), |
|
68 |
+ 'back' => array |
|
69 |
+ ( |
|
70 |
+ 'label' => &$GLOBALS['TL_LANG']['MSC']['backBT'], |
|
71 |
+ 'href' => '', |
|
72 |
+ 'class' => 'header_back', |
|
73 |
+ 'button_callback' => array('tl_esm_clients_settings', 'backBT') |
|
74 |
+ ) |
|
75 |
+ ), |
|
76 |
+ 'operations' => array |
|
77 |
+ ( |
|
78 |
+ 'edit' => array |
|
79 |
+ ( |
|
80 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_settings']['edit'], |
|
81 |
+ 'href' => 'act=edit', |
|
82 |
+ 'icon' => 'edit.gif', |
|
83 |
+ ), |
|
84 |
+ 'copy' => array |
|
85 |
+ ( |
|
86 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_settings']['copy'], |
|
87 |
+ 'href' => 'act=copy', |
|
88 |
+ 'icon' => 'copy.gif' |
|
89 |
+ ), |
|
90 |
+ 'delete' => array |
|
91 |
+ ( |
|
92 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_settings']['delete'], |
|
93 |
+ 'href' => 'act=delete', |
|
94 |
+ 'icon' => 'delete.gif', |
|
95 |
+ 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"' |
|
96 |
+ ), |
|
97 |
+ 'show' => array |
|
98 |
+ ( |
|
99 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_settings']['show'], |
|
100 |
+ 'href' => 'act=show', |
|
101 |
+ 'icon' => 'show.gif' |
|
102 |
+ ) |
|
103 |
+ ) |
|
104 |
+ ), |
|
105 |
+ |
|
106 |
+ // Palettes |
|
107 |
+ 'palettes' => array |
|
108 |
+ ( |
|
109 |
+ '__selector__' => array('type'), |
|
110 |
+ 'default' => '{type_legend},type;{attribute_legend},title', |
|
111 |
+ 'services' => '{type_legend},type;{attribute_legend},title,url', |
|
112 |
+ 'tech' => '{type_legend},type;{attribute_legend},title,url' |
|
113 |
+ ), |
|
114 |
+ |
|
115 |
+ // Fields |
|
116 |
+ 'fields' => array |
|
117 |
+ ( |
|
118 |
+ 'id' => array |
|
119 |
+ ( |
|
120 |
+ 'sql' => "int(10) unsigned NOT NULL auto_increment" |
|
121 |
+ ), |
|
122 |
+ 'tstamp' => array |
|
123 |
+ ( |
|
124 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
125 |
+ ), |
|
126 |
+ 'type' => array |
|
127 |
+ ( |
|
128 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_settings']['type'], |
|
129 |
+ 'inputType' => 'select', |
|
130 |
+ 'exclude' => true, |
|
131 |
+ 'filter' => true, |
|
132 |
+ 'options' => array('branch','type','services','tech'), |
|
133 |
+ 'reference' => $GLOBALS['TL_LANG']['tl_esm_clients_settings']['REF'], |
|
134 |
+ 'eval' => array('mandatory'=>true, 'includeBlankOption'=>true,'submitOnChange'=>true, 'csv'=>','), |
|
135 |
+ 'sql' => "text NULL" |
|
136 |
+ ), |
|
137 |
+ 'title' => array |
|
138 |
+ ( |
|
139 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_esm_clients_settings']['title'], |
|
140 |
+ 'inputType' => 'text', |
|
141 |
+ 'exclude' => true, |
|
142 |
+ 'search' => true, |
|
143 |
+ 'eval' => array('mandatory'=>true, 'maxlength'=>128, 'tl_class'=>'w50'), |
|
144 |
+ 'sql' => "varchar(128) NOT NULL default ''" |
|
145 |
+ ), |
|
146 |
+ 'url' => array |
|
147 |
+ ( |
|
148 |
+ 'label' => &$GLOBALS['TL_LANG']['MSC']['url'], |
|
149 |
+ 'exclude' => true, |
|
150 |
+ 'search' => true, |
|
151 |
+ 'inputType' => 'text', |
|
152 |
+ 'eval' => array('mandatory'=>true, 'rgxp'=>'url', 'decodeEntities'=>true, 'maxlength'=>255, 'fieldType'=>'radio', 'tl_class'=>'w50 wizard'), |
|
153 |
+ 'wizard' => array |
|
154 |
+ ( |
|
155 |
+ array('tl_esm_clients_settings', 'pagePicker') |
|
156 |
+ ), |
|
157 |
+ 'sql' => "varchar(255) NOT NULL default ''" |
|
158 |
+ ), |
|
159 |
+ ) |
|
160 |
+); |
|
161 |
+ |
|
162 |
+class tl_esm_clients_settings extends Backend |
|
163 |
+{ |
|
164 |
+ |
|
165 |
+ /** |
|
166 |
+ * Import the back end user object |
|
167 |
+ */ |
|
168 |
+ public function __construct() |
|
169 |
+ { |
|
170 |
+ parent::__construct(); |
|
171 |
+ $this->import('BackendUser', 'User'); |
|
172 |
+ } |
|
173 |
+ |
|
174 |
+ /** |
|
175 |
+ * Return the back button |
|
176 |
+ * @param string |
|
177 |
+ * @param string |
|
178 |
+ * @param string |
|
179 |
+ * @param string |
|
180 |
+ * @param string |
|
181 |
+ * @return string |
|
182 |
+ */ |
|
183 |
+ public function backBT($href, $label, $title, $class, $attributes) |
|
184 |
+ { |
|
185 |
+ return '<a href="'.$this->addToUrl($href,true,array('table')).'" class="'.$class.'" title="'.specialchars($title).'"'.$attributes.'>'.$label.'</a> '; |
|
186 |
+ } |
|
187 |
+ |
|
188 |
+ /** |
|
189 |
+ * Return the file picker wizard |
|
190 |
+ * @param \DataContainer |
|
191 |
+ * @return string |
|
192 |
+ */ |
|
193 |
+ public function filePicker(DataContainer $dc) |
|
194 |
+ { |
|
195 |
+ return ' <a href="contao/file.php?do='.Input::get('do').'&table='.$dc->table.'&field='.$dc->field.'&value='.$dc->value.'" title="'.specialchars(str_replace("'", "\\'", $GLOBALS['TL_LANG']['MSC']['filepicker'])).'" onclick="Backend.getScrollOffset();Backend.openModalSelector({\'width\':768,\'title\':\''.specialchars($GLOBALS['TL_LANG']['MOD']['files'][0]).'\',\'url\':this.href,\'id\':\''.$dc->field.'\',\'tag\':\'ctrl_'.$dc->field . ((Input::get('act') == 'editAll') ? '_' . $dc->id : '').'\',\'self\':this});return false">' . Image::getHtml('pickfile.gif', $GLOBALS['TL_LANG']['MSC']['filepicker'], 'style="vertical-align:top;cursor:pointer"') . '</a>'; |
|
196 |
+ } |
|
197 |
+ |
|
198 |
+ /** |
|
199 |
+ * Return the link picker wizard |
|
200 |
+ * @param \DataContainer |
|
201 |
+ * @return string |
|
202 |
+ */ |
|
203 |
+ public function pagePicker(DataContainer $dc) |
|
204 |
+ { |
|
205 |
+ return ' <a href="contao/page.php?do=' . Input::get('do') . '&table=' . $dc->table . '&field=' . $dc->field . '&value=' . str_replace(array('{{link_url::', '}}'), '', $dc->value) . '" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['pagepicker']) . '" onclick="Backend.getScrollOffset();Backend.openModalSelector({\'width\':768,\'title\':\'' . specialchars(str_replace("'", "\\'", $GLOBALS['TL_LANG']['MOD']['page'][0])) . '\',\'url\':this.href,\'id\':\'' . $dc->field . '\',\'tag\':\'ctrl_'. $dc->field . ((Input::get('act') == 'editAll') ? '_' . $dc->id : '') . '\',\'self\':this});return false">' . Image::getHtml('pickpage.gif', $GLOBALS['TL_LANG']['MSC']['pagepicker'], 'style="vertical-align:top;cursor:pointer"') . '</a>'; |
|
206 |
+ } |
|
207 |
+ |
|
208 |
+ /** |
|
209 |
+ * Return the "toggle visibility" button |
|
210 |
+ * @param array |
|
211 |
+ * @param string |
|
212 |
+ * @param string |
|
213 |
+ * @param string |
|
214 |
+ * @param string |
|
215 |
+ * @param string |
|
216 |
+ * @return string |
|
217 |
+ */ |
|
218 |
+ public function toggleIcon($row, $href, $label, $title, $icon, $attributes) |
|
219 |
+ { |
|
220 |
+ if (strlen(Input::get('tid'))) |
|
221 |
+ { |
|
222 |
+ $this->toggleVisibility(Input::get('tid'), (Input::get('state') == 1)); |
|
223 |
+ $this->redirect($this->getReferer()); |
|
224 |
+ } |
|
225 |
+ |
|
226 |
+ // Check permissions AFTER checking the tid, so hacking attempts are logged |
|
227 |
+ if (!$this->User->hasAccess('tl_esm_clients_settings::invisible', 'alexf')) |
|
228 |
+ { |
|
229 |
+ return ''; |
|
230 |
+ } |
|
231 |
+ |
|
232 |
+ $href .= '&id='.Input::get('id').'&tid='.$row['id'].'&state='.$row['invisible']; |
|
233 |
+ |
|
234 |
+ if ($row['invisible']) |
|
235 |
+ { |
|
236 |
+ $icon = 'invisible.gif'; |
|
237 |
+ } |
|
238 |
+ |
|
239 |
+ return '<a href="'.$this->addToUrl($href).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon, $label).'</a> '; |
|
240 |
+ } |
|
241 |
+ |
|
242 |
+ |
|
243 |
+ /** |
|
244 |
+ * Toggle the visibility of an element |
|
245 |
+ * @param integer |
|
246 |
+ * @param boolean |
|
247 |
+ */ |
|
248 |
+ public function toggleVisibility($intId, $blnVisible) |
|
249 |
+ { |
|
250 |
+ // Check permissions to edit |
|
251 |
+ Input::setGet('id', $intId); |
|
252 |
+ Input::setGet('act', 'toggle'); |
|
253 |
+ |
|
254 |
+ // The onload_callbacks vary depending on the dynamic parent table (see #4894) |
|
255 |
+ if (is_array($GLOBALS['TL_DCA']['tl_esm_clients_settings']['config']['onload_callback'])) |
|
256 |
+ { |
|
257 |
+ foreach ($GLOBALS['TL_DCA']['tl_esm_clients_settings']['config']['onload_callback'] as $callback) |
|
258 |
+ { |
|
259 |
+ if (is_array($callback)) |
|
260 |
+ { |
|
261 |
+ $this->import($callback[0]); |
|
262 |
+ $this->$callback[0]->$callback[1]($this); |
|
263 |
+ } |
|
264 |
+ elseif (is_callable($callback)) |
|
265 |
+ { |
|
266 |
+ $callback($this); |
|
267 |
+ } |
|
268 |
+ } |
|
269 |
+ } |
|
270 |
+ |
|
271 |
+ // Check permissions to publish |
|
272 |
+ if (!$this->User->hasAccess('tl_esm_clients_settings::invisible', 'alexf')) |
|
273 |
+ { |
|
274 |
+ $this->log('Not enough permissions to show/hide content element ID "'.$intId.'"', __METHOD__, TL_ERROR); |
|
275 |
+ $this->redirect('contao/main.php?act=error'); |
|
276 |
+ } |
|
277 |
+ |
|
278 |
+ $objVersions = new Versions('tl_content', $intId); |
|
279 |
+ $objVersions->initialize(); |
|
280 |
+ |
|
281 |
+ // Trigger the save_callback |
|
282 |
+ if (is_array($GLOBALS['TL_DCA']['tl_esm_clients_settings']['fields']['invisible']['save_callback'])) |
|
283 |
+ { |
|
284 |
+ foreach ($GLOBALS['TL_DCA']['tl_esm_clients_settings']['fields']['invisible']['save_callback'] as $callback) |
|
285 |
+ { |
|
286 |
+ if (is_array($callback)) |
|
287 |
+ { |
|
288 |
+ $this->import($callback[0]); |
|
289 |
+ $blnVisible = $this->$callback[0]->$callback[1]($blnVisible, $this); |
|
290 |
+ } |
|
291 |
+ elseif (is_callable($callback)) |
|
292 |
+ { |
|
293 |
+ $blnVisible = $callback($blnVisible, $this); |
|
294 |
+ } |
|
295 |
+ } |
|
296 |
+ } |
|
297 |
+ |
|
298 |
+ // Update the database |
|
299 |
+ $this->Database->prepare("UPDATE tl_esm_clients_settings SET tstamp=". time() .", invisible='" . ($blnVisible ? '' : 1) . "' WHERE id=?") |
|
300 |
+ ->execute($intId); |
|
301 |
+ |
|
302 |
+ $objVersions->create(); |
|
303 |
+ $this->log('A new version of record "tl_esm_clients_settings.id='.$intId.'" has been created', __METHOD__, TL_GENERAL); |
|
304 |
+ } |
|
305 |
+} |
|
0 | 306 |
\ No newline at end of file |
1 | 307 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,45 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+/** |
|
14 |
+ * Table tl_module |
|
15 |
+ */ |
|
16 |
+/** |
|
17 |
+ * Add palettes to tl_module |
|
18 |
+ */ |
|
19 |
+$GLOBALS['TL_DCA']['tl_module']['palettes']['clientsShowcase'] = '{title_legend},name,headline,type;{config_legend},esm_numberOfItems,perPage;{reference_legend},jumpTo;{template_legend:hide},customTpl,esm_clientsShowcase_template;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space'; |
|
20 |
+$GLOBALS['TL_DCA']['tl_module']['palettes']['clientsProject'] = '{title_legend},name,headline,type;{image_legend},imgSize,fullsize;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space'; |
|
21 |
+ |
|
22 |
+ |
|
23 |
+/** |
|
24 |
+ * Add fields to tl_module |
|
25 |
+ */ |
|
26 |
+$GLOBALS['TL_DCA']['tl_module']['fields']['esm_numberOfItems'] = array |
|
27 |
+( |
|
28 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_module']['esm_numberOfItems'], |
|
29 |
+ 'default' => 0, |
|
30 |
+ 'exclude' => true, |
|
31 |
+ 'inputType' => 'text', |
|
32 |
+ 'eval' => array('mandatory'=>true, 'rgxp'=>'natural', 'tl_class'=>'w50'), |
|
33 |
+ 'sql' => "smallint(5) unsigned NOT NULL default '0'" |
|
34 |
+); |
|
35 |
+ |
|
36 |
+$GLOBALS['TL_DCA']['tl_module']['fields']['esm_clientsShowcase_template'] = array |
|
37 |
+( |
|
38 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_module']['esm_clientsShowcase_template'], |
|
39 |
+ 'default' => '_clientsShowcase_default', |
|
40 |
+ 'exclude' => true, |
|
41 |
+ 'inputType' => 'select', |
|
42 |
+ 'options_callback' => array('tl_module_esm_clients', 'getClientsShowcaseTemplates'), |
|
43 |
+ 'eval' => array('tl_class'=>'w50'), |
|
44 |
+ 'sql' => "varchar(32) NOT NULL default ''" |
|
45 |
+); |
|
0 | 46 |
\ No newline at end of file |
1 | 47 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,25 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+/** |
|
14 |
+ * Headings |
|
15 |
+ */ |
|
16 |
+$GLOBALS['TL_LANG']['ESM_CLIENTS']['project_text'] = 'Besonderheiten'; |
|
17 |
+$GLOBALS['TL_LANG']['ESM_CLIENTS']['project_link'] = 'Projekt ansehen'; |
|
18 |
+$GLOBALS['TL_LANG']['ESM_CLIENTS']['project_services'] = 'Unsere Leistungen'; |
|
19 |
+$GLOBALS['TL_LANG']['ESM_CLIENTS']['project_features'] = 'Features'; |
|
20 |
+$GLOBALS['TL_LANG']['ESM_CLIENTS']['project_tech'] = 'Systeme'; |
|
21 |
+ |
|
22 |
+/** |
|
23 |
+ * Backend |
|
24 |
+ */ |
|
25 |
+$GLOBALS['TL_LANG']['ESM_CLIENTS']['sortorder'] = 'Sortierung im Frontend'; |
|
0 | 26 |
\ No newline at end of file |
1 | 27 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,27 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+/** |
|
14 |
+ * Backend modules |
|
15 |
+ */ |
|
16 |
+$GLOBALS['TL_LANG']['MOD']['esales'][0] = 'eSales Media'; |
|
17 |
+$GLOBALS['TL_LANG']['MOD']['clients'][0] = 'Kunden'; |
|
18 |
+$GLOBALS['TL_LANG']['MOD']['clients'][1] = 'Erlaubt das Anlegen und Verwalten von Kunden und Referenzen.'; |
|
19 |
+ |
|
20 |
+/** |
|
21 |
+ * Frontend modules |
|
22 |
+ */ |
|
23 |
+$GLOBALS['TL_LANG']['FMD']['esalesClients'][0] = 'eSales Media - Kunden'; |
|
24 |
+$GLOBALS['TL_LANG']['FMD']['clientsShowcase'][0] = 'Kundenliste mit Projekten'; |
|
25 |
+$GLOBALS['TL_LANG']['FMD']['clientsShowcase'][1] = 'Zeigt eine Liste mit Kunden an, welche Projekte zugewiesen haben.'; |
|
26 |
+$GLOBALS['TL_LANG']['FMD']['clientsProject'][0] = 'Projektdetails'; |
|
27 |
+$GLOBALS['TL_LANG']['FMD']['clientsProject'][1] = 'Zeigt die Details zu einem Kundenprojekt'; |
|
0 | 28 |
\ No newline at end of file |
1 | 29 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,59 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+/** |
|
14 |
+ * Fields |
|
15 |
+ */ |
|
16 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['title'][0] = 'Kundenname/Firma'; |
|
17 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['title'][1] = 'Der Name des Kunden, welcher auf den Projektseiten ausgegeben wird.'; |
|
18 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['branch'][0] = 'Branchen'; |
|
19 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['branch'][1] = 'Die Branche(n), in denen der Kunde tätig ist.'; |
|
20 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['text'][0] = 'Kurzbeschreibung/Profil des Kunden'; |
|
21 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['text'][1] = 'Dieser Text sollte den Kunden umschreiben.'; |
|
22 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['basecolor'][0] = 'Grundfarbe'; |
|
23 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['basecolor'][1] = 'Grundfarbe des Kunden, welche für layoutspezifische Dinge verwendet wird.'; |
|
24 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['logo_neutral'][0] = 'Neutrales Logo (weiß/transparent)'; |
|
25 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['logo_neutral'][1] = 'Neutrales, weißes Logo auf transparentem Hintergrund.'; |
|
26 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['logo_original'][0] = 'Original-Logo (weiß/transparent)'; |
|
27 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['logo_original'][1] = 'Das Originallogo des Kunden.'; |
|
28 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['invisible'][0] = 'Unsichtbar'; |
|
29 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['invisible'][1] = 'Den Eintrag im Frontend verstecken.'; |
|
30 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['start'][0] = 'Anzeigen ab'; |
|
31 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['start'][1] = 'Eintrag ab diesem Zeitpunkt anzeigen.'; |
|
32 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['stop'][0] = 'Anzeigen bis'; |
|
33 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['stop'][1] = 'Eintrag ab diesem Zeitpunkt verstecken.'; |
|
34 |
+ |
|
35 |
+ |
|
36 |
+/** |
|
37 |
+ * Legends |
|
38 |
+ */ |
|
39 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['title_legend'] = 'Titel'; |
|
40 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['categorize_legend'] = 'Kategorisierung'; |
|
41 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['teaser_legend'] = 'Beschreibung'; |
|
42 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['style_legend'] = 'Aussehen/Grafiken'; |
|
43 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['invisible_legend'] = 'Sichtbarkeit'; |
|
44 |
+ |
|
45 |
+ |
|
46 |
+/** |
|
47 |
+ * References |
|
48 |
+ */ |
|
49 |
+ |
|
50 |
+ |
|
51 |
+/** |
|
52 |
+ * Buttons |
|
53 |
+ */ |
|
54 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['new'][0] = 'Neuer Kunde'; |
|
55 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['new'][1] = 'Ein neuer Referenzkunde anlegen'; |
|
56 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['settings'][0] = 'Einstellungen'; |
|
57 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['settings'][1] = 'Einstellungen und Definitionen für das Referenz-Modul'; |
|
58 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['sort'][0] = 'Sortierreihenfolge'; |
|
59 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['sort'][1] = 'Sortierung der Kunden im Frontend'; |
|
0 | 60 |
\ No newline at end of file |
1 | 61 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,59 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+/** |
|
14 |
+ * Fields |
|
15 |
+ */ |
|
16 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['title'][0] = 'Projektname'; |
|
17 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['title'][1] = 'Der Name des Projektes.'; |
|
18 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['type'][0] = 'Projekttyp'; |
|
19 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['type'][1] = 'Um was für ein Typ Projekt handelt es sich.'; |
|
20 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['text'][0] = 'Kurzbeschreibung des Projektes'; |
|
21 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['text'][1] = 'Dieser Text sollte etwaige Besonderheiten umschreiben.'; |
|
22 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['projectUrl'][0] = 'Projekt-Url'; |
|
23 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['projectUrl'][1] = 'Die URL unter der das Projekt zu erreichen ist.'; |
|
24 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['services'][0] = 'Erbrachte Leistungen'; |
|
25 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['services'][1] = 'Die erbrachten Leistungen in dem Projekt.'; |
|
26 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['features'][0] = 'Projektfeatures'; |
|
27 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['features'][1] = 'Die besonderen Features, welche das Projekt bietet.'; |
|
28 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['tech'][0] = 'Technologie'; |
|
29 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['tech'][1] = 'Die bei dem Projekt eingesetzte Technologie'; |
|
30 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['gallerySRC'][0] = 'Screenshots'; |
|
31 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['gallerySRC'][1] = 'Screenshots/Schaubilder zum Projekt.'; |
|
32 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['invisible'][0] = 'Unsichtbar'; |
|
33 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['invisible'][1] = 'Den Eintrag im Frontend verstecken.'; |
|
34 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['start'][0] = 'Anzeigen ab'; |
|
35 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['start'][1] = 'Eintrag ab diesem Zeitpunkt anzeigen.'; |
|
36 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['stop'][0] = 'Anzeigen bis'; |
|
37 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['stop'][1] = 'Eintrag ab diesem Zeitpunkt verstecken.'; |
|
38 |
+ |
|
39 |
+ |
|
40 |
+/** |
|
41 |
+ * Legends |
|
42 |
+ */ |
|
43 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['title_legend'] = 'Titel'; |
|
44 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['categorize_legend'] = 'Kategorisierung'; |
|
45 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['details_legend'] = 'Projektdetails'; |
|
46 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['images_legend'] = 'Bilder'; |
|
47 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['invisible_legend'] = 'Sichtbarkeit'; |
|
48 |
+ |
|
49 |
+ |
|
50 |
+/** |
|
51 |
+ * References |
|
52 |
+ */ |
|
53 |
+ |
|
54 |
+ |
|
55 |
+/** |
|
56 |
+ * Buttons |
|
57 |
+ */ |
|
58 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['new'][0] = 'Neuer Kunde'; |
|
59 |
+$GLOBALS['TL_LANG']['tl_esm_clients_projects']['new'][1] = 'Ein neuer Referenzkunde anlegen'; |
|
0 | 60 |
\ No newline at end of file |
1 | 61 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,50 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+/** |
|
14 |
+ * Fields |
|
15 |
+ */ |
|
16 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['title'][0] = 'Optionstitel'; |
|
17 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['title'][1] = 'Der Titel der Option, welcher im Frontend ausgegeben wird.'; |
|
18 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['type'][0] = 'Optionstyp'; |
|
19 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['type'][1] = 'Um welche Art der Option handelt es sich.'; |
|
20 |
+ |
|
21 |
+ |
|
22 |
+/** |
|
23 |
+ * Legends |
|
24 |
+ */ |
|
25 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['type_legend'] = 'Typ'; |
|
26 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['attribute_legend'] = 'Attribut-Definition'; |
|
27 |
+ |
|
28 |
+ |
|
29 |
+/** |
|
30 |
+ * References |
|
31 |
+ */ |
|
32 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['REF']['branch'] = 'Branche'; |
|
33 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['REF']['type'] = 'Projektart'; |
|
34 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['REF']['services'] = 'Leistungen'; |
|
35 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['REF']['tech'] = 'Technologie'; |
|
36 |
+ |
|
37 |
+ |
|
38 |
+/** |
|
39 |
+ * Buttons |
|
40 |
+ */ |
|
41 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['new'][0] = 'Neue Option'; |
|
42 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['new'][1] = 'Eine neue Option anlegen'; |
|
43 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['edit'][0] = 'Option bearbeiten'; |
|
44 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['edit'][1] = 'Die Option "%s" bearbeiten'; |
|
45 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['copy'][0] = 'Option duplizieren'; |
|
46 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['copy'][1] = 'Die Option "%s" duplizieren'; |
|
47 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['delete'][0] = 'Option löschen'; |
|
48 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['delete'][1] = 'Die Option "%s" löschen'; |
|
49 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['show'][0] = 'Details anzeigen'; |
|
50 |
+$GLOBALS['TL_LANG']['tl_esm_clients_settings']['show'][1] = 'Die Details für die Option "%s" anzeigen'; |
|
0 | 51 |
\ No newline at end of file |
1 | 52 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,33 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+/** |
|
14 |
+ * Fields |
|
15 |
+ */ |
|
16 |
+$GLOBALS['TL_LANG']['tl_module']['esm_numberOfItems'][0] = 'Gesamtzahl der Elemente'; |
|
17 |
+$GLOBALS['TL_LANG']['tl_module']['esm_numberOfItems'][1] = 'Hier können Sie die Gesamtzahl der Elemente begrenzen. Geben Sie 0 ein, um alle anzuzeigen.'; |
|
18 |
+$GLOBALS['TL_LANG']['tl_module']['esm_clientsShowcase_template'][0] = 'Showcase-Template'; |
|
19 |
+$GLOBALS['TL_LANG']['tl_module']['esm_clientsShowcase_template'][1] = 'Hier können Sie das Showcase-Template überschreiben.'; |
|
20 |
+ |
|
21 |
+/** |
|
22 |
+ * Legends |
|
23 |
+ */ |
|
24 |
+//$GLOBALS['TL_LANG']['tl_module']['title_legend'] = 'Titel'; |
|
25 |
+ |
|
26 |
+/** |
|
27 |
+ * References |
|
28 |
+ */ |
|
29 |
+ |
|
30 |
+ |
|
31 |
+/** |
|
32 |
+ * Buttons |
|
33 |
+ */ |
0 | 34 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,31 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+/** |
|
14 |
+ * Fields |
|
15 |
+ */ |
|
16 |
+ |
|
17 |
+ |
|
18 |
+/** |
|
19 |
+ * Legends |
|
20 |
+ */ |
|
21 |
+ |
|
22 |
+ |
|
23 |
+/** |
|
24 |
+ * References |
|
25 |
+ */ |
|
26 |
+ |
|
27 |
+ |
|
28 |
+/** |
|
29 |
+ * Buttons |
|
30 |
+ */ |
|
31 |
+$GLOBALS['TL_LANG']['tl_esm_clients']['edit'] = 'Neuer Kunde'; |
|
0 | 32 |
\ No newline at end of file |
1 | 33 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,69 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+*/ |
|
12 |
+ |
|
13 |
+ |
|
14 |
+/** |
|
15 |
+ * Run in a custom namespace, so the class can be replaced |
|
16 |
+ */ |
|
17 |
+namespace eSM_clients; |
|
18 |
+ |
|
19 |
+ |
|
20 |
+/** |
|
21 |
+ * Reads and writes reference clients |
|
22 |
+ * |
|
23 |
+ * @package Models |
|
24 |
+ * @author Benjamin Roth <http://www.esales-media.de> |
|
25 |
+ * @copyright eSales Media 2014 |
|
26 |
+ */ |
|
27 |
+class EsmClientsModel extends \Model |
|
28 |
+{ |
|
29 |
+ |
|
30 |
+ /** |
|
31 |
+ * Table name |
|
32 |
+ * @var string |
|
33 |
+ */ |
|
34 |
+ protected static $strTable = 'tl_esm_clients'; |
|
35 |
+ |
|
36 |
+ |
|
37 |
+ /** |
|
38 |
+ * @return \Model\Collection|null |
|
39 |
+ */ |
|
40 |
+ public static function getReferenceClients() |
|
41 |
+ { |
|
42 |
+ $t1 = static::$strTable; |
|
43 |
+ $t2 = $t1.'_projects'; |
|
44 |
+ |
|
45 |
+ $Result = \Database::getInstance()->execute("SELECT $t1.id FROM $t1 WHERE invisible='' AND EXISTS (SELECT 1 FROM $t2 WHERE $t2.pid = $t1.id AND invisible = '' GROUP BY $t2.pid) ORDER BY $t1.sorting"); |
|
46 |
+ |
|
47 |
+ $arrIds = $Result->fetchEach('id'); |
|
48 |
+ |
|
49 |
+ return static::findMultipleByIds($arrIds); |
|
50 |
+ } |
|
51 |
+ |
|
52 |
+ /** |
|
53 |
+ * @param bool $blnIncludeInvisible |
|
54 |
+ * @return \Model\Collection|null |
|
55 |
+ */ |
|
56 |
+ public function getProjects($blnIncludeInvisible=false) |
|
57 |
+ { |
|
58 |
+ $arrConditions = array('pid = ?'); |
|
59 |
+ $arrValues = array($this->id); |
|
60 |
+ |
|
61 |
+ if ($blnIncludeInvisible) |
|
62 |
+ { |
|
63 |
+ $arrConditions[] = 'invisible = ?'; |
|
64 |
+ $arrValues[] = '1'; |
|
65 |
+ } |
|
66 |
+ |
|
67 |
+ return EsmClientsProjectsModel::findBy($arrConditions,$arrValues,array('order'=>'sorting')); |
|
68 |
+ } |
|
69 |
+} |
0 | 70 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,36 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+* References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+*/ |
|
12 |
+ |
|
13 |
+ |
|
14 |
+/** |
|
15 |
+ * Run in a custom namespace, so the class can be replaced |
|
16 |
+ */ |
|
17 |
+namespace eSM_clients; |
|
18 |
+ |
|
19 |
+ |
|
20 |
+/** |
|
21 |
+ * Reads and writes projects |
|
22 |
+ * |
|
23 |
+ * @package Models |
|
24 |
+ * @author Benjamin Roth <http://www.esales-media.de> |
|
25 |
+ * @copyright eSales Media 2014 |
|
26 |
+ */ |
|
27 |
+class EsmClientsProjectsModel extends \Model |
|
28 |
+{ |
|
29 |
+ |
|
30 |
+ /** |
|
31 |
+ * Table name |
|
32 |
+ * @var string |
|
33 |
+ */ |
|
34 |
+ protected static $strTable = 'tl_esm_clients_projects'; |
|
35 |
+ |
|
36 |
+} |
0 | 37 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,36 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+* References for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+*/ |
|
12 |
+ |
|
13 |
+ |
|
14 |
+/** |
|
15 |
+ * Run in a custom namespace, so the class can be replaced |
|
16 |
+ */ |
|
17 |
+namespace eSM_clients; |
|
18 |
+ |
|
19 |
+ |
|
20 |
+/** |
|
21 |
+ * Reads and writes reference clients |
|
22 |
+ * |
|
23 |
+ * @package Models |
|
24 |
+ * @author Benjamin Roth <http://www.esales-media.de> |
|
25 |
+ * @copyright eSales Media 2014 |
|
26 |
+ */ |
|
27 |
+class EsmClientsSettingsModel extends \Model |
|
28 |
+{ |
|
29 |
+ |
|
30 |
+ /** |
|
31 |
+ * Table name |
|
32 |
+ * @var string |
|
33 |
+ */ |
|
34 |
+ protected static $strTable = 'tl_esm_clients_settings'; |
|
35 |
+ |
|
36 |
+} |
0 | 37 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,299 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Clients for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+*/ |
|
12 |
+ |
|
13 |
+ |
|
14 |
+/** |
|
15 |
+ * Run in a custom namespace, so the class can be replaced |
|
16 |
+ */ |
|
17 |
+namespace eSM_clients; |
|
18 |
+ |
|
19 |
+ |
|
20 |
+/** |
|
21 |
+ * Shows a list of clients which have active projects |
|
22 |
+ * |
|
23 |
+ * @package Modules |
|
24 |
+ * @author Benjamin Roth <http://www.esales-media.de> |
|
25 |
+ * @copyright eSales Media 2014 |
|
26 |
+ */ |
|
27 |
+class ModuleClientsProject extends \Module |
|
28 |
+{ |
|
29 |
+ /** |
|
30 |
+ * Template |
|
31 |
+ * @var string |
|
32 |
+ */ |
|
33 |
+ protected $strTemplate = 'mod_clientsProject'; |
|
34 |
+ |
|
35 |
+ protected $objProject = null; |
|
36 |
+ |
|
37 |
+ |
|
38 |
+ public function generate() |
|
39 |
+ { |
|
40 |
+ if (TL_MODE == 'BE') |
|
41 |
+ { |
|
42 |
+ $objTemplate = new \BackendTemplate('be_wildcard'); |
|
43 |
+ |
|
44 |
+ $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['clientsProject'][0]) . ' ###'; |
|
45 |
+ $objTemplate->title = $this->headline; |
|
46 |
+ $objTemplate->id = $this->id; |
|
47 |
+ $objTemplate->link = $this->name; |
|
48 |
+ $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id; |
|
49 |
+ |
|
50 |
+ return $objTemplate->parse(); |
|
51 |
+ } |
|
52 |
+ |
|
53 |
+ // Set the item from the auto_item parameter |
|
54 |
+ if (!isset($_GET['items']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) |
|
55 |
+ { |
|
56 |
+ \Input::setGet('items', \Input::get('auto_item')); |
|
57 |
+ } |
|
58 |
+ |
|
59 |
+ $this->objProject = EsmClientsProjectsModel::findByIdOrAlias($_GET['items']); |
|
60 |
+ |
|
61 |
+ if ($this->objProject === null) |
|
62 |
+ { |
|
63 |
+ global $objPage; |
|
64 |
+ $objHandler = new $GLOBALS['TL_PTY']['error_404'](); |
|
65 |
+ $objHandler->generate($objPage->id); |
|
66 |
+ } |
|
67 |
+ |
|
68 |
+ return parent::generate(); |
|
69 |
+ } |
|
70 |
+ |
|
71 |
+ /** |
|
72 |
+ * Compile the current element |
|
73 |
+ */ |
|
74 |
+ protected function compile() |
|
75 |
+ { |
|
76 |
+ global $objPage; |
|
77 |
+ |
|
78 |
+ $Client = $this->objProject->getRelated('pid'); |
|
79 |
+ |
|
80 |
+ // Get the previous and next project |
|
81 |
+ $subSql = "SELECT ri.*, @row_num := @row_num+1 AS RN FROM (SELECT p.id, p.alias, p.title, c.title as 'client', p.sorting FROM tl_esm_clients c, tl_esm_clients_projects p WHERE p.pid=c.id ORDER BY c.sorting, p.sorting) ri, (SELECT @row_num := 0) r"; |
|
82 |
+ $Current = \Database::getInstance()->prepare("SELECT sq.RN FROM (".$subSql.") sq WHERE sq.id = ?")->execute($this->objProject->id); |
|
83 |
+ |
|
84 |
+ if ($Current->numRows) |
|
85 |
+ { |
|
86 |
+ // Get previous |
|
87 |
+ $Previous = \Database::getInstance()->prepare("SELECT sq.id, sq.alias, sq.title, sq.client FROM (".$subSql.") sq WHERE sq.RN = ?")->execute($Current->RN-1); |
|
88 |
+ |
|
89 |
+ // Get next |
|
90 |
+ $Next = \Database::getInstance()->prepare("SELECT sq.id, sq.alias, sq.title, sq.client FROM (".$subSql.") sq WHERE sq.RN = ?")->execute($Current->RN+1); |
|
91 |
+ |
|
92 |
+ // Set projects nav vars |
|
93 |
+ $strJumpTo = ampersand($this->generateFrontendUrl($objPage->row(), ((\Config::get('useAutoItem') && !\Config::get('disableAlias')) ? '/%s' : '/items/%s'))); |
|
94 |
+ |
|
95 |
+ if ($Previous->numRows) |
|
96 |
+ { |
|
97 |
+ $this->Template->prevProject = array_merge($Previous->row(),array('link'=>sprintf($strJumpTo,(!\Config::get('disableAlias') && $Previous->alias != '') ? $Previous->alias : $Previous->id))); |
|
98 |
+ } |
|
99 |
+ |
|
100 |
+ if ($Next->numRows) |
|
101 |
+ { |
|
102 |
+ $this->Template->nextProject = array_merge($Next->row(),array('link'=>sprintf($strJumpTo,(!\Config::get('disableAlias') && $Next->alias != '') ? $Next->alias : $Next->id))); |
|
103 |
+ } |
|
104 |
+ } |
|
105 |
+ |
|
106 |
+ |
|
107 |
+ // Get the file entries from the database |
|
108 |
+ $objFiles = \FilesModel::findMultipleByUuids(deserialize($this->objProject->gallerySRC,true)); |
|
109 |
+ |
|
110 |
+ // Get all images |
|
111 |
+ $images = array(); |
|
112 |
+ $auxDate = array(); |
|
113 |
+ |
|
114 |
+ if (!is_null($objFiles)) |
|
115 |
+ { |
|
116 |
+ while ($objFiles->next()) |
|
117 |
+ { |
|
118 |
+ // Continue if the files has been processed or does not exist |
|
119 |
+ if (isset($images[$objFiles->path]) || !file_exists(TL_ROOT . '/' . $objFiles->path)) |
|
120 |
+ { |
|
121 |
+ continue; |
|
122 |
+ } |
|
123 |
+ |
|
124 |
+ // Single files |
|
125 |
+ if ($objFiles->type == 'file') |
|
126 |
+ { |
|
127 |
+ $objFile = new \File($objFiles->path, true); |
|
128 |
+ |
|
129 |
+ if (!$objFile->isImage) |
|
130 |
+ { |
|
131 |
+ continue; |
|
132 |
+ } |
|
133 |
+ |
|
134 |
+ $arrMeta = $this->getMetaData($objFiles->meta, $objPage->language); |
|
135 |
+ |
|
136 |
+ if (empty($arrMeta)) |
|
137 |
+ { |
|
138 |
+ $arrMeta = $this->getMetaData($objFiles->meta, $objPage->rootFallbackLanguage); |
|
139 |
+ } |
|
140 |
+ |
|
141 |
+ // Use the file name as title if none is given |
|
142 |
+ if ($arrMeta['title'] == '') |
|
143 |
+ { |
|
144 |
+ $arrMeta['title'] = specialchars($objFile->basename); |
|
145 |
+ } |
|
146 |
+ |
|
147 |
+ // Add the image |
|
148 |
+ $images[$objFiles->path] = array |
|
149 |
+ ( |
|
150 |
+ 'id' => $objFiles->id, |
|
151 |
+ 'uuid' => $objFiles->uuid, |
|
152 |
+ 'name' => $objFile->basename, |
|
153 |
+ 'singleSRC' => $objFiles->path, |
|
154 |
+ 'alt' => $arrMeta['title'], |
|
155 |
+ 'imageUrl' => $arrMeta['link'], |
|
156 |
+ 'caption' => $arrMeta['caption'], |
|
157 |
+ 'size' => $this->imgSize, |
|
158 |
+ 'fullsize' => $this->fullsize |
|
159 |
+ ); |
|
160 |
+ |
|
161 |
+ $auxDate[] = $objFile->mtime; |
|
162 |
+ } // Folders |
|
163 |
+ else |
|
164 |
+ { |
|
165 |
+ $objSubfiles = \FilesModel::findByPid($objFiles->uuid); |
|
166 |
+ |
|
167 |
+ if ($objSubfiles === null) |
|
168 |
+ { |
|
169 |
+ continue; |
|
170 |
+ } |
|
171 |
+ |
|
172 |
+ while ($objSubfiles->next()) |
|
173 |
+ { |
|
174 |
+ // Skip subfolders |
|
175 |
+ if ($objSubfiles->type == 'folder') |
|
176 |
+ { |
|
177 |
+ continue; |
|
178 |
+ } |
|
179 |
+ |
|
180 |
+ $objFile = new \File($objSubfiles->path, true); |
|
181 |
+ |
|
182 |
+ if (!$objFile->isImage) |
|
183 |
+ { |
|
184 |
+ continue; |
|
185 |
+ } |
|
186 |
+ |
|
187 |
+ $arrMeta = $this->getMetaData($objSubfiles->meta, $objPage->language); |
|
188 |
+ |
|
189 |
+ if (empty($arrMeta)) |
|
190 |
+ { |
|
191 |
+ $arrMeta = $this->getMetaData($objSubfiles->meta, $objPage->rootFallbackLanguage); |
|
192 |
+ } |
|
193 |
+ |
|
194 |
+ // Use the file name as title if none is given |
|
195 |
+ if ($arrMeta['title'] == '') |
|
196 |
+ { |
|
197 |
+ $arrMeta['title'] = specialchars($objFile->basename); |
|
198 |
+ } |
|
199 |
+ |
|
200 |
+ // Add the image |
|
201 |
+ $images[$objSubfiles->path] = array |
|
202 |
+ ( |
|
203 |
+ 'id' => $objSubfiles->id, |
|
204 |
+ 'uuid' => $objSubfiles->uuid, |
|
205 |
+ 'name' => $objFile->basename, |
|
206 |
+ 'singleSRC' => $objSubfiles->path, |
|
207 |
+ 'alt' => $arrMeta['title'], |
|
208 |
+ 'imageUrl' => $arrMeta['link'], |
|
209 |
+ 'caption' => $arrMeta['caption'], |
|
210 |
+ 'size' => $this->imgSize, |
|
211 |
+ 'fullsize' => $this->fullsize |
|
212 |
+ ); |
|
213 |
+ |
|
214 |
+ $auxDate[] = $objFile->mtime; |
|
215 |
+ } |
|
216 |
+ } |
|
217 |
+ } |
|
218 |
+ |
|
219 |
+ if ($this->objProject->galleryOrder != '') |
|
220 |
+ { |
|
221 |
+ $tmp = deserialize($this->objProject->galleryOrder); |
|
222 |
+ |
|
223 |
+ if (!empty($tmp) && is_array($tmp)) |
|
224 |
+ { |
|
225 |
+ // Remove all values |
|
226 |
+ $arrOrder = array_map(function () |
|
227 |
+ { |
|
228 |
+ }, array_flip($tmp)); |
|
229 |
+ |
|
230 |
+ // Move the matching elements to their position in $arrOrder |
|
231 |
+ foreach ($images as $k => $v) |
|
232 |
+ { |
|
233 |
+ if (array_key_exists($v['uuid'], $arrOrder)) |
|
234 |
+ { |
|
235 |
+ $arrOrder[$v['uuid']] = $v; |
|
236 |
+ unset($images[$k]); |
|
237 |
+ } |
|
238 |
+ } |
|
239 |
+ |
|
240 |
+ // Append the left-over images at the end |
|
241 |
+ if (!empty($images)) |
|
242 |
+ { |
|
243 |
+ $arrOrder = array_merge($arrOrder, array_values($images)); |
|
244 |
+ } |
|
245 |
+ |
|
246 |
+ // Remove empty (unreplaced) entries |
|
247 |
+ $images = array_values(array_filter($arrOrder)); |
|
248 |
+ unset($arrOrder); |
|
249 |
+ } |
|
250 |
+ } |
|
251 |
+ $images = array_values($images); |
|
252 |
+ } |
|
253 |
+ |
|
254 |
+ // Add images to Template |
|
255 |
+ $arrImages = array(); |
|
256 |
+ foreach ($images as $image) |
|
257 |
+ { |
|
258 |
+ $objImage = new \stdClass(); |
|
259 |
+ $this->addImageToTemplate($objImage, $image, null, 'lightbox[lb' . $this->id . ']'); |
|
260 |
+ |
|
261 |
+ $arrImages[] = $objImage; |
|
262 |
+ } |
|
263 |
+ $this->Template->screenshots = $arrImages; |
|
264 |
+ |
|
265 |
+ // Set header vars |
|
266 |
+ $this->Template->client_title = $Client->title; |
|
267 |
+ $this->Template->title = $this->objProject->title; |
|
268 |
+ |
|
269 |
+ // Set client summary |
|
270 |
+ $this->Template->client_summary = $Client->text; |
|
271 |
+ |
|
272 |
+ // Set project summary vars |
|
273 |
+ $this->Template->text = $this->objProject->text; |
|
274 |
+ $this->Template->link = $this->objProject->projectUrl; |
|
275 |
+ $this->Template->services = $this->getOptions(explode(',',$this->objProject->services)); |
|
276 |
+ $this->Template->features = deserialize($this->objProject->features,true); |
|
277 |
+ $this->Template->techs = $this->getOptions(explode(',',$this->objProject->tech)); |
|
278 |
+ |
|
279 |
+ } |
|
280 |
+ |
|
281 |
+ protected function getOptions(array $values) |
|
282 |
+ { |
|
283 |
+ $arrOptions = array(); |
|
284 |
+ |
|
285 |
+ $Types = \EsmClientsSettingsModel::findMultipleByIds($values); |
|
286 |
+ |
|
287 |
+ if (!is_null($Types)) |
|
288 |
+ { |
|
289 |
+ while($Types->next()) |
|
290 |
+ { |
|
291 |
+ $arrOptions[] = array('title'=>$Types->title,'url'=>$Types->url); |
|
292 |
+ } |
|
293 |
+ } |
|
294 |
+ |
|
295 |
+ return $arrOptions; |
|
296 |
+ } |
|
297 |
+ |
|
298 |
+ |
|
299 |
+} |
0 | 300 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,189 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Clients for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de] |
|
7 |
+ * |
|
8 |
+ * @package eSM_clients |
|
9 |
+ * @link http://www.esales-media.de |
|
10 |
+ * @license commercial |
|
11 |
+*/ |
|
12 |
+ |
|
13 |
+ |
|
14 |
+/** |
|
15 |
+ * Run in a custom namespace, so the class can be replaced |
|
16 |
+ */ |
|
17 |
+namespace eSM_clients; |
|
18 |
+ |
|
19 |
+ |
|
20 |
+/** |
|
21 |
+ * Shows a list of clients which have active projects |
|
22 |
+ * |
|
23 |
+ * @package Modules |
|
24 |
+ * @author Benjamin Roth <http://www.esales-media.de> |
|
25 |
+ * @copyright eSales Media 2014 |
|
26 |
+ */ |
|
27 |
+class ModuleClientsShowcase extends \Module |
|
28 |
+{ |
|
29 |
+ /** |
|
30 |
+ * Template |
|
31 |
+ * @var string |
|
32 |
+ */ |
|
33 |
+ protected $strTemplate = 'mod_clientsShowcase'; |
|
34 |
+ |
|
35 |
+ /** |
|
36 |
+ * URL |
|
37 |
+ * @var string |
|
38 |
+ */ |
|
39 |
+ protected $strLink; |
|
40 |
+ |
|
41 |
+ |
|
42 |
+ public function generate() |
|
43 |
+ { |
|
44 |
+ if (TL_MODE == 'BE') |
|
45 |
+ { |
|
46 |
+ $objTemplate = new \BackendTemplate('be_wildcard'); |
|
47 |
+ |
|
48 |
+ $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['clientsShowcase'][0]) . ' ###'; |
|
49 |
+ $objTemplate->title = $this->headline; |
|
50 |
+ $objTemplate->id = $this->id; |
|
51 |
+ $objTemplate->link = $this->name; |
|
52 |
+ $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id; |
|
53 |
+ |
|
54 |
+ return $objTemplate->parse(); |
|
55 |
+ } |
|
56 |
+ |
|
57 |
+ $this->strUrl = preg_replace('/\?.*$/', '', \Environment::get('request')); |
|
58 |
+ $this->strLink = $this->strUrl; |
|
59 |
+ |
|
60 |
+ return parent::generate(); |
|
61 |
+ } |
|
62 |
+ |
|
63 |
+ /** |
|
64 |
+ * Compile the current element |
|
65 |
+ */ |
|
66 |
+ protected function compile() |
|
67 |
+ { |
|
68 |
+ global $objPage; |
|
69 |
+ |
|
70 |
+ $Clients = EsmClientsModel::getReferenceClients(); |
|
71 |
+ |
|
72 |
+ $strItems = ''; |
|
73 |
+ |
|
74 |
+ foreach ($Clients as $client) |
|
75 |
+ { |
|
76 |
+// dump($client); |
|
77 |
+ // Load client template |
|
78 |
+ $objClientTemplate = new \FrontendTemplate($this->esm_clientsShowcase_template); |
|
79 |
+ |
|
80 |
+ // Set template data |
|
81 |
+ $objClientTemplate->title = $client->title; |
|
82 |
+ $objClientTemplate->text = $client->text; |
|
83 |
+ $objClientTemplate->color = deserialize($client->basecolor); |
|
84 |
+ $objClientTemplate->branchId = $client->branch; |
|
85 |
+ |
|
86 |
+ // Branche |
|
87 |
+ $Branch = $client->getRelated('branch'); |
|
88 |
+ if (!is_null($Branch)) |
|
89 |
+ { |
|
90 |
+ $objClientTemplate->branch = $Branch->title; |
|
91 |
+ } |
|
92 |
+ |
|
93 |
+ // Neutral logo |
|
94 |
+ $objNeutralLogo = \FilesModel::findByUuid($client->logo_neutral); |
|
95 |
+ |
|
96 |
+ if (is_file(TL_ROOT . '/' . $objNeutralLogo->path)) |
|
97 |
+ { |
|
98 |
+ $objFile = new \File($objNeutralLogo->path, true); |
|
99 |
+ $arrSize = $objFile->imageSize; |
|
100 |
+ $arrMeta = $this->getMetaData($objNeutralLogo->meta, $objPage->language); |
|
101 |
+ if (empty($arrMeta)) |
|
102 |
+ { |
|
103 |
+ if ($objPage->rootFallbackLanguage !== null) |
|
104 |
+ { |
|
105 |
+ $arrMeta = $this->getMetaData($objNeutralLogo->meta, $objPage->rootFallbackLanguage); |
|
106 |
+ } |
|
107 |
+ } |
|
108 |
+ if ($arrMeta['title'] == '') |
|
109 |
+ { |
|
110 |
+ $arrMeta['title'] = specialchars($objFile->basename); |
|
111 |
+ } |
|
112 |
+ $objClientTemplate->logo_neutral = array |
|
113 |
+ ( |
|
114 |
+ 'src' => $objNeutralLogo->path, |
|
115 |
+ 'width' => $arrSize[0], |
|
116 |
+ 'height' => $arrSize[1], |
|
117 |
+ 'attributes' => $arrSize[3] . ' alt="' . $arrMeta['title'] . '"', |
|
118 |
+ 'meta' => $arrMeta |
|
119 |
+ ); |
|
120 |
+ |
|
121 |
+ } |
|
122 |
+ |
|
123 |
+ // Original logo |
|
124 |
+ $objOriginalLogo = \FilesModel::findByUuid($client->logo_original); |
|
125 |
+ |
|
126 |
+ if (is_file(TL_ROOT . '/' . $objOriginalLogo->path)) |
|
127 |
+ { |
|
128 |
+ $objFile = new \File($objOriginalLogo->path, true); |
|
129 |
+ $arrSize = $objFile->imageSize; |
|
130 |
+ $arrMeta = $this->getMetaData($objOriginalLogo->meta, $objPage->language); |
|
131 |
+ if (empty($arrMeta)) |
|
132 |
+ { |
|
133 |
+ if ($objPage->rootFallbackLanguage !== null) |
|
134 |
+ { |
|
135 |
+ $arrMeta = $this->getMetaData($objOriginalLogo->meta, $objPage->rootFallbackLanguage); |
|
136 |
+ } |
|
137 |
+ } |
|
138 |
+ if ($arrMeta['title'] == '') |
|
139 |
+ { |
|
140 |
+ $arrMeta['title'] = specialchars($objFile->basename); |
|
141 |
+ } |
|
142 |
+ $objClientTemplate->logo_original = array |
|
143 |
+ ( |
|
144 |
+ 'src' => $objOriginalLogo->path, |
|
145 |
+ 'width' => $arrSize[0], |
|
146 |
+ 'height' => $arrSize[1], |
|
147 |
+ 'attributes' => $arrSize[3] . ' alt="' . $arrMeta['title'] . '"', |
|
148 |
+ 'meta' => $arrMeta |
|
149 |
+ ); |
|
150 |
+ |
|
151 |
+ } |
|
152 |
+ |
|
153 |
+ // Get client projects |
|
154 |
+ $Projects = $client->getProjects(); |
|
155 |
+ |
|
156 |
+ $arrProjects = array(); |
|
157 |
+ foreach($Projects as $project) |
|
158 |
+ { |
|
159 |
+ |
|
160 |
+ $arrRow = $project->row(); |
|
161 |
+ |
|
162 |
+ if ($this->jumpTo > 0) |
|
163 |
+ { |
|
164 |
+ $objTarget = \PageModel::findByPk($this->jumpTo); |
|
165 |
+ |
|
166 |
+ if ($objTarget !== null) |
|
167 |
+ { |
|
168 |
+ $strJumpTo = ampersand($this->generateFrontendUrl($objTarget->row(), ((\Config::get('useAutoItem') && !\Config::get('disableAlias')) ? '/%s' : '/items/%s'))); |
|
169 |
+ $strJumpTo = sprintf($strJumpTo,(!\Config::get('disableAlias') && $project->alias != '') ? $project->alias : $project->id); |
|
170 |
+ |
|
171 |
+ $arrRow['link'] = $strJumpTo; |
|
172 |
+ } |
|
173 |
+ } |
|
174 |
+ |
|
175 |
+ $arrProjects[] = $arrRow; |
|
176 |
+ } |
|
177 |
+ |
|
178 |
+ $objClientTemplate->projects = $arrProjects; |
|
179 |
+ |
|
180 |
+ |
|
181 |
+ // Render Template |
|
182 |
+ $strItems .= $objClientTemplate->parse(); |
|
183 |
+ } |
|
184 |
+ |
|
185 |
+ $this->Template->items = $strItems; |
|
186 |
+ } |
|
187 |
+ |
|
188 |
+ |
|
189 |
+} |
0 | 190 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,27 @@ |
1 |
+<div class="be_eSM_report"> |
|
2 |
+ <div id="tl_buttons"> |
|
3 |
+ <a href="<?php echo $this->getReferer(true); ?>" class="header_back" title="<?php echo specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']); ?>" accesskey="b" onclick="Backend.getScrollOffset()"><?php echo $GLOBALS['TL_LANG']['MSC']['backBT']; ?></a> |
|
4 |
+ </div> |
|
5 |
+ |
|
6 |
+ <h2 class="sub_headline"><?php echo $GLOBALS['TL_LANG']['ESM_CLIENTS']['sortorder']; ?></h2> |
|
7 |
+ |
|
8 |
+ <form action="<?php echo ampersand(\Environment::get('request'), true); ?>" id="tl_esm_clients__sorting" class="tl_form" method="post" enctype="application/x-www-form-urlencoded"> |
|
9 |
+ <div class="tl_formbody_edit"> |
|
10 |
+ <input type="hidden" name="FORM_SUBMIT" value="tl_esm_clients__sorting"> |
|
11 |
+ <input type="hidden" name="REQUEST_TOKEN" value="<?php echo REQUEST_TOKEN; ?>"> |
|
12 |
+ |
|
13 |
+ <div class="tl_box"> |
|
14 |
+ <?php echo $this->fields; ?> |
|
15 |
+ </div> |
|
16 |
+ </div> |
|
17 |
+ |
|
18 |
+ <div class="tl_formbody_submit"> |
|
19 |
+ |
|
20 |
+ <div class="tl_submit_container"> |
|
21 |
+ <input type="submit" name="save" id="save" class="tl_submit" accesskey="s" value="<?php echo specialchars($GLOBALS['TL_LANG']['MSC']['save']); ?>"> |
|
22 |
+ <input type="submit" name="saveNclose" id="saveNclose" class="tl_submit" accesskey="c" value="<?php echo specialchars($GLOBALS['TL_LANG']['MSC']['saveNclose']); ?>"> |
|
23 |
+ </div> |
|
24 |
+ |
|
25 |
+ </div> |
|
26 |
+ </form> |
|
27 |
+</div> |
|
0 | 28 |
\ No newline at end of file |
1 | 29 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+<?php $this->block('content'); ?> |
|
2 |
+<?php //$this->dumpTemplateVars(); ?> |
|
3 |
+ |
|
4 |
+<div class="layout_default client"<?php if (is_array($this->color)): ?> style="background-color: #<?php echo $this->color[0]; ?>;"<?php endif; ?>> |
|
5 |
+ <div class="inside"> |
|
6 |
+ <div class="informations"> |
|
7 |
+ <h3><?php echo $this->title; ?></h3> |
|
8 |
+ <ul class="projects_<?php echo count($this->projects); ?>"> |
|
9 |
+ <?php foreach ($this->projects as $project): ?><li><a href="<?php echo $project['link']; ?>"><?php echo $project['title']; ?></a></li><?php endforeach; ?> |
|
10 |
+ </ul> |
|
11 |
+ </div> |
|
12 |
+<?php if ($this->logo_neutral): ?> |
|
13 |
+ <figure class="image_container"> |
|
14 |
+ <img class="top" src="<?php echo $this->logo_neutral['src']; ?>" <?php echo $this->logo_neutral['attributes']; ?> data-hoverimage="<?php echo $this->logo_neutral['src']; ?>"> |
|
15 |
+ <img class="back" src="<?php echo $this->logo_original['src']; ?>" <?php echo $this->logo_original['attributes']; ?> data-hoverimage="<?php echo $this->logo_original['src']; ?>"> |
|
16 |
+ </figure> |
|
17 |
+<?php endif; ?> |
|
18 |
+ </div> |
|
19 |
+</div> |
|
20 |
+ |
|
21 |
+<?php $this->endblock(); ?> |
|
0 | 22 |
\ No newline at end of file |
1 | 23 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,86 @@ |
1 |
+<?php $this->extend('block_searchable'); ?> |
|
2 |
+ |
|
3 |
+<?php $this->block('content'); ?> |
|
4 |
+ |
|
5 |
+<section class="project cf"> |
|
6 |
+ <header> |
|
7 |
+ <nav class="siblings_nav"> |
|
8 |
+ <?php if ($this->prevProject): ?> |
|
9 |
+ <a class="prev" href="<?php echo $this->prevProject['link']; ?>"><span class="ikon ikon-arrow_left ikon-3x"></span></a> |
|
10 |
+ <?php endif; ?> |
|
11 |
+ |
|
12 |
+ <?php if ($this->nextProject): ?> |
|
13 |
+ <a class="next" href="<?php echo $this->nextProject['link']; ?>"><span class="ikon ikon-arrow_right ikon-3x"></span></a> |
|
14 |
+ <?php endif; ?> |
|
15 |
+ </nav> |
|
16 |
+ <h1 class="scene_element scene_element--scaleDown"> |
|
17 |
+ <?php echo $this->client_title; ?> |
|
18 |
+ <span class="subheading"><?php echo $this->title; ?></span> |
|
19 |
+ </h1> |
|
20 |
+ </header> |
|
21 |
+ |
|
22 |
+ <div class="project_images scene_element scene_element--fadeinleft"> |
|
23 |
+ <ul class="list_screenshots"> |
|
24 |
+ <?php foreach ($this->screenshots as $screenshot): ?> |
|
25 |
+ <li> |
|
26 |
+ <figure class="image_container"> |
|
27 |
+ <?php if ($screenshot->href): ?> |
|
28 |
+ <a href="<?php echo $screenshot->href; ?>"<?php echo $screenshot->attributes; ?> title="<?php echo $screenshot->alt; ?>"><?php $this->insert('picture_default', $screenshot->picture); ?></a> |
|
29 |
+ <?php else: ?> |
|
30 |
+ <?php $this->insert('picture_default', $screenshot->picture); ?> |
|
31 |
+ <?php endif; ?> |
|
32 |
+ <?php if ($screenshot->caption): ?> |
|
33 |
+ <figcaption class="caption" style="width:<?php echo $screenshot->arrSize[0]; ?>px"><?php echo $screenshot->caption; ?></figcaption> |
|
34 |
+ <?php endif; ?> |
|
35 |
+ </figure> |
|
36 |
+ </li> |
|
37 |
+ <?php endforeach; ?> |
|
38 |
+ </ul> |
|
39 |
+ </div> |
|
40 |
+ <div class="project_summary scene_element scene_element--fadeinright"> |
|
41 |
+ <div class="client_roundup"> |
|
42 |
+ <?php echo $this->client_summary; ?> |
|
43 |
+ </div> |
|
44 |
+ <div class="project_details"> |
|
45 |
+ <?php if ($this->text): ?> |
|
46 |
+ <h3><?php echo $GLOBALS['TL_LANG']['ESM_CLIENTS']['project_text']; ?></h3> |
|
47 |
+ <?php echo $this->text; ?> |
|
48 |
+ <?php endif; ?> |
|
49 |
+ |
|
50 |
+ <?php if ($this->link): ?> |
|
51 |
+ <h3><?php echo $GLOBALS['TL_LANG']['ESM_CLIENTS']['project_link']; ?></h3> |
|
52 |
+ <p><a href="<?php echo $this->link; ?>" target="_blank"><span class="ikon ikon-share"></span> <?php echo $this->link; ?></a></p> |
|
53 |
+ <?php endif; ?> |
|
54 |
+ |
|
55 |
+ <?php if (count($this->services)): ?> |
|
56 |
+ <h3><?php echo $GLOBALS['TL_LANG']['ESM_CLIENTS']['project_services']; ?></h3> |
|
57 |
+ <ul class="list_services ikon-ul"> |
|
58 |
+ <?php foreach ($this->services as $service): ?> |
|
59 |
+ <li><span class="ikon ikon-li ikon-tick"></span><?php if (\Validator::isUrl($service['url'])): ?><a href="<?php echo $service['url']; ?>"><?php endif; ?><?php echo $service['title']; ?><?php if (\Validator::isUrl($service['url'])): ?></a><?php endif; ?></li> |
|
60 |
+ <?php endforeach; ?> |
|
61 |
+ </ul> |
|
62 |
+ <?php endif; ?> |
|
63 |
+ |
|
64 |
+ <?php if (count($this->features)): ?> |
|
65 |
+ <h3><?php echo $GLOBALS['TL_LANG']['ESM_CLIENTS']['project_features']; ?></h3> |
|
66 |
+ <ul class="list_features ikon-ul"> |
|
67 |
+ <?php foreach ($this->features as $feature): ?> |
|
68 |
+ <li><span class="ikon ikon-li ikon-tick"></span><?php echo $feature; ?></li> |
|
69 |
+ <?php endforeach; ?> |
|
70 |
+ </ul> |
|
71 |
+ <?php endif; ?> |
|
72 |
+ |
|
73 |
+ <?php if (count($this->techs)): ?> |
|
74 |
+ <h3><?php echo $GLOBALS['TL_LANG']['ESM_CLIENTS']['project_tech']; ?></h3> |
|
75 |
+ <ul class="list_tech ikon-ul"> |
|
76 |
+ <?php foreach ($this->techs as $tech): ?> |
|
77 |
+ <li><span class="ikon ikon-li ikon-tick"></span><?php if (\Validator::isUrl($tech['url'])): ?><a href="<?php echo $tech['url']; ?>"><?php endif; ?><?php echo $tech['title']; ?><?php if (\Validator::isUrl($tech['url'])): ?></a><?php endif; ?></li> |
|
78 |
+ <?php endforeach; ?> |
|
79 |
+ </ul> |
|
80 |
+ <?php endif; ?> |
|
81 |
+ |
|
82 |
+ </div> |
|
83 |
+ </div> |
|
84 |
+</section> |
|
85 |
+ |
|
86 |
+<?php $this->endblock(); ?> |
|
0 | 87 |
\ No newline at end of file |