mod-scorm MDL-19815 Added set_url calls, replaced deprecated functions
authorsamhemelryk <samhemelryk>
Thu, 24 Sep 2009 08:28:51 +0000 (08:28 +0000)
committersamhemelryk <samhemelryk>
Thu, 24 Sep 2009 08:28:51 +0000 (08:28 +0000)
mod/scorm/aicc.php
mod/scorm/datamodel.php
mod/scorm/index.php
mod/scorm/loadSCO.php
mod/scorm/loaddatamodel.php
mod/scorm/player.php
mod/scorm/report.php
mod/scorm/view.php

index 0f46d6c..e7d91b9 100755 (executable)
     $sessionid = required_param('session_id', PARAM_ALPHANUM);
     $aiccdata = optional_param('aicc_data', '', PARAM_RAW);
 
+    $url = new moodle_url($CFG->wwwroot.'/mod/scorm/aicc.php', array('command'=>$command,'session_id'=>$sessionid));
+    if ($aiccdata !== 0) {
+        $url->param('aicc_data', $aiccdata);
+    }
+    $PAGE->set_url($url);
+
     require_login();
 
     if (!empty($command) && confirm_sesskey($sessionid)) {
index 15781f5..ab462de 100755 (executable)
@@ -33,6 +33,8 @@
         print_error('missingparameter');
     }
 
+    $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/scorm/datamodel.php', array('scoid'=>$scoid,'attempt'=>$attempt, 'id'=>$cm->id)));
+
     require_login($course->id, false, $cm);
 
     if (confirm_sesskey() && (!empty($scoid))) {
index b0dc915..7bef611 100755 (executable)
@@ -1,10 +1,12 @@
-<?php // $Id$
+<?php
 
     require_once("../../config.php");
     require_once("locallib.php");
 
     $id = required_param('id', PARAM_INT);   // course id
 
+    $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/scorm/index.php', array('id'=>$id)));
+
     if (!empty($id)) {
         if (!$course = $DB->get_record('course', array('id'=>$id))) {
             print_error('invalidcourseid');
index df4343c..f15cc7e 100755 (executable)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
     require_once('../../config.php');
     require_once('locallib.php');
 
@@ -32,6 +32,8 @@
         print_error('missingparameter');
     }
 
+    $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/scorm/loadSCO.php', array('scoid'=>$scoid, 'id'=>$cm->id)));
+
     require_login($course->id, false, $cm);
 
     //check if scorm closed
index e0548c5..e4e0e13 100644 (file)
         print_error('missingparameter');
     }
 
+    $url = new moodle_url($CFG->wwwroot.'/mod/scorm/loaddatamodel.php', array('scoid'=>$scoid, 'id'=>$cm->id,'attempt'=>$attempt));
+    if ($mode !== '') {
+        $url->param('mode', $mode);
+    }
+    $PAGE->set_url($url);
+
     require_login($course, false, $cm);
 
     if ($usertrack = scorm_get_tracks($scoid,$USER->id,$attempt)) {
index 5419d3d..68e95f2 100755 (executable)
@@ -1,4 +1,4 @@
-<?PHP  // $Id$
+<?PHP
 
 /// This page prints a particular instance of aicc/scorm package
 
         print_error('missingparameter');
     }
 
+    $url = new moodle_url($CFG->wwwroot.'/mod/scorm/player.php', array('scoid'=>$scoid, 'id'=>$cm->id));
+    if ($mode !== 'normal') {
+        $url->param('mode', $mode);
+    }
+    if ($currentorg !== '') {
+        $url->param('currentorg', $currentorg);
+    }
+    if ($newattempt !== 'off') {
+        $url->param('newattempt', $newattempt);
+    }
+    $PAGE->set_url($url);
+
     require_login($course->id, false, $cm);
 
     $strscorms = get_string('modulenameplural', 'scorm');
@@ -59,7 +71,7 @@
     $PAGE->set_title($pagetitle);
     $PAGE->set_heading($course->fullname);
     $PAGE->navbar->add(format_string($scorm->name,true), new moodle_url($CFG->wwwroot.'/mode/scorm/view.php', array('id'=>$cm->id)));
-    $PAGE->set_button(update_module_button($cm->id, $course->id, $strscorm));
+    $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'scorm'));
 
     if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_COURSE,$course->id))) {
         echo $OUTPUT->header();
 
     $exitlink = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$scorm->course.'" title="'.$strexit.'">'.$strexit.'</a> ';
 
-    $PAGE->set_button($exitlink.update_module_button($cm->id, $course->id, $strscorm));
+    $PAGE->set_button($exitlink.$OUTPUT->update_module_button($cm->id, 'scorm'));
 
     echo $PAGE->requires->data_for_js('scormplayerdata', Array('cwidth'=>$scorm->width,'cheight'=>$scorm->height))->in_head();
     echo $PAGE->requires->js('mod/scorm/request.js')->in_head();
 <?php
             //Added incase javascript popups are blocked
             $link = '<a href="'.$CFG->wwwroot.'/mod/scorm/loadSCO.php?id='.$cm->id.$scoidstr.$modestr.'" target="new">'.get_string('popupblockedlinkname','scorm').'</a>';
-            print_simple_box(get_string('popupblocked','scorm',$link),'center');
+            echo $OUTPUT->box(get_string('popupblocked','scorm',$link));
         }
     } else {
-        print_simple_box(get_string('noprerequisites','scorm'),'center');
+        echo $OUTPUT->box(get_string('noprerequisites','scorm'));
     }
 ?>
             </div> <!-- SCORM object -->
