[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * Scheduled allocator's settings 20 * 21 * @package workshopallocation_scheduled 22 * @subpackage mod_workshop 23 * @copyright 2012 David Mudrak <david@moodle.com> 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 27 defined('MOODLE_INTERNAL') || die(); 28 29 require_once($CFG->dirroot.'/lib/formslib.php'); 30 require_once (__DIR__ . '/../random/settings_form.php'); // parent form 31 32 /** 33 * Allocator settings form 34 * 35 * This is used by {@see workshop_scheduled_allocator::ui()} to set up allocation parameters. 36 */ 37 class workshop_scheduled_allocator_form extends workshop_random_allocator_form { 38 39 /** 40 * Definition of the setting form elements 41 */ 42 public function definition() { 43 global $OUTPUT; 44 45 $mform = $this->_form; 46 $workshop = $this->_customdata['workshop']; 47 $current = $this->_customdata['current']; 48 49 if (!empty($workshop->submissionend)) { 50 $strtimeexpected = workshop::timestamp_formats($workshop->submissionend); 51 } 52 53 if (!empty($current->timeallocated)) { 54 $strtimeexecuted = workshop::timestamp_formats($current->timeallocated); 55 } 56 57 $mform->addElement('header', 'scheduledallocationsettings', get_string('scheduledallocationsettings', 'workshopallocation_scheduled')); 58 $mform->addHelpButton('scheduledallocationsettings', 'scheduledallocationsettings', 'workshopallocation_scheduled'); 59 60 $mform->addElement('checkbox', 'enablescheduled', get_string('enablescheduled', 'workshopallocation_scheduled'), get_string('enablescheduledinfo', 'workshopallocation_scheduled'), 1); 61 62 $mform->addElement('header', 'scheduledallocationinfo', get_string('currentstatus', 'workshopallocation_scheduled')); 63 64 if ($current === false) { 65 $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), 66 get_string('resultdisabled', 'workshopallocation_scheduled').' '. 67 html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid')))); 68 69 } else { 70 if (!empty($current->timeallocated)) { 71 $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), 72 get_string('currentstatusexecution1', 'workshopallocation_scheduled', $strtimeexecuted).' '. 73 html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/valid')))); 74 75 if ($current->resultstatus == workshop_allocation_result::STATUS_EXECUTED) { 76 $strstatus = get_string('resultexecuted', 'workshopallocation_scheduled').' '. 77 html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/valid'))); 78 } else if ($current->resultstatus == workshop_allocation_result::STATUS_FAILED) { 79 $strstatus = get_string('resultfailed', 'workshopallocation_scheduled').' '. 80 html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid'))); 81 } else { 82 $strstatus = get_string('resultvoid', 'workshopallocation_scheduled').' '. 83 html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid'))); 84 } 85 86 if (!empty($current->resultmessage)) { 87 $strstatus .= html_writer::empty_tag('br').$current->resultmessage; // yes, this is ugly. better solution suggestions are welcome. 88 } 89 $mform->addElement('static', 'inforesult', get_string('currentstatusresult', 'workshopallocation_scheduled'), $strstatus); 90 91 if ($current->timeallocated < $workshop->submissionend) { 92 $mform->addElement('static', 'infoexpected', get_string('currentstatusnext', 'workshopallocation_scheduled'), 93 get_string('currentstatusexecution2', 'workshopallocation_scheduled', $strtimeexpected).' '. 94 html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/caution')))); 95 $mform->addHelpButton('infoexpected', 'currentstatusnext', 'workshopallocation_scheduled'); 96 } else { 97 $mform->addElement('checkbox', 'reenablescheduled', get_string('currentstatusreset', 'workshopallocation_scheduled'), 98 get_string('currentstatusresetinfo', 'workshopallocation_scheduled')); 99 $mform->addHelpButton('reenablescheduled', 'currentstatusreset', 'workshopallocation_scheduled'); 100 } 101 102 } else if (empty($current->enabled)) { 103 $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), 104 get_string('resultdisabled', 'workshopallocation_scheduled').' '. 105 html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid')))); 106 107 } else if ($workshop->phase != workshop::PHASE_SUBMISSION) { 108 $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), 109 get_string('resultfailed', 'workshopallocation_scheduled').' '. 110 html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid'))). 111 html_writer::empty_tag('br'). 112 get_string('resultfailedphase', 'workshopallocation_scheduled')); 113 114 } else if (empty($workshop->submissionend)) { 115 $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), 116 get_string('resultfailed', 'workshopallocation_scheduled').' '. 117 html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid'))). 118 html_writer::empty_tag('br'). 119 get_string('resultfaileddeadline', 'workshopallocation_scheduled')); 120 121 } else if ($workshop->submissionend < time()) { 122 // next cron will execute it 123 $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), 124 get_string('currentstatusexecution4', 'workshopallocation_scheduled').' '. 125 html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/caution')))); 126 127 } else { 128 $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), 129 get_string('currentstatusexecution3', 'workshopallocation_scheduled', $strtimeexpected).' '. 130 html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/caution')))); 131 } 132 } 133 134 parent::definition(); 135 136 $mform->addHelpButton('randomallocationsettings', 'randomallocationsettings', 'workshopallocation_scheduled'); 137 } 138 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |