diff --git a/mod/lesson/mod.html b/mod/lesson/mod.html index 8effa61ceab..487b7ab1425 100644 --- a/mod/lesson/mod.html +++ b/mod/lesson/mod.html @@ -552,7 +552,7 @@ if ($form->mode == "add") { } // get the module name and then store it in a new array if ($module = get_coursemodule_from_instance($mod->modname, $mod->instance, $form->course)) { - $modinstances[$mod->modname][$module->id] = $module->name; + $modinstances[$mod->modname][$mod->id] = $module->name; } } ksort($modinstances); // sort by module name diff --git a/mod/lesson/view.php b/mod/lesson/view.php index 2f93d04e880..9013b2a48fa 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -167,12 +167,12 @@ if ($conditions->timespent) { if ($attempttimes = get_records_select('lesson_timer', "userid = $USER->id AND lessonid = $dependentlesson->id")) { // go through all the times and test to see if any of them satisfy the condition - foreach($attempttimes as $attempttime) { - $duration = $attempttime->lessontime - $attempttime->starttime; - if ($conditions->timespent < $duration/60) { - $timespent = true; - } - } + foreach($attempttimes as $attempttime) { + $duration = $attempttime->lessontime - $attempttime->starttime; + if ($conditions->timespent < $duration/60) { + $timespent = true; + } + } } } else { $timespent = true; // there isn't one set @@ -183,9 +183,9 @@ if ($studentgrades = get_records_select('lesson_grades', "userid = $USER->id AND lessonid = $dependentlesson->id")) { // go through all the grades and test to see if any of them satisfy the condition foreach($studentgrades as $studentgrade) { - if ($studentgrade->grade >= $conditions->gradebetterthan) { - $gradebetterthan = true; - } + if ($studentgrade->grade >= $conditions->gradebetterthan) { + $gradebetterthan = true; + } } } } else { @@ -1217,17 +1217,17 @@ } elseif ($lesson->modattempts && isteacher($course->id)) { echo "

".get_string("modattemptsnoteacher", "lesson")."

"; } - - if ($lesson->activitylink) { - if ($module = get_record('course_modules', 'id', $lesson->activitylink)) { - if ($modname = get_field('modules', 'name', 'id', $module->module)) - if ($instance = get_record($modname, 'id', $module->instance)) { - echo "
". - "wwwroot/mod/$modname/view.php?id=$instance->id\">". - get_string('activitylinkname', 'lesson', $instance->name)."
\n"; - } - } - } + + if ($lesson->activitylink) { + if ($module = get_record('course_modules', 'id', $lesson->activitylink)) { + if ($modname = get_field('modules', 'name', 'id', $module->module)) + if ($instance = get_record($modname, 'id', $module->instance)) { + echo "
". + "wwwroot/mod/$modname/view.php?id=$lesson->activitylink\">". + get_string('activitylinkname', 'lesson', $instance->name)."
\n"; + } + } + } echo "
id\">".get_string("mainmenu", "lesson")."
\n"; // Back to the menu (course view). echo "
id\">".get_string("viewgrades", "lesson")."
\n"; //view grades