You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.7 KiB
78 lines
2.7 KiB
13 years ago
|
<?php
|
||
|
// This file is part of Moodle - http://moodle.org/
|
||
|
//
|
||
|
// Moodle is free software: you can redistribute it and/or modify
|
||
|
// it under the terms of the GNU General Public License as published by
|
||
|
// the Free Software Foundation, either version 3 of the License, or
|
||
|
// (at your option) any later version.
|
||
|
//
|
||
|
// Moodle is distributed in the hope that it will be useful,
|
||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
// GNU General Public License for more details.
|
||
|
//
|
||
|
// You should have received a copy of the GNU General Public License
|
||
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||
15 years ago
|
|
||
12 years ago
|
/**
|
||
|
* This file contains the forms for duration
|
||
|
*
|
||
|
* @package mod_attendance
|
||
|
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
|
||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||
|
*/
|
||
|
|
||
4 years ago
|
namespace mod_attendance\form;
|
||
|
|
||
8 years ago
|
defined('MOODLE_INTERNAL') || die();
|
||
4 years ago
|
|
||
|
use moodleform;
|
||
15 years ago
|
|
||
12 years ago
|
/**
|
||
|
* class for displaying duration form.
|
||
|
*
|
||
|
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
|
||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||
|
*/
|
||
4 years ago
|
class duration extends moodleform {
|
||
15 years ago
|
|
||
12 years ago
|
/**
|
||
|
* Called to define this moodle form
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
12 years ago
|
public function definition() {
|
||
15 years ago
|
|
||
|
$mform =& $this->_form;
|
||
|
|
||
|
$cm = $this->_customdata['cm'];
|
||
12 years ago
|
$ids = $this->_customdata['ids'];
|
||
15 years ago
|
|
||
12 years ago
|
$mform->addElement('header', 'general', get_string('changeduration', 'attendance'));
|
||
|
$mform->addElement('static', 'count', get_string('countofselected', 'attendance'), count(explode('_', $ids)));
|
||
12 years ago
|
|
||
9 years ago
|
for ($i = 0; $i <= 23; $i++) {
|
||
12 years ago
|
$hours[$i] = sprintf("%02d", $i);
|
||
15 years ago
|
}
|
||
9 years ago
|
for ($i = 0; $i < 60; $i += 5) {
|
||
12 years ago
|
$minutes[$i] = sprintf("%02d", $i);
|
||
15 years ago
|
}
|
||
13 years ago
|
$durselect[] =& $mform->createElement('select', 'hours', '', $hours);
|
||
12 years ago
|
$durselect[] =& $mform->createElement('select', 'minutes', '', $minutes, false, true);
|
||
12 years ago
|
$mform->addGroup($durselect, 'durtime', get_string('newduration', 'attendance'), array(' '), true);
|
||
12 years ago
|
|
||
15 years ago
|
$mform->addElement('hidden', 'ids', $ids);
|
||
10 years ago
|
$mform->setType('ids', PARAM_ALPHANUMEXT);
|
||
12 years ago
|
$mform->addElement('hidden', 'id', $cm->id);
|
||
10 years ago
|
$mform->setType('id', PARAM_INT);
|
||
4 years ago
|
$mform->addElement('hidden', 'action', \mod_attendance_sessions_page_params::ACTION_CHANGE_DURATION);
|
||
10 years ago
|
$mform->setType('action', PARAM_INT);
|
||
12 years ago
|
|
||
9 years ago
|
$mform->setDefaults(array('durtime' => array('hours' => 0, 'minutes' => 0)));
|
||
12 years ago
|
|
||
9 years ago
|
$submitstring = get_string('update', 'attendance');
|
||
|
$this->add_action_buttons(true, $submitstring);
|
||
15 years ago
|
}
|
||
|
|
||
|
}
|