Index: moodle/mod/lamslesson/view.php
===================================================================
RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/view.php,v
diff -u -r1.5 -r1.6
--- moodle/mod/lamslesson/view.php 9 Feb 2011 20:26:44 -0000 1.5
+++ moodle/mod/lamslesson/view.php 14 Feb 2011 03:08:14 -0000 1.6
@@ -111,6 +111,7 @@
echo $OUTPUT->box_end();
// Once we have progress info ready
+
$progress = lamslesson_get_student_progress($USER->username,$lamslesson->lesson_id, $course->id);
// Progress details
@@ -150,53 +151,12 @@
// Now let's get the score from LAMS and add it into gradebook
// Getting result from LAMS
- $results = lamslesson_get_outputs($USER->username,'en','AU',$lamslesson->lesson_id,$cm->course,LAMSLESSON_OUTPUT_METHOD,$USER->username);
+ $gradebookmark = lamslesson_get_lams_outputs($USER->username,$lamslesson,$USER->username);
- // Get the outputs from the activities
- $learneroutputs = $results['ToolOutputs']['#']['LearnerOutput'];
- $activityoutputs = $learneroutputs['0']['#']['Activity'];
-
- $maxresult = 0;
- $userresult = 0;
-
- // Calculate max and user results (if they exist)
-
- foreach ($activityoutputs as $k => $v){
- // If activities don't have or produce any output then we just ignore them
- if (!empty($v['#'])) {
- foreach ($v['#']['ToolOutput'] as $k2 => $v2) {
- $activityoutputname = $v2['@']['name'];
- // The only numeric outputs we get from LAMS are for the MCQ and Assessment activities
- // learner.total.score = Assessment
- // learner.mark = MCQ
- if ($activityoutputname == 'learner.mark' || $activityoutputname == 'learner.total.score') {
- $actname = $v2['@']['name'];
- $actmaxresult = $v2['@']['marksPossible'];
- $actuserresult = $v2['@']['output'];
- $userresult += $actuserresult;
- $maxresult += $actmaxresult;
-
- }
- }
- }
-
- }
-
-
- // If there's outputs from LAMS, then we process them and add them to the gradebook
- if (!$maxresult == 0) {
-
- //print("Max total result: " . $maxresult . "
User total result: " . $userresult . " " . $lamslesson->grade);
-
- // Now calculate the percentage and then multiply it by the lamslesson grade.
- $gradebookmark = ($userresult / $maxresult) * $lamslesson->grade;
+ if (!empty($gradebookmark)) {
echo '