... | ... |
@@ -10,5 +10,22 @@ |
10 | 10 |
|
11 | 11 |
|
12 | 12 |
/** |
13 |
+ * Backend modules |
|
14 |
+ */ |
|
15 |
+array_insert($GLOBALS['BE_MOD'],1,array('singlereisen' => array())); |
|
16 |
+ |
|
17 |
+$GLOBALS['BE_MOD']['singlereisen'] = array |
|
18 |
+( |
|
19 |
+ 'sr_trips' => array |
|
20 |
+ ( |
|
21 |
+ 'tables' => array('tl_sr_trips') |
|
22 |
+ ) |
|
23 |
+); |
|
24 |
+ |
|
25 |
+if ('BE' === TL_MODE) { |
|
26 |
+ $GLOBALS['TL_CSS'][] = 'bundles/esalesmediasinglereisen/css/backend.css|static'; |
|
27 |
+} |
|
28 |
+ |
|
29 |
+/** |
|
13 | 30 |
* Hooks |
14 | 31 |
*/ |
15 | 32 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,210 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/* |
|
4 |
+ * This file is part of eSales Media SinglereisenBundle |
|
5 |
+ * |
|
6 |
+ * (c) Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license proprietary |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+$GLOBALS['TL_DCA']['tl_sr_trips'] = array |
|
12 |
+( |
|
13 |
+ |
|
14 |
+ // Config |
|
15 |
+ 'config' => array |
|
16 |
+ ( |
|
17 |
+ 'dataContainer' => 'Table', |
|
18 |
+ 'enableVersioning' => true, |
|
19 |
+ //'ctable' => array('tl_sr_trips_field'), |
|
20 |
+ 'markAsCopy' => 'title', |
|
21 |
+ 'onload_callback' => array |
|
22 |
+ ( |
|
23 |
+ ), |
|
24 |
+ 'oncreate_callback' => array |
|
25 |
+ ( |
|
26 |
+ ), |
|
27 |
+ 'oncopy_callback' => array |
|
28 |
+ ( |
|
29 |
+ ), |
|
30 |
+ 'sql' => array |
|
31 |
+ ( |
|
32 |
+ 'keys' => array |
|
33 |
+ ( |
|
34 |
+ 'id' => 'primary', |
|
35 |
+ 'alias' => 'index' |
|
36 |
+ ) |
|
37 |
+ ) |
|
38 |
+ ), |
|
39 |
+ |
|
40 |
+ // List |
|
41 |
+ 'list' => array |
|
42 |
+ ( |
|
43 |
+ 'sorting' => array |
|
44 |
+ ( |
|
45 |
+ 'mode' => 2, |
|
46 |
+ 'fields' => array('title'), |
|
47 |
+ 'flag' => 11, |
|
48 |
+ 'panelLayout' => 'filter;search,limit', |
|
49 |
+ ), |
|
50 |
+ 'label' => array |
|
51 |
+ ( |
|
52 |
+ 'fields' => array('title','alias'), |
|
53 |
+ 'showColumns' => true, |
|
54 |
+ 'format' => '%s <span style="color:#999;padding-left:3px">[%s]</span>' |
|
55 |
+ ), |
|
56 |
+ 'global_operations' => array |
|
57 |
+ ( |
|
58 |
+ 'all' => array |
|
59 |
+ ( |
|
60 |
+ 'label' => &$GLOBALS['TL_LANG']['MSC']['all'], |
|
61 |
+ 'href' => 'act=select', |
|
62 |
+ 'class' => 'header_edit_all', |
|
63 |
+ 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"' |
|
64 |
+ ) |
|
65 |
+ ), |
|
66 |
+ 'operations' => array |
|
67 |
+ ( |
|
68 |
+ 'edit' => array |
|
69 |
+ ( |
|
70 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_sr_trips']['edit'], |
|
71 |
+ 'href' => 'act=edit', |
|
72 |
+ 'icon' => 'edit.svg' |
|
73 |
+ ), |
|
74 |
+ 'copy' => array |
|
75 |
+ ( |
|
76 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_sr_trips']['copy'], |
|
77 |
+ 'href' => 'act=copy', |
|
78 |
+ 'icon' => 'copy.svg' |
|
79 |
+ ), |
|
80 |
+ 'delete' => array |
|
81 |
+ ( |
|
82 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_sr_trips']['delete'], |
|
83 |
+ 'href' => 'act=delete', |
|
84 |
+ 'icon' => 'delete.svg', |
|
85 |
+ 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"' |
|
86 |
+ ), |
|
87 |
+ 'show' => array |
|
88 |
+ ( |
|
89 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_sr_trips']['show'], |
|
90 |
+ 'href' => 'act=show', |
|
91 |
+ 'icon' => 'show.svg' |
|
92 |
+ ) |
|
93 |
+ ) |
|
94 |
+ ), |
|
95 |
+ |
|
96 |
+ // Palettes |
|
97 |
+ 'palettes' => array |
|
98 |
+ ( |
|
99 |
+ '__selector__' => array(), |
|
100 |
+ 'default' => '{title_legend},title,alias' |
|
101 |
+ ), |
|
102 |
+ |
|
103 |
+ // Subpalettes |
|
104 |
+ 'subpalettes' => array |
|
105 |
+ ( |
|
106 |
+ ), |
|
107 |
+ |
|
108 |
+ // Fields |
|
109 |
+ 'fields' => array |
|
110 |
+ ( |
|
111 |
+ 'id' => array |
|
112 |
+ ( |
|
113 |
+ 'sql' => "int(10) unsigned NOT NULL auto_increment" |
|
114 |
+ ), |
|
115 |
+ 'sorting' => array |
|
116 |
+ ( |
|
117 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
118 |
+ ), |
|
119 |
+ 'tstamp' => array |
|
120 |
+ ( |
|
121 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
122 |
+ ), |
|
123 |
+ 'title' => array |
|
124 |
+ ( |
|
125 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_sr_trips']['title'], |
|
126 |
+ 'exclude' => true, |
|
127 |
+ 'search' => true, |
|
128 |
+ 'inputType' => 'text', |
|
129 |
+ 'eval' => array('mandatory'=>true, 'maxlength'=>255, 'tl_class'=>'w50'), |
|
130 |
+ 'sql' => "varchar(255) NOT NULL default ''" |
|
131 |
+ ), |
|
132 |
+ 'alias' => array |
|
133 |
+ ( |
|
134 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_sr_trips']['alias'], |
|
135 |
+ 'exclude' => true, |
|
136 |
+ 'inputType' => 'text', |
|
137 |
+ 'eval' => array('rgxp'=>'alias', 'doNotCopy'=>true, 'maxlength'=>128, 'tl_class'=>'w50'), |
|
138 |
+ 'save_callback' => array |
|
139 |
+ ( |
|
140 |
+ array('tl_sr_trips', 'generateAlias') |
|
141 |
+ ), |
|
142 |
+ 'sql' => "varchar(128) BINARY NOT NULL default ''" |
|
143 |
+ ) |
|
144 |
+ ) |
|
145 |
+); |
|
146 |
+ |
|
147 |
+/** |
|
148 |
+ * Provide miscellaneous methods that are used by the data configuration array. |
|
149 |
+ * |
|
150 |
+ * @author Leo Feyer <https://github.com/leofeyer> |
|
151 |
+ */ |
|
152 |
+class tl_sr_trips extends Backend |
|
153 |
+{ |
|
154 |
+ |
|
155 |
+ /** |
|
156 |
+ * Import the back end user object |
|
157 |
+ */ |
|
158 |
+ public function __construct() |
|
159 |
+ { |
|
160 |
+ parent::__construct(); |
|
161 |
+ $this->import('BackendUser', 'User'); |
|
162 |
+ } |
|
163 |
+ |
|
164 |
+ |
|
165 |
+ /** |
|
166 |
+ * Auto-generate a trip alias if it has not been set yet |
|
167 |
+ * |
|
168 |
+ * @param mixed $varValue |
|
169 |
+ * @param DataContainer $dc |
|
170 |
+ * |
|
171 |
+ * @return mixed |
|
172 |
+ * |
|
173 |
+ * @throws Exception |
|
174 |
+ */ |
|
175 |
+ public function generateAlias($varValue, DataContainer $dc) |
|
176 |
+ { |
|
177 |
+ $autoAlias = false; |
|
178 |
+ |
|
179 |
+ // Generate an alias if there is none |
|
180 |
+ if ($varValue == '') |
|
181 |
+ { |
|
182 |
+ $autoAlias = true; |
|
183 |
+ $slugOptions = array('locale'=>'de'); |
|
184 |
+ |
|
185 |
+ $varValue = System::getContainer()->get('contao.slug.generator')->generate(StringUtil::prepareSlug($dc->activeRecord->title), $slugOptions); |
|
186 |
+ |
|
187 |
+ // Prefix numeric aliases (see #1598) |
|
188 |
+ if (is_numeric($varValue)) |
|
189 |
+ { |
|
190 |
+ $varValue = 'id-' . $varValue; |
|
191 |
+ } |
|
192 |
+ } |
|
193 |
+ |
|
194 |
+ $objAlias = $this->Database->prepare("SELECT id FROM tl_sr_trips WHERE id=? OR alias=?") |
|
195 |
+ ->execute($dc->id, $varValue); |
|
196 |
+ |
|
197 |
+ // Check whether the form alias exists |
|
198 |
+ if ($objAlias->numRows > 1) |
|
199 |
+ { |
|
200 |
+ if (!$autoAlias) |
|
201 |
+ { |
|
202 |
+ throw new Exception(sprintf($GLOBALS['TL_LANG']['ERR']['aliasExists'], $varValue)); |
|
203 |
+ } |
|
204 |
+ |
|
205 |
+ $varValue .= '-' . $dc->id; |
|
206 |
+ } |
|
207 |
+ |
|
208 |
+ return $varValue; |
|
209 |
+ } |
|
210 |
+} |
0 | 211 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,19 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/* |
|
4 |
+ * This file is part of eSales Media SinglereisenBundle |
|
5 |
+ * |
|
6 |
+ * (c) Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license proprietary |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+ |
|
12 |
+/** |
|
13 |
+ * Module translations |
|
14 |
+ */ |
|
15 |
+ |
|
16 |
+$GLOBALS['TL_LANG']['MOD']['singlereisen'] = 'singlereisen.de'; |
|
17 |
+ |
|
18 |
+$GLOBALS['TL_LANG']['MOD']['sr_trips'][0] = 'Reisen'; |
|
19 |
+$GLOBALS['TL_LANG']['MOD']['sr_trips'][1] = 'Reisen und Termine verwalten'; |
0 | 20 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,40 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/* |
|
4 |
+ * This file is part of eSales Media SinglereisenBundle |
|
5 |
+ * |
|
6 |
+ * (c) Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license proprietary |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+ |
|
12 |
+/** |
|
13 |
+ * Fields |
|
14 |
+ */ |
|
15 |
+ |
|
16 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['title'][0] = 'Reisetitel'; |
|
17 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['title'][1] = 'Der Titel der Reise.'; |
|
18 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['alias'][0] = 'Alias'; |
|
19 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['alias'][1] = 'Der Alias ist eine eindeutige Referenz, die in der URL verwendet wird.'; |
|
20 |
+ |
|
21 |
+/** |
|
22 |
+ * Legends |
|
23 |
+ */ |
|
24 |
+ |
|
25 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['title_legend'] = 'Titel'; |
|
26 |
+ |
|
27 |
+/** |
|
28 |
+ * Operations |
|
29 |
+ */ |
|
30 |
+ |
|
31 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['new'][0] = 'Neue Reise'; |
|
32 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['new'][1] = 'Eine neue Reise erstellen'; |
|
33 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['edit'][0] = 'Reise bearbeiten'; |
|
34 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['edit'][1] = 'Reise ID %s bearbeiten'; |
|
35 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['copy'][0] = 'Reise duplizieren'; |
|
36 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['copy'][1] = 'Reise ID %s duplizieren'; |
|
37 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['delete'][0] = 'Reise löschen'; |
|
38 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['delete'][1] = 'Reise ID %s löschen'; |
|
39 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['show'][0] = 'Reisedetails'; |
|
40 |
+$GLOBALS['TL_LANG']['tl_sr_trips']['show'][1] = 'Details der Reise ID %s anzeigen'; |