break;\r
case 'putparam':\r
if ($status == 'Running') {\r
- if (!empty($aiccdata) && has_capability('mod/scorm:savetrack', $context)) {\r
+ if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $scorm->course)) {\r
+ echo "error = 1\nerror_text = Unknown\n"; // No one must see this error message if not hacked\r
+ }\r
+ if (!empty($aiccdata) && has_capability('mod/scorm:savetrack', get_context_instance(CONTEXT_MODULE, $cm->id))) {\r
$initlessonstatus = 'not attempted';\r
$lessonstatus = 'not attempted';\r
if (isset($SESSION->scorm_lessonstatus)) {\r
\r
if (confirm_sesskey() && (!empty($scoid))) {\r
$result = true;\r
- if (has_capability('mod/scorm:savetrack', $context)) {\r
+ if (has_capability('mod/scorm:savetrack', get_context_instance(CONTEXT_MODULE,$cm->id))) {\r
foreach ($_POST as $element => $value) {\r
if (substr($element,0,3) == 'cmi') {\r
$element = str_replace('__','.',$element);\r
)
),
+ 'mod/scorm:viewreport' => 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
+ )
+ ),
+
'mod/scorm:savetrack' => array(
'captype' => 'write',
)
)
-
);
?>
\r
foreach ($scorms as $scorm) {\r
\r
+ $context = get_context_instance(CONTEXT_MODULE,$scorm->coursemodule);\r
$tt = "";\r
if ($course->format == "weeks" or $course->format == "topics") {\r
if ($scorm->section) {\r
$tt = userdate($scorm->timemodified);\r
}\r
$report = ' ';\r
- if (has_capability('moodle/user:viewuseractivitiesreport', $context)) {\r
+ if (has_capability('mod/scorm:viewreport', $context)) {\r
$trackedusers = get_record('scorm_scoes_track', 'scormid', $scorm->id, '', '', '', '', 'count(distinct(userid)) as c');\r
if ($trackedusers->c > 0) {\r
$reportshow = '<a href="report.php?a='.$scorm->id.'">'.get_string('viewallreports','scorm',$trackedusers->c).'</a></div>';\r
$strupdate = get_string('update');
$strmodule = get_string('modulename','scorm');
+ $context get_context_instance(CONTEXT_COURSE,$course->id);
echo '<div class="mod-scorm">';
if ($scorms = get_all_instances_in_course('scorm', $course)) {
print_simple_box($headertext,'','100%');
scorm_view_display($user, $scorm, 'view.php?id='.$course->id, $cm, '100%');
} else {
- if (has_capability('moodle/course:', $context)) {
+ if (has_capability('moodle/course:update', $context)) {
// Create a new activity
redirect($CFG->wwwroot.'/course/mod.php?id='.$course->id.'&section=0&sesskey='.sesskey().'&add=scorm');
} else {
$pagetitle = strip_tags("$course->shortname: ".format_string($scorm->name));
- if (!$cm->visible and !has_capability('moodle/user:viewhiddenactivities',$context)) {
+ if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_COURSE,$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);
require_login($course->id, false, $cm);
- if (!has_capability('moodle/user:viewuseractivitiesreport',$context)) {
+ if (!has_capability('mod/scorm:viewreport', get_context_instance(CONTEXT_MODULE,$cm->id)) {
error("You are not allowed to use this script");
}
$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
+ $organization = optional_param('organization', '', PARAM_INT); // organization ID
if (!empty($id)) {
- if (! $cm = $cm = get_coursemodule_from_id('scorm', $id)) {
+ if (! $cm = get_coursemodule_from_id('scorm', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
require_login($course->id, false, $cm);
+ $context = get_context_instance(CONTEXT_COURSE, $course->id)
+
if (isset($SESSION->scorm_scoid)) {
unset($SESSION->scorm_scoid);
}
}
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>';
+ echo "<div class=\"reportlink\"><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');