Skip to content
Snippets Groups Projects
Select Git revision
  • main
1 result

mod_form.php

Blame
    • Amrita Deb's avatar
      8cce09db
      Update action.php, card_form.php, controller.php, index.php, lib.php,... · 8cce09db
      Amrita Deb authored
      Update action.php, card_form.php, controller.php, index.php, lib.php, locallib.php, mod_form.php, README.md, renderer.php, styles.css, review_form.php, view.php, version.php, backup/moodle2/backup_cardbox_activity_task.class.php, backup/moodle2/backup_cardbox_stepslib.php, backup/moodle2/restore_cardbox_stepslib.php, backup/moodle2/restore_cardbox_activity_task.class.php, classes/output/card.php, classes/output/start.php, classes/output/statistics.php, classes/output/review.php, classes/output/overview.php, classes/output/practice.php, classes/task/remind.php, db/access.php, db/install.xml, db/install.php, db/tasks.php, db/upgrade.php, db/messages.php, js/Chart.bundle.js, js/review2.js, js/overview.js, js/statistics.js, js/review.js, js/start.js, js/practice.js, model/card_selection_algorithm.php, model/cardcollection.class.php, model/card_selection_interface.php, model/card_sorting_interface.php, model/cardbox.class.php, model/card_sorting_algorithm.php, pix/icon.png, pix/icon_19.png, pix/icon_19.svg, pix/icon.svg, pix/icon_21.png, pix/icon_21.svg, pix/icon_25.png, pix/icon_25.svg, templates/card.mustache, templates/cardside.mustache, templates/options.mustache, templates/overview.mustache, templates/practice.mustache, templates/practice_answer_autocheck.mustache, templates/practice_answer_selfcheck.mustache, templates/practice_question_autocheck.mustache, templates/practice_question_selfcheck.mustache, templates/practice_start.mustache, templates/review.mustache, templates/review2.mustache, templates/statistics.mustache, lang/de/cardbox.php, lang/en/cardbox.php files
      8cce09db
      History
      Update action.php, card_form.php, controller.php, index.php, lib.php,...
      Amrita Deb authored
      Update action.php, card_form.php, controller.php, index.php, lib.php, locallib.php, mod_form.php, README.md, renderer.php, styles.css, review_form.php, view.php, version.php, backup/moodle2/backup_cardbox_activity_task.class.php, backup/moodle2/backup_cardbox_stepslib.php, backup/moodle2/restore_cardbox_stepslib.php, backup/moodle2/restore_cardbox_activity_task.class.php, classes/output/card.php, classes/output/start.php, classes/output/statistics.php, classes/output/review.php, classes/output/overview.php, classes/output/practice.php, classes/task/remind.php, db/access.php, db/install.xml, db/install.php, db/tasks.php, db/upgrade.php, db/messages.php, js/Chart.bundle.js, js/review2.js, js/overview.js, js/statistics.js, js/review.js, js/start.js, js/practice.js, model/card_selection_algorithm.php, model/cardcollection.class.php, model/card_selection_interface.php, model/card_sorting_interface.php, model/cardbox.class.php, model/card_sorting_algorithm.php, pix/icon.png, pix/icon_19.png, pix/icon_19.svg, pix/icon.svg, pix/icon_21.png, pix/icon_21.svg, pix/icon_25.png, pix/icon_25.svg, templates/card.mustache, templates/cardside.mustache, templates/options.mustache, templates/overview.mustache, templates/practice.mustache, templates/practice_answer_autocheck.mustache, templates/practice_answer_selfcheck.mustache, templates/practice_question_autocheck.mustache, templates/practice_question_selfcheck.mustache, templates/practice_start.mustache, templates/review.mustache, templates/review2.mustache, templates/statistics.mustache, lang/de/cardbox.php, lang/en/cardbox.php files
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    mod_form.php 2.88 KiB
    <?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 is used when adding/editing a cardbox module to a course.
     * It contains the elements that will be displayed on the form responsible
     * for creating/installing an instance of cardbox.
     *
     * @package   mod_cardbox
     * @copyright 2019 RWTH Aachen (see README.md)
     * @author    Anna Heynkes
     * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
     */
    
    defined('MOODLE_INTERNAL') || die(); //  It must be included from a Moodle page.
    
    require_once($CFG->dirroot.'/course/moodleform_mod.php');
    require_once($CFG->dirroot.'/mod/cardbox/lib.php');
     
    class mod_cardbox_mod_form extends moodleform_mod {
     
        function definition() {
            global $CFG, $DB, $OUTPUT, $USER, $COURSE;
     
            $mform =& $this->_form;
            $config = get_config('mod_cardbox');
    
            $mform->addElement('hidden', 'idcreator', $USER->id);
            $mform->setType('idcreator', PARAM_INT);
    
            $mform->addElement('hidden', 'idCourse', $COURSE->id);
            $mform->setType('idCourse', PARAM_INT);
    
            $mform->addElement('text', 'name', get_string('cardboxname', 'cardbox'), array('size'=>'64'));
            $mform->setType('name', PARAM_TEXT);
            $mform->addRule('name', null, 'required', null, 'client');
            $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
    
            // Description.
            $this->standard_intro_elements();
    
            $element = $mform->getElement('introeditor');
            $attributes = $element->getAttributes();
            $attributes['rows'] = 5;
            $element->setAttributes($attributes);
    
            $mform->addElement('advcheckbox', 'autocorrection', get_string('setting_autocorrection', 'cardbox'), get_string('setting_autocorrection_label', 'cardbox'), null, array(0, 1));
            $mform->setType('autocorrection', PARAM_BOOL);
            $mform->setDefault('autocorrection', 1);
            $mform->addHelpButton('autocorrection', 'setting_autocorrection', 'cardbox');
    
            $this->standard_coursemodule_elements();
    
            $this->add_action_buttons();
    
            $mform->addElement('hidden', 'revision'); // Hard-coded as 1; should be changed if version becomes important.
            $mform->setType('revision', PARAM_INT);
            $mform->setDefault('revision', 1);
        }
    }