index e7ebebc..967a059 100755 (executable)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 // This script uses installed report plugins to print quiz reports
 
     $action     = optional_param('action', '', PARAM_ALPHA);
     $attemptids = optional_param('attemptid', array(), PARAM_RAW); //get array of responses to delete.
 
+    $url = new moodle_url($CFG->wwwroot.'/mod/scorm/report.php');
+    if ($user !== '') {
+        $url->param('user', $user);
+    }
+    if ($attempt !== '1') {
+        $url->param('attempt', $attempt);
+    }
+    if ($action !== '') {
+        $url->param('action', $action);
+    }
+    
     if (!empty($id)) {
+        $url->param('id', $id);
         if (! $cm = get_coursemodule_from_id('scorm', $id)) {
             print_error('invalidcoursemodule');
         }
         }
     } else {
         if (!empty($b)) {
+            $url->param('b', $b);
             if (! $sco = $DB->get_record('scorm_scoes', array('id'=>$b))) {
                 print_error('invalidactivity', 'scorm');
             }
             $a = $sco->scorm;
         }
         if (!empty($a)) {
+            $url->param('a', $a);
             if (! $scorm = $DB->get_record('scorm', array('id'=>$a))) {
                 print_error('invalidcoursemodule');
             }
@@ -42,6 +56,7 @@
             }
         }
     }
+    $PAGE->set_url($url);
 
     require_login($course->id, false, $cm);
 
index a6bc100..84081aa 100755 (executable)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
     require_once("../../config.php");
     require_once('locallib.php');
         print_error('missingparameter');
     }
 
+    $url = new moodle_url($CFG->wwwroot.'/mod/scorm/view.php', array('id'=>$cm->id));
+    if ($organization !== '') {
+        $url->param('organization', $organization);
+    }
+    $PAGE->set_url($url);
+    
     require_login($course->id, false, $cm);
 
     $context = get_context_instance(CONTEXT_COURSE, $course->id);
@@ -55,7 +61,7 @@
     //
     $PAGE->set_title($pagetitle);
     $PAGE->set_heading($course->fullname);
-    $PAGE->set_button(update_module_button($cm->id, $course->id, $strscorm));
+    $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'scorm'));
     echo $OUTPUT->header();
 
     if (has_capability('mod/scorm:viewreport', $context)) {