AutorÃa | Ultima modificación | Ver Log |
<?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/>.
/**
* This file manages the forms to create and edit an instance of this module
*
* @package mod_custommailing
* @author jeanfrancois@cblue.be
* @copyright 2021 CBlue SPRL
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once $CFG->dirroot . '/course/moodleform_mod.php';
/**
* Moodleform class.
*
* @package mod_custommailing
* @author jeanfrancois@cblue.be
* @copyright 2021 CBlue SPRL
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_custommailing_mod_form extends moodleform_mod {
/**
* @throws coding_exception
*/
public function definition() {
$mform =& $this->_form;
// Adding the "general" fieldset, where all the common settings are shown.
$mform->addElement('header', 'general', get_string('general', 'form'));
// Adding the standard "name" field.
$mform->addElement('text', 'name', get_string('custommailingname', 'custommailing'), ['size' => '32']);
$mform->setType('name', PARAM_TEXT);
$mform->addRule('name', null, 'required', null, 'client');
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$config = get_config('custommailing');
if (!empty($config->debugmode)) {
$mform->addElement('html', html_writer::div(get_string('debugmode', 'mod_custommailing') . ' : ' . get_string('debugmode_help', 'mod_custommailing'), 'alert alert-danger'));
}
// Adding the standard "intro" fields.
$this->standard_intro_elements();
// Add standard elements, common to all modules.
$this->standard_coursemodule_elements();
// Add standard buttons, common to all modules.
$this->add_action_buttons();
}
/**
* @param array|stdClass $default_values
*/
public function set_data($default_values) {
$default_values->visible = false; // Force visible to false to hide the activity from students
parent::set_data($default_values);
}
}