diff --git a/mod/lesson/view.php b/mod/lesson/view.php index 9858245c45f..9b352c34f24 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -145,75 +145,6 @@ $timedflag = false; $attemptflag = false; if (empty($pageid)) { - // check for dependencies first - if ($lesson->dependency and !isteacher($course->id)) { - if ($dependentlesson = get_record('lesson', 'id', $lesson->dependency)) { - // lesson exists, so we can proceed - $conditions = unserialize($lesson->conditions); - // assume true for all - $timespent = false; - $completed = false; - $gradebetterthan = false; - if ($conditions->timespent) { - if ($attempttimes = get_records_select('lesson_timer', "userid = $USER->id AND lessonid = $dependentlesson->id")) { - foreach($attempttimes as $attempttime) { - $duration = $attempttime->lessontime - $attempttime->starttime; - if ($conditions->timespent < $duration/60) { - $timespent = true; - } - } - } - } else { - $timespent = true; // there isn't one set - } - - if($conditions->gradebetterthan) { - if ($studentgrades = get_records_select('lesson_grades', "userid = $USER->id AND lessonid = $dependentlesson->id")) { - foreach($studentgrades as $studentgrade) { - if ($studentgrade->grade >= $conditions->gradebetterthan) { - $gradebetterthan = true; - } - } - } - } else { - $gradebetterthan = true; // there isn't one set - } - - if ($conditions->completed) { - if (count_records('lesson_grades', 'userid', $USER->id, 'lessonid', $dependentlesson->id)) { - $completed = true; - } - } else { - $completed = true; // not set - } - - if (!$gradebetterthan or !$timespent or !$completed) { - - } - - $errors = array(); - - if (!$timespent) { - $errors[] = get_string('timespenterror', 'lesson', $conditions->timespent); - } - if (!$completed) { - $errors[] = get_string('completederror', 'lesson'); - } - if (!$gradebetterthan) { - $errors[] = get_string('gradebetterthanerror', 'lesson', $conditions->gradebetterthan); - } - if (!empty($errors)) { - echo '

'; - print_simple_box_start('center'); - print_string('completethefollowingconditions', 'lesson', $dependentlesson->name); - echo '

'.implode('
'.get_string('and', 'lesson').'
', $errors).'

'; - print_simple_box_end(); - echo '

'; - print_footer($course); - exit(); - } - } - } add_to_log($course->id, 'lesson', 'start', 'view.php?id='. $cm->id, $lesson->id, $cm->id); // if no pageid given see if the lesson has been started if ($grades = get_records_select('lesson_grades', 'lessonid = '. $lesson->id .' AND userid = '. $USER->id, @@ -520,31 +451,7 @@ error('Error: could not update lesson_timer table'); } } - - if (!$lesson->timed) { // this is for Tom Wilson, wants the time spent on lesson to be printed out. I do not print if - // it is a timed lesson though - // get our times spent on lesson then calculate our hours, minutes, and seconds - $timespent = $timer->lessontime - $timer->starttime; - $hours = floor($timespent/3600); - $timespent = $timespent - ($hours * 3600); - $minutes = floor($timespent/60); - $secs = $timespent - ($minutes * 60); - // put them all together - $formattedtime = ''; - if ($hours > 0) { - $formattedtime .= $hours.":"; - if ($minutes < 10) { - $minutes .= "0".$minutes; - } - } - if ($secs < 10) { - $secs = "0".$secs; - } - $formattedtime .= $minutes.":".$secs; - echo '
'.get_string('timespent', 'lesson').': '.$formattedtime.'
'; - - } - + if ($attemptflag) { print_heading(get_string('attempt', 'lesson', $retries + 1)); } @@ -645,11 +552,6 @@ } echo "
"; - if ($page->qtype == LESSON_IDENTITY) { - $identitytype = array_rand($LESSON_IDENTITY_QUESTIONS); - $page->contents = $LESSON_IDENTITY_QUESTIONS[$identitytype]; - } - if ($lesson->slideshow) { echo format_text($page->contents); } else { @@ -680,11 +582,6 @@ echo ''; } switch ($page->qtype) { - case LESSON_IDENTITY : - if (!isteacher($course->id)) { - $USER->lessonstopclock[$lesson->id] = true; // we need to stop the clock - } - echo ''; case LESSON_SHORTANSWER : case LESSON_NUMERICAL : if (isset($USER->modattempts[$lesson->id])) { @@ -1373,8 +1270,6 @@ get_string("addendofcluster", "lesson")." | ". "id&action=addbranchtable&pageid=$page->prevpageid\">". get_string("addabranchtable", "lesson")." | ". - "id&sesskey=".$USER->sesskey."&action=addidentitypage&pageid=$page->prevpageid\">". - get_string("addidentitypage", "lesson")." | ". "id&action=addpage&pageid=$page->prevpageid\">". get_string("addaquestionpage", "lesson")." ".get_string("here","lesson"). "\n"; @@ -1393,8 +1288,6 @@ get_string("addcluster", "lesson")." | ". "id&action=addbranchtable&pageid=0\">". get_string("addabranchtable", "lesson")." | ". - "id&sesskey=".$USER->sesskey."&action=addidentitypage&pageid=$page->prevpageid\">". - get_string("addidentitypage", "lesson")." | ". "id&action=addpage&pageid=0\">". get_string("addaquestionpage", "lesson")." ".get_string("here","lesson"). "\n"; @@ -1452,9 +1345,6 @@ case LESSON_ENDOFBRANCH : echo get_string("endofbranch", "lesson"); break; - case LESSON_IDENTITY : - echo get_string("identity", "lesson"); - break; } echo "\n"; $i = 1; @@ -1584,7 +1474,6 @@ } else { if ($lesson->custom && $page->qtype != LESSON_BRANCHTABLE && $page->qtype != LESSON_ENDOFBRANCH - && $page->qtype != LESSON_IDENTITY && $page->qtype != LESSON_CLUSTER && $page->qtype != LESSON_ENDOFCLUSTER) { echo "\n"; }
".get_string("score", "lesson")." $i:"; @@ -1632,9 +1521,7 @@ echo "id&sesskey=".$USER->sesskey."&action=addendofbranch&pageid=$page->id\">". get_string("addanendofbranch", "lesson")." | "; } - echo "id&sesskey=".$USER->sesskey."&action=addidentitypage&pageid=$page->prevpageid\">". - get_string("addidentitypage", "lesson")." | ". - "id&action=addpage&pageid=$page->id\">". + echo "id&action=addpage&pageid=$page->id\">". get_string("addaquestionpage", "lesson")." ".get_string("here","lesson"). "