mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
Added capability support
This commit is contained in:
parent
86cbff7abd
commit
2b3447c38a
@ -135,7 +135,7 @@
|
||||
break;
|
||||
case 'putparam':
|
||||
if ($status == 'Running') {
|
||||
if (!empty($aiccdata) && isstudent($scorm->course)) {
|
||||
if (!empty($aiccdata) && has_capability('mod/scorm:savetrack', $context)) {
|
||||
$initlessonstatus = 'not attempted';
|
||||
$lessonstatus = 'not attempted';
|
||||
if (isset($SESSION->scorm_lessonstatus)) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
$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
|
||||
$scoid = required_param('scoid', PARAM_INT); // sco ID
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA); // navigation mode
|
||||
$attempt = required_param('attempt', PARAM_INT); // new attempt
|
||||
|
||||
@ -60,20 +60,11 @@
|
||||
} else {
|
||||
error('Sco not found');
|
||||
}
|
||||
|
||||
switch ($scorm->version) {
|
||||
case 'SCORM_1.2':
|
||||
include_once ('datamodels/scorm1_2.js.php');
|
||||
break;
|
||||
case 'SCORM_1.3':
|
||||
include_once ('datamodels/scorm1_3.js.php');
|
||||
break;
|
||||
case 'AICC':
|
||||
include_once ('datamodels/aicc.js.php');
|
||||
break;
|
||||
default:
|
||||
include_once ('datamodels/scorm1_2.js.php');
|
||||
break;
|
||||
$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe
|
||||
if (file_exists($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php')) {
|
||||
include_once($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php');
|
||||
} else {
|
||||
include_once($CFG->dirroot.'/mod/scorm/datamodels/scorm_12.js.php');
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
$a = optional_param('a', '', PARAM_INT); // scorm ID
|
||||
$scoid = required_param('scoid', PARAM_INT); // sco ID
|
||||
// $attempt = required_param('attempt', PARAM_INT); // attempt number
|
||||
$attempt = $USER->attempt;
|
||||
$attempt = $SESSION->scorm_attempt;
|
||||
|
||||
|
||||
if (!empty($id)) {
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
if (confirm_sesskey() && (!empty($scoid))) {
|
||||
$result = true;
|
||||
if (isstudent($course->id) || (isteacher($course->id) && !isadmin())) {
|
||||
if (has_capability('mod/scorm:savetrack', $context)) {
|
||||
foreach ($_POST as $element => $value) {
|
||||
if (substr($element,0,3) == 'cmi') {
|
||||
$element = str_replace('__','.',$element);
|
||||
|
@ -38,7 +38,7 @@ $mod_scorm_capabilities = array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_MODULE,
|
||||
'legacy' => array(
|
||||
'guest' => CAP_PREVENT,
|
||||
'guest' => CAP_ALLOW,
|
||||
'student' => CAP_ALLOW,
|
||||
'teacher' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
@ -47,20 +47,35 @@ $mod_scorm_capabilities = array(
|
||||
)
|
||||
),
|
||||
|
||||
'mod/scorm:viewgrades' => array(
|
||||
'mod/scorm:savetrack' => array(
|
||||
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_MODULE,
|
||||
'legacy' => array(
|
||||
'guest' => CAP_PREVENT,
|
||||
'student' => CAP_ALLOW,
|
||||
'teacher' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_PREVENT,
|
||||
'coursecreator' => CAP_PREVENT,
|
||||
'admin' => CAP_PREVENT
|
||||
)
|
||||
),
|
||||
|
||||
'mod/scorm:viewscores' => array(
|
||||
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_MODULE,
|
||||
'legacy' => array(
|
||||
'guest' => CAP_PREVENT,
|
||||
'student' => CAP_PREVENT,
|
||||
'teacher' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
'coursecreator' => CAP_ALLOW,
|
||||
'admin' => CAP_ALLOW
|
||||
'student' => CAP_ALLOW,
|
||||
'teacher' => CAP_PREVENT,
|
||||
'editingteacher' => CAP_PREVENT,
|
||||
'coursecreator' => CAP_PREVENT,
|
||||
'admin' => CAP_PREVENT
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -61,18 +61,18 @@
|
||||
$tt = userdate($scorm->timemodified);
|
||||
}
|
||||
$report = ' ';
|
||||
if (isteacher($course->id)) {
|
||||
if (has_capability('moodle/user:viewuseractivitiesreport', $context)) {
|
||||
$trackedusers = get_record('scorm_scoes_track', 'scormid', $scorm->id, '', '', '', '', 'count(distinct(userid)) as c');
|
||||
if ($trackedusers->c > 0) {
|
||||
$reportshow = '<a href="report.php?a='.$scorm->id.'">'.get_string('viewallreports','scorm',$trackedusers->c).'</a></div>';
|
||||
} else {
|
||||
$reportshow = get_string('noreports','scorm');
|
||||
}
|
||||
} else if (isstudent($course->id)) {
|
||||
require_once('locallib.php');
|
||||
$report = scorm_grade_user_new(get_records('scorm_scoes','scorm',$scorm->id), $USER->id, $scorm->grademethod);
|
||||
$sco_count = scorm_get_user_sco_count($scorm->id,$USER->id);
|
||||
$reportshow = get_string('implement','scorm').$sco_count.get_string('lesson','scorm') ."<br><table width=".($report*100)."% bgcolor=#800000><tr><td height=15></td></tr></table>".get_string('scoreRate','scorm').": ".($report*100)."%"; }
|
||||
} else if (has_capability('mod/scorm:viewscores', $context)) {
|
||||
require_once('locallib.php');
|
||||
$report = scorm_grade_user(get_records('scorm_scoes','scorm',$scorm->id), $USER->id, $scorm->grademethod);
|
||||
$reportshow = get_string('score','scorm').": ".$report;
|
||||
}
|
||||
if (!$scorm->visible) {
|
||||
//Show dimmed if the mod is hidden
|
||||
$table->data[] = array ($tt, "<a class=\"dimmed\" href=\"view.php?id=$scorm->coursemodule\">".format_string($scorm->name,true)."</a>",
|
||||
|
@ -1,58 +1,5 @@
|
||||
<?php // $Id$
|
||||
|
||||
/// Library of functions and constants for module scorm
|
||||
|
||||
define('GRADESCOES', '0');
|
||||
define('GRADEHIGHEST', '1');
|
||||
define('GRADEAVERAGE', '2');
|
||||
define('GRADESUM', '3');
|
||||
$SCORM_GRADE_METHOD = array (GRADESCOES => get_string('gradescoes', 'scorm'),
|
||||
GRADEHIGHEST => get_string('gradehighest', 'scorm'),
|
||||
GRADEAVERAGE => get_string('gradeaverage', 'scorm'),
|
||||
GRADESUM => get_string('gradesum', 'scorm'));
|
||||
|
||||
define('VALUEHIGHEST', '0');
|
||||
define('VALUEAVERAGE', '1');
|
||||
define('VALUEFIRST', '2');
|
||||
define('VALUELAST', '3');
|
||||
$SCORM_WHAT_GRADE = array (VALUEHIGHEST => get_string('highestattempt', 'scorm'),
|
||||
VALUEAVERAGE => get_string('averageattempt', 'scorm'),
|
||||
VALUEFIRST => get_string('firstattempt', 'scorm'),
|
||||
VALUELAST => get_string('lastattempt', 'scorm'));
|
||||
|
||||
$SCORM_POPUP_OPTIONS = array('resizable'=>1,
|
||||
'scrollbars'=>1,
|
||||
'directories'=>0,
|
||||
'location'=>0,
|
||||
'menubar'=>0,
|
||||
'toolbar'=>0,
|
||||
'status'=>0);
|
||||
$stdoptions = '';
|
||||
foreach ($SCORM_POPUP_OPTIONS as $popupopt => $value) {
|
||||
$stdoptions .= $popupopt.'='.$value;
|
||||
if ($popupopt != 'status') {
|
||||
$stdoptions .= ',';
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($CFG->scorm_maxattempts)) {
|
||||
set_config('scorm_maxattempts','6');
|
||||
}
|
||||
|
||||
if (!isset($CFG->scorm_frameheight)) {
|
||||
set_config('scorm_frameheight','500');
|
||||
}
|
||||
|
||||
if (!isset($CFG->scorm_framewidth)) {
|
||||
set_config('scorm_framewidth','100%');
|
||||
}
|
||||
|
||||
//
|
||||
// Repository configurations
|
||||
//
|
||||
$repositoryconfigfile = $CFG->dirroot.'/mod/resource/type/ims/repository_config.php';
|
||||
$repositorybrowser = '/mod/resource/type/ims/finder.php';
|
||||
|
||||
/**
|
||||
* Given an object containing all the necessary data,
|
||||
* (defined by the form in mod.html) this function
|
||||
@ -127,10 +74,7 @@ function scorm_update_instance($scorm) {
|
||||
(basename($scorm->reference) != 'imsmanifest.xml') && ($scorm->reference[0] != '#')) {
|
||||
rename($scorm->dir.$scorm->datadir,$scorm->dir.'/'.$scorm->id);
|
||||
}
|
||||
/* // Delete old related records
|
||||
delete_records('scorm_scoes','scorm',$scorm->id);
|
||||
delete_records('scorm_scoes_track','scormid',$scorm->id);
|
||||
delete_records('scorm_sequencing_controlmode','scormid',$scorm->id);
|
||||
/* delete_records('scorm_sequencing_controlmode','scormid',$scorm->id);
|
||||
delete_records('scorm_sequencing_rolluprules','scormid',$scorm->id);
|
||||
delete_records('scorm_sequencing_rolluprule','scormid',$scorm->id);
|
||||
delete_records('scorm_sequencing_rollupruleconditions','scormid',$scorm->id);
|
||||
@ -161,9 +105,12 @@ function scorm_delete_instance($id) {
|
||||
|
||||
$result = true;
|
||||
|
||||
// Delete any dependent files
|
||||
require_once('locallib.php');
|
||||
scorm_delete_files($CFG->dataroot.'/'.$scorm->course.'/moddata/scorm/'.$scorm->id);
|
||||
$scorm->dir = $CFG->dataroot.'/'.$scorm->course.'/moddata/scorm';
|
||||
if (is_dir($scorm->dir.'/'.$scorm->id)) {
|
||||
// Delete any dependent files
|
||||
require_once('locallib.php');
|
||||
scorm_delete_files($scorm->dir.'/'.$scorm->id);
|
||||
}
|
||||
|
||||
// Delete any dependent records
|
||||
if (! delete_records('scorm_scoes_track', 'scormid', $scorm->id)) {
|
||||
@ -175,7 +122,7 @@ function scorm_delete_instance($id) {
|
||||
if (! delete_records('scorm', 'id', $scorm->id)) {
|
||||
$result = false;
|
||||
}
|
||||
if (! delete_records('scorm_sequencing_controlmode', 'scormid', $scorm->id)) {
|
||||
/*if (! delete_records('scorm_sequencing_controlmode', 'scormid', $scorm->id)) {
|
||||
$result = false;
|
||||
}
|
||||
if (! delete_records('scorm_sequencing_rolluprules', 'scormid', $scorm->id)) {
|
||||
@ -195,7 +142,7 @@ function scorm_delete_instance($id) {
|
||||
}
|
||||
if (! delete_records('scorm_sequencing_ruleconditions', 'scormid', $scorm->id)) {
|
||||
$result = false;
|
||||
}
|
||||
}*/
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@
|
||||
if (!empty($sco->parameters)) {
|
||||
$sco->parameters = '&'. $sco->parameters;
|
||||
}
|
||||
$launcher = $sco->launch.$connector.'aicc_sid='.sesskey().'&aicc_url='.$CFG->wwwroot.'/mod/scorm/aicc.php'.$sco->parameters;
|
||||
$launcher = $sco->launch.$connector.'aicc_sid='.sesskey().'&aicc_url='.$CFG->wwwroot.'/mod/scorm/type/aicc/aicc.php'.$sco->parameters;
|
||||
} else {
|
||||
$launcher = $sco->launch.$connector.$sco->parameters;
|
||||
}
|
||||
@ -100,11 +100,11 @@
|
||||
<title>LoadSCO</title>
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
setTimeout('document.location = "<?php echo $result ?>";',1000);
|
||||
setTimeout('document.location = "<?php echo $result ?>";',2000);
|
||||
-->
|
||||
</script>
|
||||
<noscript>
|
||||
<meta http-equiv="refresh" content="1;url=<?php echo $result ?>" />
|
||||
<meta http-equiv="refresh" content="2;url=<?php echo $result ?>" />
|
||||
</noscript>
|
||||
</head>
|
||||
<body>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once($CFG->dirroot.'/mod/scorm/lib.php');
|
||||
require_once($CFG->dirroot.'/mod/scorm/configurations.php');
|
||||
if (!isset($form->name)) {
|
||||
$form->name = '';
|
||||
}
|
||||
@ -64,6 +64,9 @@
|
||||
$element = trim($element);
|
||||
$window->$element = trim($value)==1?'checked':'';
|
||||
}
|
||||
if (!isset($form->pkgtype)) {
|
||||
$form->pkgtype = '';
|
||||
}
|
||||
$scormid = '';
|
||||
if (!empty($form->instance)) {
|
||||
$scormid = '&instance='.$form->instance;
|
||||
|
@ -4,8 +4,7 @@
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once('locallib.php');
|
||||
require_once('sequencinglib.php');
|
||||
|
||||
|
||||
//
|
||||
// Checkin' script parameters
|
||||
//
|
||||
@ -42,101 +41,14 @@
|
||||
|
||||
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
|
||||
// The module SCORM/AICC activity with the first 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> ->";
|
||||
@ -148,7 +60,7 @@
|
||||
|
||||
$pagetitle = strip_tags("$course->shortname: ".format_string($scorm->name));
|
||||
|
||||
if (!$cm->visible and !isteacher($course->id)) {
|
||||
if (!$cm->visible and !has_capability('moodle/user:viewhiddenactivities',$context)) {
|
||||
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);
|
||||
@ -158,24 +70,14 @@
|
||||
//
|
||||
// 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';
|
||||
//}
|
||||
$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe
|
||||
require_once($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'lib.php');
|
||||
$attempt = scorm_get_last_attempt($scorm->id, $USER->id);
|
||||
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;
|
||||
|
||||
@ -183,14 +85,11 @@
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -210,12 +109,7 @@
|
||||
$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
|
||||
$SESSION->scorm_attempt = $attempt;
|
||||
|
||||
//
|
||||
// Print the page header
|
||||
@ -224,20 +118,10 @@
|
||||
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>) ';
|
||||
|
||||
$exitlink = '(<a href="'.$CFG->wwwroot.'/course/view.php?id='.$cm->course.'">'.get_string('exit','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);
|
||||
'', '', true, $exitlink.update_module_button($cm->id, $course->id, $strscorm), '', false, $bodyscript);
|
||||
if ($sco->scormtype == 'sco') {
|
||||
?>
|
||||
<script language="JavaScript" type="text/javascript" src="request.js"></script>
|
||||
@ -337,28 +221,14 @@
|
||||
<?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"
|
||||
<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">
|
||||
@ -386,30 +256,12 @@
|
||||
var main = openpopup(url, "scormpopup", "<?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
|
||||
}
|
||||
@ -422,7 +274,6 @@
|
||||
</div> <!-- SCORM content -->
|
||||
</div> <!-- Content -->
|
||||
</div> <!-- Page -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
if (!has_capability('moodle/user:viewuseractivitiesreport',$context)) {
|
||||
error("You are not allowed to use this script");
|
||||
}
|
||||
|
||||
|
@ -483,6 +483,7 @@ function scorm_sequecingrule_implement($scormid,$scoidchild, $userid)
|
||||
}
|
||||
return $sequencingResult;
|
||||
}
|
||||
|
||||
function get_sco_after_exit($scoid,$scormid){
|
||||
$scochild = get_record("scorm_scoes","id",$scoid);
|
||||
$scoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$scochild->parent);
|
||||
|
@ -60,38 +60,37 @@
|
||||
//
|
||||
// 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));
|
||||
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);
|
||||
if (empty($cm->visible) and !has_capability('moodle/course:manageactivities', $context)) {
|
||||
notice(get_string("activityiscurrentlyhidden"));
|
||||
}
|
||||
|
||||
if (has_capability('moodle/course:manageactivities', $context)) {
|
||||
// Added by Pham Minh Duc
|
||||
$examNumber = get_record_select('scorm_scoes', 'scorm ='.($scorm->id).' and minnormalizedmeasure > -1','count(id) as 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>';
|
||||
}
|
||||
// End Add
|
||||
|
||||
$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>';
|
||||
}
|
||||
}
|
||||
|
||||
// Added by Pham Minh Duc
|
||||
$USER->setAttempt = 'notset';
|
||||
// End Add
|
||||
|
||||
// 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);
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user