ggoffy /
wgevents
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | /* |
||
| 4 | You may not change or alter any portion of this comment or credits |
||
| 5 | of supporting developers from this source code or any supporting source code |
||
| 6 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 7 | |||
| 8 | This program is distributed in the hope that it will be useful, |
||
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 11 | */ |
||
| 12 | |||
| 13 | /** |
||
| 14 | * wgEvents module for xoops |
||
| 15 | * |
||
| 16 | * @copyright 2021 XOOPS Project (https://xoops.org) |
||
| 17 | * @license GPL 2.0 or later |
||
| 18 | * @package wgevents |
||
| 19 | * @author Goffy - Wedega - Email:[email protected] - Website:https://xoops.wedega.com |
||
| 20 | */ |
||
| 21 | |||
| 22 | use Xmf\Request; |
||
| 23 | use XoopsModules\Wgevents; |
||
| 24 | use XoopsModules\Wgevents\{ |
||
| 25 | Constants, |
||
| 26 | Common |
||
| 27 | }; |
||
| 28 | |||
| 29 | require __DIR__ . '/header.php'; |
||
| 30 | $GLOBALS['xoopsOption']['template_main'] = 'wgevents_question.tpl'; |
||
| 31 | require_once \XOOPS_ROOT_PATH . '/header.php'; |
||
| 32 | |||
| 33 | $op = Request::getCmd('op', 'list'); |
||
| 34 | $queId = Request::getInt('id'); |
||
| 35 | $queEvid = Request::getInt('evid'); |
||
| 36 | $start = Request::getInt('start'); |
||
| 37 | $limit = Request::getInt('limit', $helper->getConfig('userpager')); |
||
| 38 | $GLOBALS['xoopsTpl']->assign('start', $start); |
||
| 39 | $GLOBALS['xoopsTpl']->assign('limit', $limit); |
||
| 40 | |||
| 41 | // Define Stylesheet |
||
| 42 | $GLOBALS['xoTheme']->addStylesheet($style, null); |
||
| 43 | // Paths |
||
| 44 | $GLOBALS['xoopsTpl']->assign('xoops_icons32_url', \XOOPS_ICONS32_URL); |
||
| 45 | $GLOBALS['xoopsTpl']->assign('wgevents_url', \WGEVENTS_URL); |
||
| 46 | // Keywords |
||
| 47 | $keywords = []; |
||
| 48 | // Breadcrumbs |
||
| 49 | $xoBreadcrumbs[] = ['title' => \_MA_WGEVENTS_INDEX, 'link' => 'index.php']; |
||
| 50 | |||
| 51 | $GLOBALS['xoopsTpl']->assign('addEvid', $queEvid); |
||
| 52 | |||
| 53 | switch ($op) { |
||
| 54 | case 'show': |
||
| 55 | case 'list': |
||
| 56 | default: |
||
| 57 | $GLOBALS['xoTheme']->addScript(\WGEVENTS_URL . '/assets/js/jquery-ui.min.js'); |
||
| 58 | $GLOBALS['xoTheme']->addScript(\WGEVENTS_URL . '/assets/js/sortables.js'); |
||
| 59 | |||
| 60 | // check whether there are textblocks available |
||
| 61 | $uidCurrent = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0; |
||
| 62 | $crTextblock = new \CriteriaCompo(); |
||
| 63 | $crTextblock->add(new \Criteria('class', Constants::TEXTBLOCK_CLASS_PUBLIC)); |
||
| 64 | $crTextblock->add(new \Criteria('submitter', $uidCurrent), 'OR'); |
||
| 65 | $textblocksCount = $textblockHandler->getCount($crTextblock); |
||
| 66 | $GLOBALS['xoopsTpl']->assign('textblocksCount', $textblocksCount); |
||
| 67 | |||
| 68 | // get default fields |
||
| 69 | $regdefaults = []; |
||
| 70 | $regdefaults[] = [ |
||
| 71 | 'type_text' => \_MA_WGEVENTS_FIELD_TEXTBOX, |
||
| 72 | 'caption' => \_MA_WGEVENTS_REGISTRATION_FIRSTNAME, |
||
| 73 | 'value_list' => '', |
||
| 74 | 'placeholder' => \_MA_WGEVENTS_REGISTRATION_FIRSTNAME_PLACEHOLDER, |
||
| 75 | 'required' => \_YES, |
||
| 76 | 'print' => \_YES |
||
| 77 | ]; |
||
| 78 | $regdefaults[] = [ |
||
| 79 | 'type_text' => \_MA_WGEVENTS_FIELD_TEXTBOX, |
||
| 80 | 'caption' => \_MA_WGEVENTS_REGISTRATION_LASTNAME, |
||
| 81 | 'value_list' => '', |
||
| 82 | 'placeholder' => \_MA_WGEVENTS_REGISTRATION_LASTNAME_PLACEHOLDER, |
||
| 83 | 'required' => \_YES, |
||
| 84 | 'print' => \_YES |
||
| 85 | ]; |
||
| 86 | $regdefaults[] = [ |
||
| 87 | 'type_text' => \_MA_WGEVENTS_FIELD_TEXTBOX, |
||
| 88 | 'caption' => \_MA_WGEVENTS_REGISTRATION_EMAIL, |
||
| 89 | 'value_list' => '', |
||
| 90 | 'placeholder' => \_MA_WGEVENTS_REGISTRATION_EMAIL_PLACEHOLDER, |
||
| 91 | 'required' => \_YES, |
||
| 92 | 'print' => \_YES |
||
| 93 | ]; |
||
| 94 | $GLOBALS['xoopsTpl']->assign('regdefaults', $regdefaults); |
||
| 95 | |||
| 96 | //get event details |
||
| 97 | $eventObj = $eventHandler->get($queEvid); |
||
| 98 | $evName = $eventObj->getVar('name'); |
||
| 99 | $evSubmitter = $eventObj->getVar('submitter'); |
||
| 100 | $evStatus = $eventObj->getVar('status'); |
||
| 101 | $keywords[] = $evName; |
||
| 102 | |||
| 103 | // Breadcrumbs |
||
| 104 | if ('' !== $evName) { |
||
| 105 | $xoBreadcrumbs[] = ['title' => $evName]; |
||
| 106 | } |
||
| 107 | $xoBreadcrumbs[] = ['title' => \_MA_WGEVENTS_QUESTIONS_LIST]; |
||
| 108 | |||
| 109 | // get question fields |
||
| 110 | $crQuestion = new \CriteriaCompo(); |
||
| 111 | $crQuestion->add(new \Criteria('evid', $queEvid)); |
||
| 112 | $questionsCount = $questionHandler->getCount($crQuestion); |
||
| 113 | $GLOBALS['xoopsTpl']->assign('questionsCount', $questionsCount); |
||
| 114 | $crQuestion->setSort('weight ASC, id'); |
||
| 115 | $crQuestion->setOrder('DESC'); |
||
| 116 | $crQuestion->setStart($start); |
||
| 117 | $crQuestion->setLimit($limit); |
||
| 118 | if ($questionsCount > 0) { |
||
| 119 | $questionsAll = $questionHandler->getAll($crQuestion); |
||
| 120 | $questions = []; |
||
| 121 | $evName = ''; |
||
| 122 | $evSubmitter = 0; |
||
| 123 | $evStatus = 0; |
||
| 124 | // Get All Question |
||
| 125 | foreach (\array_keys($questionsAll) as $i) { |
||
| 126 | $questions[$i] = $questionsAll[$i]->getValuesQuestions(); |
||
| 127 | } |
||
| 128 | $GLOBALS['xoopsTpl']->assign('questions', $questions); |
||
| 129 | unset($questions); |
||
| 130 | // Display Navigation |
||
| 131 | if ($questionsCount > $limit) { |
||
| 132 | require_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
| 133 | $pagenav = new \XoopsPageNav($questionsCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
||
| 134 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
||
| 135 | } |
||
| 136 | $GLOBALS['xoopsTpl']->assign('eventName', $evName); |
||
| 137 | $permEdit = $permissionsHandler->getPermQuestionsAdmin($evSubmitter, $evStatus); |
||
| 138 | $GLOBALS['xoopsTpl']->assign('permEdit', $permEdit); |
||
| 139 | $GLOBALS['xoopsTpl']->assign('wgevents_icons_url_16', \WGEVENTS_ICONS_URL_16); |
||
| 140 | |||
| 141 | $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', \strip_tags($evName . ' - ' . $GLOBALS['xoopsModule']->getVar('name'))); |
||
| 142 | |||
| 143 | } |
||
| 144 | break; |
||
| 145 | case 'save': |
||
| 146 | // Security Check |
||
| 147 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 148 | \redirect_header('question.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 149 | } |
||
| 150 | $eventObj = $eventHandler->get($queEvid); |
||
| 151 | // Check permissions |
||
| 152 | if (!$permissionsHandler->getPermQuestionsAdmin($eventObj->getVar('submitter'), $eventObj->getVar('status'))) { |
||
| 153 | \redirect_header('index.php?op=list', 3, \_NOPERM); |
||
| 154 | } |
||
| 155 | if ($queId > 0) { |
||
| 156 | $questionObj = $questionHandler->get($queId); |
||
| 157 | } else { |
||
| 158 | $questionObj = $questionHandler->create(); |
||
| 159 | } |
||
| 160 | $questionObj->setVar('evid', $queEvid); |
||
| 161 | $queType = Request::getInt('type'); |
||
| 162 | $questionObj->setVar('fdid', $queType); |
||
| 163 | $fieldObj = $fieldHandler->get($queType); |
||
| 164 | $fieldType = $fieldObj->getVar('type'); |
||
| 165 | $questionObj->setVar('type', $fieldType); |
||
| 166 | $questionObj->setVar('caption', Request::getString('caption')); |
||
| 167 | $questionObj->setVar('desc', Request::getText('desc')); |
||
| 168 | $queValuesText = ''; |
||
| 169 | $queValues = Request::getString('values'); |
||
| 170 | if ('' != $queValues) { |
||
| 171 | if (Constants::FIELD_COMBOBOX == $fieldType || |
||
| 172 | Constants::FIELD_SELECTBOX == $fieldType || |
||
| 173 | Constants::FIELD_RADIO == $fieldType || |
||
| 174 | Constants::FIELD_CHECKBOX == $fieldType) { |
||
| 175 | $queValuesText = \serialize(\preg_split('/\r\n|\r|\n/', $queValues)); |
||
| 176 | } else { |
||
| 177 | $tmpArr = [$queValues]; |
||
| 178 | $queValuesText = \serialize($tmpArr); |
||
| 179 | } |
||
| 180 | } |
||
| 181 | $questionObj->setVar('values', $queValuesText); |
||
| 182 | $questionObj->setVar('placeholder', Request::getString('placeholder')); |
||
| 183 | $questionObj->setVar('required', Request::getInt('required')); |
||
| 184 | $questionObj->setVar('print', Request::getInt('print')); |
||
| 185 | $questionObj->setVar('weight', Request::getInt('weight')); |
||
| 186 | if (Request::hasVar('datecreated_int')) { |
||
| 187 | $questionObj->setVar('datecreated', Request::getInt('datecreated_int')); |
||
| 188 | } else { |
||
| 189 | $questionDatecreatedObj = \DateTime::createFromFormat(\_SHORTDATESTRING, Request::getString('datecreated')); |
||
| 190 | $questionObj->setVar('datecreated', $questionDatecreatedObj->getTimestamp()); |
||
| 191 | } |
||
| 192 | $questionObj->setVar('submitter', Request::getInt('submitter')); |
||
| 193 | // Insert Data |
||
| 194 | if ($questionHandler->insert($questionObj)) { |
||
| 195 | // redirect after insert |
||
| 196 | \redirect_header('question.php?op=list&evid=' . $queEvid . '&start=' . $start . '&limit=' . $limit, 2, \_MA_WGEVENTS_FORM_OK); |
||
| 197 | } |
||
| 198 | // Get Form Error |
||
| 199 | $GLOBALS['xoopsTpl']->assign('error', $questionObj->getHtmlErrors()); |
||
| 200 | $form = $questionObj->getForm(); |
||
| 201 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
| 202 | break; |
||
| 203 | case 'save_textblock': |
||
| 204 | // Security Check |
||
| 205 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 206 | \redirect_header('question.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 207 | } |
||
| 208 | $eventObj = $eventHandler->get($queEvid); |
||
| 209 | // Check permissions |
||
| 210 | if (!$permissionsHandler->getPermQuestionsAdmin($eventObj->getVar('submitter'), $eventObj->getVar('status'))) { |
||
| 211 | \redirect_header('index.php?op=list', 3, \_NOPERM); |
||
| 212 | } |
||
| 213 | $weight = $questionHandler->getNextWeight($queEvid); |
||
| 214 | $uidCurrent = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0; |
||
| 215 | |||
| 216 | $cbTextblocks = Request::getArray('cbTextblock'); |
||
| 217 | $errors = ''; |
||
| 218 | foreach (\array_keys($cbTextblocks) as $i) { |
||
| 219 | $textblockObj = $textblockHandler->get($i); |
||
| 220 | |||
| 221 | $questionObj = $questionHandler->create(); |
||
| 222 | $questionObj->setVar('evid', $queEvid); |
||
| 223 | $questionObj->setVar('fdid', Constants::FIELD_LABEL); |
||
| 224 | $fieldObj = $fieldHandler->get(Constants::FIELD_LABEL); |
||
| 225 | $questionObj->setVar('type', $fieldObj->getVar('type')); |
||
| 226 | $questionObj->setVar('caption', $textblockObj->getVar('name')); |
||
| 227 | $questionObj->setVar('desc', $textblockObj->getVar('text')); |
||
| 228 | $questionObj->setVar('values', ''); |
||
| 229 | $questionObj->setVar('placeholder', ''); |
||
| 230 | $questionObj->setVar('required', 0); |
||
| 231 | $questionObj->setVar('print', 0); |
||
| 232 | $questionObj->setVar('weight', $weight); |
||
| 233 | $questionObj->setVar('datecreated', \time()); |
||
| 234 | $questionObj->setVar('submitter', $uidCurrent); |
||
| 235 | // Insert Data |
||
| 236 | if (!$questionHandler->insert($questionObj)) { |
||
| 237 | $errors .= $questionHandler.getHtmlErrors(); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 238 | } |
||
| 239 | $weight++; |
||
| 240 | } |
||
| 241 | if ('' == $errors) { |
||
| 242 | // redirect after insert |
||
| 243 | \redirect_header('question.php?op=list&evid=' . $queEvid . '&start=' . $start . '&limit=' . $limit, 2, \_MA_WGEVENTS_FORM_OK); |
||
| 244 | } else { |
||
| 245 | $GLOBALS['xoopsTpl']->assign('error', $errors); |
||
| 246 | } |
||
| 247 | break; |
||
| 248 | case 'newset': |
||
| 249 | $eventObj = $eventHandler->get($queEvid); |
||
| 250 | // Check permissions |
||
| 251 | if (!$permissionsHandler->getPermQuestionsAdmin($eventObj->getVar('submitter'), $eventObj->getVar('status'))) { |
||
| 252 | \redirect_header('index.php?op=list', 3, \_NOPERM); |
||
| 253 | } |
||
| 254 | $questionHandler->createQuestionsDefaultset($queEvid); |
||
| 255 | \redirect_header('question.php?op=list&evid=' . $queEvid . '&start=' . $start . '&limit=' . $limit, 0, \_MA_WGEVENTS_FORM_OK); |
||
| 256 | break; |
||
| 257 | case 'add_textblock': |
||
| 258 | $eventObj = $eventHandler->get($queEvid); |
||
| 259 | // Check permissions |
||
| 260 | if (!$permissionsHandler->getPermQuestionsAdmin($eventObj->getVar('submitter'), $eventObj->getVar('status'))) { |
||
| 261 | \redirect_header('index.php?op=list', 3, \_NOPERM); |
||
| 262 | } |
||
| 263 | $xoBreadcrumbs[] = ['title' => \_MA_WGEVENTS_TEXTBLOCK_ADD]; |
||
| 264 | |||
| 265 | $uidCurrent = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0; |
||
| 266 | $crTextblock = new \CriteriaCompo(); |
||
| 267 | $crTextblock->add(new \Criteria('class', Constants::TEXTBLOCK_CLASS_PUBLIC)); |
||
| 268 | $crTextblock->add(new \Criteria('submitter', $uidCurrent), 'OR'); |
||
| 269 | $textblocksCount = $textblockHandler->getCount($crTextblock); |
||
| 270 | $GLOBALS['xoopsTpl']->assign('textblocksCount', $textblocksCount); |
||
| 271 | if ($textblocksCount > 0) { |
||
| 272 | $crTextblock->setStart($start); |
||
| 273 | $crTextblock->setLimit($limit); |
||
| 274 | $textblocksAll = $textblockHandler->getAll($crTextblock); |
||
| 275 | $formTextblockSelect = $textblockHandler->getFormSelect($textblocksAll); |
||
| 276 | |||
| 277 | $GLOBALS['xoopsTpl']->assign('formTextblockSelect', $formTextblockSelect->render()); |
||
| 278 | unset($textblocks); |
||
| 279 | // Display Navigation |
||
| 280 | if ($textblocksCount > $limit) { |
||
| 281 | require_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
| 282 | $pagenav = new \XoopsPageNav($textblocksCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
||
| 283 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
||
| 284 | } |
||
| 285 | } |
||
| 286 | break; |
||
| 287 | case 'new': |
||
| 288 | $eventObj = $eventHandler->get($queEvid); |
||
| 289 | // Check permissions |
||
| 290 | if (!$permissionsHandler->getPermQuestionsAdmin($eventObj->getVar('submitter'), $eventObj->getVar('status'))) { |
||
| 291 | \redirect_header('index.php?op=list', 3, \_NOPERM); |
||
| 292 | } |
||
| 293 | $GLOBALS['xoTheme']->addScript(\WGEVENTS_URL . '/assets/js/forms.js'); |
||
| 294 | // Breadcrumbs |
||
| 295 | $xoBreadcrumbs[] = ['title' => \_MA_WGEVENTS_QUESTION_ADD]; |
||
| 296 | // Form Create |
||
| 297 | $questionObj = $questionHandler->create(); |
||
| 298 | $questionObj->setVar('evid', $queEvid); |
||
| 299 | $form = $questionObj->getForm(); |
||
| 300 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
| 301 | break; |
||
| 302 | case 'test': |
||
| 303 | $eventObj = $eventHandler->get($queEvid); |
||
| 304 | // Check permissions |
||
| 305 | if (!$permissionsHandler->getPermQuestionsAdmin($eventObj->getVar('submitter'), $eventObj->getVar('status'))) { |
||
| 306 | \redirect_header('index.php?op=list', 3, \_NOPERM); |
||
| 307 | } |
||
| 308 | // Breadcrumbs |
||
| 309 | $xoBreadcrumbs[] = ['title' => $eventObj->getVar('name')]; |
||
| 310 | // Form Create |
||
| 311 | $registrationObj = $registrationHandler->create(); |
||
| 312 | $registrationObj->setVar('evid', $queEvid); |
||
| 313 | $form = $registrationObj->getForm('', true); |
||
| 314 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
| 315 | break; |
||
| 316 | case 'edit': |
||
| 317 | $eventObj = $eventHandler->get($queEvid); |
||
| 318 | // Check permissions |
||
| 319 | if (!$permissionsHandler->getPermQuestionsAdmin($eventObj->getVar('submitter'), $eventObj->getVar('status'))) { |
||
| 320 | \redirect_header('index.php?op=list', 3, \_NOPERM); |
||
| 321 | } |
||
| 322 | $GLOBALS['xoTheme']->addScript(\WGEVENTS_URL . '/assets/js/forms.js'); |
||
| 323 | // Breadcrumbs |
||
| 324 | $xoBreadcrumbs[] = ['title' => \_MA_WGEVENTS_QUESTION_EDIT]; |
||
| 325 | // Check params |
||
| 326 | if (0 == $queId) { |
||
| 327 | \redirect_header('question.php?op=list', 3, \_MA_WGEVENTS_INVALID_PARAM); |
||
| 328 | } |
||
| 329 | // Get Form |
||
| 330 | $questionObj = $questionHandler->get($queId); |
||
| 331 | $questionObj->start = $start; |
||
| 332 | $questionObj->limit = $limit; |
||
| 333 | $form = $questionObj->getForm(); |
||
| 334 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
| 335 | break; |
||
| 336 | case 'clone': |
||
| 337 | // Breadcrumbs |
||
| 338 | $xoBreadcrumbs[] = ['title' => \_MA_WGEVENTS_QUESTION_CLONE]; |
||
| 339 | // Request source |
||
| 340 | $queIdSource = Request::getInt('id_source'); |
||
| 341 | // Check params |
||
| 342 | if (0 == $queIdSource) { |
||
| 343 | \redirect_header('question.php?op=list', 3, \_MA_WGEVENTS_INVALID_PARAM); |
||
| 344 | } |
||
| 345 | // Get Form |
||
| 346 | $questionObjSource = $questionHandler->get($queIdSource); |
||
| 347 | $questionObj = $questionHandler->create(); |
||
| 348 | $questionObj->setVar('evid', $questionObjSource->getVar('evid')); |
||
| 349 | $questionObj->setVar('fdid', $questionObjSource->getVar('fdid')); |
||
| 350 | $questionObj->setVar('type', $questionObjSource->getVar('type')); |
||
| 351 | $questionObj->setVar('caption', $questionObjSource->getVar('caption')); |
||
| 352 | $questionObj->setVar('desc', $questionObjSource->getVar('desc')); |
||
| 353 | $questionObj->setVar('values', $questionObjSource->getVar('values')); |
||
| 354 | $questionObj->setVar('placeholder', $questionObjSource->getVar('placeholder')); |
||
| 355 | $questionObj->setVar('required', $questionObjSource->getVar('required')); |
||
| 356 | $questionObj->setVar('print', $questionObjSource->getVar('print')); |
||
| 357 | $questionObj->setVar('weight', $questionObjSource->getVar('weight')); |
||
| 358 | $form = $questionObj->getForm('question.php?op=save'); |
||
| 359 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
| 360 | unset($questionObjSource); |
||
| 361 | break; |
||
| 362 | case 'delete': |
||
| 363 | // Breadcrumbs |
||
| 364 | $xoBreadcrumbs[] = ['title' => \_MA_WGEVENTS_QUESTION_DELETE]; |
||
| 365 | // Check params |
||
| 366 | if (0 == $queId) { |
||
| 367 | \redirect_header('question.php?op=list', 3, \_MA_WGEVENTS_INVALID_PARAM); |
||
| 368 | } |
||
| 369 | $questionObj = $questionHandler->get($queId); |
||
| 370 | $queEvid = $questionObj->getVar('evid'); |
||
| 371 | if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
||
| 372 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 373 | \redirect_header('question.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 374 | } |
||
| 375 | if ($questionHandler->delete($questionObj)) { |
||
| 376 | \redirect_header('question.php?list&evid=' . $queEvid, 3, \_MA_WGEVENTS_FORM_DELETE_OK); |
||
| 377 | } else { |
||
| 378 | $GLOBALS['xoopsTpl']->assign('error', $questionObj->getHtmlErrors()); |
||
| 379 | } |
||
| 380 | } else { |
||
| 381 | $customConfirm = new Common\Confirm( |
||
| 382 | ['ok' => 1, 'id' => $queId, 'evid' => $queEvid, 'op' => 'delete'], |
||
| 383 | $_SERVER['REQUEST_URI'], |
||
| 384 | \sprintf(\_MA_WGEVENTS_CONFIRMDELETE_QUESTION, $questionObj->getVar('caption')), \_MA_WGEVENTS_CONFIRMDELETE_TITLE, \_MA_WGEVENTS_CONFIRMDELETE_LABEL); |
||
| 385 | $form = $customConfirm->getFormConfirm(); |
||
| 386 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
| 387 | } |
||
| 388 | break; |
||
| 389 | case 'order': |
||
| 390 | $order = $_POST['order']; |
||
| 391 | for ($i = 0, $iMax = \count($order); $i < $iMax; $i++) { |
||
| 392 | $questionObj = $questionHandler->get($order[$i]); |
||
| 393 | $questionObj->setVar('weight', $i + 1); |
||
| 394 | $questionHandler->insert($questionObj); |
||
| 395 | } |
||
| 396 | break; |
||
| 397 | } |
||
| 398 | |||
| 399 | // Keywords |
||
| 400 | wgeventsMetaKeywords($helper->getConfig('keywords') . ', ' . \implode(',', $keywords)); |
||
| 401 | unset($keywords); |
||
| 402 | |||
| 403 | // Description |
||
| 404 | wgeventsMetaDescription(\_MA_WGEVENTS_QUESTIONS_DESC); |
||
| 405 | $GLOBALS['xoopsTpl']->assign('xoops_mpageurl', \WGEVENTS_URL.'/question.php'); |
||
| 406 | $GLOBALS['xoopsTpl']->assign('wgevents_upload_url', \WGEVENTS_UPLOAD_URL); |
||
| 407 | |||
| 408 | require __DIR__ . '/footer.php'; |
||
| 409 |