Conditions | 31 |
Paths | 424 |
Total Lines | 388 |
Code Lines | 251 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php declare(strict_types=1); |
||
231 | function editDepartment() |
||
232 | { |
||
233 | $deptID = 0; |
||
234 | $session = Xhelp\Session::getInstance(); |
||
235 | global $icons, $xoopsModule, $limit, $start; |
||
236 | $helper = Xhelp\Helper::getInstance(); |
||
237 | $errors = []; |
||
238 | |||
239 | $module_id = $xoopsModule->getVar('mid'); |
||
240 | $displayName = $helper->getConfig('xhelp_displayName'); // Determines if username or real name is displayed |
||
241 | |||
242 | $session->set('xhelp_return_page', mb_substr(mb_strstr($_SERVER['REQUEST_URI'], 'admin/'), 6)); |
||
243 | |||
244 | if (Request::hasVar('deptid', 'REQUEST')) { |
||
245 | $deptID = Request::getInt('deptid', 0); |
||
246 | } else { |
||
247 | $helper->redirect('admin/department.php?op=manageDepartments', 3, _AM_XHELP_MSG_NO_DEPTID); |
||
248 | } |
||
249 | |||
250 | /** @var \XoopsModules\Xhelp\DepartmentHandler $departmentHandler */ |
||
251 | $departmentHandler = $helper->getHandler('Department'); |
||
252 | /** @var \XoopsGroupHandler $groupHandler */ |
||
253 | $groupHandler = xoops_getHandler('group'); |
||
254 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||
255 | $grouppermHandler = xoops_getHandler('groupperm'); |
||
256 | |||
257 | if (Request::hasVar('updateDept', 'POST')) { |
||
258 | $groups = ($_POST['groups'] ?? []); |
||
259 | |||
260 | $hasErrors = false; |
||
261 | //Department Name supplied? |
||
262 | if ('' === trim(\Xmf\Request::getString('newDept', '', 'POST'))) { |
||
263 | $hasErrors = true; |
||
264 | $errors['newDept'][] = _AM_XHELP_MESSAGE_NO_DEPT; |
||
265 | } else { |
||
266 | //Department Name unique? |
||
267 | $criteria = new \CriteriaCompo(new \Criteria('department', \Xmf\Request::getString('newDept', '', 'POST'))); |
||
268 | $criteria->add(new \Criteria('id', (string)$deptID, '!=')); |
||
269 | $existingDepts = $departmentHandler->getCount($criteria); |
||
270 | if ($existingDepts) { |
||
271 | $hasErrors = true; |
||
272 | $errors['newDept'][] = _XHELP_MESSAGE_DEPT_EXISTS; |
||
273 | } |
||
274 | } |
||
275 | |||
276 | if ($hasErrors) { |
||
277 | $session = Xhelp\Session::getInstance(); |
||
278 | //Store existing dept info in session, reload addition page |
||
279 | $aDept = []; |
||
280 | $aDept['newDept'] = \Xmf\Request::getString('newDept', '', 'POST'); |
||
281 | $aDept['groups'] = $groups; |
||
282 | $session->set("xhelp_editDepartment_$deptID", $aDept); |
||
283 | $session->set("xhelp_editDepartmentErrors_$deptID", $errors); |
||
284 | redirect_header(Xhelp\Utility::createURI(XHELP_ADMIN_URL . '/department.php', ['op' => 'editDepartment', 'deptid' => $deptID], false)); |
||
285 | } |
||
286 | |||
287 | $dept = $departmentHandler->get($deptID); |
||
288 | |||
289 | $oldDept = $dept; |
||
290 | $groups = $_POST['groups']; |
||
291 | |||
292 | // Need to remove old group permissions first |
||
293 | $criteria = new \CriteriaCompo(new \Criteria('gperm_modid', $module_id)); |
||
294 | $criteria->add(new \Criteria('gperm_itemid', (string)$deptID)); |
||
295 | $criteria->add(new \Criteria('gperm_name', _XHELP_GROUP_PERM_DEPT)); |
||
296 | $grouppermHandler->deleteAll($criteria); |
||
297 | |||
298 | foreach ($groups as $group) { // Add new group permissions |
||
299 | $grouppermHandler->addRight(_XHELP_GROUP_PERM_DEPT, $deptID, $group, $module_id); |
||
300 | } |
||
301 | |||
302 | $dept->setVar('department', \Xmf\Request::getString('newDept', '', 'POST')); |
||
303 | |||
304 | if ($departmentHandler->insert($dept)) { |
||
305 | $message = _XHELP_MESSAGE_UPDATE_DEPT; |
||
306 | |||
307 | // Update default dept |
||
308 | if (Request::hasVar('defaultDept', 'POST') && (1 == $_POST['defaultDept'])) { |
||
309 | Xhelp\Utility::setMeta('default_department', $dept->getVar('id')); |
||
310 | } else { |
||
311 | $depts = $departmentHandler->getObjects(); |
||
312 | $aDepts = []; |
||
313 | foreach ($depts as $dpt) { |
||
314 | $aDepts[] = $dpt->getVar('id'); |
||
315 | } |
||
316 | Xhelp\Utility::setMeta('default_department', $aDepts[0]); |
||
317 | } |
||
318 | |||
319 | // Edit configoption for department |
||
320 | /** @var \XoopsModules\Xhelp\ConfigOptionHandler $configOptionHandler */ |
||
321 | $configOptionHandler = $helper->getHandler('ConfigOption'); |
||
322 | $criteria = new \CriteriaCompo(new \Criteria('confop_name', $oldDept->getVar('department'))); |
||
323 | $criteria->add(new \Criteria('confop_value', $oldDept->getVar('id'))); |
||
324 | $confOption = $configOptionHandler->getObjects($criteria); |
||
325 | |||
326 | if (count($confOption) > 0) { |
||
327 | $confOption[0]->setVar('confop_name', $dept->getVar('department')); |
||
328 | |||
329 | if (!$configOptionHandler->insert($confOption[0])) { |
||
330 | $helper->redirect('admin/department.php?op=manageDepartments', 3, _AM_XHELP_MSG_UPDATE_CONFIG_ERR); |
||
331 | } |
||
332 | } |
||
333 | clearEditSessionVars($deptID); |
||
334 | $helper->redirect('admin/department.php?op=manageDepartments'); |
||
335 | } else { |
||
336 | $message = _XHELP_MESSAGE_UPDATE_DEPT_ERROR . $dept->getHtmlErrors(); |
||
337 | $helper->redirect('admin/department.php?op=manageDepartments', 3, $message); |
||
338 | } |
||
339 | } else { |
||
340 | xoops_cp_header(); |
||
341 | //echo $oAdminButton->renderButtons('manDept'); |
||
342 | |||
343 | $dept = $departmentHandler->get($deptID); |
||
344 | |||
345 | $session = Xhelp\Session::getInstance(); |
||
346 | $sess_dept = $session->get("xhelp_editDepartment_$deptID"); |
||
347 | $sess_errors = $session->get("xhelp_editDepartmentErrors_$deptID"); |
||
348 | |||
349 | //Display any form errors |
||
350 | if (false === !$sess_errors) { |
||
351 | xhelpRenderErrors($sess_errors, Xhelp\Utility::createURI(XHELP_ADMIN_URL . '/department.php', ['op' => 'clearEditSession', 'deptid' => $deptID])); |
||
352 | } |
||
353 | |||
354 | $adminObject = Admin::getInstance(); |
||
355 | $adminObject->displayNavigation('department.php?op=editDepartment'); |
||
356 | |||
357 | // Get list of groups with permission |
||
358 | $criteria = new \CriteriaCompo(new \Criteria('gperm_modid', $module_id)); |
||
359 | $criteria->add(new \Criteria('gperm_itemid', (string)$deptID)); |
||
360 | $criteria->add(new \Criteria('gperm_name', _XHELP_GROUP_PERM_DEPT)); |
||
361 | $group_perms = $grouppermHandler->getObjects($criteria); |
||
362 | |||
363 | $aPerms = []; // Put group_perms in usable format |
||
364 | foreach ($group_perms as $perm) { |
||
365 | $aPerms[$perm->getVar('gperm_groupid')] = $perm->getVar('gperm_groupid'); |
||
366 | } |
||
367 | |||
368 | if (false !== !$sess_dept) { |
||
369 | $fld_newDept = $dept->getVar('department'); |
||
370 | $fld_groups = $aPerms; |
||
371 | } else { |
||
372 | $fld_newDept = $sess_dept['newDept']; |
||
373 | $fld_groups = $sess_dept['groups']; |
||
374 | } |
||
375 | |||
376 | // Get list of all groups |
||
377 | $criteria = new \Criteria('', ''); |
||
378 | $criteria->setSort('name'); |
||
379 | $criteria->setOrder('ASC'); |
||
380 | $groups = $groupHandler->getObjects($criteria, true); |
||
381 | |||
382 | $aGroups = []; |
||
383 | foreach ($groups as $group_id => $group) { |
||
384 | $aGroups[$group_id] = $group->getVar('name'); |
||
385 | } |
||
386 | asort($aGroups); // Set groups in alphabetical order |
||
387 | |||
388 | echo '<script type="text/javascript" src="' . XOOPS_URL . '/modules/xhelp/include/functions.js"></script>'; |
||
389 | $form = new Xhelp\Form( |
||
390 | _AM_XHELP_EDIT_DEPARTMENT, 'edit_dept', Xhelp\Utility::createURI(XHELP_ADMIN_URL . '/department.php', [ |
||
391 | 'op' => 'editDepartment', |
||
392 | 'deptid' => $deptID, |
||
393 | ]) |
||
394 | ); |
||
395 | $dept_name = new \XoopsFormText(_AM_XHELP_TEXT_EDIT_DEPT, 'newDept', 20, 35, $fld_newDept); |
||
396 | $group_select = new \XoopsFormSelect(_AM_XHELP_TEXT_EDIT_DEPT_PERMS, 'groups', $fld_groups, 6, true); |
||
397 | $group_select->addOptionArray($aGroups); |
||
398 | $defaultDeptID = Xhelp\Utility::getMeta('default_department'); |
||
399 | $defaultDept = new Xhelp\FormCheckbox(_AM_XHELP_TEXT_DEFAULT_DEPT, 'defaultDept', (($defaultDeptID == $deptID) ? 1 : 0), 'defaultDept'); |
||
400 | $defaultDept->addOption('1', ''); |
||
401 | $btn_tray = new \XoopsFormElementTray(''); |
||
402 | $btn_tray->addElement(new \XoopsFormButton('', 'updateDept', _SUBMIT, 'submit')); |
||
403 | $form->addElement($dept_name); |
||
404 | $form->addElement($group_select); |
||
405 | $form->addElement($defaultDept); |
||
406 | $form->addElement($btn_tray); |
||
407 | $form->setLabelWidth('20%'); |
||
408 | echo $form->render(); |
||
409 | |||
410 | // Get dept staff members |
||
411 | /** @var \XoopsModules\Xhelp\MembershipHandler $membershipHandler */ |
||
412 | $membershipHandler = $helper->getHandler('Membership'); |
||
413 | /** @var \XoopsMemberHandler $memberHandler */ |
||
414 | $memberHandler = xoops_getHandler('member'); |
||
415 | /** @var \XoopsModules\Xhelp\StaffRoleHandler $staffRoleHandler */ |
||
416 | $staffRoleHandler = $helper->getHandler('StaffRole'); |
||
417 | /** @var \XoopsModules\Xhelp\RoleHandler $roleHandler */ |
||
418 | $roleHandler = $helper->getHandler('Role'); |
||
419 | |||
420 | $staff = $membershipHandler->membershipByDept($deptID, $limit, $start); |
||
421 | $criteria = new \Criteria('j.department', (string)$deptID); |
||
422 | $staffCount = $membershipHandler->getCount($criteria); |
||
423 | $roles = $roleHandler->getObjects(null, true); |
||
424 | |||
425 | echo "<form action='" . XHELP_ADMIN_URL . '/department.php?op=deleteStaffDept&deptid=' . $deptID . "' method='post'>"; |
||
426 | echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
||
427 | echo "<table width='100%' cellspacing='1' class='outer'> |
||
428 | <tr><th colspan='" . (3 + count($roles)) . "'><label>" . _AM_XHELP_MANAGE_STAFF . '</label></th></tr>'; |
||
429 | |||
430 | if ($staffCount > 0) { |
||
431 | $aStaff = []; |
||
432 | foreach ($staff as $stf) { |
||
433 | $aStaff[$stf->getVar('uid')] = $stf->getVar('uid'); // Get array of staff uid |
||
434 | } |
||
435 | |||
436 | // Get user list |
||
437 | $criteria = new \Criteria('uid', '(' . implode(',', $aStaff) . ')', 'IN'); |
||
438 | //$members = $memberHandler->getUserList($criteria); |
||
439 | $members = Xhelp\Utility::getUsers($criteria, $displayName); |
||
440 | |||
441 | // Get staff roles |
||
442 | $criteria = new \CriteriaCompo(new \Criteria('uid', '(' . implode(',', $aStaff) . ')', 'IN')); |
||
443 | $criteria->add(new \Criteria('deptid', (string)$deptID)); |
||
444 | $staffRoles = $staffRoleHandler->getObjects($criteria); |
||
445 | unset($aStaff); |
||
446 | |||
447 | $staffInfo = []; |
||
448 | foreach ($staff as $stf) { |
||
449 | $staff_uid = $stf->getVar('uid'); |
||
450 | $staffInfo[$staff_uid]['uname'] = $members[$staff_uid]; |
||
451 | $aRoles = []; |
||
452 | foreach ($staffRoles as $role) { |
||
453 | $role_id = $role->getVar('roleid'); |
||
454 | if ($role->getVar('uid') == $staff_uid) { |
||
455 | $aRoles[$role_id] = $roles[$role_id]->getVar('name'); |
||
456 | } |
||
457 | $staffInfo[$staff_uid]['roles'] = implode(', ', $aRoles); |
||
458 | } |
||
459 | } |
||
460 | $nav = new \XoopsPageNav($staffCount, $limit, $start, 'start', "op=editDepartment&deptid=$deptID&limit=$limit"); |
||
461 | |||
462 | echo "<tr class='head'><td rowspan='2'>" . _AM_XHELP_TEXT_ID . "</td><td rowspan='2'>" . _AM_XHELP_TEXT_USER . "</td><td colspan='" . count($roles) . "'>" . _AM_XHELP_TEXT_ROLES . "</td><td rowspan='2'>" . _AM_XHELP_TEXT_ACTIONS . '</td></tr>'; |
||
463 | echo "<tr class='head'>"; |
||
464 | foreach ($roles as $thisrole) { |
||
465 | echo '<td>' . $thisrole->getVar('name') . '</td>'; |
||
466 | } |
||
467 | echo '</tr>'; |
||
468 | foreach ($staffInfo as $uid => $staff) { |
||
469 | echo "<tr class='even'> |
||
470 | <td><input type='checkbox' name='staff[]' value='" . $uid . "'>" . $uid . '</td> |
||
471 | <td>' . $staff['uname'] . '</td>'; |
||
472 | foreach ($roles as $thisrole) { |
||
473 | echo "<td><img src='" . XHELP_BASE_URL . '/assets/images/'; |
||
474 | echo in_array($thisrole->getVar('name'), explode(', ', $staff['roles'])) ? 'on.png' : 'off.png'; |
||
475 | echo "'></td>"; |
||
476 | } |
||
477 | echo " <td> |
||
478 | <a href='" . XHELP_ADMIN_URL . '/staff.php?op=editStaff&uid=' . $uid . "'><img src='" . XOOPS_URL . "/modules/xhelp/assets/images/button_edit.png' title='" . _AM_XHELP_TEXT_EDIT . "' name='editStaff'></a> |
||
479 | <a href='" . XHELP_ADMIN_URL . '/department.php?op=deleteStaffDept&uid=' . $uid . '&deptid=' . $deptID . "'><img src='" . XOOPS_URL . "/modules/xhelp/assets/images/button_delete.png' title='" . _AM_XHELP_TEXT_DELETE_STAFF_DEPT . "' name='deleteStaffDept'></a> |
||
480 | </td> |
||
481 | </tr>"; |
||
482 | } |
||
483 | echo "<tr> |
||
484 | <td class='foot' colspan='" . (3 + count($roles)) . "'> |
||
485 | <input type='checkbox' name='checkallRoles' value='0' onclick='selectAll(this.form,\"staff[]\",this.checked);'> |
||
486 | <input type='submit' name='deleteStaff' id='deleteStaff' value='" . _AM_XHELP_BUTTON_DELETE . "'> |
||
487 | </td> |
||
488 | </tr>"; |
||
489 | echo '</table></form>'; |
||
490 | echo "<div id='staff_nav'>" . $nav->renderNav() . '</div>'; |
||
491 | } else { |
||
492 | echo '</table></form>'; |
||
493 | } |
||
494 | |||
495 | //now do the list of servers |
||
496 | /** @var \XoopsModules\Xhelp\DepartmentMailBoxHandler $departmentMailBoxHandler */ |
||
497 | $departmentMailBoxHandler = $helper->getHandler('DepartmentMailBox'); |
||
498 | $deptServers = $departmentMailBoxHandler->getByDepartment($deptID); |
||
499 | //iterate |
||
500 | if (count($deptServers) > 0) { |
||
501 | echo "<br><table width='100%' cellspacing='1' class='outer'> |
||
502 | <tr> |
||
503 | <th colspan='5'><label>" . _AM_XHELP_DEPARTMENT_SERVERS . "</label></th> |
||
504 | </tr> |
||
505 | <tr> |
||
506 | <td class='head' width='20%'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_EMAIL . "</label></td> |
||
507 | <td class='head'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_TYPE . "</label></td> |
||
508 | <td class='head'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_SERVERNAME . "</label></td> |
||
509 | <td class='head'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_PORT . "</label></td> |
||
510 | <td class='head'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_ACTION . '</label></td> |
||
511 | </tr>'; |
||
512 | $i = 0; |
||
513 | foreach ($deptServers as $server) { |
||
514 | if ($server->getVar('active')) { |
||
515 | $activ_link = '".XHELP_ADMIN_URL."/department.php?op=activateMailbox&setstate=0&id=' . $server->getVar('id'); |
||
516 | $activ_img = $icons['online']; |
||
517 | $activ_title = _AM_XHELP_MESSAGE_DEACTIVATE; |
||
518 | } else { |
||
519 | $activ_link = '".XHELP_ADMIN_URL."/department.php?op=activateMailbox&setstate=1&id=' . $server->getVar('id'); |
||
520 | $activ_img = $icons['offline']; |
||
521 | $activ_title = _AM_XHELP_MESSAGE_ACTIVATE; |
||
522 | } |
||
523 | |||
524 | echo '<tr class="even"> |
||
525 | <td>' . $server->getVar('emailaddress') . '</td> |
||
526 | <td>' . Xhelp\Utility::getMBoxType($server->getVar('mboxtype')) . '</td> |
||
527 | <td>' . $server->getVar('server') . '</td> |
||
528 | <td>' . $server->getVar('serverport') . '</td> |
||
529 | <td> <a href="' . $activ_link . '" title="' . $activ_title . '">' . $activ_img . '</a> |
||
530 | <a href="' . XHELP_ADMIN_URL . '/department.php?op=EditDepartmentServer&id=' . $server->GetVar('id') . '">' . $icons['edit'] . '</a> |
||
531 | <a href="' . XHELP_ADMIN_URL . '/department.php?op=DeleteDepartmentServer&id=' . $server->GetVar('id') . '">' . $icons['delete'] . '</a> |
||
532 | |||
533 | </td> |
||
534 | </tr>'; |
||
535 | } |
||
536 | echo '</table>'; |
||
537 | } |
||
538 | //finally add Mailbox form |
||
539 | echo '<br><br>'; |
||
540 | |||
541 | $formElements = [ |
||
542 | 'type_select', |
||
543 | 'server_text', |
||
544 | 'port_text', |
||
545 | 'username_text', |
||
546 | 'pass_text', |
||
547 | 'priority_radio', |
||
548 | 'email_text', |
||
549 | 'btn_tray', |
||
550 | ]; |
||
551 | $form = new Xhelp\Form(_AM_XHELP_DEPARTMENT_ADD_SERVER, 'add_server', Xhelp\Utility::createURI(XHELP_ADMIN_URL . '/department.php', ['op' => 'AddDepartmentServer', 'id' => $deptID])); |
||
552 | |||
553 | $type_select = new \XoopsFormSelect(_AM_XHELP_DEPARTMENT_SERVERS_TYPE, 'mboxtype'); |
||
554 | $type_select->setExtra("id='mboxtype'"); |
||
555 | $type_select->addOption((string)Constants::XHELP_MAILBOXTYPE_POP3, _AM_XHELP_MBOX_POP3); |
||
556 | |||
557 | $server_text = new \XoopsFormText(_AM_XHELP_DEPARTMENT_SERVERS_SERVERNAME, 'server', 40, 50); |
||
558 | $server_text->setExtra("id='txtServer'"); |
||
559 | |||
560 | $port_text = new \XoopsFormText(_AM_XHELP_DEPARTMENT_SERVERS_PORT, 'port', 5, 5, '110'); |
||
561 | $port_text->setExtra("id='txtPort'"); |
||
562 | |||
563 | $username_text = new \XoopsFormText(_AM_XHELP_DEPARTMENT_SERVER_USERNAME, 'username', 25, 50); |
||
564 | $username_text->setExtra("id='txtUsername'"); |
||
565 | |||
566 | $pass_text = new \XoopsFormText(_AM_XHELP_DEPARTMENT_SERVER_PASSWORD, 'password', 25, 50); |
||
567 | $pass_text->setExtra("id='txtPassword'"); |
||
568 | |||
569 | $priority_radio = new Xhelp\FormRadio(_AM_XHELP_DEPARTMENT_SERVERS_PRIORITY, 'priority', (string)XHELP_DEFAULT_PRIORITY); |
||
570 | $priority_array = [ |
||
571 | 1 => "<label for='priority1'><img src='" . XHELP_IMAGE_URL . "/priority1.png' title='" . Xhelp\Utility::getPriority(1) . "' alt='priority1'></label>", |
||
572 | 2 => "<label for='priority2'><img src='" . XHELP_IMAGE_URL . "/priority2.png' title='" . Xhelp\Utility::getPriority(2) . "' alt='priority2'></label>", |
||
573 | 3 => "<label for='priority3'><img src='" . XHELP_IMAGE_URL . "/priority3.png' title='" . Xhelp\Utility::getPriority(3) . "' alt='priority3'></label>", |
||
574 | 4 => "<label for='priority4'><img src='" . XHELP_IMAGE_URL . "/priority4.png' title='" . Xhelp\Utility::getPriority(4) . "' alt='priority4'></label>", |
||
575 | 5 => "<label for='priority5'><img src='" . XHELP_IMAGE_URL . "/priority5.png' title='" . Xhelp\Utility::getPriority(5) . "' alt='priority5'></label>", |
||
576 | ]; |
||
577 | $priority_radio->addOptionArray($priority_array); |
||
578 | |||
579 | $email_text = new \XoopsFormText(_AM_XHELP_DEPARTMENT_SERVER_EMAILADDRESS, 'emailaddress', 50, 255); |
||
580 | $email_text->setExtra("id='txtEmailaddress'"); |
||
581 | |||
582 | $btn_tray = new \XoopsFormElementTray(''); |
||
583 | $test_button = new \XoopsFormButton('', 'email_test', _AM_XHELP_BUTTON_TEST, 'button'); |
||
584 | $test_button->setExtra("id='test'"); |
||
585 | $submit_button = new \XoopsFormButton('', 'updateDept2', _SUBMIT, 'submit'); |
||
586 | $cancel2_button = new \XoopsFormButton('', 'cancel2', _AM_XHELP_BUTTON_CANCEL, 'button'); |
||
587 | $cancel2_button->setExtra("onclick='history.go(-1)'"); |
||
588 | $btn_tray->addElement($test_button); |
||
589 | $btn_tray->addElement($submit_button); |
||
590 | $btn_tray->addElement($cancel2_button); |
||
591 | |||
592 | $form->setLabelWidth('20%'); |
||
593 | foreach ($formElements as $element) { |
||
594 | $form->addElement($$element); |
||
595 | } |
||
596 | echo $form->render(); |
||
597 | |||
598 | echo '<script type="text/javascript" language="javascript"> |
||
599 | <!-- |
||
600 | function xhelpEmailTest() |
||
601 | { |
||
602 | pop = openWithSelfMain("", "email_test", 250, 150); |
||
603 | frm = xoopsGetElementById("add_server"); |
||
604 | newaction = "department.php?op=testMailbox"; |
||
605 | oldaction = frm.action; |
||
606 | frm.action = newaction; |
||
607 | frm.target = "email_test"; |
||
608 | frm.submit(); |
||
609 | frm.action = oldaction; |
||
610 | frm.target = "main"; |
||
611 | |||
612 | } |
||
613 | |||
614 | xhelpDOMAddEvent(xoopsGetElementById("email_test"), "click", xhelpEmailTest, false); |
||
615 | |||
616 | //--> |
||
617 | </script>'; |
||
618 | require_once __DIR__ . '/admin_footer.php'; |
||
619 | } |
||
1096 |