Merge branch 'wip-MDL-45127-master' of git://github.com/abgreeve/moodle

This commit is contained in:
Marina Glancy 2014-05-05 10:18:03 +08:00
commit a128a24fca
4 changed files with 102 additions and 2 deletions

View file

@ -770,6 +770,12 @@ abstract class lesson_add_page_form_base extends moodleform {
if ($value !== null) {
$this->_form->setDefault($name, $value);
}
$this->_form->addHelpButton($name, 'score', 'lesson');
// Score is only used for custom scoring. Disable the element when not in use to stop some confusion.
if (!$this->_customdata['lesson']->custom) {
$this->_form->freeze($name);
}
}
/**
@ -1983,12 +1989,17 @@ abstract class lesson_page extends lesson_base {
$attempt->timeseen = time();
// if allow modattempts, then update the old attempt record, otherwise, insert new answer record
$userisreviewing = false;
if (isset($USER->modattempts[$this->lesson->id])) {
$attempt->retry = $nretakes - 1; // they are going through on review, $nretakes will be too high
$userisreviewing = true;
}
if ($this->lesson->retake || (!$this->lesson->retake && $nretakes == 0)) {
$DB->insert_record("lesson_attempts", $attempt);
// Only insert a record if we are not reviewing the lesson.
if (!$userisreviewing) {
if ($this->lesson->retake || (!$this->lesson->retake && $nretakes == 0)) {
$DB->insert_record("lesson_attempts", $attempt);
}
}
// "number of attempts remaining" message if $this->lesson->maxattempts > 1
// displaying of message(s) is at the end of page for more ergonomic display