@@ -74,177 +74,195 @@ discard block |
||
74 | 74 | |
75 | 75 | switch ($op) { |
76 | 76 | |
77 | - case 'enreg': |
|
78 | - |
|
79 | - $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT); |
|
80 | - $fileHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_FILE); |
|
81 | - // $t = print_r($_POST,true); |
|
82 | - // echo "<pre>{$t}</pre><br>"; |
|
83 | - // exit; |
|
84 | - // If the date format is wrong |
|
85 | - // if ( |
|
86 | - // !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_start']['date']) |
|
87 | - // || !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_end']['date']) |
|
88 | - // ) { |
|
89 | - // redirect_header( |
|
90 | - // 'event.php', 3, _MD_EXTCAL_WRONG_DATE_FORMAT . "<br>" |
|
91 | - // . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()) |
|
92 | - // ); |
|
93 | - // exit; |
|
94 | - // } |
|
95 | - |
|
96 | - //exit; |
|
97 | - /////////////////////////////////////////////////////////////////////////////// |
|
98 | - Extcal\Utility::loadImg($_REQUEST, $event_picture1, $event_picture2); |
|
99 | - /////////////////////////////////////////////////////////////////////////////// |
|
100 | - $data = [ |
|
101 | - 'event_title' => $_POST['event_title'], |
|
102 | - 'cat_id' => $_POST['cat_id'], |
|
103 | - 'event_desc' => $_POST['event_desc'], |
|
104 | - 'event_nbmember' => $_POST['event_nbmember'], |
|
105 | - 'event_organisateur' => $_POST['event_organisateur'], |
|
106 | - 'event_contact' => $_POST['event_contact'], |
|
107 | - 'event_url' => $_POST['event_url'], |
|
108 | - 'event_email' => $_POST['event_email'], |
|
109 | - 'event_address' => $_POST['event_address'], |
|
110 | - 'event_approved' => 1, |
|
111 | - 'event_start' => $_POST['event_start'], |
|
112 | - 'have_end' => $_POST['have_end'], |
|
113 | - 'event_end' => $_POST['event_end'], |
|
114 | - 'event_picture1' => @$event_picture1, |
|
115 | - 'event_picture2' => @$event_picture2, |
|
116 | - 'event_price' => @$_POST['event_price'], |
|
117 | - 'event_etablissement' => $_POST['event_etablissement'], |
|
118 | - 'dohtml' => $extcalConfig['allow_html'], |
|
119 | - 'event_icone' => $_POST['event_icone'], |
|
120 | - ]; |
|
121 | - |
|
122 | - // Event edited |
|
123 | - if (isset($_POST['event_id'])) { |
|
124 | - if (!$eventHandler->modifyEvent($_POST['event_id'], $data)) { |
|
125 | - redirect_header('event.php', 3, _AM_EXTCAL_EVENT_EDIT_FAILED, false); |
|
77 | + case 'enreg': |
|
78 | + |
|
79 | + $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT); |
|
80 | + $fileHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_FILE); |
|
81 | + // $t = print_r($_POST,true); |
|
82 | + // echo "<pre>{$t}</pre><br>"; |
|
83 | + // exit; |
|
84 | + // If the date format is wrong |
|
85 | + // if ( |
|
86 | + // !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_start']['date']) |
|
87 | + // || !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_end']['date']) |
|
88 | + // ) { |
|
89 | + // redirect_header( |
|
90 | + // 'event.php', 3, _MD_EXTCAL_WRONG_DATE_FORMAT . "<br>" |
|
91 | + // . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()) |
|
92 | + // ); |
|
93 | + // exit; |
|
94 | + // } |
|
95 | + |
|
96 | + //exit; |
|
97 | + /////////////////////////////////////////////////////////////////////////////// |
|
98 | + Extcal\Utility::loadImg($_REQUEST, $event_picture1, $event_picture2); |
|
99 | + /////////////////////////////////////////////////////////////////////////////// |
|
100 | + $data = [ |
|
101 | + 'event_title' => $_POST['event_title'], |
|
102 | + 'cat_id' => $_POST['cat_id'], |
|
103 | + 'event_desc' => $_POST['event_desc'], |
|
104 | + 'event_nbmember' => $_POST['event_nbmember'], |
|
105 | + 'event_organisateur' => $_POST['event_organisateur'], |
|
106 | + 'event_contact' => $_POST['event_contact'], |
|
107 | + 'event_url' => $_POST['event_url'], |
|
108 | + 'event_email' => $_POST['event_email'], |
|
109 | + 'event_address' => $_POST['event_address'], |
|
110 | + 'event_approved' => 1, |
|
111 | + 'event_start' => $_POST['event_start'], |
|
112 | + 'have_end' => $_POST['have_end'], |
|
113 | + 'event_end' => $_POST['event_end'], |
|
114 | + 'event_picture1' => @$event_picture1, |
|
115 | + 'event_picture2' => @$event_picture2, |
|
116 | + 'event_price' => @$_POST['event_price'], |
|
117 | + 'event_etablissement' => $_POST['event_etablissement'], |
|
118 | + 'dohtml' => $extcalConfig['allow_html'], |
|
119 | + 'event_icone' => $_POST['event_icone'], |
|
120 | + ]; |
|
121 | + |
|
122 | + // Event edited |
|
123 | + if (isset($_POST['event_id'])) { |
|
124 | + if (!$eventHandler->modifyEvent($_POST['event_id'], $data)) { |
|
125 | + redirect_header('event.php', 3, _AM_EXTCAL_EVENT_EDIT_FAILED, false); |
|
126 | + } else { |
|
127 | + $fileHandler->createFile((int)$_POST['event_id']); |
|
128 | + redirect_header('event.php', 3, _AM_EXTCAL_EVENT_EDITED, false); |
|
129 | + } |
|
130 | + |
|
131 | + // New event |
|
126 | 132 | } else { |
127 | - $fileHandler->createFile((int)$_POST['event_id']); |
|
128 | - redirect_header('event.php', 3, _AM_EXTCAL_EVENT_EDITED, false); |
|
133 | + $notificationHandler = xoops_getHandler('notification'); |
|
134 | + /** @var Extcal\CategoryHandler $catHandler */ |
|
135 | + // $catHandler = xoops_getModuleHandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE); |
|
136 | + $catHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_CAT); |
|
137 | + |
|
138 | + $data['event_submitter'] = $xoopsUser ? $xoopsUser->getVar('uid') : 0; |
|
139 | + $data['event_submitdate'] = time(); |
|
140 | + |
|
141 | + if ($eventHandler->createEvent($data, $_POST)) { |
|
142 | + $fileHandler->createFile($eventHandler->getInsertId()); |
|
143 | + $cat = $catHandler->getCat($_POST['cat_id'], $xoopsUser, 'all'); |
|
144 | + $notificationHandler->triggerEvent('global', 0, 'new_event', ['EVENT_TITLE' => $_POST['event_title']]); |
|
145 | + $notificationHandler->triggerEvent('category', $_POST['cat_id'], 'new_event_cat', [ |
|
146 | + 'EVENT_TITLE' => $_POST['event_title'], |
|
147 | + 'CAT_NAME' => $cat->getVar('cat_name'), |
|
148 | + ]); |
|
149 | + redirect_header('event.php', 3, _AM_EXTCAL_EVENT_CREATED, false); |
|
150 | + } else { |
|
151 | + redirect_header('event.php', 3, _AM_EXTCAL_EVENT_CREATE_FAILED, false); |
|
152 | + } |
|
129 | 153 | } |
154 | + break; |
|
130 | 155 | |
131 | - // New event |
|
132 | - } else { |
|
133 | - $notificationHandler = xoops_getHandler('notification'); |
|
134 | - /** @var Extcal\CategoryHandler $catHandler */ |
|
135 | - // $catHandler = xoops_getModuleHandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE); |
|
136 | - $catHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_CAT); |
|
137 | - |
|
138 | - $data['event_submitter'] = $xoopsUser ? $xoopsUser->getVar('uid') : 0; |
|
139 | - $data['event_submitdate'] = time(); |
|
140 | - |
|
141 | - if ($eventHandler->createEvent($data, $_POST)) { |
|
142 | - $fileHandler->createFile($eventHandler->getInsertId()); |
|
143 | - $cat = $catHandler->getCat($_POST['cat_id'], $xoopsUser, 'all'); |
|
144 | - $notificationHandler->triggerEvent('global', 0, 'new_event', ['EVENT_TITLE' => $_POST['event_title']]); |
|
145 | - $notificationHandler->triggerEvent('category', $_POST['cat_id'], 'new_event_cat', [ |
|
146 | - 'EVENT_TITLE' => $_POST['event_title'], |
|
147 | - 'CAT_NAME' => $cat->getVar('cat_name'), |
|
148 | - ]); |
|
149 | - redirect_header('event.php', 3, _AM_EXTCAL_EVENT_CREATED, false); |
|
150 | - } else { |
|
151 | - redirect_header('event.php', 3, _AM_EXTCAL_EVENT_CREATE_FAILED, false); |
|
156 | + case 'clone': /* sur validation du formulaire */ |
|
157 | + case 'modify': |
|
158 | + $action = (('clone' === $op) ? 'clone' : 'edit'); |
|
159 | + xoops_cp_header(); |
|
160 | + //================================================ |
|
161 | + // require_once (XOOPS_ROOT_PATH . '/class/xoopsform/tc_calendar/formtccalendar.php'); |
|
162 | + // |
|
163 | + // // Call the calendar constructor - use the desired form and format, according to the instructions/samples provided on triconsole.com |
|
164 | + // $dateBirthday = new \XoopsTcCalendar("datez1", true, false); |
|
165 | + // //$dateBirthday->setIcon("/images/iconCalendar.gif"); |
|
166 | + // $dateBirthday->setIcon("/class/xoopsform/tc_calendar/images/iconCalendar.gif"); |
|
167 | + // //$dateBirthday->rtl=false; |
|
168 | + // $dateBirthday->setAutoHide(false); |
|
169 | + // |
|
170 | + // //$myCalendar->setDate(date('d'), date('m'), date('Y')); |
|
171 | + // //$dateBirthday->setDate($p['date1_day'], $p['date1_month'], $p['date1_year']); |
|
172 | + // $dateBirthday->setDate(date('d'), date('m'), date('Y')); |
|
173 | + // |
|
174 | + // $dateBirthday->setPath(XOOPS_URL . "/class/xoopsform/tc_calendar/"); |
|
175 | + // $dateBirthday->zindex = 150; //default 1 |
|
176 | + // $dateBirthday->setYearInterval(1995, date('Y')); |
|
177 | + // $dateBirthday->dateAllow('1960-03-01', date('Y-m-d')); |
|
178 | + // //$dateBirthday->autoSubmit(true, "calendar"); |
|
179 | + // $dateBirthday->disabledDay("sat"); |
|
180 | + // $dateBirthday->disabledDay("sun"); |
|
181 | + // $dateBirthday->setSpecificDate(array("2011-04-14", "2010-12-25"), 0, 'month'); |
|
182 | + // $dateBirthday->setSpecificDate(array("2011-04-01"), 0, 'year'); |
|
183 | + // $dateBirthday->setAlignment('right', 'bottom'); //optional |
|
184 | + // echo "<table><tr><td>zzzzz</td><td></td><td>"; |
|
185 | + // echo $dateBirthday->render(); |
|
186 | + // echo "</td></tr></table>"; |
|
187 | + //echo $dateBirthday->render(); |
|
188 | + //================================================ |
|
189 | + // @author Gregory Mage (Aka Mage) |
|
190 | + //*************************************************************************************** |
|
191 | + // require_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php"; |
|
192 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
193 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
194 | + //*************************************************************************************** |
|
195 | + |
|
196 | + $eventId = $_GET['event_id']; |
|
197 | + $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT); |
|
198 | + |
|
199 | + echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_EDIT_EVENT . '</legend>'; |
|
200 | + |
|
201 | + if ($form = $eventHandler->getEventForm('admin', $action, ['event_id' => $eventId])) { |
|
202 | + $form->display(); |
|
152 | 203 | } |
153 | - } |
|
154 | - break; |
|
155 | - |
|
156 | - case 'clone': /* sur validation du formulaire */ |
|
157 | - case 'modify': |
|
158 | - $action = (('clone' === $op) ? 'clone' : 'edit'); |
|
159 | - xoops_cp_header(); |
|
160 | - //================================================ |
|
161 | - // require_once (XOOPS_ROOT_PATH . '/class/xoopsform/tc_calendar/formtccalendar.php'); |
|
162 | - // |
|
163 | - // // Call the calendar constructor - use the desired form and format, according to the instructions/samples provided on triconsole.com |
|
164 | - // $dateBirthday = new \XoopsTcCalendar("datez1", true, false); |
|
165 | - // //$dateBirthday->setIcon("/images/iconCalendar.gif"); |
|
166 | - // $dateBirthday->setIcon("/class/xoopsform/tc_calendar/images/iconCalendar.gif"); |
|
167 | - // //$dateBirthday->rtl=false; |
|
168 | - // $dateBirthday->setAutoHide(false); |
|
169 | - // |
|
170 | - // //$myCalendar->setDate(date('d'), date('m'), date('Y')); |
|
171 | - // //$dateBirthday->setDate($p['date1_day'], $p['date1_month'], $p['date1_year']); |
|
172 | - // $dateBirthday->setDate(date('d'), date('m'), date('Y')); |
|
173 | - // |
|
174 | - // $dateBirthday->setPath(XOOPS_URL . "/class/xoopsform/tc_calendar/"); |
|
175 | - // $dateBirthday->zindex = 150; //default 1 |
|
176 | - // $dateBirthday->setYearInterval(1995, date('Y')); |
|
177 | - // $dateBirthday->dateAllow('1960-03-01', date('Y-m-d')); |
|
178 | - // //$dateBirthday->autoSubmit(true, "calendar"); |
|
179 | - // $dateBirthday->disabledDay("sat"); |
|
180 | - // $dateBirthday->disabledDay("sun"); |
|
181 | - // $dateBirthday->setSpecificDate(array("2011-04-14", "2010-12-25"), 0, 'month'); |
|
182 | - // $dateBirthday->setSpecificDate(array("2011-04-01"), 0, 'year'); |
|
183 | - // $dateBirthday->setAlignment('right', 'bottom'); //optional |
|
184 | - // echo "<table><tr><td>zzzzz</td><td></td><td>"; |
|
185 | - // echo $dateBirthday->render(); |
|
186 | - // echo "</td></tr></table>"; |
|
187 | - //echo $dateBirthday->render(); |
|
188 | - //================================================ |
|
189 | - // @author Gregory Mage (Aka Mage) |
|
190 | - //*************************************************************************************** |
|
191 | - // require_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php"; |
|
192 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
193 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
194 | - //*************************************************************************************** |
|
195 | - |
|
196 | - $eventId = $_GET['event_id']; |
|
197 | - $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT); |
|
198 | - |
|
199 | - echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_EDIT_EVENT . '</legend>'; |
|
200 | - |
|
201 | - if ($form = $eventHandler->getEventForm('admin', $action, ['event_id' => $eventId])) { |
|
202 | - $form->display(); |
|
203 | - } |
|
204 | 204 | |
205 | - echo '</fieldset><br>'; |
|
205 | + echo '</fieldset><br>'; |
|
206 | 206 | |
207 | - xoops_cp_footer(); |
|
207 | + xoops_cp_footer(); |
|
208 | 208 | |
209 | - break; |
|
209 | + break; |
|
210 | 210 | |
211 | - case 'clone2': /* sur clique de l'icone du formulaire*/ |
|
211 | + case 'clone2': /* sur clique de l'icone du formulaire*/ |
|
212 | 212 | |
213 | - //$newEventId = 1; |
|
214 | - $eventId = $_GET['event_id']; |
|
215 | - $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT); |
|
216 | - $event = $eventHandler->getEvent($eventId); |
|
217 | - $t = $event->getVars(); |
|
218 | - $data = []; |
|
219 | - // while (list($key, $val) = each($t)) { |
|
220 | - foreach ($t as $key => $val) { |
|
221 | - $data[$key] = $val['value']; |
|
222 | - } |
|
213 | + //$newEventId = 1; |
|
214 | + $eventId = $_GET['event_id']; |
|
215 | + $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT); |
|
216 | + $event = $eventHandler->getEvent($eventId); |
|
217 | + $t = $event->getVars(); |
|
218 | + $data = []; |
|
219 | + // while (list($key, $val) = each($t)) { |
|
220 | + foreach ($t as $key => $val) { |
|
221 | + $data[$key] = $val['value']; |
|
222 | + } |
|
223 | 223 | |
224 | - $data['event_id'] = 0; |
|
225 | - $data['event_title'] .= ' (' . _AM_EXTCAL_CLONE_OF . $eventId . ')'; |
|
224 | + $data['event_id'] = 0; |
|
225 | + $data['event_title'] .= ' (' . _AM_EXTCAL_CLONE_OF . $eventId . ')'; |
|
226 | 226 | |
227 | - $newEvent = $eventHandler->create(); |
|
228 | - $newEvent->setVars($data); |
|
229 | - $t = $eventHandler->insert($newEvent, true); |
|
227 | + $newEvent = $eventHandler->create(); |
|
228 | + $newEvent->setVars($data); |
|
229 | + $t = $eventHandler->insert($newEvent, true); |
|
230 | 230 | |
231 | - $newEventId = $newEvent->getVar('event_id'); |
|
232 | - $ts = print_r($newEventId, true); |
|
231 | + $newEventId = $newEvent->getVar('event_id'); |
|
232 | + $ts = print_r($newEventId, true); |
|
233 | 233 | |
234 | - redirect_header("event.php?op=modify&event_id={$newEventId}", 3, _AM_EXTCAL_EVENT_DELETED, false); |
|
235 | - break; |
|
234 | + redirect_header("event.php?op=modify&event_id={$newEventId}", 3, _AM_EXTCAL_EVENT_DELETED, false); |
|
235 | + break; |
|
236 | 236 | |
237 | - case 'delete': |
|
237 | + case 'delete': |
|
238 | 238 | |
239 | - if (isset($_POST['confirm'])) { |
|
240 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
241 | - redirect_header('index.php', 3, _NOPERM . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
239 | + if (isset($_POST['confirm'])) { |
|
240 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
241 | + redirect_header('index.php', 3, _NOPERM . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
242 | + } |
|
243 | + // $eventHandler = xoops_getModuleHandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE); |
|
244 | + // $eventHandler->deleteEvent($_POST['event_id']); |
|
245 | + deleteEvents($_POST['event_id']); |
|
246 | + redirect_header('event.php', 3, _AM_EXTCAL_EVENT_DELETED, false); |
|
247 | + } else { |
|
248 | + xoops_cp_header(); |
|
249 | + // @author Gregory Mage (Aka Mage) |
|
250 | + //*************************************************************************************** |
|
251 | + //require_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php"; |
|
252 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
253 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
254 | + //*************************************************************************************** |
|
255 | + |
|
256 | + $hiddens = ['event_id' => $_GET['event_id'], 'form_delete' => '', 'confirm' => 1]; |
|
257 | + xoops_confirm($hiddens, 'event.php?op=delete', _AM_EXTCAL_CONFIRM_DELETE_EVENT, _DELETE, 'event.php'); |
|
258 | + |
|
259 | + xoops_cp_footer(); |
|
242 | 260 | } |
243 | - // $eventHandler = xoops_getModuleHandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE); |
|
244 | - // $eventHandler->deleteEvent($_POST['event_id']); |
|
245 | - deleteEvents($_POST['event_id']); |
|
246 | - redirect_header('event.php', 3, _AM_EXTCAL_EVENT_DELETED, false); |
|
247 | - } else { |
|
261 | + |
|
262 | + break; |
|
263 | + |
|
264 | + case 'deleteSelection': |
|
265 | + |
|
248 | 266 | xoops_cp_header(); |
249 | 267 | // @author Gregory Mage (Aka Mage) |
250 | 268 | //*************************************************************************************** |
@@ -252,184 +270,166 @@ discard block |
||
252 | 270 | $adminObject = \Xmf\Module\Admin::getInstance(); |
253 | 271 | $adminObject->displayNavigation(basename(__FILE__)); |
254 | 272 | //*************************************************************************************** |
273 | + if (isset($_POST['deleteSelection'][0])) { |
|
274 | + $msg = _AM_EXTCAL_CONFIRM_DELETE_ALL; |
|
275 | + $ids = array_keys($_POST['deleteAllEvents']); |
|
276 | + } else { |
|
277 | + $msg = _AM_EXTCAL_CONFIRM_DELETE_SELECTION; |
|
278 | + $ids = array_keys($_POST['deleteEvents']); |
|
279 | + } |
|
255 | 280 | |
256 | - $hiddens = ['event_id' => $_GET['event_id'], 'form_delete' => '', 'confirm' => 1]; |
|
257 | - xoops_confirm($hiddens, 'event.php?op=delete', _AM_EXTCAL_CONFIRM_DELETE_EVENT, _DELETE, 'event.php'); |
|
281 | + // $msg = ((isset($_POST['deleteSelection'][0])) ? _AM_EXTCAL_CONFIRM_DELETE_ALL : _AM_EXTCAL_CONFIRM_DELETE_SELECTION); |
|
282 | + // $ids = array_keys($_POST['deleteEvents']); |
|
283 | + $ids = implode(',', $ids); |
|
284 | + //echo $ids.'<br>'; |
|
285 | + $hiddens = ['event_ids' => $ids, 'form_delete' => '', 'confirm' => 1]; |
|
286 | + //$hiddens = array('event_ids' => $_POST['deleteEvents'], 'form_delete' => '', 'confirm' => 1); |
|
287 | + xoops_confirm($hiddens, 'event.php?op=deleteSelectionOK', $msg, _DELETE, 'event.php'); |
|
258 | 288 | |
259 | 289 | xoops_cp_footer(); |
260 | - } |
|
261 | 290 | |
262 | - break; |
|
263 | - |
|
264 | - case 'deleteSelection': |
|
265 | - |
|
266 | - xoops_cp_header(); |
|
267 | - // @author Gregory Mage (Aka Mage) |
|
268 | - //*************************************************************************************** |
|
269 | - //require_once XOOPS_ROOT_PATH . "/modules/extcal/class/admin.php"; |
|
270 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
271 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
272 | - //*************************************************************************************** |
|
273 | - if (isset($_POST['deleteSelection'][0])) { |
|
274 | - $msg = _AM_EXTCAL_CONFIRM_DELETE_ALL; |
|
275 | - $ids = array_keys($_POST['deleteAllEvents']); |
|
276 | - } else { |
|
277 | - $msg = _AM_EXTCAL_CONFIRM_DELETE_SELECTION; |
|
278 | - $ids = array_keys($_POST['deleteEvents']); |
|
279 | - } |
|
291 | + break; |
|
280 | 292 | |
281 | - // $msg = ((isset($_POST['deleteSelection'][0])) ? _AM_EXTCAL_CONFIRM_DELETE_ALL : _AM_EXTCAL_CONFIRM_DELETE_SELECTION); |
|
282 | - // $ids = array_keys($_POST['deleteEvents']); |
|
283 | - $ids = implode(',', $ids); |
|
284 | - //echo $ids.'<br>'; |
|
285 | - $hiddens = ['event_ids' => $ids, 'form_delete' => '', 'confirm' => 1]; |
|
286 | - //$hiddens = array('event_ids' => $_POST['deleteEvents'], 'form_delete' => '', 'confirm' => 1); |
|
287 | - xoops_confirm($hiddens, 'event.php?op=deleteSelectionOK', $msg, _DELETE, 'event.php'); |
|
288 | - |
|
289 | - xoops_cp_footer(); |
|
290 | - |
|
291 | - break; |
|
292 | - |
|
293 | - case 'deleteSelectionOK': |
|
294 | - //----------------------------------------- |
|
295 | - // $t = print_r($_GET,true); |
|
296 | - // echo "<hr><pre>{$t}</pre><hr>"; |
|
297 | - // |
|
298 | - // $t = print_r($_POST,true); |
|
299 | - // echo "<hr><pre>{$t}</pre><hr>"; |
|
300 | - // exit; |
|
301 | - //----------------------------------------- |
|
302 | - |
|
303 | - if (isset($_POST['deleteSelection'][0])) { |
|
304 | - } else { |
|
305 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
306 | - redirect_header('index.php', 3, _NOPERM . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
307 | - } |
|
293 | + case 'deleteSelectionOK': |
|
294 | + //----------------------------------------- |
|
295 | + // $t = print_r($_GET,true); |
|
296 | + // echo "<hr><pre>{$t}</pre><hr>"; |
|
297 | + // |
|
298 | + // $t = print_r($_POST,true); |
|
299 | + // echo "<hr><pre>{$t}</pre><hr>"; |
|
300 | + // exit; |
|
301 | + //----------------------------------------- |
|
308 | 302 | |
309 | - deleteEvents($_POST['event_ids']); |
|
303 | + if (isset($_POST['deleteSelection'][0])) { |
|
304 | + } else { |
|
305 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
306 | + redirect_header('index.php', 3, _NOPERM . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
307 | + } |
|
310 | 308 | |
311 | - redirect_header('event.php', 3, _AM_EXTCAL_EVENTS_DELETED, false); |
|
312 | - } |
|
309 | + deleteEvents($_POST['event_ids']); |
|
313 | 310 | |
314 | - break; |
|
311 | + redirect_header('event.php', 3, _AM_EXTCAL_EVENTS_DELETED, false); |
|
312 | + } |
|
315 | 313 | |
316 | - case 'default': |
|
317 | - default: |
|
314 | + break; |
|
318 | 315 | |
319 | - //global $extcalConfig; |
|
320 | - $extcalConfig = Extcal\Config::getHandler(); |
|
316 | + case 'default': |
|
317 | + default: |
|
321 | 318 | |
322 | - $start = \Xmf\Request::getInt('start', 0, 'GET'); |
|
323 | - $nbEventsByPage = $helper->getConfig('nbEventsByPage'); |
|
319 | + //global $extcalConfig; |
|
320 | + $extcalConfig = Extcal\Config::getHandler(); |
|
324 | 321 | |
325 | - xoops_cp_header(); |
|
326 | - // @author Gregory Mage (Aka Mage) |
|
327 | - //*************************************************************************************** |
|
322 | + $start = \Xmf\Request::getInt('start', 0, 'GET'); |
|
323 | + $nbEventsByPage = $helper->getConfig('nbEventsByPage'); |
|
328 | 324 | |
329 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
330 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
331 | - //*************************************************************************************** |
|
325 | + xoops_cp_header(); |
|
326 | + // @author Gregory Mage (Aka Mage) |
|
327 | + //*************************************************************************************** |
|
332 | 328 | |
333 | - $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT); |
|
334 | - $events = $eventHandler->objectToArray($eventHandler->getNewEvent($start, $nbEventsByPage, 0, true), ['cat_id']); |
|
335 | - $eventHandler->formatEventsDate($events, _SHORTDATESTRING); |
|
329 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
330 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
331 | + //*************************************************************************************** |
|
336 | 332 | |
337 | - echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTCAL_APPROVED_EVENT . '</legend>'; |
|
338 | - echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _AM_EXTCAL_INFORMATION . '</legend>'; |
|
339 | - //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/edit.png' .' '.'style=vertical-align:middle;> ' . _AM_EXTCAL_INFO_EDIT . '<br>'; |
|
340 | - //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/delete.png'. ' '."style=vertical-align:middle;> ". _AM_EXTCAL_INFO_DELETE; |
|
333 | + $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT); |
|
334 | + $events = $eventHandler->objectToArray($eventHandler->getNewEvent($start, $nbEventsByPage, 0, true), ['cat_id']); |
|
335 | + $eventHandler->formatEventsDate($events, _SHORTDATESTRING); |
|
341 | 336 | |
342 | - echo '<img src=' . $pathIcon16 . '/edit.png' . ' ' . 'style=vertical-align:middle;> ' . _AM_EXTCAL_INFO_EDIT . '<br>'; |
|
343 | - echo '<img src=' . $pathIcon16 . '/delete.png' . ' ' . 'style=vertical-align:middle;> ' . _AM_EXTCAL_INFO_DELETE . '<br>'; |
|
337 | + echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTCAL_APPROVED_EVENT . '</legend>'; |
|
338 | + echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _AM_EXTCAL_INFORMATION . '</legend>'; |
|
339 | + //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/edit.png' .' '.'style=vertical-align:middle;> ' . _AM_EXTCAL_INFO_EDIT . '<br>'; |
|
340 | + //echo'<img src='. XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/assets/images/action/delete.png'. ' '."style=vertical-align:middle;> ". _AM_EXTCAL_INFO_DELETE; |
|
344 | 341 | |
345 | - echo '</fieldset><br>'; |
|
342 | + echo '<img src=' . $pathIcon16 . '/edit.png' . ' ' . 'style=vertical-align:middle;> ' . _AM_EXTCAL_INFO_EDIT . '<br>'; |
|
343 | + echo '<img src=' . $pathIcon16 . '/delete.png' . ' ' . 'style=vertical-align:middle;> ' . _AM_EXTCAL_INFO_DELETE . '<br>'; |
|
346 | 344 | |
347 | - echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _MD_EXTCAL_SUBMITED_EVENT . '</legend>'; |
|
345 | + echo '</fieldset><br>'; |
|
348 | 346 | |
349 | - echo '<form method="POST" action="event.php">'; |
|
350 | - echo '<input type="hidden" name="op" value="deleteSelection">'; |
|
347 | + echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _MD_EXTCAL_SUBMITED_EVENT . '</legend>'; |
|
351 | 348 | |
352 | - echo '<table class="outer" style="width:100%;">'; |
|
353 | - echo '<tr style="text-align:center;">'; |
|
354 | - echo '<th>' . _AM_EXTCAL_DELETE . '</th>'; |
|
355 | - echo '<th>#</th>'; |
|
356 | - echo '<th>' . _AM_EXTCAL_CATEGORY . '</th>'; |
|
357 | - echo '<th>' . _AM_EXTCAL_TITLE . '</th>'; |
|
358 | - echo '<th>' . _AM_EXTCAL_START_DATE . '</th>'; |
|
359 | - echo '<th>' . _AM_EXTCAL_END_DATE . '</th>'; |
|
360 | - echo '<th>' . _AM_EXTCAL_RECURRENT . '</th>'; |
|
361 | - echo '<th>' . _AM_EXTCAL_START_RULES . '</th>'; |
|
362 | - echo '<th>' . _AM_EXTCAL_ACTION . '</th>'; |
|
349 | + echo '<form method="POST" action="event.php">'; |
|
350 | + echo '<input type="hidden" name="op" value="deleteSelection">'; |
|
363 | 351 | |
364 | - echo '</tr>'; |
|
352 | + echo '<table class="outer" style="width:100%;">'; |
|
353 | + echo '<tr style="text-align:center;">'; |
|
354 | + echo '<th>' . _AM_EXTCAL_DELETE . '</th>'; |
|
355 | + echo '<th>#</th>'; |
|
356 | + echo '<th>' . _AM_EXTCAL_CATEGORY . '</th>'; |
|
357 | + echo '<th>' . _AM_EXTCAL_TITLE . '</th>'; |
|
358 | + echo '<th>' . _AM_EXTCAL_START_DATE . '</th>'; |
|
359 | + echo '<th>' . _AM_EXTCAL_END_DATE . '</th>'; |
|
360 | + echo '<th>' . _AM_EXTCAL_RECURRENT . '</th>'; |
|
361 | + echo '<th>' . _AM_EXTCAL_START_RULES . '</th>'; |
|
362 | + echo '<th>' . _AM_EXTCAL_ACTION . '</th>'; |
|
365 | 363 | |
366 | - if (count($events) > 0) { |
|
367 | - $i = 0; |
|
368 | - foreach ($events as $event) { |
|
369 | - $class = (0 == ++$i % 2) ? 'even' : 'odd'; |
|
370 | - echo '<tr style="text-align:left;" class="' . $class . '">'; |
|
371 | - echo "<td width='10%' align='center'>"; |
|
372 | - echo "<input type='checkbox' name='deleteEvents[{$event['event_id']}]' value='1' >"; |
|
373 | - echo "<input type='hidden' name='deleteAllEvents[{$event['event_id']}]' value='1'>"; |
|
374 | - echo '</td>'; |
|
375 | - echo "<td align = 'center' width='5%'>" . $event['event_id'] . '</td>'; |
|
376 | - echo "<td width='10%'>" . '<a href=cat.php?op=modify&cat_id=' . $event['Category']['cat_id'] . '&form_modify' . '>' . $event['Category']['cat_name'] . '</a>' . '</td>'; |
|
377 | - |
|
378 | - echo '<td>' . '<a href=event.php?op=modify&event_id=' . $event['event_id'] . '>' . $event['event_title'] . '</a>' . '</td>'; |
|
379 | - |
|
380 | - // if ($event['event_isrecur']) { |
|
381 | - // echo '<td>' . $event['formated_reccur_rule'] . '</td>'; |
|
382 | - // } else { |
|
383 | - // echo '<td>' . $event['formated_event_start'] . '</td>'; |
|
384 | - // } |
|
385 | - |
|
386 | - echo "<td align = 'center' width='10%'>" . $event['formated_event_start'] . '</td>'; |
|
387 | - echo "<td align = 'center' width='10%'>" . $event['formated_event_end'] . '</td>'; |
|
388 | - echo '<td align="center">' . ((1 == $event['event_isrecur']) ? _YES : _NO) . '</td>'; |
|
389 | - if (!isset($event['formated_reccur_rule'])) { |
|
390 | - $event['formated_reccur_rule'] = ''; |
|
364 | + echo '</tr>'; |
|
365 | + |
|
366 | + if (count($events) > 0) { |
|
367 | + $i = 0; |
|
368 | + foreach ($events as $event) { |
|
369 | + $class = (0 == ++$i % 2) ? 'even' : 'odd'; |
|
370 | + echo '<tr style="text-align:left;" class="' . $class . '">'; |
|
371 | + echo "<td width='10%' align='center'>"; |
|
372 | + echo "<input type='checkbox' name='deleteEvents[{$event['event_id']}]' value='1' >"; |
|
373 | + echo "<input type='hidden' name='deleteAllEvents[{$event['event_id']}]' value='1'>"; |
|
374 | + echo '</td>'; |
|
375 | + echo "<td align = 'center' width='5%'>" . $event['event_id'] . '</td>'; |
|
376 | + echo "<td width='10%'>" . '<a href=cat.php?op=modify&cat_id=' . $event['Category']['cat_id'] . '&form_modify' . '>' . $event['Category']['cat_name'] . '</a>' . '</td>'; |
|
377 | + |
|
378 | + echo '<td>' . '<a href=event.php?op=modify&event_id=' . $event['event_id'] . '>' . $event['event_title'] . '</a>' . '</td>'; |
|
379 | + |
|
380 | + // if ($event['event_isrecur']) { |
|
381 | + // echo '<td>' . $event['formated_reccur_rule'] . '</td>'; |
|
382 | + // } else { |
|
383 | + // echo '<td>' . $event['formated_event_start'] . '</td>'; |
|
384 | + // } |
|
385 | + |
|
386 | + echo "<td align = 'center' width='10%'>" . $event['formated_event_start'] . '</td>'; |
|
387 | + echo "<td align = 'center' width='10%'>" . $event['formated_event_end'] . '</td>'; |
|
388 | + echo '<td align="center">' . ((1 == $event['event_isrecur']) ? _YES : _NO) . '</td>'; |
|
389 | + if (!isset($event['formated_reccur_rule'])) { |
|
390 | + $event['formated_reccur_rule'] = ''; |
|
391 | + } |
|
392 | + echo '<td>' . $event['formated_reccur_rule'] . '</td>'; |
|
393 | + |
|
394 | + echo '<td style="width:10%; text-align:center;">'; |
|
395 | + echo '<a href=event.php?op=modify&event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/edit.png' title='" . _AM_EXTCAL_ICONE_EDIT . "'></a> "; |
|
396 | + echo '<a href=event.php?op=delete&event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/delete.png' title='" . _AM_EXTCAL_ICONE_DELETE . "'></a> "; |
|
397 | + echo '<a href=event.php?op=clone&event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/editcopy.png' title='" . _AM_EXTCAL_ICONE_CLONE . "'></a>"; |
|
398 | + echo '</td>'; |
|
399 | + |
|
400 | + echo '</tr>'; |
|
391 | 401 | } |
392 | - echo '<td>' . $event['formated_reccur_rule'] . '</td>'; |
|
402 | + //--------------------------------------------------------- |
|
403 | + $pageNav = new \XoopsPageNav($eventHandler->getCountNewEvent(), $nbEventsByPage, $start); |
|
393 | 404 | |
394 | - echo '<td style="width:10%; text-align:center;">'; |
|
395 | - echo '<a href=event.php?op=modify&event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/edit.png' title='" . _AM_EXTCAL_ICONE_EDIT . "'></a> "; |
|
396 | - echo '<a href=event.php?op=delete&event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/delete.png' title='" . _AM_EXTCAL_ICONE_DELETE . "'></a> "; |
|
397 | - echo '<a href=event.php?op=clone&event_id=' . $event['event_id'] . "><img src='" . $pathIcon16 . "/editcopy.png' title='" . _AM_EXTCAL_ICONE_CLONE . "'></a>"; |
|
405 | + echo '<tr><td colspan="2" style="text-align: right;">'; |
|
406 | + echo $pageNav->renderNav(2); |
|
398 | 407 | echo '</td>'; |
399 | 408 | |
400 | - echo '</tr>'; |
|
401 | - } |
|
402 | - //--------------------------------------------------------- |
|
403 | - $pageNav = new \XoopsPageNav($eventHandler->getCountNewEvent(), $nbEventsByPage, $start); |
|
409 | + echo '<td colspan="2" style="text-align: right;">'; |
|
404 | 410 | |
405 | - echo '<tr><td colspan="2" style="text-align: right;">'; |
|
406 | - echo $pageNav->renderNav(2); |
|
407 | - echo '</td>'; |
|
411 | + echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_ALL . '" name="deleteSelection[0]">'; |
|
412 | + echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_SELECTION . '" name="deleteSelection[1]">'; |
|
408 | 413 | |
409 | - echo '<td colspan="2" style="text-align: right;">'; |
|
410 | - |
|
411 | - echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_ALL . '" name="deleteSelection[0]">'; |
|
412 | - echo '<input type="submit" value="' . _AM_EXTCAL_DELETE_SELECTION . '" name="deleteSelection[1]">'; |
|
413 | - |
|
414 | - echo '</td>'; |
|
415 | - echo '</tr>'; |
|
416 | - } else { |
|
417 | - echo '<tr><td colspan="5">' . _AM_EXTCAL_NO_PENDING_EVENT . '</td></tr>'; |
|
418 | - } |
|
419 | - echo '</table>'; |
|
420 | - echo '</form>'; |
|
414 | + echo '</td>'; |
|
415 | + echo '</tr>'; |
|
416 | + } else { |
|
417 | + echo '<tr><td colspan="5">' . _AM_EXTCAL_NO_PENDING_EVENT . '</td></tr>'; |
|
418 | + } |
|
419 | + echo '</table>'; |
|
420 | + echo '</form>'; |
|
421 | 421 | |
422 | - echo '</fieldset>'; |
|
423 | - echo '</fieldset><br><br>'; |
|
424 | - //Fin de la liste des evennement ------------------------------------- |
|
425 | - echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_SUBMIT_EVENT . '</legend>'; |
|
422 | + echo '</fieldset>'; |
|
423 | + echo '</fieldset><br><br>'; |
|
424 | + //Fin de la liste des evennement ------------------------------------- |
|
425 | + echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _MD_EXTCAL_SUBMIT_EVENT . '</legend>'; |
|
426 | 426 | |
427 | - $form = $eventHandler->getEventForm('admin'); |
|
428 | - $form->display(); |
|
427 | + $form = $eventHandler->getEventForm('admin'); |
|
428 | + $form->display(); |
|
429 | 429 | |
430 | - echo '</fieldset>'; |
|
430 | + echo '</fieldset>'; |
|
431 | 431 | |
432 | - require_once __DIR__ . '/admin_footer.php'; |
|
432 | + require_once __DIR__ . '/admin_footer.php'; |
|
433 | 433 | |
434 | - break; |
|
434 | + break; |
|
435 | 435 | } |