]> git.mjollnir.org Git - moodle.git/commitdiff
lams conversion to new roles framework
authorskodak <skodak>
Mon, 11 Sep 2006 19:54:11 +0000 (19:54 +0000)
committerskodak <skodak>
Mon, 11 Sep 2006 19:54:11 +0000 (19:54 +0000)
mod/lams/db/access.php [new file with mode: 0644]
mod/lams/version.php
mod/lams/view.php

diff --git a/mod/lams/db/access.php b/mod/lams/db/access.php
new file mode 100644 (file)
index 0000000..1c3030e
--- /dev/null
@@ -0,0 +1,36 @@
+<?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
index 92dad72db96ae67bdb80237128e8a8cff3790069..7f4e96ace4864ee90c1ba33e2f163916c9ed9ef2 100644 (file)
@@ -5,7 +5,7 @@
 ///  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)
 
index 1abfc78697567a413825fd6bbe2fb2932d5ed631..a078017ace74d691f5a351d55fde73b10d7354a6 100644 (file)
@@ -22,6 +22,7 @@ if (! $lams = get_record("lams", "id", $cm->instance)) {
 }
 
 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");
 
@@ -47,7 +48,7 @@ print_heading(format_string($lams->name));
 //              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));
@@ -76,7 +77,7 @@ if(isteacher($course->id,$USER->id)||isteacheredit($course->id,$USER->id)){
     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));