/**
- * Given an instance of a module, finds the coursemodule description
+ * Given an id of a course module, finds the coursemodule description
*
- * @uses $CFG
- * @param string $modulename ?
- * @param string $instance ?
- * @param int $courseid The id of the course as found in the 'course' table.
- * @return object
- * @todo Finish documenting this function
+ * @param string $modulename name of module type, eg. resource, assignment,...
+ * @param int $cmid course module id (id in course_modules table)
+ * @param int $courseid optional course id for extra validation
+ * @return object course module instance with instance and module name
+ */
+function get_coursemodule_from_id($modulename, $cmid, $courseid=0) {
+
+ global $CFG;
+
+ $courseselect = ($courseid) ? "cm.course = '$courseid' AND " : '';
+
+ return get_record_sql("SELECT cm.*, m.name, md.name as modname
+ FROM {$CFG->prefix}course_modules cm,
+ {$CFG->prefix}modules md,
+ {$CFG->prefix}$modulename m
+ WHERE $courseselect
+ cm.id = '$cmid' AND
+ cm.instance = m.id AND
+ md.name = '$modulename' AND
+ md.id = cm.module");
+}
+
+/**
+ * Given an instance number of a module, finds the coursemodule description
+ *
+ * @param string $modulename name of module type, eg. resource, assignment,...
+ * @param int $instance module instance number (id in resource, assignment etc. table)
+ * @param int $courseid optional course id for extra validation
+ * @return object course module instance with instance and module name
*/
function get_coursemodule_from_instance($modulename, $instance, $courseid=0) {
global $CFG;
-
+
$courseselect = ($courseid) ? "cm.course = '$courseid' AND " : '';
- return get_record_sql("SELECT cm.*, m.name
+ return get_record_sql("SELECT cm.*, m.name, md.name as modname
FROM {$CFG->prefix}course_modules cm,
{$CFG->prefix}modules md,
{$CFG->prefix}$modulename m
if ($cmid) {
if ($cm) {
$this->cm = $cm;
- } else if (! $this->cm = get_record('course_modules', 'id', $cmid)) {
+ } else if (! $this->cm = get_coursemodule_from_id('assignment', $cmid)) {
error('Course Module ID was incorrect');
}
$mode = optional_param('mode', 'all', PARAM_ALPHA); // What mode are we in?
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('assignment', $id)) {
error("Course Module ID was incorrect");
}
$id = required_param('id', PARAM_INT); // Course Module ID
$userid = required_param('userid', PARAM_INT); // User ID
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('assignment', $id)) {
error("Course Module ID was incorrect");
}
$a = optional_param('a', 0, PARAM_INT); // Assignment ID
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('assignment', $id)) {
error("Course Module ID was incorrect");
}
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800;
-$module->requires = 2005031000; // Requires this Moodle version
+$module->version = 2006080900;
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 60;
?>
$a = optional_param('a', 0, PARAM_INT); // Assignment ID
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('assignment', $id)) {
error("Course Module ID was incorrect");
}
$deletesession = optional_param('deletesession', 0, PARAM_BOOL);
$confirmdelete = optional_param('confirmdelete', 0, PARAM_BOOL);
- if (! $cm = get_record('course_modules', 'id', $id)) {
+ if (! $cm = get_coursemodule_from_id('chat', $id)) {
error('Course Module ID was incorrect');
}
if (! $chat = get_record('chat', 'id', $cm->instance)) {
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800; // The (date) version of this module
-$module->requires = 2005031000; // Requires this Moodle version
+$module->version = 2006080900; // The (date) version of this module
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 300; // How often should cron check this module (seconds)?
?>
$edit = optional_param('edit', -1, PARAM_BOOL);
if ($id) {
- if (! $cm = get_record('course_modules', 'id', $id)) {
+ if (! $cm = get_coursemodule_from_id('chat', $id)) {
error('Course Module ID was incorrect');
}
$download = optional_param('download', '', PARAM_ALPHA);
$action = optional_param('action', '', PARAM_ALPHA);
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('choice', $id)) {
error("Course Module ID was incorrect");
}
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800;
-$module->requires = 2005021600; // Requires this Moodle version
+$module->version = 2006080900;
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 0;
?>
$action = optional_param('action', '', PARAM_ALPHA);
$attemptids = optional_param('attemptid', array(), PARAM_INT); // array of attempt ids for delete action
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('choice', $id)) {
error("Course Module ID was incorrect");
}
$mode ='addtemplate'; //define the mode for this page, only 1 mode available
if ($id) {
- if (! $cm = get_record('course_modules', 'id', $id)) {
+ if (! $cm = get_coursemodule_from_id('data', $id)) {
error('Course Module ID was incorrect');
}
if (! $course = get_record('course', 'id', $cm->course)) {
$fieldenclosure = optional_param('fieldenclosure', '', PARAM_CLEANHTML); // characters used as record delimiters for csv file import
if ($id) {
- if (! $cm = get_record('course_modules', 'id', $id)) {
+ if (! $cm = get_coursemodule_from_id('data', $id)) {
error('Course Module ID was incorrect');
}
if (! $course = get_record('course', 'id', $cm->course)) {
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800;
-$module->requires = 2005060230; // Requires this Moodle version
+$module->version = 2006080900;
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 60;
?>
$delete = optional_param('delete', 0, PARAM_INT); //delete recordid
if ($id) {
- if (! $cm = get_record('course_modules', 'id', $id)) {
+ if (! $cm = get_coursemodule_from_id('data', $id)) {
error('Course Module ID was incorrect');
}
if (! $course = get_record('course', 'id', $cm->course)) {
$userid = optional_param('userid', 0, PARAM_INT);
// get some esential stuff...
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('exercise', $id)) {
error("Course Module ID was incorrect");
}
$title = optional_param('title', '', PARAM_CLEAN);
// get some essential stuff...
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('exercise', $id)) {
error("Course Module ID was incorrect");
}
$timenow = time();
// get some esential stuff...
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('exercise', $id)) {
error("Course Module ID was incorrect");
}
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800;
-$module->requires = 2005031000; // Requires this Moodle version
+$module->version = 2006080900;
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 60;
?>
$changegroup = optional_param('group', -1, PARAM_INT);
// get some esential stuff...
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('exercise', $id)) {
error("Course Module ID was incorrect");
}
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800;
-$module->requires = 2005031000; // Requires this Moodle version
+$module->version = 2006080900;
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 60;
?>
$search = optional_param('search', ''); // search string
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('forum', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
$mode = optional_param('mode','approval', PARAM_ALPHA);
$hook = optional_param('hook','ALL', PARAM_CLEAN);
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
global $USER, $CFG;
- if (! $cm = get_record('course_modules', 'id', $id)) {
+ if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error('Course Module ID was incorrect');
}
global $USER, $CFG;
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
$entrydeleted = get_string("entrydeleted","glossary");
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
$mode = optional_param('mode', '', PARAM_ALPHA); // categories if by category?
$hook = optional_param('hook', '', PARAM_ALPHANUM); // CategoryID
-if (! $cm = get_record("course_modules", "id", $id)) {
+if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
$action = strtolower($action);
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
$l = optional_param('l','', PARAM_ALPHANUM);
$cat = optional_param('cat',0, PARAM_ALPHANUM);
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
$PermissionGranted = 1;
- $cm = get_record('course_modules','id',$id);
+ $cm = get_coursemodule_from_id('glossary', $id);
if ( ! $cm ) {
$PermissionGranted = 0;
} else {
$l = optional_param('l','', PARAM_ALPHANUM);
$cat = optional_param('cat',0, PARAM_ALPHANUM);
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
$mode = optional_param('mode', 'letter', PARAM_ALPHA );
$hook = optional_param('hook', 'ALL', PARAM_ALPHANUM);
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
$hook = optional_param('hook','ALL', PARAM_ALPHANUM); // what to show
$sortkey = optional_param('sortkey','UPDATE', PARAM_ALPHA); // Sorting key
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800;
-$module->requires = 2005031000; // Requires this Moodle version
+$module->version = 2006080900;
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
?>
$show = optional_param('show', '', PARAM_ALPHA); // [ concept | alias ] => mode=term hook=$show
if (!empty($id)) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
===============================================
-This is v2.1.21 of the HotPot module for Moodle
+This is v2.2.0 of the HotPot module for Moodle
===============================================
This module allows teachers to administer Hot Potatoes and TexToys quizzes via Moodle.
It has been tested on:
- Hot Potatoes 6
- - Moodle 1.1 thru 1.7
+ - Moodle 1.7
- PHP 4.1 thru 5.1.2
- MySQL 4.x thru 5.0
- PostgreSQL 7.3 thru 8.2
$hp = optional_param("hp"); // hotpot ID
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
$hp = optional_param("hp"); // hotpot ID
$attempt = required_param("attempt"); // A particular attempt ID for review
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
/// Code fragment to define the version of hotpot
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800; // release date of this version (see note below)
-$module->release = 'v2.1.21'; // human-friendly version name (used in mod/hotpot/lib.php)
+$module->version = 2006080900; // release date of this version (see note below)
+$module->release = 'v2.2.0'; // human-friendly version name (used in mod/hotpot/lib.php)
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 0; // period for cron to check this module (secs)
// interpretation of YYYYMMDDXY version numbers
// YYYY : year
$hp = optional_param("hp"); // hotpot ID
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
$id = required_param('id', PARAM_INT); // Course Module ID
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('journal', $id)) {
error("Course Module ID was incorrect");
}
$id = required_param('id', PARAM_INT); // course module
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('journal', $id)) {
error("Course Module ID was incorrect");
}
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800;
-$module->requires = 2005031000; // Requires this Moodle version
+$module->version = 2006080900;
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 60;
?>
$id = required_param('id', PARAM_INT); // Course Module ID
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('journal', $id)) {
error("Course Module ID was incorrect");
}
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800; // The current module version (Date: YYYYMMDDXX)
-$module->requires = 2004052505; // Requires this Moodle version
+$module->version = 2006080900; // The current module version (Date: YYYYMMDDXX)
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
?>
$l = optional_param('l',0,PARAM_INT); // Label ID
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('label', $id)) {
error("Course Module ID was incorrect");
}
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2006080900; // The current module version (Date: YYYYMMDDXX)
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
?>
$id = optional_param('id', 0, PARAM_INT); // Course Module ID, or
-if (! $cm = get_record("course_modules", "id", $id)) {
+if (! $cm = get_coursemodule_from_id('lams', $id)) {
error("Course Module ID was incorrect");
}
$id = required_param('id', PARAM_INT); // Course Module ID
$pageid = optional_param('pageid', '', PARAM_INT); // Page ID
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('lesson', $id)) {
error("Course Module ID was incorrect");
}
$pageid = optional_param('pageid', '', PARAM_INT); // Page ID
global $matches;
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('lesson', $id)) {
error("Course Module ID was incorrect");
}
$action = required_param('action', PARAM_ALPHA); // Action
// get some esential stuff...
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('lesson', $id)) {
error("Course Module ID was incorrect");
}
$id = required_param('id', PARAM_INT); // Course Module ID
$printclose = optional_param('printclose', 0, PARAM_INT);
- if (! $cm = get_record('course_modules', 'id', $id)) {
+ if (! $cm = get_coursemodule_from_id('lesson', $id)) {
error('Course Module ID was incorrect');
}
echo "<center><p>";
echo '<object classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"';
echo ' codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ';
- echo ' standby="Loading Microsoft® Windows® Media Player components..." ';
+ echo ' standby="Loading Microsoft(R) Windows(R) Media Player components..." ';
echo ' id="msplayer" align="" type="application/x-oleobject">';
echo "<param name=\"Filename\" value=\"$fullurl\">";
echo '<param name="ShowControls" value="true" />';
$action = optional_param('action', 'view', PARAM_ALPHA); // action to take
$nothingtodisplay = false;
- if (! $cm = get_record('course_modules', 'id', $id)) {
+ if (! $cm = get_coursemodule_from_id('lesson', $id)) {
error('Course Module ID was incorrect');
}
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800; // The current module version (Date: YYYYMMDDXX)
-$module->requires = 2005021600; // Requires this Moodle version
+$module->version = 2006080900; // The current module version (Date: YYYYMMDDXX)
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
?>
$mode = optional_param('mode', '', PARAM_ALPHA); // for eacherview action todo use user pref
- if (! $cm = get_record('course_modules', 'id', $id)) {
+ if (! $cm = get_coursemodule_from_id('lesson', $id)) {
error('Course Module ID was incorrect');
}
}
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('quiz', $id)) {
error("There is no coursemodule with id $id");
}
$mode = optional_param('mode', 'overview', PARAM_ALPHA); // Report mode
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('quiz', $id)) {
error("There is no coursemodule with id $id");
}
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800; // The (date) version of this module
-$module->requires = 2006022400; // Requires this Moodle version
+$module->version = 2006080900; // The (date) version of this module
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 0; // How often should cron check this module (seconds)?
?>
$edit = optional_param('edit', -1, PARAM_BOOL);
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('quiz', $id)) {
error("There is no coursemodule with id $id");
}
$id = required_param('id', PARAM_INT); // Course Module ID
$url = required_param('url', PARAM_URL); // url to fetch
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('resource', $id)) {
error("Course Module ID was incorrect");
}
global $course; // Ugly hack, needed for course language ugly hack
if ($cmid) {
- if (! $this->cm = get_record("course_modules", "id", $cmid)) {
+ if (! $this->cm = get_coursemodule_from_id('resource', $cmid)) {
error("Course Module ID was incorrect");
}
/// Fetch some records from DB
$course = get_record ('course', 'id', $courseid);
- $cm = get_record ('course_modules', 'id', $cmid);
+ $cm = get_coursemodule_from_id('resource', $cmid);
$resource = get_record ('resource', 'id', $cm->instance);
/// Get some needed strings
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800;
-$module->requires = 2005021600; // Requires this Moodle version
+$module->version = 2006080900;
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 0;
?>
}
} else if ($id) {
- if (! $cm = get_record('course_modules', 'id', $id)) {
+ if (! $cm = get_coursemodule_from_id('resource', $id)) {
error('Course Module ID was incorrect');
}
$attempt = required_param('attempt', PARAM_INT); // new attempt\r
\r
if (!empty($id)) {\r
- if (! $cm = get_record("course_modules", "id", $id)) {\r
+ if (! $cm = get_coursemodule_from_id('scorm', $id)) {\r
error("Course Module ID was incorrect");\r
}\r
if (! $course = get_record("course", "id", $cm->course)) {\r
$scoid = required_param('scoid', PARAM_INT); // sco ID\r
\r
if (!empty($id)) {\r
- if (! $cm = get_record("course_modules", "id", $id)) {\r
+ if (! $cm = get_coursemodule_from_id('scorm', $id)) {\r
error("Course Module ID was incorrect");\r
}\r
if (! $course = get_record("course", "id", $cm->course)) {\r
-<?PHP // $Id$\r
-\r
-/// This page prints a particular instance of aicc/scorm package\r
-\r
- require_once('../../config.php');\r
- require_once('locallib.php');\r
- require_once('sequencinglib.php');\r
- \r
- //\r
- // Checkin' script parameters\r
- //\r
- $id = optional_param('id', '', PARAM_INT); // Course Module ID, or\r
- $a = optional_param('a', '', PARAM_INT); // scorm ID\r
- $scoid = required_param('scoid', PARAM_INT); // sco ID\r
- $mode = optional_param('mode', 'normal', PARAM_ALPHA); // navigation mode\r
- $currentorg = optional_param('currentorg', '', PARAM_RAW); // selected organization\r
- $newattempt = optional_param('newattempt', 'off', PARAM_ALPHA); // the user request to start a new attempt\r
-\r
- if (!empty($id)) {\r
- if (! $cm = get_record("course_modules", "id", $id)) {\r
- error("Course Module ID was incorrect");\r
- }\r
- if (! $course = get_record("course", "id", $cm->course)) {\r
- error("Course is misconfigured");\r
- }\r
- if (! $scorm = get_record("scorm", "id", $cm->instance)) {\r
- error("Course module is incorrect");\r
- }\r
- } else if (!empty($a)) {\r
- if (! $scorm = get_record("scorm", "id", $a)) {\r
- error("Course module is incorrect");\r
- }\r
- if (! $course = get_record("course", "id", $scorm->course)) {\r
- error("Course is misconfigured");\r
- }\r
- if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {\r
- error("Course Module ID was incorrect");\r
- }\r
- } else {\r
- error('A required parameter is missing');\r
- }\r
-\r
- require_login($course->id, false, $cm);\r
-\r
- //$f = "D:\\test.txt";\r
- //@$ft = fopen($f,"a");\r
- //fwrite($ft,"\n ++ Thong tin quyen set attempt ".$USER->setAttempt);\r
- $strscorms = get_string('modulenameplural', 'scorm');\r
- $strscorm = get_string('modulename', 'scorm');\r
- $strpopup = get_string('popup','scorm');\r
-\r
- $attempt = scorm_get_last_attempt($scorm->id,$USER->id); \r
- \r
- //Kiem tra xem co phai la tiep tuc khong \r
- if ($mode=='continue') {\r
- $scoid = scorm_get_suspendscoid($scorm->id,$USER->id);\r
- $USER->setAttempt = 'set';\r
- $mode = 'normal';\r
- }\r
- if (($mode == 'normal') && ($USER->setAttempt == 'notset')) {\r
- $attempt++;\r
- $USER->setAttempt = 'set';\r
- }\r
- //Thuc hien Sequencing\r
-\r
- if ($mode!='review') {\r
- $sequencingResult = scorm_sequecingrule_implement($scorm->id,$scoid,$USER->id);\r
- //echo "<script language='JavaScript'>";\r
- // echo "alert('Sequencing');";\r
- //echo "<script>";\r
- if (($sequencingResult->rule == 'pre') && ($sequencingResult->action == 'disabled')){\r
- echo "<script language='JavaScript'>";\r
- echo "alert('Disabling');";\r
- echo "</script>"; \r
- }\r
- if (($sequencingResult->rule == 'exit') && ($sequencingResult->action == 'exit')){\r
- $exitscoid = get_sco_after_exit($scoid,$scorm->id);\r
- //fwrite($ft,"\n ++ Thong tin exit sco la ".$exitscoid);\r
- $orgstr = '¤torg='.$currentorg;\r
- $modepop = '&mode='.$mode;\r
- $scostr = '&scoid='.$exitscoid;\r
- echo "<script language='JavaScript'>";\r
- echo "alert('Exiting');";\r
- echo "location.href='".$CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modepop.$scostr."';";\r
- echo "</script>"; \r
- } \r
- } \r
-\r
- //Thiet lap attempt_status cho scoid\r
- scorm_set_attempt($scoid,$USER->id);\r
- //Ket thuc thiet lap attemp_status\r
- if ($mode!='review') {\r
- //Update trang thai\r
- scorm_rollup_updatestatus($scorm->id,$scoid,$USER->id);\r
- //------------------------------\r
- } \r
- //Thiet lap thong tin lien quan truy xuat Scorm\r
- $statistic = get_record('scorm_statistic',"scormid",$scorm->id,"userid",$USER->id);\r
- if (empty($statistic)) {\r
- $statisticInput->accesstime = time();\r
- $statisticInput->durationtime = 0;\r
- $statisticInput->status = 'during';\r
- $statisticInput->attemptnumber = $attempt;\r
- $statisticInput->scormid = $scorm->id;\r
- $statisticInput->userid = $USER->id;\r
- $statisticid = scorm_insert_statistic($statisticInput);\r
- } else {\r
- if ($statistic->status=='suspend') {\r
- $statisticInput->accesstime = time();\r
- $statisticInput->durationtime = $statistic->durationtime;\r
- $statisticInput->status = 'during';\r
- $statisticInput->attemptnumber = $attempt;\r
- $statisticInput->scormid = $scorm->id;\r
- $statisticInput->userid = $USER->id;\r
- }\r
- } \r
-\r
- //---------------------Ket thuc thiet lap thoi gian ---------------\r
-\r
- //Lay thoi gian toi da cho phep\r
- $absoluteTimeLimit = scorm_get_AbsoluteTimeLimit($scoid);\r
- if ($absoluteTimeLimit > 0) { \r
- echo "<script type='text/javascript'>"; \r
- echo "alert('Bai nay co thoi gian lam la: ".$absoluteTimeLimit."');";\r
- echo "function remind(msg1) {"; \r
- echo "var msg = 'Da het gio lam bai ' + msg1 +' Secs.Lua chon bai khac de tiep tuc';";\r
- echo "alert(msg);"; \r
- echo "window.location.href = 'view.php?id=".$scorm->id."';";\r
- echo "}";\r
- echo "setTimeout('remind(".$absoluteTimeLimit.")',".$absoluteTimeLimit.");";\r
- echo "</script>";\r
- }\r
- //--------------------------------\r
-\r
- \r
- if ($course->category != 0) {\r
- $navigation = "<a target=\"{$CFG->framename}\" href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";\r
- if ($scorms = get_all_instances_in_course('scorm', $course)) {\r
- // The module SCORM activity with the least id is the course \r
- $firstscorm = current($scorms);\r
- if (!(($course->format == 'scorm') && ($firstscorm->id == $scorm->id))) {\r
- $navigation .= "<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strscorms</a> ->";\r
- }\r
- }\r
- } else {\r
- $navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strscorms</a> ->";\r
- }\r
-\r
- $pagetitle = strip_tags("$course->shortname: ".format_string($scorm->name));\r
-\r
- if (!$cm->visible and !isteacher($course->id)) {\r
- print_header($pagetitle, "$course->fullname",\r
- "$navigation <a target='{$CFG->framename}' href='view.php?id=$cm->id'>".format_string($scorm->name,true)."</a>",\r
- '', '', true, update_module_button($cm->id, $course->id, $strscorm), '', false);\r
- notice(get_string("activityiscurrentlyhidden"));\r
- }\r
-\r
- //\r
- // TOC processing\r
- //\r
- //$attempt = scorm_get_last_attempt($scorm->id, $USER->id);\r
- //$f = "D:\\test.txt";\r
- //@$ft = fopen($f,"a");\r
- ////fwrite($ft,"\n ++ ++ + ++ Gia tri $attempt lay duoc la ".$attempt);\r
-\r
- //if ($mode=='normal'){\r
- // $newattempt = 'on';\r
- //}\r
- if (($newattempt=='on') && (($attempt < $scorm->maxattempt) || ($scorm->maxattempt == 0))) {\r
- $attempt++;\r
- //$f = "D:\\test.txt";\r
- //@$ft = fopen($f,"a");\r
- //fwrite($ft,"\n ----New attempt------- ".$attempt);\r
-\r
- }\r
- $attemptstr = '&attempt=' . $attempt;\r
-\r
- //fwrite($ft,"\n ----Gia tri attempt bay gio la------- ".$attempt);\r
- $result = scorm_get_toc($USER,$scorm,'structurelist',$currentorg,$scoid,$mode,$attempt,true);\r
- $sco = $result->sco;\r
-\r
- if (($mode == 'browse') && ($scorm->hidebrowse == 1)) {\r
- $mode = 'normal';\r
- }\r
- if ($mode != 'browse') {\r
- ////fwrite($ft,"\n ++ ++ + ++ Gia tri $mode khac browser ".$mode);\r
- if ($trackdata = scorm_get_tracks($sco->id,$USER->id,$attempt)) {\r
- if (($trackdata->status == 'completed') || ($trackdata->status == 'passed') || ($trackdata->status == 'failed')) {\r
- $mode = 'review';\r
- ////fwrite($ft,"\n ++ ++ + ++ Gia tri $mode ".$mode);\r
- } else {\r
- $mode = 'normal';\r
- ////fwrite($ft,"\n ++ ++ + ++ Gia tri $mode ".$mode);\r
- }\r
- }\r
- }\r
-\r
- add_to_log($course->id, 'scorm', 'view', "player.php?id=$cm->id&scoid=$sco->id", "$scorm->id");\r
-\r
- $scoidstr = '&scoid='.$sco->id;\r
- $scoidpop = '&scoid='.$sco->id;\r
- $modestr = '&mode='.$mode;\r
- if ($mode == 'browse') {\r
- $modepop = '&mode='.$mode;\r
- } else {\r
- $modepop = '';\r
- }\r
- $orgstr = '¤torg='.$currentorg;\r
-\r
- $SESSION->scorm_scoid = $sco->id;\r
- $SESSION->scorm_status = 'Not Initialized';\r
- $SESSION->scorm_mode = $mode;\r
- $SESSION->attempt = $attempt;\r
-\r
- // Doan code them\r
- ////fwrite($ft,"\n ++ ++ + ++ Gia tri attempt duoc gan cho user la ".$attempt);\r
- $USER->attempt = $attempt;\r
- //------------Ket thuc doan them\r
-\r
- //\r
- // Print the page header\r
- //\r
- $bodyscript = '';\r
- if ($scorm->popup == 1) {\r
- $bodyscript = 'onunload="main.close();"';\r
- }\r
-\r
- // Kiem tra xem co duoc exit khong\r
- if (scorm_isChoiceexit($sco->scorm,$sco->id)) {\r
- $exitlink = '(<a href="'.$CFG->wwwroot.'/course/view.php?id='.$cm->course.'">'.get_string('exit','scorm').'</a>) ';\r
- } else {\r
- $exitlink = get_string('exitisnotallowed','scorm');\r
- }\r
-\r
- //Luu giu khoa hoc thoat ra\r
- $suspend = '(<a href="suspend.php?scorm='.$sco->scorm.'&sco='.$sco->id.'&userid='.$USER->id.'&id='.$cm->course.'">'.get_string('suspend','scorm').'</a>) ';\r
-\r
- print_header($pagetitle, "$course->fullname",\r
- "$navigation <a target='{$CFG->framename}' href='view.php?id=$cm->id'>".format_string($scorm->name,true)."</a>",\r
- '', '', true, $exitlink.$suspend.update_module_button($cm->id, $course->id, $strscorm), '', false, $bodyscript);\r
- if ($sco->scormtype == 'sco') {\r
-?>\r
- <script language="JavaScript" type="text/javascript" src="request.js"></script>\r
- <script language="JavaScript" type="text/javascript" src="api.php?id=<?php echo $cm->id.$scoidstr.$modestr.$attemptstr ?>"></script>\r
-<?php\r
- }\r
- if (($sco->previd != 0) && ($sco->previous == 0)) {\r
- $scostr = '&scoid='.$sco->previd;\r
- echo ' <script language="javascript">var prev="'.$CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modepop.$scostr."\";</script>\n";\r
- } else {\r
- echo ' <script language="javascript">var prev="'.$CFG->wwwroot.'/mod/scorm/view.php?id='.$cm->id."\";</script>\n";\r
- }\r
- if (($sco->nextid != 0) && ($sco->next == 0)) {\r
- $scostr = '&scoid='.$sco->nextid;\r
- echo ' <script language="javascript">var next="'.$CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modepop.$scostr."\";</script>\n";\r
- } else {\r
- echo ' <script language="javascript">var next="'.$CFG->wwwroot.'/mod/scorm/view.php?id='.$cm->id."\";</script>\n";\r
- }\r
-?>\r
- <div id="scormpage">\r
-<?php \r
- if ($scorm->hidetoc == 0) {\r
-?>\r
- <div id="tocbox" class="generalbox">\r
- <div id="tochead" class="header"><?php print_string('coursestruct','scorm') ?></div>\r
- <div id="toctree">\r
- <?php echo $result->toc; ?>\r
- </div>\r
- </div>\r
-<?php\r
- $class = ' class="toc"';\r
- } else {\r
- $class = ' class="no-toc"';\r
- }\r
-?>\r
- <div id="scormbox"<?php echo $class ?>>\r
-<?php\r
- // This very big test check if is necessary the "scormtop" div\r
- if (\r
- ($mode != 'normal') || // We are not in normal mode so review or browse text will displayed\r
- (\r
- ($scorm->hidenav == 0) && // Teacher want to display navigation links\r
- (\r
- (\r
- ($sco->previd != 0) && // This is not the first learning object of the package\r
- ($sco->previous == 0) // Moodle must manage the previous link\r
- ) || \r
- (\r
- ($sco->nextid != 0) && // This is not the last learning object of the package\r
- ($sco->next == 0) // Moodle must manage the next link\r
- ) \r
- )\r
- ) || ($scorm->hidetoc == 2) // Teacher want to display toc in a small dropdown menu \r
- ) {\r
-?>\r
- <div id="scormtop">\r
- <?php echo $mode == 'browse' ? '<div id="scormmode" class="left">'.get_string('browsemode','scorm')."</div>\n" : ''; ?>\r
- <?php echo $mode == 'review' ? '<div id="scormmode" class="left">'.get_string('reviewmode','scorm')."</div>\n" : ''; ?>\r
-<?php\r
- if (($scorm->hidenav == 0) || ($scorm->hidetoc == 2)) {\r
-?>\r
- <div id="scormnav" class="right">\r
- <?php\r
- $orgstr = '&currentorg='.$currentorg;\r
- if (($scorm->hidenav == 0) && ($sco->previd != 0) && ($sco->previous == 0)) {\r
- /// Print the prev LO link\r
- $scostr = '&scoid='.$sco->previd;\r
- $url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;\r
- echo '<a href="'.$url.'">< '.get_string('prev','scorm').'</a>';\r
- }\r
- if ($scorm->hidetoc == 2) {\r
- echo $result->tocmenu;\r
- }\r
- if (($scorm->hidenav == 0) && ($sco->nextid != 0) && ($sco->next == 0)) {\r
- /// Print the next LO link\r
- $scostr = '&scoid='.$sco->nextid;\r
- $url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;\r
- echo ' <a href="'.$url.'">'.get_string('next','scorm').' ></a>';\r
- }\r
- ?>\r
-\r
- </div>\r
-<?php\r
- } \r
-?>\r
- </div>\r
-<?php\r
- } // The end of the very big test\r
-?>\r
- <div id="scormobject" class="right">\r
- <noscript>\r
- <div id="noscript">\r
- <?php print_string('noscriptnoscorm','scorm'); // No Martin(i), No Party ;-) ?>\r
-\r
- </div>\r
- </noscript>\r
-<?php\r
- if ($result->prerequisites) {\r
- if ($scorm->popup == 0) {\r
- if (strpos('MSIE',$_SERVER['HTTP_USER_AGENT']) === false) { \r
- /// Internet Explorer does not has full support to objects\r
-?>\r
- <iframe id="main" \r
- class="scoframe"\r
- width="<?php echo $scorm->width<=100 ? $scorm->width.'%' : $scorm->width ?>" \r
- height="<?php echo $scorm->height<=100 ? $scorm->height.'%' : $scorm->height ?>" \r
- src="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr ?>">\r
- </iframe>\r
-<?php\r
- } else {\r
-?>\r
- <object id="main" \r
- class="scoframe" \r
- width="<?php echo $scorm->width<=100 ? $scorm->width.'%' : $scorm->width ?>" \r
- height="<?php echo $scorm->height<=100 ? $scorm->height.'%' : $scorm->height ?>" \r
- data="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr ?>"\r
- type="text/html">\r
- <?php print_string('noobjectsupport', 'scorm'); ?>\r
- </object>\r
-<?php\r
- }\r
- } else {\r
-?>\r
- <script lanuguage="javascript">\r
- function openpopup(url,name,options,width,height) {\r
- fullurl = "<?php echo $CFG->wwwroot.'/mod/scorm/' ?>" + url;\r
- windowobj = window.open(fullurl,name,options);\r
- if ((width==100) && (height==100)) {\r
- // Fullscreen\r
- windowobj.moveTo(0,0);\r
- } \r
- if (width<=100) {\r
- width = Math.round(screen.availWidth * width / 100);\r
- }\r
- if (height<=100) {\r
- height = Math.round(screen.availHeight * height / 100);\r
- }\r
- windowobj.resizeTo(width,height);\r
- windowobj.focus();\r
- return windowobj;\r
- }\r
-\r
- url = "loadSCO.php?id=<?php echo $cm->id.$scoidpop ?>";\r
- width = <?php p($scorm->width) ?>;\r
- height = <?php p($scorm->height) ?>;\r
- var main = openpopup(url, "<?php p($scorm->name) ?>", "<?php p($scorm->options) ?>", width, height);\r
- </script>\r
- <noscript>\r
-<?php\r
- if (strpos('MSIE',$_SERVER['HTTP_USER_AGENT']) === false) { \r
- /// Internet Explorer does not has full support to objects\r
-?>\r
- <iframe id="main"\r
- class="scoframe"\r
- width="<?php echo $scorm->width<=100 ? $scorm->width.'%' : $scorm->width ?>" \r
- height="<?php echo $scorm->height<=100 ? $scorm->height.'%' : $scorm->height ?>" \r
- src="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr ?>">\r
- </iframe>\r
-<?php\r
- } else {\r
-?>\r
- <object id="main" \r
- class="scoframe" \r
- width="<?php echo $scorm->width<=100 ? $scorm->width.'%' : $scorm->width ?>" \r
- height="<?php echo $scorm->height<=100 ? $scorm->height.'%' : $scorm->height ?>" \r
- data="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr ?>"\r
- type="text/html">\r
- <?php print_string('noobjectsupport', 'scorm'); ?>\r
- </object>\r
-<?php\r
- }\r
-?>\r
- </noscript>\r
-<?php \r
- }\r
- } else {\r
- print_simple_box(get_string('noprerequisites','scorm'),'center');\r
- }\r
-?>\r
- </div> <!-- SCORM object -->\r
- </div> <!-- SCORM box -->\r
- </div> <!-- SCORM content -->\r
- </div> <!-- Content -->\r
- </div> <!-- Page -->\r
-\r
-</body>\r
-</html>\r
-\r
+<?PHP // $Id$
+
+/// This page prints a particular instance of aicc/scorm package
+
+ require_once('../../config.php');
+ require_once('locallib.php');
+ require_once('sequencinglib.php');
+
+ //
+ // Checkin' script parameters
+ //
+ $id = optional_param('id', '', PARAM_INT); // Course Module ID, or
+ $a = optional_param('a', '', PARAM_INT); // scorm ID
+ $scoid = required_param('scoid', PARAM_INT); // sco ID
+ $mode = optional_param('mode', 'normal', PARAM_ALPHA); // navigation mode
+ $currentorg = optional_param('currentorg', '', PARAM_RAW); // selected organization
+ $newattempt = optional_param('newattempt', 'off', PARAM_ALPHA); // the user request to start a new attempt
+
+ if (!empty($id)) {
+ if (! $cm = get_coursemodule_from_id('scorm', $id)) {
+ error("Course Module ID was incorrect");
+ }
+ if (! $course = get_record("course", "id", $cm->course)) {
+ error("Course is misconfigured");
+ }
+ if (! $scorm = get_record("scorm", "id", $cm->instance)) {
+ error("Course module is incorrect");
+ }
+ } else if (!empty($a)) {
+ if (! $scorm = get_record("scorm", "id", $a)) {
+ error("Course module is incorrect");
+ }
+ if (! $course = get_record("course", "id", $scorm->course)) {
+ error("Course is misconfigured");
+ }
+ if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
+ error("Course Module ID was incorrect");
+ }
+ } else {
+ error('A required parameter is missing');
+ }
+
+ require_login($course->id, false, $cm);
+
+ //$f = "D:\\test.txt";
+ //@$ft = fopen($f,"a");
+ //fwrite($ft,"\n ++ Thong tin quyen set attempt ".$USER->setAttempt);
+ $strscorms = get_string('modulenameplural', 'scorm');
+ $strscorm = get_string('modulename', 'scorm');
+ $strpopup = get_string('popup','scorm');
+
+ $attempt = scorm_get_last_attempt($scorm->id,$USER->id);
+
+ //Kiem tra xem co phai la tiep tuc khong
+ if ($mode=='continue') {
+ $scoid = scorm_get_suspendscoid($scorm->id,$USER->id);
+ $USER->setAttempt = 'set';
+ $mode = 'normal';
+ }
+ if (($mode == 'normal') && ($USER->setAttempt == 'notset')) {
+ $attempt++;
+ $USER->setAttempt = 'set';
+ }
+ //Thuc hien Sequencing
+
+ if ($mode!='review') {
+ $sequencingResult = scorm_sequecingrule_implement($scorm->id,$scoid,$USER->id);
+ //echo "<script language='JavaScript'>";
+ // echo "alert('Sequencing');";
+ //echo "<script>";
+ if (($sequencingResult->rule == 'pre') && ($sequencingResult->action == 'disabled')){
+ echo "<script language='JavaScript'>";
+ echo "alert('Disabling');";
+ echo "</script>";
+ }
+ if (($sequencingResult->rule == 'exit') && ($sequencingResult->action == 'exit')){
+ $exitscoid = get_sco_after_exit($scoid,$scorm->id);
+ //fwrite($ft,"\n ++ Thong tin exit sco la ".$exitscoid);
+ $orgstr = '¤torg='.$currentorg;
+ $modepop = '&mode='.$mode;
+ $scostr = '&scoid='.$exitscoid;
+ echo "<script language='JavaScript'>";
+ echo "alert('Exiting');";
+ echo "location.href='".$CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modepop.$scostr."';";
+ echo "</script>";
+ }
+ }
+
+ //Thiet lap attempt_status cho scoid
+ scorm_set_attempt($scoid,$USER->id);
+ //Ket thuc thiet lap attemp_status
+ if ($mode!='review') {
+ //Update trang thai
+ scorm_rollup_updatestatus($scorm->id,$scoid,$USER->id);
+ //------------------------------
+ }
+ //Thiet lap thong tin lien quan truy xuat Scorm
+ $statistic = get_record('scorm_statistic',"scormid",$scorm->id,"userid",$USER->id);
+ if (empty($statistic)) {
+ $statisticInput->accesstime = time();
+ $statisticInput->durationtime = 0;
+ $statisticInput->status = 'during';
+ $statisticInput->attemptnumber = $attempt;
+ $statisticInput->scormid = $scorm->id;
+ $statisticInput->userid = $USER->id;
+ $statisticid = scorm_insert_statistic($statisticInput);
+ } else {
+ if ($statistic->status=='suspend') {
+ $statisticInput->accesstime = time();
+ $statisticInput->durationtime = $statistic->durationtime;
+ $statisticInput->status = 'during';
+ $statisticInput->attemptnumber = $attempt;
+ $statisticInput->scormid = $scorm->id;
+ $statisticInput->userid = $USER->id;
+ }
+ }
+
+ //---------------------Ket thuc thiet lap thoi gian ---------------
+
+ //Lay thoi gian toi da cho phep
+ $absoluteTimeLimit = scorm_get_AbsoluteTimeLimit($scoid);
+ if ($absoluteTimeLimit > 0) {
+ echo "<script type='text/javascript'>";
+ echo "alert('Bai nay co thoi gian lam la: ".$absoluteTimeLimit."');";
+ echo "function remind(msg1) {";
+ echo "var msg = 'Da het gio lam bai ' + msg1 +' Secs.Lua chon bai khac de tiep tuc';";
+ echo "alert(msg);";
+ echo "window.location.href = 'view.php?id=".$scorm->id."';";
+ echo "}";
+ echo "setTimeout('remind(".$absoluteTimeLimit.")',".$absoluteTimeLimit.");";
+ echo "</script>";
+ }
+ //--------------------------------
+
+
+ if ($course->category != 0) {
+ $navigation = "<a target=\"{$CFG->framename}\" href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
+ if ($scorms = get_all_instances_in_course('scorm', $course)) {
+ // The module SCORM activity with the least id is the course
+ $firstscorm = current($scorms);
+ if (!(($course->format == 'scorm') && ($firstscorm->id == $scorm->id))) {
+ $navigation .= "<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strscorms</a> ->";
+ }
+ }
+ } else {
+ $navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strscorms</a> ->";
+ }
+
+ $pagetitle = strip_tags("$course->shortname: ".format_string($scorm->name));
+
+ if (!$cm->visible and !isteacher($course->id)) {
+ print_header($pagetitle, "$course->fullname",
+ "$navigation <a target='{$CFG->framename}' href='view.php?id=$cm->id'>".format_string($scorm->name,true)."</a>",
+ '', '', true, update_module_button($cm->id, $course->id, $strscorm), '', false);
+ notice(get_string("activityiscurrentlyhidden"));
+ }
+
+ //
+ // TOC processing
+ //
+ //$attempt = scorm_get_last_attempt($scorm->id, $USER->id);
+ //$f = "D:\\test.txt";
+ //@$ft = fopen($f,"a");
+ ////fwrite($ft,"\n ++ ++ + ++ Gia tri $attempt lay duoc la ".$attempt);
+
+ //if ($mode=='normal'){
+ // $newattempt = 'on';
+ //}
+ if (($newattempt=='on') && (($attempt < $scorm->maxattempt) || ($scorm->maxattempt == 0))) {
+ $attempt++;
+ //$f = "D:\\test.txt";
+ //@$ft = fopen($f,"a");
+ //fwrite($ft,"\n ----New attempt------- ".$attempt);
+
+ }
+ $attemptstr = '&attempt=' . $attempt;
+
+ //fwrite($ft,"\n ----Gia tri attempt bay gio la------- ".$attempt);
+ $result = scorm_get_toc($USER,$scorm,'structurelist',$currentorg,$scoid,$mode,$attempt,true);
+ $sco = $result->sco;
+
+ if (($mode == 'browse') && ($scorm->hidebrowse == 1)) {
+ $mode = 'normal';
+ }
+ if ($mode != 'browse') {
+ ////fwrite($ft,"\n ++ ++ + ++ Gia tri $mode khac browser ".$mode);
+ if ($trackdata = scorm_get_tracks($sco->id,$USER->id,$attempt)) {
+ if (($trackdata->status == 'completed') || ($trackdata->status == 'passed') || ($trackdata->status == 'failed')) {
+ $mode = 'review';
+ ////fwrite($ft,"\n ++ ++ + ++ Gia tri $mode ".$mode);
+ } else {
+ $mode = 'normal';
+ ////fwrite($ft,"\n ++ ++ + ++ Gia tri $mode ".$mode);
+ }
+ }
+ }
+
+ add_to_log($course->id, 'scorm', 'view', "player.php?id=$cm->id&scoid=$sco->id", "$scorm->id");
+
+ $scoidstr = '&scoid='.$sco->id;
+ $scoidpop = '&scoid='.$sco->id;
+ $modestr = '&mode='.$mode;
+ if ($mode == 'browse') {
+ $modepop = '&mode='.$mode;
+ } else {
+ $modepop = '';
+ }
+ $orgstr = '¤torg='.$currentorg;
+
+ $SESSION->scorm_scoid = $sco->id;
+ $SESSION->scorm_status = 'Not Initialized';
+ $SESSION->scorm_mode = $mode;
+ $SESSION->attempt = $attempt;
+
+ // Doan code them
+ ////fwrite($ft,"\n ++ ++ + ++ Gia tri attempt duoc gan cho user la ".$attempt);
+ $USER->attempt = $attempt;
+ //------------Ket thuc doan them
+
+ //
+ // Print the page header
+ //
+ $bodyscript = '';
+ if ($scorm->popup == 1) {
+ $bodyscript = 'onunload="main.close();"';
+ }
+
+ // Kiem tra xem co duoc exit khong
+ if (scorm_isChoiceexit($sco->scorm,$sco->id)) {
+ $exitlink = '(<a href="'.$CFG->wwwroot.'/course/view.php?id='.$cm->course.'">'.get_string('exit','scorm').'</a>) ';
+ } else {
+ $exitlink = get_string('exitisnotallowed','scorm');
+ }
+
+ //Luu giu khoa hoc thoat ra
+ $suspend = '(<a href="suspend.php?scorm='.$sco->scorm.'&sco='.$sco->id.'&userid='.$USER->id.'&id='.$cm->course.'">'.get_string('suspend','scorm').'</a>) ';
+
+ print_header($pagetitle, "$course->fullname",
+ "$navigation <a target='{$CFG->framename}' href='view.php?id=$cm->id'>".format_string($scorm->name,true)."</a>",
+ '', '', true, $exitlink.$suspend.update_module_button($cm->id, $course->id, $strscorm), '', false, $bodyscript);
+ if ($sco->scormtype == 'sco') {
+?>
+ <script language="JavaScript" type="text/javascript" src="request.js"></script>
+ <script language="JavaScript" type="text/javascript" src="api.php?id=<?php echo $cm->id.$scoidstr.$modestr.$attemptstr ?>"></script>
+<?php
+ }
+ if (($sco->previd != 0) && ($sco->previous == 0)) {
+ $scostr = '&scoid='.$sco->previd;
+ echo ' <script language="javascript">var prev="'.$CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modepop.$scostr."\";</script>\n";
+ } else {
+ echo ' <script language="javascript">var prev="'.$CFG->wwwroot.'/mod/scorm/view.php?id='.$cm->id."\";</script>\n";
+ }
+ if (($sco->nextid != 0) && ($sco->next == 0)) {
+ $scostr = '&scoid='.$sco->nextid;
+ echo ' <script language="javascript">var next="'.$CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modepop.$scostr."\";</script>\n";
+ } else {
+ echo ' <script language="javascript">var next="'.$CFG->wwwroot.'/mod/scorm/view.php?id='.$cm->id."\";</script>\n";
+ }
+?>
+ <div id="scormpage">
+<?php
+ if ($scorm->hidetoc == 0) {
+?>
+ <div id="tocbox" class="generalbox">
+ <div id="tochead" class="header"><?php print_string('coursestruct','scorm') ?></div>
+ <div id="toctree">
+ <?php echo $result->toc; ?>
+ </div>
+ </div>
+<?php
+ $class = ' class="toc"';
+ } else {
+ $class = ' class="no-toc"';
+ }
+?>
+ <div id="scormbox"<?php echo $class ?>>
+<?php
+ // This very big test check if is necessary the "scormtop" div
+ if (
+ ($mode != 'normal') || // We are not in normal mode so review or browse text will displayed
+ (
+ ($scorm->hidenav == 0) && // Teacher want to display navigation links
+ (
+ (
+ ($sco->previd != 0) && // This is not the first learning object of the package
+ ($sco->previous == 0) // Moodle must manage the previous link
+ ) ||
+ (
+ ($sco->nextid != 0) && // This is not the last learning object of the package
+ ($sco->next == 0) // Moodle must manage the next link
+ )
+ )
+ ) || ($scorm->hidetoc == 2) // Teacher want to display toc in a small dropdown menu
+ ) {
+?>
+ <div id="scormtop">
+ <?php echo $mode == 'browse' ? '<div id="scormmode" class="left">'.get_string('browsemode','scorm')."</div>\n" : ''; ?>
+ <?php echo $mode == 'review' ? '<div id="scormmode" class="left">'.get_string('reviewmode','scorm')."</div>\n" : ''; ?>
+<?php
+ if (($scorm->hidenav == 0) || ($scorm->hidetoc == 2)) {
+?>
+ <div id="scormnav" class="right">
+ <?php
+ $orgstr = '&currentorg='.$currentorg;
+ if (($scorm->hidenav == 0) && ($sco->previd != 0) && ($sco->previous == 0)) {
+ /// Print the prev LO link
+ $scostr = '&scoid='.$sco->previd;
+ $url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
+ echo '<a href="'.$url.'">< '.get_string('prev','scorm').'</a>';
+ }
+ if ($scorm->hidetoc == 2) {
+ echo $result->tocmenu;
+ }
+ if (($scorm->hidenav == 0) && ($sco->nextid != 0) && ($sco->next == 0)) {
+ /// Print the next LO link
+ $scostr = '&scoid='.$sco->nextid;
+ $url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
+ echo ' <a href="'.$url.'">'.get_string('next','scorm').' ></a>';
+ }
+ ?>
+
+ </div>
+<?php
+ }
+?>
+ </div>
+<?php
+ } // The end of the very big test
+?>
+ <div id="scormobject" class="right">
+ <noscript>
+ <div id="noscript">
+ <?php print_string('noscriptnoscorm','scorm'); // No Martin(i), No Party ;-) ?>
+
+ </div>
+ </noscript>
+<?php
+ if ($result->prerequisites) {
+ if ($scorm->popup == 0) {
+ if (strpos('MSIE',$_SERVER['HTTP_USER_AGENT']) === false) {
+ /// Internet Explorer does not has full support to objects
+?>
+ <iframe id="main"
+ class="scoframe"
+ width="<?php echo $scorm->width<=100 ? $scorm->width.'%' : $scorm->width ?>"
+ height="<?php echo $scorm->height<=100 ? $scorm->height.'%' : $scorm->height ?>"
+ src="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr ?>">
+ </iframe>
+<?php
+ } else {
+?>
+ <object id="main"
+ class="scoframe"
+ width="<?php echo $scorm->width<=100 ? $scorm->width.'%' : $scorm->width ?>"
+ height="<?php echo $scorm->height<=100 ? $scorm->height.'%' : $scorm->height ?>"
+ data="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr ?>"
+ type="text/html">
+ <?php print_string('noobjectsupport', 'scorm'); ?>
+ </object>
+<?php
+ }
+ } else {
+?>
+ <script lanuguage="javascript">
+ function openpopup(url,name,options,width,height) {
+ fullurl = "<?php echo $CFG->wwwroot.'/mod/scorm/' ?>" + url;
+ windowobj = window.open(fullurl,name,options);
+ if ((width==100) && (height==100)) {
+ // Fullscreen
+ windowobj.moveTo(0,0);
+ }
+ if (width<=100) {
+ width = Math.round(screen.availWidth * width / 100);
+ }
+ if (height<=100) {
+ height = Math.round(screen.availHeight * height / 100);
+ }
+ windowobj.resizeTo(width,height);
+ windowobj.focus();
+ return windowobj;
+ }
+
+ url = "loadSCO.php?id=<?php echo $cm->id.$scoidpop ?>";
+ width = <?php p($scorm->width) ?>;
+ height = <?php p($scorm->height) ?>;
+ var main = openpopup(url, "<?php p($scorm->name) ?>", "<?php p($scorm->options) ?>", width, height);
+ </script>
+ <noscript>
+<?php
+ if (strpos('MSIE',$_SERVER['HTTP_USER_AGENT']) === false) {
+ /// Internet Explorer does not has full support to objects
+?>
+ <iframe id="main"
+ class="scoframe"
+ width="<?php echo $scorm->width<=100 ? $scorm->width.'%' : $scorm->width ?>"
+ height="<?php echo $scorm->height<=100 ? $scorm->height.'%' : $scorm->height ?>"
+ src="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr ?>">
+ </iframe>
+<?php
+ } else {
+?>
+ <object id="main"
+ class="scoframe"
+ width="<?php echo $scorm->width<=100 ? $scorm->width.'%' : $scorm->width ?>"
+ height="<?php echo $scorm->height<=100 ? $scorm->height.'%' : $scorm->height ?>"
+ data="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr ?>"
+ type="text/html">
+ <?php print_string('noobjectsupport', 'scorm'); ?>
+ </object>
+<?php
+ }
+?>
+ </noscript>
+<?php
+ }
+ } else {
+ print_simple_box(get_string('noprerequisites','scorm'),'center');
+ }
+?>
+ </div> <!-- SCORM object -->
+ </div> <!-- SCORM box -->
+ </div> <!-- SCORM content -->
+ </div> <!-- Content -->
+ </div> <!-- Page -->
+
+</body>
+</html>
+
-<?php // $Id$\r
-\r
-// This script uses installed report plugins to print quiz reports\r
-\r
- require_once("../../config.php");\r
- require_once('locallib.php');\r
- \r
- $id = optional_param('id', '', PARAM_INT); // Course Module ID, or\r
- $a = optional_param('a', '', PARAM_INT); // SCORM ID\r
- $b = optional_param('b', '', PARAM_INT); // SCO ID\r
- $user = optional_param('user', '', PARAM_INT); // User ID\r
-\r
- if (!empty($id)) {\r
- if (! $cm = get_record("course_modules", "id", $id)) {\r
- error("Course Module ID was incorrect");\r
- }\r
- if (! $course = get_record("course", "id", $cm->course)) {\r
- error("Course is misconfigured");\r
- }\r
- if (! $scorm = get_record("scorm", "id", $cm->instance)) {\r
- error("Course module is incorrect");\r
- }\r
- } else {\r
- if (!empty($b)) {\r
- if (! $sco = get_record("scorm_scoes", "id", $b)) {\r
- error("Scorm activity is incorrect");\r
- }\r
- $a = $sco->scorm;\r
- }\r
- if (!empty($a)) {\r
- if (! $scorm = get_record("scorm", "id", $a)) {\r
- error("Course module is incorrect");\r
- }\r
- if (! $course = get_record("course", "id", $scorm->course)) {\r
- error("Course is misconfigured");\r
- }\r
- if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {\r
- error("Course Module ID was incorrect");\r
- }\r
- }\r
- }\r
-\r
- require_login($course->id, false, $cm);\r
-\r
- if (!isteacher($course->id)) {\r
- error("You are not allowed to use this script");\r
- }\r
-\r
- add_to_log($course->id, "scorm", "report", "report.php?id=$cm->id", "$scorm->id");\r
-\r
-/// Print the page header\r
- if (empty($noheader)) {\r
- if ($course->category) {\r
- $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";\r
- } else {\r
- $navigation = '';\r
- }\r
-\r
- $strscorms = get_string("modulenameplural", "scorm");\r
- $strscorm = get_string("modulename", "scorm");\r
- $strreport = get_string("report", "scorm");\r
- $strname = get_string('name');\r
- if (empty($b)) {\r
- print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",\r
- "$navigation <a href=\"index.php?id=$course->id\">$strscorms</a>\r
- -> <a href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a> -> $strreport",\r
- "", "", true);\r
- } else {\r
- print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",\r
- "$navigation <a href=\"index.php?id=$course->id\">$strscorms</a>\r
- -> <a href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>\r
- -> <a href=\"report.php?id=$cm->id\">$strreport</a> -> $sco->title",\r
- "", "", true);\r
- }\r
- print_heading(format_string($scorm->name));\r
- }\r
-\r
- $scormpixdir = $CFG->modpixpath.'/scorm/pix';\r
-\r
- if (empty($b) ) {\r
- if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' ORDER BY id")) {\r
- if ($scousers=get_records_select("scorm_scoes_track", "scormid='$scorm->id' GROUP BY userid,scormid", "", "userid,scormid")) {\r
- $table = new stdClass();\r
- $table->head = array(' ', $strname);\r
- $table->align = array('center', 'left');\r
- $table->wrap = array('nowrap', 'nowrap');\r
- $table->width = '100%';\r
- $table->size = array(10, '*');\r
- foreach ($scoes as $sco) {\r
- if ($sco->launch!='') {\r
- $table->head[]=scorm_string_wrap($sco->title);\r
- //$table->head[]=$sco->title;\r
- $table->align[] = 'center';\r
- $table->wrap[] = 'nowrap';\r
- $table->size[] = '*';\r
- }\r
- }\r
-\r
- foreach ($scousers as $scouser) {\r
- if ($userdata = scorm_get_user_data($scouser->userid)) {\r
- $row = array();\r
- $row[] = print_user_picture($scouser->userid, $course->id, $userdata->picture, false, true);\r
- $row[] = "<a href=\"$CFG->wwwroot/user/view.php?id=$scouser->userid&course=$course->id\">".\r
- "$userdata->firstname $userdata->lastname</a>";\r
- foreach ($scoes as $sco) {\r
- if ($sco->launch!='') {\r
- $anchorstart = '';\r
- $anchorend = '';\r
- $scoreview = '';\r
- if ($trackdata = scorm_get_tracks($sco->id,$scouser->userid)) {\r
- if ($trackdata->score_raw != '') {\r
- $scoreview = '<br />'.get_string('score','scorm').': '.$trackdata->score_raw;\r
- }\r
- if ($trackdata->status == '') {\r
- $trackdata->status = 'notattempted';\r
- } else {\r
- $anchorstart = '<a href="report.php?b='.$sco->id.'&user='.$scouser->userid.'" title="'.\r
- get_string('details','scorm').'">';\r
- $anchorend = '</a>';\r
- }\r
- } else {\r
- $trackdata->status = 'notattempted';\r
- $trackdata->total_time = '';\r
- }\r
- $strstatus = get_string($trackdata->status,'scorm');\r
- $row[] = $anchorstart.'<img src="'.$scormpixdir.'/'.$trackdata->status.'.gif" alt="'.$strstatus.'" title="'.\r
- $strstatus.'"> '.$trackdata->total_time.$scoreview.$anchorend;\r
- }\r
- }\r
- $table->data[] = $row;\r
- }\r
- }\r
- print_table($table);\r
- } else {\r
- notice('No users to report');\r
- }\r
- }\r
- } else {\r
- if (!empty($user)) {\r
- if ($userdata = scorm_get_user_data($user)) {\r
- print_simple_box_start('center');\r
- print_heading(format_string($sco->title));\r
- echo '<div align="center">'."\n";\r
- print_user_picture($user, $course->id, $userdata->picture, false, false);\r
- echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user&course=$course->id\">".\r
- "$userdata->firstname $userdata->lastname</a><br />";\r
- $scoreview = '';\r
- if ($trackdata = scorm_get_tracks($sco->id,$user)) {\r
- if ($trackdata->score_raw != '') {\r
- $scoreview = get_string('score','scorm').': '.$trackdata->score_raw;\r
- }\r
- if ($trackdata->status == '') {\r
- $trackdata->status = 'notattempted';\r
- }\r
- } else {\r
- $trackdata->status = 'notattempted';\r
- $trackdata->total_time = '';\r
- }\r
- $strstatus = get_string($trackdata->status,'scorm');\r
- echo '<img src="'.$scormpixdir.'/'.$trackdata->status.'.gif" alt="'.$strstatus.'" title="'.\r
- $strstatus.'"> '.$trackdata->total_time.'<br />'.$scoreview.'<br />';\r
- echo '</div>'."\n";\r
- echo '<hr /><h2>'.get_string('details','scorm').'</h2>';\r
- \r
- // Print general score data\r
- $table = new stdClass();\r
- $table->head = array(get_string('element','scorm'), get_string('value','scorm'));\r
- $table->align = array('left', 'left');\r
- $table->wrap = array('nowrap', 'nowrap');\r
- $table->width = '100%';\r
- $table->size = array('*', '*');\r
- \r
- $existelements = false;\r
- if ($scorm->version == 'SCORM_1.3') {\r
- $elements = array('raw' => 'cmi.score.raw',\r
- 'min' => 'cmi.score.min',\r
- 'max' => 'cmi.score.max',\r
- 'status' => 'cmi.completition_status',\r
- 'time' => 'cmi.total_time');\r
- } else {\r
- $elements = array('raw' => 'cmi.core.score.raw',\r
- 'min' => 'cmi.core.score.min',\r
- 'max' => 'cmi.core.score.max',\r
- 'status' => 'cmi.core.lesson_status',\r
- 'time' => 'cmi.core.total_time');\r
- }\r
- foreach ($elements as $key => $element) {\r
- if (isset($trackdata->$element)) {\r
- $existelements = true;\r
- $printedelements[]=$element;\r
- $row = array();\r
- $row[] = get_string($key,'scorm');\r
- $row[] = $trackdata->$element;\r
- $table->data[] = $row;\r
- }\r
- }\r
- if ($existelements) {\r
- echo '<h3>'.get_string('general','scorm').'</h3>';\r
- print_table($table);\r
- } \r
- \r
- // Print Interactions data\r
- $table = new stdClass();\r
- $table->head = array(get_string('identifier','scorm'),\r
- get_string('type','scorm'),\r
- get_string('result','scorm'),\r
- get_string('student_response','scorm'));\r
- $table->align = array('center', 'center', 'center', 'center');\r
- $table->wrap = array('nowrap', 'nowrap', 'nowrap', 'nowrap');\r
- $table->width = '100%';\r
- $table->size = array('*', '*', '*', '*', '*');\r
- \r
- $existinteraction = false;\r
- \r
- $i = 0;\r
- $interactionid = 'cmi.interactions.'.$i.'.id';\r
- \r
- while (isset($trackdata->$interactionid)) {\r
- $existinteraction = true;\r
- $printedelements[]=$interactionid;\r
- $elements = array($interactionid,\r
- 'cmi.interactions.'.$i.'.type',\r
- 'cmi.interactions.'.$i.'.result',\r
- 'cmi.interactions.'.$i.'.student_response');\r
- $row = array();\r
- foreach ($elements as $element) {\r
- if (isset($trackdata->$element)) {\r
- $row[] = $trackdata->$element;\r
- $printedelements[]=$element;\r
- } else {\r
- $row[] = ' ';\r
- }\r
- }\r
- $table->data[] = $row;\r
- \r
- $i++;\r
- $interactionid = 'cmi.interactions.'.$i.'.id';\r
- }\r
- if ($existinteraction) {\r
- echo '<h3>'.get_string('interactions','scorm').'</h3>';\r
- print_table($table);\r
- }\r
- \r
- // Print Objectives data\r
- $table = new stdClass();\r
- $table->head = array(get_string('identifier','scorm'),\r
- get_string('status','scorm'),\r
- get_string('raw','scorm'),\r
- get_string('min','scorm'),\r
- get_string('max','scorm'));\r
- $table->align = array('center', 'center', 'center', 'center', 'center');\r
- $table->wrap = array('nowrap', 'nowrap', 'nowrap', 'nowrap', 'nowrap');\r
- $table->width = '100%';\r
- $table->size = array('*', '*', '*', '*', '*');\r
- \r
- $existobjective = false;\r
- \r
- $i = 0;\r
- $objectiveid = 'cmi.objectives.'.$i.'.id';\r
- \r
- while (isset($trackdata->$objectiveid)) {\r
- $existobjective = true;\r
- $printedelements[]=$objectiveid;\r
- $elements = array($objectiveid,\r
- 'cmi.objectives.'.$i.'.status',\r
- 'cmi.objectives.'.$i.'.score.raw',\r
- 'cmi.objectives.'.$i.'.score.min',\r
- 'cmi.objectives.'.$i.'.score.max');\r
- $row = array();\r
- foreach ($elements as $element) {\r
- if (isset($trackdata->$element)) {\r
- $row[] = $trackdata->$element;\r
- $printedelements[]=$element;\r
- } else {\r
- $row[] = ' ';\r
- }\r
- }\r
- $table->data[] = $row;\r
- \r
- $i++;\r
- $objectiveid = 'cmi.objectives.'.$i.'.id';\r
- }\r
- if ($existobjective) {\r
- echo '<h3>'.get_string('objectives','scorm').'</h3>';\r
- print_table($table);\r
- }\r
- $table = new stdClass();\r
- $table->head = array(get_string('element','scorm'), get_string('value','scorm'));\r
- $table->align = array('left', 'left');\r
- $table->wrap = array('nowrap', 'wrap');\r
- $table->width = '100%';\r
- $table->size = array('*', '*');\r
- \r
- $existelements = false;\r
- \r
- foreach($trackdata as $element => $value) {\r
- if (substr($element,0,3) == 'cmi') { \r
- if (!(in_array ($element, $printedelements))) {\r
- $existelements = true;\r
- $row = array();\r
- $row[] = get_string($element,'scorm') != '[['.$element.']]' ? get_string($element,'scorm') : $element;\r
- $row[] = $value;\r
- $table->data[] = $row;\r
- }\r
- }\r
- }\r
- if ($existelements) {\r
- echo '<h3>'.get_string('othertracks','scorm').'</h3>';\r
- print_table($table);\r
- } \r
- print_simple_box_end();\r
- }\r
- } else {\r
- error('Missing script parameter');\r
- }\r
- }\r
- \r
- print_heading(format_string(get_string('timestatistic','scorm')));\r
- $scousers=get_records_select("scorm_scoes_track", "scormid='$scorm->id' GROUP BY userid,scormid", "", "userid,scormid"); \r
- $attempt = scorm_get_last_attempt($scorm->id,$USER->id); \r
- \r
- foreach($scousers as $scouser){\r
- $str = 'scormid ='.($scorm->id).' and userid = '.$scouser->userid.' and attempt = '.$attempt.' ORDER BY timemodified asc';\r
- $endtrack = get_record_select("scorm_scoes_track", $str,'max(timemodified) as maxtimemodified');\r
-\r
- }\r
-\r
-//Phan trinh bay thong ke theo thoi gian\r
- $table = new stdClass();\r
- $table->head = array(' ', get_string('name','scorm'));\r
- $table->align = array('center', 'left');\r
- $table->wrap = array('nowrap', 'nowrap');\r
- $table->width = '100%';\r
- $table->size = array(10, '*');\r
-\r
- $table->head[]=scorm_string_wrap(get_string('beginTime','scorm'));\r
- $table->align[] = 'center';\r
- $table->wrap[] = 'nowrap';\r
- $table->size[] = '*';\r
-\r
- $table->head[]=scorm_string_wrap(get_string('endTime','scorm'));\r
- $table->align[] = 'center';\r
- $table->wrap[] = 'nowrap';\r
- $table->size[] = '*';\r
-\r
- $row = array();\r
- $row[] = "";\r
- $row[] = "(".get_string('coefficient','scorm').")";\r
- foreach($scousers as $scouser){\r
- $userdata = scorm_get_user_data($scouser->userid);\r
- $row = array();\r
- $row[] = print_user_picture($scouser->userid, $course->id, $userdata->picture, false, true);\r
- $row[] = "<a href=\"$CFG->wwwroot/user/view.php?id=$scouser->userid&course=$course->id\">".\r
- "$userdata->firstname $userdata->lastname</a>"; \r
- $str = 'scormid ='.($scorm->id).' and userid = '.$scouser->userid.' and attempt = '.$attempt.' ORDER BY timemodified asc';\r
- $begintrack = get_record_select("scorm_scoes_track", $str,'min(timemodified) as mintimemodified'); \r
- $row[] = strftime( "%H h -%M ' - %S s - %d -%m-%Y", $begintrack->mintimemodified); \r
- $endtrack = get_record_select("scorm_scoes_track", $str,'max(timemodified) as maxtimemodified');\r
- $row[] = strftime( "%H h -%M ' - %S s - %d -%m-%Y", $endtrack->maxtimemodified);\r
- $table->data[] = $row;\r
- }\r
- print_table($table);\r
- \r
- echo "<br><a href='viewScore.php?a=$scorm->id'>".format_string(get_string('viewscore','scorm'))."</a>";\r
- if (empty($noheader)) {\r
- print_footer($course);\r
- }\r
-?>\r
+<?php // $Id$
+
+// This script uses installed report plugins to print quiz reports
+
+ require_once("../../config.php");
+ require_once('locallib.php');
+
+ $id = optional_param('id', '', PARAM_INT); // Course Module ID, or
+ $a = optional_param('a', '', PARAM_INT); // SCORM ID
+ $b = optional_param('b', '', PARAM_INT); // SCO ID
+ $user = optional_param('user', '', PARAM_INT); // User ID
+
+ if (!empty($id)) {
+ if (! $cm = get_coursemodule_from_id('scorm', $id)) {
+ error("Course Module ID was incorrect");
+ }
+ if (! $course = get_record("course", "id", $cm->course)) {
+ error("Course is misconfigured");
+ }
+ if (! $scorm = get_record("scorm", "id", $cm->instance)) {
+ error("Course module is incorrect");
+ }
+ } else {
+ if (!empty($b)) {
+ if (! $sco = get_record("scorm_scoes", "id", $b)) {
+ error("Scorm activity is incorrect");
+ }
+ $a = $sco->scorm;
+ }
+ if (!empty($a)) {
+ if (! $scorm = get_record("scorm", "id", $a)) {
+ error("Course module is incorrect");
+ }
+ if (! $course = get_record("course", "id", $scorm->course)) {
+ error("Course is misconfigured");
+ }
+ if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
+ error("Course Module ID was incorrect");
+ }
+ }
+ }
+
+ require_login($course->id, false, $cm);
+
+ if (!isteacher($course->id)) {
+ error("You are not allowed to use this script");
+ }
+
+ add_to_log($course->id, "scorm", "report", "report.php?id=$cm->id", "$scorm->id");
+
+/// Print the page header
+ if (empty($noheader)) {
+ if ($course->category) {
+ $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
+ } else {
+ $navigation = '';
+ }
+
+ $strscorms = get_string("modulenameplural", "scorm");
+ $strscorm = get_string("modulename", "scorm");
+ $strreport = get_string("report", "scorm");
+ $strname = get_string('name');
+ if (empty($b)) {
+ print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
+ "$navigation <a href=\"index.php?id=$course->id\">$strscorms</a>
+ -> <a href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a> -> $strreport",
+ "", "", true);
+ } else {
+ print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
+ "$navigation <a href=\"index.php?id=$course->id\">$strscorms</a>
+ -> <a href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>
+ -> <a href=\"report.php?id=$cm->id\">$strreport</a> -> $sco->title",
+ "", "", true);
+ }
+ print_heading(format_string($scorm->name));
+ }
+
+ $scormpixdir = $CFG->modpixpath.'/scorm/pix';
+
+ if (empty($b) ) {
+ if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' ORDER BY id")) {
+ if ($scousers=get_records_select("scorm_scoes_track", "scormid='$scorm->id' GROUP BY userid,scormid", "", "userid,scormid")) {
+ $table = new stdClass();
+ $table->head = array(' ', $strname);
+ $table->align = array('center', 'left');
+ $table->wrap = array('nowrap', 'nowrap');
+ $table->width = '100%';
+ $table->size = array(10, '*');
+ foreach ($scoes as $sco) {
+ if ($sco->launch!='') {
+ $table->head[]=scorm_string_wrap($sco->title);
+ //$table->head[]=$sco->title;
+ $table->align[] = 'center';
+ $table->wrap[] = 'nowrap';
+ $table->size[] = '*';
+ }
+ }
+
+ foreach ($scousers as $scouser) {
+ if ($userdata = scorm_get_user_data($scouser->userid)) {
+ $row = array();
+ $row[] = print_user_picture($scouser->userid, $course->id, $userdata->picture, false, true);
+ $row[] = "<a href=\"$CFG->wwwroot/user/view.php?id=$scouser->userid&course=$course->id\">".
+ "$userdata->firstname $userdata->lastname</a>";
+ foreach ($scoes as $sco) {
+ if ($sco->launch!='') {
+ $anchorstart = '';
+ $anchorend = '';
+ $scoreview = '';
+ if ($trackdata = scorm_get_tracks($sco->id,$scouser->userid)) {
+ if ($trackdata->score_raw != '') {
+ $scoreview = '<br />'.get_string('score','scorm').': '.$trackdata->score_raw;
+ }
+ if ($trackdata->status == '') {
+ $trackdata->status = 'notattempted';
+ } else {
+ $anchorstart = '<a href="report.php?b='.$sco->id.'&user='.$scouser->userid.'" title="'.
+ get_string('details','scorm').'">';
+ $anchorend = '</a>';
+ }
+ } else {
+ $trackdata->status = 'notattempted';
+ $trackdata->total_time = '';
+ }
+ $strstatus = get_string($trackdata->status,'scorm');
+ $row[] = $anchorstart.'<img src="'.$scormpixdir.'/'.$trackdata->status.'.gif" alt="'.$strstatus.'" title="'.
+ $strstatus.'"> '.$trackdata->total_time.$scoreview.$anchorend;
+ }
+ }
+ $table->data[] = $row;
+ }
+ }
+ print_table($table);
+ } else {
+ notice('No users to report');
+ }
+ }
+ } else {
+ if (!empty($user)) {
+ if ($userdata = scorm_get_user_data($user)) {
+ print_simple_box_start('center');
+ print_heading(format_string($sco->title));
+ echo '<div align="center">'."\n";
+ print_user_picture($user, $course->id, $userdata->picture, false, false);
+ echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user&course=$course->id\">".
+ "$userdata->firstname $userdata->lastname</a><br />";
+ $scoreview = '';
+ if ($trackdata = scorm_get_tracks($sco->id,$user)) {
+ if ($trackdata->score_raw != '') {
+ $scoreview = get_string('score','scorm').': '.$trackdata->score_raw;
+ }
+ if ($trackdata->status == '') {
+ $trackdata->status = 'notattempted';
+ }
+ } else {
+ $trackdata->status = 'notattempted';
+ $trackdata->total_time = '';
+ }
+ $strstatus = get_string($trackdata->status,'scorm');
+ echo '<img src="'.$scormpixdir.'/'.$trackdata->status.'.gif" alt="'.$strstatus.'" title="'.
+ $strstatus.'"> '.$trackdata->total_time.'<br />'.$scoreview.'<br />';
+ echo '</div>'."\n";
+ echo '<hr /><h2>'.get_string('details','scorm').'</h2>';
+
+ // Print general score data
+ $table = new stdClass();
+ $table->head = array(get_string('element','scorm'), get_string('value','scorm'));
+ $table->align = array('left', 'left');
+ $table->wrap = array('nowrap', 'nowrap');
+ $table->width = '100%';
+ $table->size = array('*', '*');
+
+ $existelements = false;
+ if ($scorm->version == 'SCORM_1.3') {
+ $elements = array('raw' => 'cmi.score.raw',
+ 'min' => 'cmi.score.min',
+ 'max' => 'cmi.score.max',
+ 'status' => 'cmi.completition_status',
+ 'time' => 'cmi.total_time');
+ } else {
+ $elements = array('raw' => 'cmi.core.score.raw',
+ 'min' => 'cmi.core.score.min',
+ 'max' => 'cmi.core.score.max',
+ 'status' => 'cmi.core.lesson_status',
+ 'time' => 'cmi.core.total_time');
+ }
+ foreach ($elements as $key => $element) {
+ if (isset($trackdata->$element)) {
+ $existelements = true;
+ $printedelements[]=$element;
+ $row = array();
+ $row[] = get_string($key,'scorm');
+ $row[] = $trackdata->$element;
+ $table->data[] = $row;
+ }
+ }
+ if ($existelements) {
+ echo '<h3>'.get_string('general','scorm').'</h3>';
+ print_table($table);
+ }
+
+ // Print Interactions data
+ $table = new stdClass();
+ $table->head = array(get_string('identifier','scorm'),
+ get_string('type','scorm'),
+ get_string('result','scorm'),
+ get_string('student_response','scorm'));
+ $table->align = array('center', 'center', 'center', 'center');
+ $table->wrap = array('nowrap', 'nowrap', 'nowrap', 'nowrap');
+ $table->width = '100%';
+ $table->size = array('*', '*', '*', '*', '*');
+
+ $existinteraction = false;
+
+ $i = 0;
+ $interactionid = 'cmi.interactions.'.$i.'.id';
+
+ while (isset($trackdata->$interactionid)) {
+ $existinteraction = true;
+ $printedelements[]=$interactionid;
+ $elements = array($interactionid,
+ 'cmi.interactions.'.$i.'.type',
+ 'cmi.interactions.'.$i.'.result',
+ 'cmi.interactions.'.$i.'.student_response');
+ $row = array();
+ foreach ($elements as $element) {
+ if (isset($trackdata->$element)) {
+ $row[] = $trackdata->$element;
+ $printedelements[]=$element;
+ } else {
+ $row[] = ' ';
+ }
+ }
+ $table->data[] = $row;
+
+ $i++;
+ $interactionid = 'cmi.interactions.'.$i.'.id';
+ }
+ if ($existinteraction) {
+ echo '<h3>'.get_string('interactions','scorm').'</h3>';
+ print_table($table);
+ }
+
+ // Print Objectives data
+ $table = new stdClass();
+ $table->head = array(get_string('identifier','scorm'),
+ get_string('status','scorm'),
+ get_string('raw','scorm'),
+ get_string('min','scorm'),
+ get_string('max','scorm'));
+ $table->align = array('center', 'center', 'center', 'center', 'center');
+ $table->wrap = array('nowrap', 'nowrap', 'nowrap', 'nowrap', 'nowrap');
+ $table->width = '100%';
+ $table->size = array('*', '*', '*', '*', '*');
+
+ $existobjective = false;
+
+ $i = 0;
+ $objectiveid = 'cmi.objectives.'.$i.'.id';
+
+ while (isset($trackdata->$objectiveid)) {
+ $existobjective = true;
+ $printedelements[]=$objectiveid;
+ $elements = array($objectiveid,
+ 'cmi.objectives.'.$i.'.status',
+ 'cmi.objectives.'.$i.'.score.raw',
+ 'cmi.objectives.'.$i.'.score.min',
+ 'cmi.objectives.'.$i.'.score.max');
+ $row = array();
+ foreach ($elements as $element) {
+ if (isset($trackdata->$element)) {
+ $row[] = $trackdata->$element;
+ $printedelements[]=$element;
+ } else {
+ $row[] = ' ';
+ }
+ }
+ $table->data[] = $row;
+
+ $i++;
+ $objectiveid = 'cmi.objectives.'.$i.'.id';
+ }
+ if ($existobjective) {
+ echo '<h3>'.get_string('objectives','scorm').'</h3>';
+ print_table($table);
+ }
+ $table = new stdClass();
+ $table->head = array(get_string('element','scorm'), get_string('value','scorm'));
+ $table->align = array('left', 'left');
+ $table->wrap = array('nowrap', 'wrap');
+ $table->width = '100%';
+ $table->size = array('*', '*');
+
+ $existelements = false;
+
+ foreach($trackdata as $element => $value) {
+ if (substr($element,0,3) == 'cmi') {
+ if (!(in_array ($element, $printedelements))) {
+ $existelements = true;
+ $row = array();
+ $row[] = get_string($element,'scorm') != '[['.$element.']]' ? get_string($element,'scorm') : $element;
+ $row[] = $value;
+ $table->data[] = $row;
+ }
+ }
+ }
+ if ($existelements) {
+ echo '<h3>'.get_string('othertracks','scorm').'</h3>';
+ print_table($table);
+ }
+ print_simple_box_end();
+ }
+ } else {
+ error('Missing script parameter');
+ }
+ }
+
+ print_heading(format_string(get_string('timestatistic','scorm')));
+ $scousers=get_records_select("scorm_scoes_track", "scormid='$scorm->id' GROUP BY userid,scormid", "", "userid,scormid");
+ $attempt = scorm_get_last_attempt($scorm->id,$USER->id);
+
+ foreach($scousers as $scouser){
+ $str = 'scormid ='.($scorm->id).' and userid = '.$scouser->userid.' and attempt = '.$attempt.' ORDER BY timemodified asc';
+ $endtrack = get_record_select("scorm_scoes_track", $str,'max(timemodified) as maxtimemodified');
+
+ }
+
+//Phan trinh bay thong ke theo thoi gian
+ $table = new stdClass();
+ $table->head = array(' ', get_string('name','scorm'));
+ $table->align = array('center', 'left');
+ $table->wrap = array('nowrap', 'nowrap');
+ $table->width = '100%';
+ $table->size = array(10, '*');
+
+ $table->head[]=scorm_string_wrap(get_string('beginTime','scorm'));
+ $table->align[] = 'center';
+ $table->wrap[] = 'nowrap';
+ $table->size[] = '*';
+
+ $table->head[]=scorm_string_wrap(get_string('endTime','scorm'));
+ $table->align[] = 'center';
+ $table->wrap[] = 'nowrap';
+ $table->size[] = '*';
+
+ $row = array();
+ $row[] = "";
+ $row[] = "(".get_string('coefficient','scorm').")";
+ foreach($scousers as $scouser){
+ $userdata = scorm_get_user_data($scouser->userid);
+ $row = array();
+ $row[] = print_user_picture($scouser->userid, $course->id, $userdata->picture, false, true);
+ $row[] = "<a href=\"$CFG->wwwroot/user/view.php?id=$scouser->userid&course=$course->id\">".
+ "$userdata->firstname $userdata->lastname</a>";
+ $str = 'scormid ='.($scorm->id).' and userid = '.$scouser->userid.' and attempt = '.$attempt.' ORDER BY timemodified asc';
+ $begintrack = get_record_select("scorm_scoes_track", $str,'min(timemodified) as mintimemodified');
+ $row[] = strftime( "%H h -%M ' - %S s - %d -%m-%Y", $begintrack->mintimemodified);
+ $endtrack = get_record_select("scorm_scoes_track", $str,'max(timemodified) as maxtimemodified');
+ $row[] = strftime( "%H h -%M ' - %S s - %d -%m-%Y", $endtrack->maxtimemodified);
+ $table->data[] = $row;
+ }
+ print_table($table);
+
+ echo "<br><a href='viewScore.php?a=$scorm->id'>".format_string(get_string('viewscore','scorm'))."</a>";
+ if (empty($noheader)) {
+ print_footer($course);
+ }
+?>
-<?php // $Id$\r
-\r
-/////////////////////////////////////////////////////////////////////////////////\r
-/// Code fragment to define the version of scorm\r
-/// This fragment is called by moodle_needs_upgrading() and /admin/index.php\r
-/////////////////////////////////////////////////////////////////////////////////\r
-\r
-$module->version = 2006080800; // The (date) version of this module\r
-$module->requires = 2005060200; // The version of Moodle that is required\r
-$module->cron = 0; // How often should cron check this module (seconds)?\r
-\r
-?>\r
+<?php // $Id$
+
+/////////////////////////////////////////////////////////////////////////////////
+/// Code fragment to define the version of scorm
+/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
+/////////////////////////////////////////////////////////////////////////////////
+
+$module->version = 2006080900; // The (date) version of this module
+$module->requires = 2006080900; // The version of Moodle that is required
+$module->cron = 0; // How often should cron check this module (seconds)?
+
+?>
-<?php // $Id$\r
-\r
- require_once("../../config.php");\r
- require_once('locallib.php');\r
- \r
- $id = optional_param('id', '', PARAM_INT); // Course Module ID, or\r
- $a = optional_param('a', '', PARAM_INT); // scorm ID\r
- //$organization = optional_param('organization', '', PARAM_INT); // organization ID\r
-\r
- if (!empty($id)) {\r
- if (! $cm = get_record("course_modules", "id", $id)) {\r
- error("Course Module ID was incorrect");\r
- }\r
- if (! $course = get_record("course", "id", $cm->course)) {\r
- error("Course is misconfigured");\r
- }\r
- if (! $scorm = get_record("scorm", "id", $cm->instance)) {\r
- error("Course module is incorrect");\r
- }\r
- } else if (!empty($a)) {\r
- if (! $scorm = get_record("scorm", "id", $a)) {\r
- error("Course module is incorrect");\r
- }\r
- if (! $course = get_record("course", "id", $scorm->course)) {\r
- error("Course is misconfigured");\r
- }\r
- if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {\r
- error("Course Module ID was incorrect");\r
- }\r
- } else {\r
- error('A required parameter is missing');\r
- }\r
-\r
- require_login($course->id, false, $cm);\r
-\r
- if (isset($SESSION->scorm_scoid)) {\r
- unset($SESSION->scorm_scoid);\r
- }\r
-\r
- $strscorms = get_string("modulenameplural", "scorm");\r
- $strscorm = get_string("modulename", "scorm");\r
-\r
- if ($course->category != 0) { \r
- $navigation = "<a target=\"{$CFG->framename}\" href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";\r
- if ($scorms = get_all_instances_in_course('scorm', $course)) {\r
- // The module SCORM activity with the least id is the course \r
- $firstscorm = current($scorms);\r
- if (!(($course->format == 'scorm') && ($firstscorm->id == $scorm->id))) {\r
- $navigation .= "<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strscorms</a> ->";\r
- } \r
- }\r
- } else {\r
- $navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strscorms</a> ->";\r
- }\r
-\r
- $pagetitle = strip_tags($course->shortname.': '.format_string($scorm->name));\r
-\r
- add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id='.$cm->id, "$scorm->id");\r
-\r
- //\r
- // Print the page header\r
- //\r
- if (!$cm->visible and !isteacher($course->id)) {\r
- print_header($pagetitle, "$course->fullname", "$navigation ".format_string($scorm->name), '', '', true,\r
- update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm));\r
- notice(get_string('activityiscurrentlyhidden'));\r
- } else {\r
- print_header($pagetitle, "$course->fullname",\r
- "$navigation <a target=\"{$CFG->framename}\" href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>",\r
- '', '', true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm));\r
-\r
- if (isteacher($course->id)) {\r
-\r
- //Phan thiet lap he so diem\r
- $examNumber = get_record_select('scorm_scoes', 'scorm ='.($scorm->id).' and minnormalizedmeasure > -1','count(id) as examCount');\r
- //fwrite($ft,"\n So bai kiem tra la ".($examNumber->examCount)); \r
- if ($examNumber->examCount > 0){\r
- echo "<div class=\"reportlink\"><img src='pix\SuaHeSoDiem.png' /><a target=\"{$CFG->framename}\" href=\"coefficientSetting.php?id=$cm->id\"> ".get_string('scorecoefficientsetting','scorm',$examNumber->examCount).'</a></div>';\r
- }\r
-\r
- //-----------------------\r
- $trackedusers = get_record('scorm_scoes_track', 'scormid', $scorm->id, '', '', '', '', 'count(distinct(userid)) as c');\r
- if ($trackedusers->c > 0) {\r
- echo "<div class=\"reportlink\"><img src='pix\ThongKe.png' /><a target=\"{$CFG->framename}\" href=\"report.php?id=$cm->id\"> ".get_string('viewallreports','scorm',$trackedusers->c).'</a></div>';\r
- } else {\r
- echo '<div class="reportlink">'.get_string('noreports','scorm').'</div>';\r
- }\r
- }\r
-\r
- $USER->setAttempt = 'notset';\r
- // Print the main part of the page\r
- print_heading(format_string($scorm->name));\r
- print_simple_box(format_text($scorm->summary), 'center', '70%', '', 5, 'generalbox', 'intro');\r
- scorm_view_display($USER, $scorm, 'view.php?id='.$cm->id, $cm);\r
- print_footer($course);\r
- }\r
-?>\r
+<?php // $Id$
+
+ require_once("../../config.php");
+ require_once('locallib.php');
+
+ $id = optional_param('id', '', PARAM_INT); // Course Module ID, or
+ $a = optional_param('a', '', PARAM_INT); // scorm ID
+ //$organization = optional_param('organization', '', PARAM_INT); // organization ID
+
+ if (!empty($id)) {
+ if (! $cm = $cm = get_coursemodule_from_id('scorm', $id)) {
+ error("Course Module ID was incorrect");
+ }
+ if (! $course = get_record("course", "id", $cm->course)) {
+ error("Course is misconfigured");
+ }
+ if (! $scorm = get_record("scorm", "id", $cm->instance)) {
+ error("Course module is incorrect");
+ }
+ } else if (!empty($a)) {
+ if (! $scorm = get_record("scorm", "id", $a)) {
+ error("Course module is incorrect");
+ }
+ if (! $course = get_record("course", "id", $scorm->course)) {
+ error("Course is misconfigured");
+ }
+ if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
+ error("Course Module ID was incorrect");
+ }
+ } else {
+ error('A required parameter is missing');
+ }
+
+ require_login($course->id, false, $cm);
+
+ if (isset($SESSION->scorm_scoid)) {
+ unset($SESSION->scorm_scoid);
+ }
+
+ $strscorms = get_string("modulenameplural", "scorm");
+ $strscorm = get_string("modulename", "scorm");
+
+ if ($course->category != 0) {
+ $navigation = "<a target=\"{$CFG->framename}\" href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
+ if ($scorms = get_all_instances_in_course('scorm', $course)) {
+ // The module SCORM activity with the least id is the course
+ $firstscorm = current($scorms);
+ if (!(($course->format == 'scorm') && ($firstscorm->id == $scorm->id))) {
+ $navigation .= "<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strscorms</a> ->";
+ }
+ }
+ } else {
+ $navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strscorms</a> ->";
+ }
+
+ $pagetitle = strip_tags($course->shortname.': '.format_string($scorm->name));
+
+ add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id='.$cm->id, "$scorm->id");
+
+ //
+ // Print the page header
+ //
+ if (!$cm->visible and !isteacher($course->id)) {
+ print_header($pagetitle, "$course->fullname", "$navigation ".format_string($scorm->name), '', '', true,
+ update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm));
+ notice(get_string('activityiscurrentlyhidden'));
+ } else {
+ print_header($pagetitle, "$course->fullname",
+ "$navigation <a target=\"{$CFG->framename}\" href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>",
+ '', '', true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm));
+
+ if (isteacher($course->id)) {
+
+ //Phan thiet lap he so diem
+ $examNumber = get_record_select('scorm_scoes', 'scorm ='.($scorm->id).' and minnormalizedmeasure > -1','count(id) as examCount');
+ //fwrite($ft,"\n So bai kiem tra la ".($examNumber->examCount));
+ if ($examNumber->examCount > 0){
+ echo "<div class=\"reportlink\"><img src='pix\SuaHeSoDiem.png' /><a target=\"{$CFG->framename}\" href=\"coefficientSetting.php?id=$cm->id\"> ".get_string('scorecoefficientsetting','scorm',$examNumber->examCount).'</a></div>';
+ }
+
+ //-----------------------
+ $trackedusers = get_record('scorm_scoes_track', 'scormid', $scorm->id, '', '', '', '', 'count(distinct(userid)) as c');
+ if ($trackedusers->c > 0) {
+ echo "<div class=\"reportlink\"><img src='pix\ThongKe.png' /><a target=\"{$CFG->framename}\" href=\"report.php?id=$cm->id\"> ".get_string('viewallreports','scorm',$trackedusers->c).'</a></div>';
+ } else {
+ echo '<div class="reportlink">'.get_string('noreports','scorm').'</div>';
+ }
+ }
+
+ $USER->setAttempt = 'notset';
+ // Print the main part of the page
+ print_heading(format_string($scorm->name));
+ print_simple_box(format_text($scorm->summary), 'center', '70%', '', 5, 'generalbox', 'intro');
+ scorm_view_display($USER, $scorm, 'view.php?id='.$cm->id, $cm);
+ print_footer($course);
+ }
+?>
$sid = optional_param('sid', false, PARAM_INT); // Student ID
$qid = optional_param('qid', 0, PARAM_INT); // Group ID
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('survey', $id)) {
error("Course Module ID was incorrect");
}
$student = optional_param('student', 0, PARAM_INT); // Student ID
$notes = optional_param('notes', '', PARAM_RAW); // Save teachers notes
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('survey', $id)) {
error("Course Module ID was incorrect");
}
$id = required_param('id', PARAM_INT); // Course Module ID
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('survey', $id)) {
error("Course Module ID was incorrect");
}
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800;
-$module->requires = 2005031000; // Requires this Moodle version
+$module->version = 2006080900;
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 0;
?>
$id = required_param('id', PARAM_INT); // Course Module ID
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('survey', $id)) {
error("Course Module ID was incorrect");
}
$groupid = optional_param('groupid', 0, PARAM_INT); // Group wiki.
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('wiki', $id)) {
error("Course Module ID was incorrect");
}
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800; // The current module version (Date: YYYYMMDDXX)
-$module->requires = 2005031000; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2006080900; // The current module version (Date: YYYYMMDDXX)
+$module->requires = 2006080900; // The current module version (Date: YYYYMMDDXX)
$module->cron = 0; // Period for cron to check this module (secs)
?>
$editsave = optional_param('thankyou', '');
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('wiki', $id)) {
error("Course Module ID was incorrect");
}
// get some useful stuff...
if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('workshop', $id)) {
error("Course Module ID was incorrect");
}
if (! $workshop = get_record("workshop", "id", $cm->instance)) {
$timenow = time();
// get some useful stuff...
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('workshop', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080800;
-$module->requires = 2005031000; // Requires this Moodle version
+$module->version = 2006080900;
+$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 60;
?>
$timenow = time();
// get some useful stuff...
- if (! $cm = get_record("course_modules", "id", $id)) {
+ if (! $cm = get_coursemodule_from_id('workshop', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2006080400; // YYYYMMDD = date
+ $version = 2006080900; // YYYYMMDD = date
// XY = increments within a single day
$release = '1.7 dev'; // Human-friendly version name