--- /dev/null
+<?php // $Id$
+/**
+ * Capability definitions for the lams module.
+ *
+ * For naming conventions, see lib/db/access.php.
+ */
+$mod_lams_capabilities = array(
+
+ 'mod/lams:participate' => array(
+
+ 'captype' => 'write',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'guest' => CAP_PREVENT,
+ 'student' => CAP_ALLOW,
+ 'teacher' => CAP_PREVENT,
+ 'editingteacher' => CAP_PREVENT,
+ 'coursecreator' => CAP_PREVENT,
+ 'admin' => CAP_PREVENT
+ )
+ ),
+
+ 'mod/lams:manage' => array(
+
+ 'captype' => 'write',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'guest' => CAP_PREVENT,
+ 'student' => CAP_PREVENT,
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'coursecreator' => CAP_PREVENT,
+ 'admin' => CAP_ALLOW
+ )
+ )
+);
\ No newline at end of file
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006080900; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2006091100; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
}
require_login($course->id);
+$context = get_context_instance(CONTEXT_MODULE, $cm->id);
add_to_log($course->id, "lams", "view", "view.php?id=$cm->id", "$lams->id");
// navmenu($course, $cm));
/// Print the main part of the page
-if(isteacher($course->id,$USER->id)||isteacheredit($course->id,$USER->id)){
+if(has_capability('mod/lams:manage', $context)){
$datetime = date("F d,Y g:i a");
$plaintext = trim($datetime).trim($USER->username).trim($LAMSCONSTANTS->monitor_method).trim($CFG->lams_serverid).trim($CFG->lams_serverkey);
$hash = sha1(strtolower($plaintext));
print_simple_box_start('center');
echo '<a target="LAMS Learner" title="LAMS Learner" href="'.$url.'">'.get_string("openlearner", "lams").'</a>';
print_simple_box_end();
-}else if(isstudent($course->id,$USER->id)){
+}else if(has_capability('mod/lams:participate', $context)){
$datetime = date("F d,Y g:i a");
$plaintext = trim($datetime).trim($USER->username).trim($LAMSCONSTANTS->learner_method).trim($CFG->lams_serverid).trim($CFG->lams_serverkey);
$hash = sha1(strtolower($plaintext));