1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Form to edit a users course preferences. 19 * 20 * These are stored as columns in the user table, which 21 * is why they are in /user and not /course or /admin. 22 * 23 * @copyright 2016 Joey Andres <jandres@ualberta.ca> 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 * @package core_user 26 */ 27 28 namespace core_user; 29 30 if (!defined('MOODLE_INTERNAL')) { 31 die('Direct access to this script is forbidden.'); // It must be included from a Moodle page. 32 } 33 34 require_once($CFG->dirroot.'/lib/formslib.php'); 35 36 /** 37 * Class user_course_form. 38 * 39 * @copyright 2016 Joey Andres <jandres@ualberta.ca> 40 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 41 */ 42 class course_form extends \moodleform { 43 44 /** 45 * Define the form. 46 */ 47 public function definition () { 48 global $COURSE; 49 50 $mform = $this->_form; 51 52 $mform->addElement('advcheckbox', 53 'enableactivitychooser', 54 get_string('enableactivitychooser', 'admin'), 55 get_string('configenableactivitychooser', 'admin')); 56 $mform->setDefault('enableactivitychooser', 57 get_user_preferences('usemodchooser', true, $this->_customdata['userid'])); 58 59 // Add some extra hidden fields. 60 $mform->addElement('hidden', 'id'); 61 $mform->setType('id', PARAM_INT); 62 $mform->addElement('hidden', 'course', $COURSE->id); 63 $mform->setType('course', PARAM_INT); 64 65 $this->add_action_buttons(true, get_string('savechanges')); 66 } 67 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body