PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/tool/qeupgradehelper/cronsetup_form.php

https://bitbucket.org/synergylearning/campusconnect
PHP | 66 lines | 27 code | 12 blank | 27 comment | 1 complexity | 8e200b7b34b042b7bb8ab01722f6bcaf MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-3.0, GPL-3.0, LGPL-2.1, Apache-2.0, BSD-3-Clause, AGPL-3.0
  1. <?php
  2. // This file is part of Moodle - http://moodle.org/
  3. //
  4. // Moodle is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // Moodle is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
  16. /**
  17. * Settings form for cronsetup.php.
  18. *
  19. * @package tool
  20. * @subpackage qeupgradehelper
  21. * @copyright 2011 The Open University
  22. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23. */
  24. defined('MOODLE_INTERNAL') || die();
  25. require_once($CFG->libdir . '/formslib.php');
  26. /**
  27. * Cron setup form.
  28. * @copyright 2011 The Open University
  29. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  30. */
  31. class tool_qeupgradehelper_cron_setup_form extends moodleform {
  32. public function definition() {
  33. $mform = $this->_form;
  34. $mform->addElement('selectyesno', 'cronenabled',
  35. get_string('cronenabled', 'tool_qeupgradehelper'));
  36. $mform->setType('cronenabled', PARAM_BOOL);
  37. $mform->addElement('select', 'starthour',
  38. get_string('cronstarthour', 'tool_qeupgradehelper'), range(0, 23));
  39. $mform->setType('starthour', PARAM_INT);
  40. $mform->addElement('select', 'stophour',
  41. get_string('cronstophour', 'tool_qeupgradehelper'),
  42. array_combine(range(1, 24), range(1, 24)));
  43. $mform->setType('stophour', PARAM_INT);
  44. $mform->setDefault('stophour', 24);
  45. $mform->addElement('duration', 'procesingtime',
  46. get_string('cronprocesingtime', 'tool_qeupgradehelper'));
  47. $mform->setType('procesingtime', PARAM_INT);
  48. $mform->setDefault('procesingtime', 60);
  49. $mform->disabledIf('starthour', 'cronenabled', 'eq', 0);
  50. $mform->disabledIf('stophour', 'cronenabled', 'eq', 0);
  51. $mform->disabledIf('procesingtime', 'cronenabled', 'eq', 0);
  52. $this->add_action_buttons();
  53. }
  54. }