mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-52414 Lesson: Apply defaults to lesson creation
This commit is contained in:
parent
9d5d9c64ff
commit
a36eba45dc
@ -353,5 +353,60 @@ function xmldb_lesson_upgrade($oldversion) {
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2016012800) {
|
||||
// Convert lesson settings to use config_plugins instead of $CFG.
|
||||
// Lesson_maxanswers => mod_lesson/maxanswers.
|
||||
if (isset($CFG->lesson_maxanswers)) {
|
||||
set_config('maxanswers', $CFG->lesson_maxanswers, 'mod_lesson');
|
||||
set_config('maxanswers_adv', '1', 'mod_lesson');
|
||||
unset_config('lesson_maxanswers');
|
||||
}
|
||||
|
||||
// Lesson_slideshowwidth => mod_lesson/slideshowwidth.
|
||||
if (isset($CFG->lesson_slideshowwidth)) {
|
||||
set_config('slideshowwidth', $CFG->lesson_slideshowwidth, 'mod_lesson');
|
||||
unset_config('lesson_slideshowwidth');
|
||||
}
|
||||
|
||||
// Lesson_slideshowheight => mod_lesson/slideshowheight.
|
||||
if (isset($CFG->lesson_slideshowheight)) {
|
||||
set_config('slideshowheight', $CFG->lesson_slideshowheight, 'mod_lesson');
|
||||
unset_config('lesson_slideshowheight');
|
||||
}
|
||||
|
||||
// Lesson_slideshowbgcolor => mod_lesson/slideshowbgcolor.
|
||||
if (isset($CFG->lesson_slideshowbgcolor)) {
|
||||
set_config('slideshowbgcolor', $CFG->lesson_slideshowbgcolor, 'mod_lesson');
|
||||
unset_config('lesson_slideshowbgcolor');
|
||||
}
|
||||
|
||||
// Lesson_defaultnextpage => mod_lesson/defaultnextpage.
|
||||
if (isset($CFG->lesson_defaultnextpage)) {
|
||||
set_config('defaultnextpage', $CFG->lesson_defaultnextpage, 'mod_lesson');
|
||||
set_config('defaultnextpage_adv', '1', 'mod_lesson');
|
||||
unset_config('lesson_defaultnextpage');
|
||||
}
|
||||
|
||||
// Lesson_mediawidth => mod_lesson/mediawidth.
|
||||
if (isset($CFG->lesson_mediawidth)) {
|
||||
set_config('mediawidth', $CFG->lesson_mediawidth, 'mod_lesson');
|
||||
unset_config('lesson_mediawidth');
|
||||
}
|
||||
|
||||
// Lesson_mediaheight => mod_lesson/mediaheight.
|
||||
if (isset($CFG->lesson_mediaheight)) {
|
||||
set_config('mediaheight', $CFG->lesson_mediaheight, 'mod_lesson');
|
||||
unset_config('lesson_mediaheight');
|
||||
}
|
||||
|
||||
// Lesson_mediaclose => mod_lesson/mediaclose.
|
||||
if (isset($CFG->lesson_mediaclose)) {
|
||||
set_config('mediaclose', $CFG->lesson_mediaclose, 'mod_lesson');
|
||||
unset_config('lesson_mediaclose');
|
||||
}
|
||||
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2016012800, 'lesson');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ essayemailmessage,mod_lesson
|
||||
lessonattempted,mod_lesson
|
||||
clicktopost,mod_lesson
|
||||
configmaxhighscores,mod_lesson
|
||||
configactionaftercorrectanswer,mod_lesson
|
||||
displayhighscores,mod_lesson
|
||||
entername,mod_lesson
|
||||
eventhighscoreadded,mod_lesson
|
||||
|
@ -103,14 +103,16 @@ $string['completionendreached_desc'] = 'Student must reach the end of lesson pag
|
||||
$string['completiontimespent'] = 'Student must do this activity at least for';
|
||||
$string['completiontimespentgroup'] = 'Require time spent';
|
||||
$string['conditionsfordependency'] = 'Condition(s) for the dependency';
|
||||
$string['configactionaftercorrectanswer'] = 'The default action to take after a correct answer';
|
||||
$string['configintro'] = 'The values set here define the default values that are used in the settings form when creating a new lesson activity. Settings specified as advanced are only shown when the \'Show more...\' link is clicked.';
|
||||
$string['configmaxanswers'] = 'Default maximum number of answers per page';
|
||||
$string['configmediaclose'] = 'Displays a close button as part of the popup generated for a linked media file';
|
||||
$string['configmediaheight'] = 'Sets the height of the popup displayed for a linked media file';
|
||||
$string['configmediawidth'] = 'Sets the width of the popup displayed for a linked media file';
|
||||
$string['configpassword_desc'] = 'Whether a password is required in order to access the lesson.';
|
||||
$string['configslideshowbgcolor'] = 'Background colour to for the slideshow if it is enabled';
|
||||
$string['configslideshowheight'] = 'Sets the height of the slideshow if it is enabled';
|
||||
$string['configslideshowwidth'] = 'Sets the width of the slideshow if it is enabled';
|
||||
$string['configtimelimit_desc'] = 'If a time limit is set, a warning is displayed at the beginning of the lesson and there is a countdown timer. If set to zero, then there is no time limit.';
|
||||
$string['confirmdelete'] = 'Delete page';
|
||||
$string['confirmdeletionofthispage'] = 'Confirm deletion of this page';
|
||||
$string['congratulations'] = 'Congratulations - end of lesson reached';
|
||||
@ -525,3 +527,5 @@ $string['topscorestitle'] = 'Top {$a} high scores';
|
||||
$string['viewhighscores'] = 'View high scores list';
|
||||
$string['youmadehighscore'] = 'You made it on the top {$a} high scores list.';
|
||||
|
||||
// Deprecated since Moodle 3.1.
|
||||
$string['configactionaftercorrectanswer'] = 'The default action to take after a correct answer';
|
||||
|
@ -53,39 +53,39 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
|
||||
$mform = $this->_form;
|
||||
|
||||
$config = get_config('lesson');
|
||||
$lessonconfig = get_config('mod_lesson');
|
||||
|
||||
$mform->addElement('header', 'general', get_string('general', 'form'));
|
||||
|
||||
/** Legacy slideshow width element to maintain backwards compatibility */
|
||||
$mform->addElement('hidden', 'width');
|
||||
$mform->setType('width', PARAM_INT);
|
||||
$mform->setDefault('width', $CFG->lesson_slideshowwidth);
|
||||
$mform->setDefault('width', $lessonconfig->slideshowwidth);
|
||||
|
||||
/** Legacy slideshow height element to maintain backwards compatibility */
|
||||
$mform->addElement('hidden', 'height');
|
||||
$mform->setType('height', PARAM_INT);
|
||||
$mform->setDefault('height', $CFG->lesson_slideshowheight);
|
||||
$mform->setDefault('height', $lessonconfig->slideshowheight);
|
||||
|
||||
/** Legacy slideshow background color element to maintain backwards compatibility */
|
||||
$mform->addElement('hidden', 'bgcolor');
|
||||
$mform->setType('bgcolor', PARAM_TEXT);
|
||||
$mform->setDefault('bgcolor', $CFG->lesson_slideshowbgcolor);
|
||||
$mform->setDefault('bgcolor', $lessonconfig->slideshowbgcolor);
|
||||
|
||||
/** Legacy media popup width element to maintain backwards compatibility */
|
||||
$mform->addElement('hidden', 'mediawidth');
|
||||
$mform->setType('mediawidth', PARAM_INT);
|
||||
$mform->setDefault('mediawidth', $CFG->lesson_mediawidth);
|
||||
$mform->setDefault('mediawidth', $lessonconfig->mediawidth);
|
||||
|
||||
/** Legacy media popup height element to maintain backwards compatibility */
|
||||
$mform->addElement('hidden', 'mediaheight');
|
||||
$mform->setType('mediaheight', PARAM_INT);
|
||||
$mform->setDefault('mediaheight', $CFG->lesson_mediaheight);
|
||||
$mform->setDefault('mediaheight', $lessonconfig->mediaheight);
|
||||
|
||||
/** Legacy media popup close button element to maintain backwards compatibility */
|
||||
$mform->addElement('hidden', 'mediaclose');
|
||||
$mform->setType('mediaclose', PARAM_BOOL);
|
||||
$mform->setDefault('mediaclose', $CFG->lesson_mediaclose);
|
||||
$mform->setDefault('mediaclose', $lessonconfig->mediaclose);
|
||||
|
||||
$mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
|
||||
if (!empty($CFG->formatstringstriptags)) {
|
||||
@ -108,18 +108,22 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
|
||||
$mform->addElement('filemanager', 'mediafile', get_string('mediafile', 'lesson'), null, $filemanageroptions);
|
||||
$mform->addHelpButton('mediafile', 'mediafile', 'lesson');
|
||||
$mform->setAdvanced('mediafile', $lessonconfig->mediafile_adv);
|
||||
|
||||
$mform->addElement('selectyesno', 'progressbar', get_string('progressbar', 'lesson'));
|
||||
$mform->addHelpButton('progressbar', 'progressbar', 'lesson');
|
||||
$mform->setDefault('progressbar', 0);
|
||||
$mform->setDefault('progressbar', $lessonconfig->progressbar);
|
||||
$mform->setAdvanced('progressbar', $lessonconfig->progressbar_adv);
|
||||
|
||||
$mform->addElement('selectyesno', 'ongoing', get_string('ongoing', 'lesson'));
|
||||
$mform->addHelpButton('ongoing', 'ongoing', 'lesson');
|
||||
$mform->setDefault('ongoing', 0);
|
||||
$mform->setDefault('ongoing', $lessonconfig->ongoing);
|
||||
$mform->setAdvanced('ongoing', $lessonconfig->ongoing_adv);
|
||||
|
||||
$mform->addElement('selectyesno', 'displayleft', get_string('displayleftmenu', 'lesson'));
|
||||
$mform->addHelpButton('displayleft', 'displayleftmenu', 'lesson');
|
||||
$mform->setDefault('displayleft', 0);
|
||||
$mform->setDefault('displayleft', $lessonconfig->displayleftmenu);
|
||||
$mform->setAdvanced('displayleft', $lessonconfig->displayleftmenu_adv);
|
||||
|
||||
$options = array();
|
||||
for($i = 100; $i >= 0; $i--) {
|
||||
@ -127,11 +131,13 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
}
|
||||
$mform->addElement('select', 'displayleftif', get_string('displayleftif', 'lesson'), $options);
|
||||
$mform->addHelpButton('displayleftif', 'displayleftif', 'lesson');
|
||||
$mform->setDefault('displayleftif', 0);
|
||||
$mform->setDefault('displayleftif', $lessonconfig->displayleftif);
|
||||
$mform->setAdvanced('displayleftif', $lessonconfig->displayleftif_adv);
|
||||
|
||||
$mform->addElement('selectyesno', 'slideshow', get_string('slideshow', 'lesson'));
|
||||
$mform->addHelpButton('slideshow', 'slideshow', 'lesson');
|
||||
$mform->setDefault('slideshow', 0);
|
||||
$mform->setDefault('slideshow', $lessonconfig->slideshow);
|
||||
$mform->setAdvanced('slideshow', $lessonconfig->slideshow_adv);
|
||||
|
||||
$numbers = array();
|
||||
for ($i = 20; $i > 1; $i--) {
|
||||
@ -139,13 +145,15 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
}
|
||||
|
||||
$mform->addElement('select', 'maxanswers', get_string('maximumnumberofanswersbranches', 'lesson'), $numbers);
|
||||
$mform->setDefault('maxanswers', $CFG->lesson_maxanswers);
|
||||
$mform->setDefault('maxanswers', $lessonconfig->maxanswers);
|
||||
$mform->setAdvanced('maxanswers', $lessonconfig->maxanswers_adv);
|
||||
$mform->setType('maxanswers', PARAM_INT);
|
||||
$mform->addHelpButton('maxanswers', 'maximumnumberofanswersbranches', 'lesson');
|
||||
|
||||
$mform->addElement('selectyesno', 'feedback', get_string('displaydefaultfeedback', 'lesson'));
|
||||
$mform->addHelpButton('feedback', 'displaydefaultfeedback', 'lesson');
|
||||
$mform->setDefault('feedback', 0);
|
||||
$mform->setDefault('feedback', $lessonconfig->defaultfeedback);
|
||||
$mform->setAdvanced('feedback', $lessonconfig->defaultfeedback_adv);
|
||||
|
||||
// Get the modules.
|
||||
if ($mods = get_course_mods($COURSE->id)) {
|
||||
@ -165,6 +173,7 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
$mform->addElement('select', 'activitylink', get_string('activitylink', 'lesson'), $modinstances);
|
||||
$mform->addHelpButton('activitylink', 'activitylink', 'lesson');
|
||||
$mform->setDefault('activitylink', 0);
|
||||
$mform->setAdvanced('activitylink', $lessonconfig->activitylink_adv);
|
||||
}
|
||||
|
||||
// Availability.
|
||||
@ -180,13 +189,17 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
$mform->addElement('duration', 'timelimit', get_string('timelimit', 'lesson'),
|
||||
array('optional' => true));
|
||||
$mform->addHelpButton('timelimit', 'timelimit', 'lesson');
|
||||
$mform->setAdvanced('timelimit', $lessonconfig->timelimit_adv);
|
||||
$mform->setDefault('timelimit', $lessonconfig->timelimit);
|
||||
|
||||
$mform->addElement('selectyesno', 'usepassword', get_string('usepassword', 'lesson'));
|
||||
$mform->addHelpButton('usepassword', 'usepassword', 'lesson');
|
||||
$mform->setDefault('usepassword', 0);
|
||||
$mform->setDefault('usepassword', $lessonconfig->password);
|
||||
$mform->setAdvanced('usepassword', $lessonconfig->password_adv);
|
||||
|
||||
$mform->addElement('passwordunmask', 'password', get_string('password', 'lesson'));
|
||||
$mform->setDefault('password', '');
|
||||
$mform->setAdvanced('password', $lessonconfig->password_adv);
|
||||
$mform->setType('password', PARAM_RAW);
|
||||
$mform->disabledIf('password', 'usepassword', 'eq', 0);
|
||||
$mform->disabledIf('passwordunmask', 'usepassword', 'eq', 0);
|
||||
@ -241,11 +254,13 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
|
||||
$mform->addElement('selectyesno', 'modattempts', get_string('modattempts', 'lesson'));
|
||||
$mform->addHelpButton('modattempts', 'modattempts', 'lesson');
|
||||
$mform->setDefault('modattempts', 0);
|
||||
$mform->setDefault('modattempts', $lessonconfig->modattempts);
|
||||
$mform->setAdvanced('modattempts', $lessonconfig->modattempts_adv);
|
||||
|
||||
$mform->addElement('selectyesno', 'review', get_string('displayreview', 'lesson'));
|
||||
$mform->addHelpButton('review', 'displayreview', 'lesson');
|
||||
$mform->setDefault('review', 0);
|
||||
$mform->setDefault('review', $lessonconfig->displayreview);
|
||||
$mform->setAdvanced('review', $lessonconfig->displayreview_adv);
|
||||
|
||||
$numbers = array();
|
||||
for ($i = 10; $i > 0; $i--) {
|
||||
@ -253,7 +268,8 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
}
|
||||
$mform->addElement('select', 'maxattempts', get_string('maximumnumberofattempts', 'lesson'), $numbers);
|
||||
$mform->addHelpButton('maxattempts', 'maximumnumberofattempts', 'lesson');
|
||||
$mform->setDefault('maxattempts', 1);
|
||||
$mform->setDefault('maxattempts', $lessonconfig->maximumnumberofattempts);
|
||||
$mform->setAdvanced('maxattempts', $lessonconfig->maximumnumberofattempts_adv);
|
||||
|
||||
$defaultnextpages = array();
|
||||
$defaultnextpages[0] = get_string('normal', 'lesson');
|
||||
@ -261,7 +277,8 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
$defaultnextpages[LESSON_UNANSWEREDPAGE] = get_string('showanunansweredpage', 'lesson');
|
||||
$mform->addElement('select', 'nextpagedefault', get_string('actionaftercorrectanswer', 'lesson'), $defaultnextpages);
|
||||
$mform->addHelpButton('nextpagedefault', 'actionaftercorrectanswer', 'lesson');
|
||||
$mform->setDefault('nextpagedefault', $CFG->lesson_defaultnextpage);
|
||||
$mform->setDefault('nextpagedefault', $lessonconfig->defaultnextpage);
|
||||
$mform->setAdvanced('nextpagedefault', $lessonconfig->defaultnextpage_adv);
|
||||
|
||||
$numbers = array();
|
||||
for ($i = 100; $i >= 0; $i--) {
|
||||
@ -269,7 +286,8 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
}
|
||||
$mform->addElement('select', 'maxpages', get_string('numberofpagestoshow', 'lesson'), $numbers);
|
||||
$mform->addHelpButton('maxpages', 'numberofpagestoshow', 'lesson');
|
||||
$mform->setDefault('maxpages', 0);
|
||||
$mform->setDefault('maxpages', $lessonconfig->numberofpagestoshow);
|
||||
$mform->setAdvanced('maxpages', $lessonconfig->numberofpagestoshow_adv);
|
||||
|
||||
// Grade.
|
||||
$this->standard_grading_coursemodule_elements();
|
||||
@ -278,22 +296,26 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
|
||||
$mform->addElement('selectyesno', 'practice', get_string('practice', 'lesson'));
|
||||
$mform->addHelpButton('practice', 'practice', 'lesson');
|
||||
$mform->setDefault('practice', 0);
|
||||
$mform->setDefault('practice', $lessonconfig->practice);
|
||||
$mform->setAdvanced('practice', $lessonconfig->practice_adv);
|
||||
|
||||
$mform->addElement('selectyesno', 'custom', get_string('customscoring', 'lesson'));
|
||||
$mform->addHelpButton('custom', 'customscoring', 'lesson');
|
||||
$mform->setDefault('custom', 1);
|
||||
$mform->setDefault('custom', $lessonconfig->customscoring);
|
||||
$mform->setAdvanced('custom', $lessonconfig->customscoring_adv);
|
||||
|
||||
$mform->addElement('selectyesno', 'retake', get_string('retakesallowed', 'lesson'));
|
||||
$mform->addHelpButton('retake', 'retakesallowed', 'lesson');
|
||||
$mform->setDefault('retake', 0);
|
||||
$mform->setDefault('retake', $lessonconfig->retakesallowed);
|
||||
$mform->setAdvanced('retake', $lessonconfig->retakesallowed_adv);
|
||||
|
||||
$options = array();
|
||||
$options[0] = get_string('usemean', 'lesson');
|
||||
$options[1] = get_string('usemaximum', 'lesson');
|
||||
$mform->addElement('select', 'usemaxgrade', get_string('handlingofretakes', 'lesson'), $options);
|
||||
$mform->addHelpButton('usemaxgrade', 'handlingofretakes', 'lesson');
|
||||
$mform->setDefault('usemaxgrade', 0);
|
||||
$mform->setDefault('usemaxgrade', $lessonconfig->handlingofretakes);
|
||||
$mform->setAdvanced('usemaxgrade', $lessonconfig->handlingofretakes_adv);
|
||||
$mform->disabledIf('usemaxgrade', 'retake', 'eq', '0');
|
||||
|
||||
$numbers = array();
|
||||
@ -302,7 +324,8 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
}
|
||||
$mform->addElement('select', 'minquestions', get_string('minimumnumberofquestions', 'lesson'), $numbers);
|
||||
$mform->addHelpButton('minquestions', 'minimumnumberofquestions', 'lesson');
|
||||
$mform->setDefault('minquestions', 0);
|
||||
$mform->setDefault('minquestions', $lessonconfig->minimumnumberofquestions);
|
||||
$mform->setAdvanced('minquestions', $lessonconfig->minimumnumberofquestions_adv);
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
$this->standard_coursemodule_elements();
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -27,39 +26,156 @@ defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
if ($ADMIN->fulltree) {
|
||||
require_once($CFG->dirroot.'/mod/lesson/locallib.php');
|
||||
$yesno = array(0 => get_string('no'), 1 => get_string('yes'));
|
||||
|
||||
/** Slideshow settings */
|
||||
$settings->add(new admin_setting_configtext('lesson_slideshowwidth', get_string('slideshowwidth', 'lesson'),
|
||||
get_string('configslideshowwidth', 'lesson'), 640, PARAM_INT));
|
||||
// Introductory explanation that all the settings are defaults for the add lesson form.
|
||||
$settings->add(new admin_setting_heading('mod_lesson/lessonintro', '', get_string('configintro', 'lesson')));
|
||||
|
||||
$settings->add(new admin_setting_configtext('lesson_slideshowheight', get_string('slideshowheight', 'lesson'),
|
||||
get_string('configslideshowheight', 'lesson'), 480, PARAM_INT));
|
||||
// Appearance settings.
|
||||
$settings->add(new admin_setting_heading('mod_lesson/appearance', get_string('appearance'), ''));
|
||||
|
||||
$settings->add(new admin_setting_configtext('lesson_slideshowbgcolor', get_string('slideshowbgcolor', 'lesson'),
|
||||
get_string('configslideshowbgcolor', 'lesson'), '#FFFFFF', PARAM_TEXT));
|
||||
// Media file popup settings.
|
||||
$setting = new admin_setting_configempty('mod_lesson/mediafile', get_string('mediafile', 'lesson'),
|
||||
get_string('mediafile_help', 'lesson'));
|
||||
|
||||
/** Media file popup settings */
|
||||
$settings->add(new admin_setting_configtext('lesson_mediawidth', get_string('mediawidth', 'lesson'),
|
||||
$setting->set_advanced_flag_options(admin_setting_flag::ENABLED, true);
|
||||
$settings->add($setting);
|
||||
|
||||
$settings->add(new admin_setting_configtext('mod_lesson/mediawidth', get_string('mediawidth', 'lesson'),
|
||||
get_string('configmediawidth', 'lesson'), 640, PARAM_INT));
|
||||
|
||||
$settings->add(new admin_setting_configtext('lesson_mediaheight', get_string('mediaheight', 'lesson'),
|
||||
$settings->add(new admin_setting_configtext('mod_lesson/mediaheight', get_string('mediaheight', 'lesson'),
|
||||
get_string('configmediaheight', 'lesson'), 480, PARAM_INT));
|
||||
|
||||
$settings->add(new admin_setting_configcheckbox('lesson_mediaclose', get_string('mediaclose', 'lesson'),
|
||||
$settings->add(new admin_setting_configcheckbox('mod_lesson/mediaclose', get_string('mediaclose', 'lesson'),
|
||||
get_string('configmediaclose', 'lesson'), false, PARAM_TEXT));
|
||||
|
||||
/** Default lesson settings */
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/progressbar',
|
||||
get_string('progressbar', 'lesson'), get_string('progressbar_help', 'lesson'),
|
||||
array('value' => 0, 'adv' => false), $yesno));
|
||||
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/ongoing',
|
||||
get_string('ongoing', 'lesson'), get_string('ongoing_help', 'lesson'),
|
||||
array('value' => 0, 'adv' => true), $yesno));
|
||||
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/displayleftmenu',
|
||||
get_string('displayleftmenu', 'lesson'), get_string('displayleftmenu_help', 'lesson'),
|
||||
array('value' => 0, 'adv' => false), $yesno));
|
||||
|
||||
$percentage = array();
|
||||
for ($i = 100; $i >= 0; $i--) {
|
||||
$percentage[$i] = $i.'%';
|
||||
}
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/displayleftif',
|
||||
get_string('displayleftif', 'lesson'), get_string('displayleftif_help', 'lesson'),
|
||||
array('value' => 0, 'adv' => true), $percentage));
|
||||
|
||||
// Slideshow settings.
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/slideshow',
|
||||
get_string('slideshow', 'lesson'), get_string('slideshow_help', 'lesson'),
|
||||
array('value' => 0, 'adv' => true), $yesno));
|
||||
|
||||
$settings->add(new admin_setting_configtext('mod_lesson/slideshowwidth', get_string('slideshowwidth', 'lesson'),
|
||||
get_string('configslideshowwidth', 'lesson'), 640, PARAM_INT));
|
||||
|
||||
$settings->add(new admin_setting_configtext('mod_lesson/slideshowheight', get_string('slideshowheight', 'lesson'),
|
||||
get_string('configslideshowheight', 'lesson'), 480, PARAM_INT));
|
||||
|
||||
$settings->add(new admin_setting_configtext('mod_lesson/slideshowbgcolor', get_string('slideshowbgcolor', 'lesson'),
|
||||
get_string('configslideshowbgcolor', 'lesson'), '#FFFFFF', PARAM_TEXT));
|
||||
|
||||
$numbers = array();
|
||||
for ($i=20; $i>1; $i--) {
|
||||
for ($i = 20; $i > 1; $i--) {
|
||||
$numbers[$i] = $i;
|
||||
}
|
||||
$settings->add(new admin_setting_configselect('lesson_maxanswers', get_string('maximumnumberofanswersbranches','lesson'),
|
||||
get_string('configmaxanswers', 'lesson'), 4, $numbers));
|
||||
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/maxanswers',
|
||||
get_string('maximumnumberofanswersbranches', 'lesson'), get_string('maximumnumberofanswersbranches_help', 'lesson'),
|
||||
array('value' => '5', 'adv' => true), $numbers));
|
||||
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/defaultfeedback',
|
||||
get_string('displaydefaultfeedback', 'lesson'), get_string('displaydefaultfeedback_help', 'lesson'),
|
||||
array('value' => 0, 'adv' => true), $yesno));
|
||||
|
||||
$setting = new admin_setting_configempty('mod_lesson/activitylink', get_string('activitylink', 'lesson'),
|
||||
'');
|
||||
|
||||
$setting->set_advanced_flag_options(admin_setting_flag::ENABLED, true);
|
||||
$settings->add($setting);
|
||||
|
||||
// Availability settings.
|
||||
$settings->add(new admin_setting_heading('mod_lesson/availibility', get_string('availability'), ''));
|
||||
|
||||
$settings->add(new admin_setting_configduration_with_advanced('mod_lesson/timelimit',
|
||||
get_string('timelimit', 'lesson'), get_string('configtimelimit_desc', 'lesson'),
|
||||
array('value' => '0', 'adv' => false), 60));
|
||||
|
||||
$settings->add(new admin_setting_configcheckbox_with_advanced('mod_lesson/password',
|
||||
get_string('password', 'lesson'), get_string('configpassword_desc', 'lesson'),
|
||||
array('value' => 0, 'adv' => true)));
|
||||
|
||||
// Flow Control.
|
||||
$settings->add(new admin_setting_heading('lesson/flowcontrol', get_string('flowcontrol', 'lesson'), ''));
|
||||
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/modattempts',
|
||||
get_string('modattempts', 'lesson'), get_string('modattempts_help', 'lesson'),
|
||||
array('value' => 0, 'adv' => false), $yesno));
|
||||
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/displayreview',
|
||||
get_string('displayreview', 'lesson'), get_string('displayreview_help', 'lesson'),
|
||||
array('value' => 0, 'adv' => false), $yesno));
|
||||
|
||||
$attempts = array();
|
||||
for ($i = 10; $i > 0; $i--) {
|
||||
$attempts[$i] = $i;
|
||||
}
|
||||
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/maximumnumberofattempts',
|
||||
get_string('maximumnumberofattempts', 'lesson'), get_string('maximumnumberofattempts_help', 'lesson'),
|
||||
array('value' => '1', 'adv' => false), $attempts));
|
||||
|
||||
$defaultnextpages = array();
|
||||
$defaultnextpages[0] = get_string("normal", "lesson");
|
||||
$defaultnextpages[LESSON_UNSEENPAGE] = get_string("showanunseenpage", "lesson");
|
||||
$defaultnextpages[LESSON_UNANSWEREDPAGE] = get_string("showanunansweredpage", "lesson");
|
||||
$settings->add(new admin_setting_configselect('lesson_defaultnextpage', get_string('actionaftercorrectanswer','lesson'),
|
||||
get_string('configactionaftercorrectanswer', 'lesson'), 0, $defaultnextpages));
|
||||
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/defaultnextpage',
|
||||
get_string('actionaftercorrectanswer', 'lesson'), '',
|
||||
array('value' => 0, 'adv' => true), $defaultnextpages));
|
||||
|
||||
$pages = array();
|
||||
for ($i = 100; $i >= 0; $i--) {
|
||||
$pages[$i] = $i;
|
||||
}
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/numberofpagestoshow',
|
||||
get_string('numberofpagestoshow', 'lesson'), get_string('numberofpagestoshow_help', 'lesson'),
|
||||
array('value' => '1', 'adv' => true), $pages));
|
||||
|
||||
// Grade.
|
||||
$settings->add(new admin_setting_heading('lesson/grade', get_string('grade'), ''));
|
||||
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/practice',
|
||||
get_string('practice', 'lesson'), get_string('practice_help', 'lesson'),
|
||||
array('value' => 0, 'adv' => false), $yesno));
|
||||
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/customscoring',
|
||||
get_string('customscoring', 'lesson'), get_string('customscoring_help', 'lesson'),
|
||||
array('value' => 0, 'adv' => true), $yesno));
|
||||
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/retakesallowed',
|
||||
get_string('retakesallowed', 'lesson'), get_string('retakesallowed_help', 'lesson'),
|
||||
array('value' => 0, 'adv' => false), $yesno));
|
||||
|
||||
$options = array();
|
||||
$options[0] = get_string('usemean', 'lesson');
|
||||
$options[1] = get_string('usemaximum', 'lesson');
|
||||
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/handlingofretakes',
|
||||
get_string('handlingofretakes', 'lesson'), get_string('handlingofretakes_help', 'lesson'),
|
||||
array('value' => 0, 'adv' => true), $options));
|
||||
|
||||
$settings->add(new admin_setting_configselect_with_advanced('mod_lesson/minimumnumberofquestions',
|
||||
get_string('minimumnumberofquestions', 'lesson'), get_string('minimumnumberofquestions_help', 'lesson'),
|
||||
array('value' => 0, 'adv' => true), $pages));
|
||||
|
||||
}
|
||||
|
@ -54,14 +54,15 @@ class mod_lesson_generator extends testing_module_generator {
|
||||
global $CFG;
|
||||
|
||||
// Add default values for lesson.
|
||||
$lessonconfig = get_config('mod_lesson');
|
||||
$record = (array)$record + array(
|
||||
'progressbar' => 0,
|
||||
'ongoing' => 0,
|
||||
'displayleft' => 0,
|
||||
'displayleftif' => 0,
|
||||
'slideshow' => 0,
|
||||
'maxanswers' => $CFG->lesson_maxanswers,
|
||||
'feedback' => 0,
|
||||
'progressbar' => $lessonconfig->progressbar,
|
||||
'ongoing' => $lessonconfig->ongoing,
|
||||
'displayleft' => $lessonconfig->displayleftmenu,
|
||||
'displayleftif' => $lessonconfig->displayleftif,
|
||||
'slideshow' => $lessonconfig->slideshow,
|
||||
'maxanswers' => $lessonconfig->maxanswers,
|
||||
'feedback' => $lessonconfig->defaultfeedback,
|
||||
'activitylink' => 0,
|
||||
'available' => 0,
|
||||
'deadline' => 0,
|
||||
@ -71,16 +72,16 @@ class mod_lesson_generator extends testing_module_generator {
|
||||
'timespent' => 0,
|
||||
'completed' => 0,
|
||||
'gradebetterthan' => 0,
|
||||
'modattempts' => 0,
|
||||
'review' => 0,
|
||||
'maxattempts' => 1,
|
||||
'nextpagedefault' => $CFG->lesson_defaultnextpage,
|
||||
'maxpages' => 0,
|
||||
'practice' => 0,
|
||||
'custom' => 1,
|
||||
'retake' => 0,
|
||||
'usemaxgrade' => 0,
|
||||
'minquestions' => 0,
|
||||
'modattempts' => $lessonconfig->modattempts,
|
||||
'review' => $lessonconfig->displayreview,
|
||||
'maxattempts' => $lessonconfig->maximumnumberofattempts,
|
||||
'nextpagedefault' => $lessonconfig->defaultnextpage,
|
||||
'maxpages' => $lessonconfig->numberofpagestoshow,
|
||||
'practice' => $lessonconfig->practice,
|
||||
'custom' => $lessonconfig->customscoring,
|
||||
'retake' => $lessonconfig->retakesallowed,
|
||||
'usemaxgrade' => $lessonconfig->handlingofretakes,
|
||||
'minquestions' => $lessonconfig->minimumnumberofquestions,
|
||||
'grade' => 100,
|
||||
);
|
||||
if (!isset($record['mediafile'])) {
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2015111600; // The current module version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2016020800; // The current module version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015111000; // Requires this Moodle version
|
||||
$plugin->component = 'mod_lesson'; // Full name of the plugin (used for diagnostics)
|
||||
$plugin->cron = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user