Skip to content
Permalink
Browse files

Merge branch 'MDL-39270-master-int' of git://github.com/FMCorz/moodle

  • Loading branch information...
danpoltawski committed Apr 30, 2013
2 parents 21a6714 + d756d3f commit fb92d5ef57e14b8e0181209371f61db6a4a290ab
Showing with 135 additions and 136 deletions.
  1. +5 −4 mod/lesson/lang/en/lesson.php
  2. +130 −132 mod/lesson/mod_form.php
@@ -32,7 +32,7 @@
* Show an unseen page - Pages are shown in a random order with no page shown twice
* Show an unanswered page - Pages are shown in a random order, with pages containing unanswered questions shown again';
$string['actions'] = 'Actions';
$string['activitylink'] = 'Link to an activity';
$string['activitylink'] = 'Link to next activity';
$string['activitylink_help'] = 'To provide a link at the end of the lesson to another activity in the course, select the activity from the dropdown list.';
$string['activitylinkname'] = 'Go to {$a}';
$string['addabranchtable'] = 'Add a content page';
@@ -129,11 +129,11 @@
$string['detailedstats'] = 'Detailed statistics';
$string['didnotanswerquestion'] = 'Did not answer this question.';
$string['didnotreceivecredit'] = 'Did not receive credit';
$string['displaydefaultfeedback'] = 'Display default feedback';
$string['displaydefaultfeedback'] = 'Use default feedback';
$string['displaydefaultfeedback_help'] = 'If enabled, when a response is not found for a particular question, the default response of "That\'s the correct answer" or "That\'s the wrong answer" will be shown.';
$string['displayhighscores'] = 'Display high scores';
$string['displayinleftmenu'] = 'Display in left menu?';
$string['displayleftif'] = 'Display left menu only if grade greater than';
$string['displayleftif'] = 'Minimum grade to display menu';
$string['displayleftif_help'] = 'This setting determines whether a student must obtain a certain grade before viewing the left menu. This forces the student to go through the entire lesson on their first attempt, then after obtaining the required grade they can use the left menu for review.';
$string['displayleftmenu'] = 'Display left menu';
$string['displayleftmenu_help'] = 'If enabled, a list of pages is displayed.';
@@ -241,7 +241,7 @@
$string['maxtime'] = 'Time limit (minutes)';
$string['maxtimewarning'] = 'You have {$a} minute(s) to finish the lesson.';
$string['mediaclose'] = 'Show close button:';
$string['mediafile'] = 'Pop-up to file or web page';
$string['mediafile'] = 'File pop-up';
$string['mediafile_help'] = 'To include a pop-up window at the beginning of a lesson, choose the appropriate file to display. Every lesson page will include a link to re-open the pop-up if necessary.';
$string['mediafilepopup'] = 'Click here to view';
$string['mediaheight'] = 'Popup window height:';
@@ -340,6 +340,7 @@
$string['practice'] = 'Practice lesson';
$string['practice_help'] = 'A practice lesson does not appear in the gradebook.';
$string['preprocesserror'] = 'Error occurred during pre-processing!';
$string['prerequisitelesson'] = 'Prerequisite lesson';
$string['preview'] = 'Preview';
$string['previewlesson'] = 'Preview {$a}';
$string['previouspage'] = 'Previous page';
@@ -90,6 +90,85 @@ function definition() {
}
$mform->addRule('name', null, 'required', null, 'client');
// Appearance.
$mform->addElement('header', 'appearancehdr', get_string('appearance'));
$filemanageroptions = array();
$filemanageroptions['filetypes'] = '*';
$filemanageroptions['maxbytes'] = $this->course->maxbytes;
$filemanageroptions['subdirs'] = 0;
$filemanageroptions['maxfiles'] = 1;
$mform->addElement('filemanager', 'mediafile', get_string('mediafile', 'lesson'), null, $filemanageroptions);
$mform->addHelpButton('mediafile', 'mediafile', 'lesson');
$mform->addElement('selectyesno', 'progressbar', get_string('progressbar', 'lesson'));
$mform->addHelpButton('progressbar', 'progressbar', 'lesson');
$mform->setDefault('progressbar', 0);
$mform->addElement('selectyesno', 'ongoing', get_string('ongoing', 'lesson'));
$mform->addHelpButton('ongoing', 'ongoing', 'lesson');
$mform->setDefault('ongoing', 0);
$mform->addElement('selectyesno', 'displayleft', get_string('displayleftmenu', 'lesson'));
$mform->addHelpButton('displayleft', 'displayleftmenu', 'lesson');
$mform->setDefault('displayleft', 0);
$options = array();
for($i = 100; $i >= 0; $i--) {
$options[$i] = $i.'%';
}
$mform->addElement('select', 'displayleftif', get_string('displayleftif', 'lesson'), $options);
$mform->addHelpButton('displayleftif', 'displayleftif', 'lesson');
$mform->setDefault('displayleftif', 0);
$mform->addElement('selectyesno', 'slideshow', get_string('slideshow', 'lesson'));
$mform->addHelpButton('slideshow', 'slideshow', 'lesson');
$mform->setDefault('slideshow', 0);
$numbers = array();
for ($i = 20; $i > 1; $i--) {
$numbers[$i] = $i;
}
$mform->addElement('select', 'maxanswers', get_string('maximumnumberofanswersbranches', 'lesson'), $numbers);
$mform->setDefault('maxanswers', $CFG->lesson_maxanswers);
$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);
// Get the modules.
if ($mods = get_course_mods($COURSE->id)) {
$modinstances = array();
foreach ($mods as $mod) {
// get the module name and then store it in a new array
if ($module = get_coursemodule_from_instance($mod->modname, $mod->instance, $COURSE->id)) {
if (isset($this->_cm->id) and $this->_cm->id != $mod->id){
$modinstances[$mod->id] = $mod->modname.' - '.$module->name;
}
}
}
asort($modinstances); // sort by module name
$modinstances=array(0=>get_string('none'))+$modinstances;
$mform->addElement('select', 'activitylink', get_string('activitylink', 'lesson'), $modinstances);
$mform->addHelpButton('activitylink', 'activitylink', 'lesson');
$mform->setDefault('activitylink', 0);
}
// Availability.
$mform->addElement('header', 'availabilityhdr', get_string('availability'));
$mform->addElement('date_time_selector', 'available', get_string('available', 'lesson'), array('optional'=>true));
$mform->setDefault('available', 0);
$mform->addElement('date_time_selector', 'deadline', get_string('deadline', 'lesson'), array('optional'=>true));
$mform->setDefault('deadline', 0);
// Create a text box that can be enabled/disabled for lesson time limit
$timedgrp = array();
$timedgrp[] = &$mform->createElement('text', 'maxtime');
@@ -107,64 +186,47 @@ function definition() {
$mform->setDefault('maxtime', 20);
$mform->setType('maxtime', PARAM_INT);
$numbers = array();
for ($i=20; $i>1; $i--) {
$numbers[$i] = $i;
}
$mform->addElement('date_time_selector', 'available', get_string('available', 'lesson'), array('optional'=>true));
$mform->setDefault('available', 0);
$mform->addElement('date_time_selector', 'deadline', get_string('deadline', 'lesson'), array('optional'=>true));
$mform->setDefault('deadline', 0);
$mform->addElement('select', 'maxanswers', get_string('maximumnumberofanswersbranches', 'lesson'), $numbers);
$mform->setDefault('maxanswers', $CFG->lesson_maxanswers);
$mform->setType('maxanswers', PARAM_INT);
$mform->addHelpButton('maxanswers', 'maximumnumberofanswersbranches', 'lesson');
$mform->addElement('selectyesno', 'usepassword', get_string('usepassword', 'lesson'));
$mform->addHelpButton('usepassword', 'usepassword', 'lesson');
$mform->setDefault('usepassword', 0);
$mform->setAdvanced('usepassword');
$mform->addElement('passwordunmask', 'password', get_string('password', 'lesson'));
$mform->setDefault('password', '');
$mform->setType('password', PARAM_RAW);
$mform->setAdvanced('password');
$mform->disabledIf('password', 'usepassword', 'eq', 0);
$mform->disabledIf('passwordunmask', 'usepassword', 'eq', 0);
$this->standard_grading_coursemodule_elements();
//-------------------------------------------------------------------------------
$mform->addElement('header', 'gradeoptions', get_string('gradeoptions', 'lesson'));
// Dependent on.
$mform->addElement('header', 'dependencyon', get_string('prerequisitelesson', 'lesson'));
$mform->addElement('selectyesno', 'practice', get_string('practice', 'lesson'));
$mform->addHelpButton('practice', 'practice', 'lesson');
$mform->setDefault('practice', 0);
$options = array(0=>get_string('none'));
if ($lessons = get_all_instances_in_course('lesson', $COURSE)) {
foreach($lessons as $lesson) {
if ($lesson->id != $this->_instance){
$options[$lesson->id] = format_string($lesson->name, true);
}
$mform->addElement('selectyesno', 'custom', get_string('customscoring', 'lesson'));
$mform->addHelpButton('custom', 'customscoring', 'lesson');
$mform->setDefault('custom', 1);
}
}
$mform->addElement('select', 'dependency', get_string('dependencyon', 'lesson'), $options);
$mform->addHelpButton('dependency', 'dependencyon', 'lesson');
$mform->setDefault('dependency', 0);
$mform->addElement('selectyesno', 'retake', get_string('retakesallowed', 'lesson'));
$mform->addHelpButton('retake', 'retakesallowed', 'lesson');
$mform->setDefault('retake', 0);
$mform->addElement('text', 'timespent', get_string('timespentminutes', 'lesson'));
$mform->setDefault('timespent', 0);
$mform->setType('timespent', PARAM_INT);
$mform->disabledIf('timespent', 'dependency', 'eq', 0);
$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->disabledIf('usemaxgrade', 'retake', 'eq', '0');
$mform->addElement('checkbox', 'completed', get_string('completed', 'lesson'));
$mform->setDefault('completed', 0);
$mform->disabledIf('completed', 'dependency', 'eq', 0);
$mform->addElement('selectyesno', 'ongoing', get_string('ongoing', 'lesson'));
$mform->addHelpButton('ongoing', 'ongoing', 'lesson');
$mform->setDefault('ongoing', 0);
$mform->addElement('text', 'gradebetterthan', get_string('gradebetterthan', 'lesson'));
$mform->setDefault('gradebetterthan', 0);
$mform->setType('gradebetterthan', PARAM_INT);
$mform->disabledIf('gradebetterthan', 'dependency', 'eq', 0);
//-------------------------------------------------------------------------------
// Flow control.
$mform->addElement('header', 'flowcontrol', get_string('flowcontrol', 'lesson'));
$mform->addElement('selectyesno', 'modattempts', get_string('modattempts', 'lesson'));
@@ -176,7 +238,7 @@ function definition() {
$mform->setDefault('review', 0);
$numbers = array();
for ($i=10; $i>0; $i--) {
for ($i = 10; $i > 0; $i--) {
$numbers[$i] = $i;
}
$mform->addElement('select', 'maxattempts', get_string('maximumnumberofattempts', 'lesson'), $numbers);
@@ -190,111 +252,47 @@ function definition() {
$mform->addElement('select', 'nextpagedefault', get_string('actionaftercorrectanswer', 'lesson'), $defaultnextpages);
$mform->addHelpButton('nextpagedefault', 'actionaftercorrectanswer', 'lesson');
$mform->setDefault('nextpagedefault', $CFG->lesson_defaultnextpage);
$mform->setAdvanced('nextpagedefault');
$mform->addElement('selectyesno', 'feedback', get_string('displaydefaultfeedback', 'lesson'));
$mform->addHelpButton('feedback', 'displaydefaultfeedback', 'lesson');
$mform->setDefault('feedback', 0);
$mform->addElement('selectyesno', 'progressbar', get_string('progressbar', 'lesson'));
$mform->addHelpButton('progressbar', 'progressbar', 'lesson');
$mform->setDefault('progressbar', 0);
$mform->addElement('selectyesno', 'displayleft', get_string('displayleftmenu', 'lesson'));
$mform->addHelpButton('displayleft', 'displayleftmenu', 'lesson');
$mform->setDefault('displayleft', 0);
$options = array();
for($i = 100; $i >= 0; $i--) {
$options[$i] = $i.'%';
}
$mform->addElement('select', 'displayleftif', get_string('displayleftif', 'lesson'), $options);
$mform->addHelpButton('displayleftif', 'displayleftif', 'lesson');
$mform->setDefault('displayleftif', 0);
$mform->setAdvanced('displayleftif');
$numbers = array();
for ($i = 100; $i >= 0; $i--) {
$numbers[$i] = $i;
}
$mform->addElement('select', 'minquestions', get_string('minimumnumberofquestions', 'lesson'), $numbers);
$mform->addHelpButton('minquestions', 'minimumnumberofquestions', 'lesson');
$mform->setDefault('minquestions', 0);
$mform->setAdvanced('minquestions');
$numbers = array();
for ($i = 100; $i >= 0; $i--) {
$numbers[$i] = $i;
}
$mform->addElement('select', 'maxpages', get_string('numberofpagestoshow', 'lesson'), $numbers);
$mform->addHelpButton('maxpages', 'numberofpagestoshow', 'lesson');
$mform->setAdvanced('maxpages');
$mform->setDefault('maxpages', 0);
$mform->addElement('selectyesno', 'slideshow', get_string('slideshow', 'lesson'));
$mform->addHelpButton('slideshow', 'slideshow', 'lesson');
$mform->setDefault('slideshow', 0);
$mform->setAdvanced('slideshow');
// get the modules
if ($mods = get_course_mods($COURSE->id)) {
$modinstances = array();
foreach ($mods as $mod) {
// get the module name and then store it in a new array
if ($module = get_coursemodule_from_instance($mod->modname, $mod->instance, $COURSE->id)) {
if (isset($this->_cm->id) and $this->_cm->id != $mod->id){
$modinstances[$mod->id] = $mod->modname.' - '.$module->name;
}
}
}
asort($modinstances); // sort by module name
$modinstances=array(0=>get_string('none'))+$modinstances;
$mform->addElement('select', 'activitylink', get_string('activitylink', 'lesson'), $modinstances);
$mform->addHelpButton('activitylink', 'activitylink', 'lesson');
$mform->setDefault('activitylink', 0);
$mform->setAdvanced('activitylink');
}
// Grade.
$this->standard_grading_coursemodule_elements();
//-------------------------------------------------------------------------------
$mform->addElement('header', 'mediafileheader', get_string('mediafile', 'lesson'));
// No header here, so that the following settings are displayed in the grade section.
$filemanageroptions = array();
$filemanageroptions['filetypes'] = '*';
$filemanageroptions['maxbytes'] = $this->course->maxbytes;
$filemanageroptions['subdirs'] = 0;
$filemanageroptions['maxfiles'] = 1;
$mform->addElement('selectyesno', 'practice', get_string('practice', 'lesson'));
$mform->addHelpButton('practice', 'practice', 'lesson');
$mform->setDefault('practice', 0);
$mform->addElement('filemanager', 'mediafile', get_string('mediafile', 'lesson'), null, $filemanageroptions);
$mform->addHelpButton('mediafile', 'mediafile', 'lesson');
$mform->addElement('selectyesno', 'custom', get_string('customscoring', 'lesson'));
$mform->addHelpButton('custom', 'customscoring', 'lesson');
$mform->setDefault('custom', 1);
//-------------------------------------------------------------------------------
$mform->addElement('header', 'dependencyon', get_string('dependencyon', 'lesson'));
$mform->addElement('selectyesno', 'retake', get_string('retakesallowed', 'lesson'));
$mform->addHelpButton('retake', 'retakesallowed', 'lesson');
$mform->setDefault('retake', 0);
$options = array(0=>get_string('none'));
if ($lessons = get_all_instances_in_course('lesson', $COURSE)) {
foreach($lessons as $lesson) {
if ($lesson->id != $this->_instance){
$options[$lesson->id] = format_string($lesson->name, true);
}
$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->disabledIf('usemaxgrade', 'retake', 'eq', '0');
}
$numbers = array();
for ($i = 100; $i >= 0; $i--) {
$numbers[$i] = $i;
}
$mform->addElement('select', 'dependency', get_string('dependencyon', 'lesson'), $options);
$mform->addHelpButton('dependency', 'dependencyon', 'lesson');
$mform->setDefault('dependency', 0);
$mform->addElement('text', 'timespent', get_string('timespentminutes', 'lesson'));
$mform->setDefault('timespent', 0);
$mform->setType('timespent', PARAM_INT);
$mform->addElement('checkbox', 'completed', get_string('completed', 'lesson'));
$mform->setDefault('completed', 0);
$mform->addElement('text', 'gradebetterthan', get_string('gradebetterthan', 'lesson'));
$mform->setDefault('gradebetterthan', 0);
$mform->setType('gradebetterthan', PARAM_INT);
$mform->addElement('select', 'minquestions', get_string('minimumnumberofquestions', 'lesson'), $numbers);
$mform->addHelpButton('minquestions', 'minimumnumberofquestions', 'lesson');
$mform->setDefault('minquestions', 0);
//-------------------------------------------------------------------------------
$this->standard_coursemodule_elements();

0 comments on commit fb92d5e

Please sign in to comment.
You can’t perform that action at this time.