|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00027 require_once(dirname(__FILE__) . '/../../../config.php'); 00028 require_once(dirname(__FILE__) . '/locallib.php'); 00029 require_once(dirname(__FILE__) . '/cronsetup_form.php'); 00030 require_once($CFG->libdir . '/adminlib.php'); 00031 00032 require_login(); 00033 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); 00034 00035 admin_externalpage_setup('qeupgradehelper', '', array(), 00036 tool_qeupgradehelper_url('cronsetup')); 00037 $PAGE->navbar->add(get_string('cronsetup', 'tool_qeupgradehelper')); 00038 00039 $renderer = $PAGE->get_renderer('tool_qeupgradehelper'); 00040 00041 $form = new tool_qeupgradehelper_cron_setup_form( 00042 new moodle_url('/admin/tool/qeupgradehelper/cronsetup.php')); 00043 $form->set_data(get_config('tool_qeupgradehelper')); 00044 00045 if ($form->is_cancelled()) { 00046 redirect(tool_qeupgradehelper_url('index')); 00047 00048 } else if ($fromform = $form->get_data()) { 00049 if ($fromform->cronenabled) { 00050 set_config('cronenabled', $fromform->cronenabled, 'tool_qeupgradehelper'); 00051 set_config('starthour', $fromform->starthour, 'tool_qeupgradehelper'); 00052 set_config('stophour', $fromform->stophour, 'tool_qeupgradehelper'); 00053 set_config('procesingtime', $fromform->procesingtime, 'tool_qeupgradehelper'); 00054 00055 } else { 00056 unset_config('cronenabled', 'tool_qeupgradehelper'); 00057 unset_config('starthour', 'tool_qeupgradehelper'); 00058 unset_config('stophour', 'tool_qeupgradehelper'); 00059 unset_config('procesingtime', 'tool_qeupgradehelper'); 00060 } 00061 redirect(tool_qeupgradehelper_url('index')); 00062 00063 } 00064 00065 echo $renderer->header(); 00066 echo $renderer->heading(get_string('cronsetup', 'tool_qeupgradehelper')); 00067 echo $renderer->box(get_string('croninstructions', 'tool_qeupgradehelper')); 00068 $form->display(); 00069 echo $renderer->footer();