1
+ <?php
2
+
3
+ /**
4
+ * EU cookies plugin for CMS e107 v2
5
+ *
6
+ * @author OxigenO2 (oxigen.rg@gmail.com)
7
+ * @copyright Copyright (C) 2015 OxigenO2
8
+ * @license GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
9
+ * @link http://oxigen.mablog.eu/
10
+ */
11
+
12
+ require_once ('../../class2.php ' );
13
+ if (!getperms ('P ' ))
14
+ {
15
+ header ('location: ' .e_BASE.'index.php ' );
16
+ exit ;
17
+ }
18
+
19
+
20
+
21
+ class eu_cookies_adminArea extends e_admin_dispatcher
22
+ {
23
+
24
+ protected $ modes = array (
25
+
26
+ 'main ' => array (
27
+ 'controller ' => 'eu_cookies_ui ' ,
28
+ 'path ' => null ,
29
+ 'ui ' => 'eu_cookies_form_ui ' ,
30
+ 'uipath ' => null
31
+ ),
32
+
33
+
34
+ );
35
+
36
+
37
+ protected $ adminMenu = array (
38
+
39
+ 'main/prefs ' => array ('caption ' => LAN_PREFS , 'perm ' => 'P ' ),
40
+
41
+ // 'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P')
42
+ );
43
+
44
+ protected $ adminMenuAliases = array (
45
+ 'main/edit ' => 'main/list '
46
+ );
47
+
48
+ protected $ menuTitle = 'EU cookies ' ;
49
+ }
50
+
51
+
52
+
53
+
54
+
55
+ class eu_cookies_ui extends e_admin_ui
56
+ {
57
+
58
+ protected $ pluginTitle = 'EU cookies ' ;
59
+ protected $ pluginName = 'eu_cookies ' ;
60
+ // protected $eventName = 'eu_cookies-'; // remove comment to enable event triggers in admin.
61
+ protected $ table = '' ;
62
+ protected $ pid = '' ;
63
+ protected $ perPage = 10 ;
64
+ protected $ batchDelete = true ;
65
+ // protected $batchCopy = true;
66
+ // protected $sortField = 'somefield_order';
67
+ // protected $orderStep = 10;
68
+ protected $ preftabs = array (LAN_SETTINGS ,LAN_PLUGIN_EUC_STYLE ); // Use 'tab'=>0 OR 'tab'=>1 in the $fields below to enable.
69
+
70
+ // protected $listQry = "SELECT * FROM `#tableName` WHERE field != '' "; // Example Custom Query. LEFT JOINS allowed. Should be without any Order or Limit.
71
+
72
+ protected $ listOrder = ' DESC ' ;
73
+
74
+ protected $ fields = NULL ;
75
+
76
+ protected $ fieldpref = array ();
77
+
78
+
79
+ // protected $preftabs = array('General', 'Other' );
80
+ protected $ prefs = array (
81
+ 'eu_cookie_text ' => array ('title ' => LAN_PLUGIN_EUC_TEXT , 'tab ' =>0 , 'type ' =>'textarea ' , 'data ' => 'str ' , 'help ' =>'Help Text goes here ' ),
82
+ 'eu_cookie_policylink ' => array ('title ' => LAN_PLUGIN_EUC_POLICYLINK , 'tab ' =>0 , 'type ' =>'text ' , 'data ' => 'str ' , 'help ' =>'Help Text goes here ' ),
83
+ 'eu_cookie_btn ' => array ('title ' => LAN_PLUGIN_EUC_BTN , 'tab ' =>0 , 'type ' =>'text ' , 'data ' => 'str ' , 'help ' =>'Help Text goes here ' ),
84
+ 'eu_cookie_position ' => array ('title ' => LAN_PLUGIN_EUC_POSITION , 'tab ' =>0 , 'type ' =>'dropdown ' , 'data ' => 'str ' , 'help ' =>'Help Text goes here ' ),
85
+ 'eu_cookie_theme ' => array ('title ' => LAN_PLUGIN_EUC_THEME , 'tab ' =>1 , 'type ' =>'dropdown ' , 'data ' => 'str ' , 'help ' =>'Help Text goes here ' ),
86
+ 'eu_cookie_openeffect ' => array ('title ' => LAN_PLUGIN_EUC_OPENEFFECT , 'tab ' =>1 , 'type ' =>'dropdown ' , 'data ' => 'str ' , 'help ' =>'Help Text goes here ' ),
87
+ 'eu_cookie_openeffectduration ' => array ('title ' => LAN_PLUGIN_EUC_OPENEFFECTDURATION , 'tab ' =>1 , 'type ' =>'number ' , 'data ' => 'str ' , 'help ' =>'Help Text goes here ' ),
88
+ 'eu_cookie_openeffecteasing ' => array ('title ' => LAN_PLUGIN_EUC_OPENEFFECTEASING , 'tab ' =>1 , 'type ' =>'dropdown ' , 'data ' => 'str ' , 'help ' =>'Help Text goes here ' ),
89
+ 'eu_cookie_closeeffect ' => array ('title ' => LAN_PLUGIN_EUC_CLOSEEFFECT , 'tab ' =>1 , 'type ' =>'dropdown ' , 'data ' => 'str ' , 'help ' =>'Help Text goes here ' ),
90
+ 'eu_cookie_closeeffectduration ' => array ('title ' => LAN_PLUGIN_EUC_CLOSEEFFECTDURATION , 'tab ' =>1 , 'type ' =>'number ' , 'data ' => 'str ' , 'help ' =>'Help Text goes here ' ),
91
+ 'eu_cookie_closeeffecteasing ' => array ('title ' => LAN_PLUGIN_EUC_CLOSEEFFECTEASING , 'tab ' =>1 , 'type ' =>'dropdown ' , 'data ' => 'str ' , 'help ' =>'Help Text goes here ' ),
92
+
93
+ );
94
+
95
+
96
+ public function init ()
97
+ {
98
+ // Set drop-down values (if any).
99
+
100
+ $ position = array (
101
+ 'top ' => 'Top ' ,
102
+ 'bottom ' => 'Bottom '
103
+ );
104
+
105
+
106
+ $ this ->prefs ['eu_cookie_position ' ]['writeParms ' ] = $ position ;
107
+ $ this ->prefs ['eu_cookie_position ' ]['readParms ' ] = $ position ;
108
+
109
+ $ theme = array (
110
+ 'dark ' => 'Dark ' ,
111
+ 'light ' => 'Light '
112
+ );
113
+
114
+
115
+ $ this ->prefs ['eu_cookie_theme ' ]['writeParms ' ] = $ theme ;
116
+ $ this ->prefs ['eu_cookie_theme ' ]['readParms ' ] = $ theme ;
117
+
118
+ $ openeffect = array (
119
+ 'fade ' => 'Fade ' ,
120
+ 'slideUp ' => 'Slide Down ' ,
121
+ 'slideDown ' => 'Slide Up ' ,
122
+ 'slideLeft ' => 'Slide Left ' ,
123
+ 'slideRight ' => 'Slide Right '
124
+ );
125
+
126
+
127
+ $ this ->prefs ['eu_cookie_openeffect ' ]['writeParms ' ] = $ openeffect ;
128
+ $ this ->prefs ['eu_cookie_openeffect ' ]['readParms ' ] = $ openeffect ;
129
+
130
+ $ openeffecteasing = array (
131
+ 'swing ' => 'Swing ' ,
132
+ 'linear ' => 'Linear '
133
+ );
134
+
135
+
136
+ $ this ->prefs ['eu_cookie_openeffecteasing ' ]['writeParms ' ] = $ openeffecteasing ;
137
+ $ this ->prefs ['eu_cookie_openeffecteasing ' ]['readParms ' ] = $ openeffecteasing ;
138
+
139
+ $ closeeffect = array (
140
+ 'fade ' => 'Fade ' ,
141
+ 'slideUp ' => 'Slide Down ' ,
142
+ 'slideDown ' => 'Slide Up ' ,
143
+ 'slideLeft ' => 'Slide Left ' ,
144
+ 'slideRight ' => 'Slide Right '
145
+ );
146
+
147
+
148
+ $ this ->prefs ['eu_cookie_closeeffect ' ]['writeParms ' ] = $ closeeffect ;
149
+ $ this ->prefs ['eu_cookie_closeeffect ' ]['readParms ' ] = $ closeeffect ;
150
+
151
+ $ closeeffecteasing = array (
152
+ 'swing ' => 'Swing ' ,
153
+ 'linear ' => 'Linear '
154
+ );
155
+
156
+
157
+ $ this ->prefs ['eu_cookie_closeeffecteasing ' ]['writeParms ' ] = $ closeeffecteasing ;
158
+ $ this ->prefs ['eu_cookie_closeeffecteasing ' ]['readParms ' ] = $ closeeffecteasing ;
159
+
160
+
161
+
162
+
163
+ }
164
+
165
+
166
+ // ------- Customize Create --------
167
+
168
+ public function beforeCreate ($ new_data )
169
+ {
170
+ return $ new_data ;
171
+ }
172
+
173
+ public function afterCreate ($ new_data , $ old_data , $ id )
174
+ {
175
+ // do something
176
+ }
177
+
178
+ public function onCreateError ($ new_data , $ old_data )
179
+ {
180
+ // do something
181
+ }
182
+
183
+
184
+ // ------- Customize Update --------
185
+
186
+ public function beforeUpdate ($ new_data , $ old_data , $ id )
187
+ {
188
+ return $ new_data ;
189
+ }
190
+
191
+ public function afterUpdate ($ new_data , $ old_data , $ id )
192
+ {
193
+ // do something
194
+ }
195
+
196
+ public function onUpdateError ($ new_data , $ old_data , $ id )
197
+ {
198
+ // do something
199
+ }
200
+
201
+
202
+ /*
203
+ // optional - a custom page.
204
+ public function customPage()
205
+ {
206
+ $text = 'Hello World!';
207
+ return $text;
208
+
209
+ }
210
+ */
211
+
212
+ }
213
+
214
+
215
+
216
+ class eu_cookies_form_ui extends e_admin_form_ui
217
+ {
218
+
219
+ }
220
+
221
+
222
+ new eu_cookies_adminArea ();
223
+
224
+ require_once (e_ADMIN."auth.php " );
225
+ e107 ::getAdminUI ()->runPage ();
226
+
227
+ require_once (e_ADMIN."footer.php " );
228
+ exit ;
229
+
230
+ ?>
0 commit comments