From 35b179fa733bd69d10b5deab2d30875ae1d3fe97 Mon Sep 17 00:00:00 2001 From: mark-nielsen Date: Sun, 10 Sep 2006 01:30:57 +0000 Subject: [PATCH] Updated to use new handy library functions --- mod/lesson/report.php | 53 +++++-------------------------------------- mod/lesson/tabs.php | 18 ++++++++------- 2 files changed, 16 insertions(+), 55 deletions(-) diff --git a/mod/lesson/report.php b/mod/lesson/report.php index fe7fa07d51..bb669a9cf5 100644 --- a/mod/lesson/report.php +++ b/mod/lesson/report.php @@ -9,20 +9,10 @@ $id = required_param('id', PARAM_INT); // Course Module ID $pageid = optional_param('pageid', NULL, PARAM_INT); // Lesson Page ID - $action = optional_param('action', 'view', PARAM_ALPHA); // action to take + $action = optional_param('action', 'reportoverview', PARAM_ALPHA); // action to take $nothingtodisplay = false; - if (! $cm = get_coursemodule_from_id('lesson', $id)) { - error('Course Module ID was incorrect'); - } - - if (! $course = get_record('course', 'id', $cm->course)) { - error('Course is misconfigured'); - } - - if (! $lesson = get_record('lesson', 'id', $cm->instance)) { - error('Course module is incorrect'); - } + list($cm, $course, $lesson) = lesson_get_basics($id); if (! $students = get_records_sql("SELECT DISTINCT u.* FROM {$CFG->prefix}user u, @@ -95,39 +85,8 @@ $times = array(); } -/// Print the page header - $strlessons = get_string('modulenameplural', 'lesson'); + lesson_print_header($cm, $course, $lesson, $action); - if ($course->category) { - $navigation = ''. $course->shortname .' ->'; - } - $button = '
'. - ''. - ''. - ''. - '
'; - - if ($action == 'view') { - $navigationend = get_string("reports", "lesson"); - } else if ($action == 'detail' and !optional_param('userid', 0, PARAM_INT)) { - $navigationend = "id\">".get_string("reports", "lesson").' -> '.get_string('detailedstats', 'lesson'); - } else { - $navigationend = "id\">".get_string("reports", "lesson").' -> '.get_string('review', 'lesson'); - } - - print_header($course->shortname .': '. format_string($lesson->name), $course->fullname, - "$navigation id>$strlessons -> id\">".format_string($lesson->name,true)." - -> $navigationend", '', '', true, $button, navmenu($course, $cm)); - - - if (!optional_param('userid', 0, PARAM_INT)) { - $currenttab = 'reports'; - $mode = $action; - } - include('tabs.php'); - - print_heading_with_help(format_string($lesson->name,true), "overview", "lesson"); - if ($nothingtodisplay) { notify(get_string('nolessonattempts', 'lesson')); print_footer($course); @@ -137,7 +96,7 @@ /************************************************************************** this action is for default view and overview view **************************************************************************/ - if ($action == 'view') { + if ($action == 'reportoverview') { $studentdata = array(); // build an array for output @@ -226,7 +185,7 @@ $temp = ''; } - $temp .= "id&action=detail&userid=".$try['userid'].'&try='.$try['try'].'">'; + $temp .= "id&action=reportdetail&userid=".$try['userid'].'&try='.$try['try'].'">'; if ($try["grade"] !== NULL) { // if NULL then not done yet // this is what the link does when the user has completed the try $timetotake = $try["timeend"] - $try["timestart"]; @@ -349,7 +308,7 @@ 4. Print out the object which contains all the try info **************************************************************************/ - else if ($action == 'detail') { + else if ($action == 'reportdetail') { $formattextdefoptions->para = false; //I'll use it widely in this page diff --git a/mod/lesson/tabs.php b/mod/lesson/tabs.php index be5e093a6e..6a5c09ea09 100644 --- a/mod/lesson/tabs.php +++ b/mod/lesson/tabs.php @@ -49,14 +49,16 @@ $tabs[] = $row; /// sub tabs for reports (overview and detail) - if ($currenttab == 'reports' and isset($mode)) { - $inactive[] = 'reports'; - $currenttab = $mode; - - $row = array(); - $row[] = new tabobject('view', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&action=view", get_string('overview', 'lesson')); - $row[] = new tabobject('detail', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&action=detail", get_string('detailedstats', 'lesson')); - $tabs[] = $row; + switch ($currenttab) { + case 'reportoverview': + case 'reportdetail': + $inactive[] = 'reports'; + + $row = array(); + $row[] = new tabobject('reportoverview', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&action=reportoverview", get_string('overview', 'lesson')); + $row[] = new tabobject('reportdetail', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&action=reportdetail", get_string('detailedstats', 'lesson')); + $tabs[] = $row; + break; } /// sub tabs for teacher view (collapsed and expanded aka full) -- 2.39.5