|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00027 defined('MOODLE_INTERNAL') || die(); 00028 00029 00030 class imsenterprise_roles { 00031 private $imsroles; 00032 00033 function __construct() { 00034 $this->imsroles = array( 00035 '01'=>'Learner', 00036 '02'=>'Instructor', 00037 '03'=>'Content Developer', 00038 '04'=>'Member', 00039 '05'=>'Manager', 00040 '06'=>'Mentor', 00041 '07'=>'Administrator', 00042 '08'=>'TeachingAssistant', 00043 ); 00044 // PLEASE NOTE: It may seem odd that "Content Developer" has a space in it 00045 // but "TeachingAssistant" doesn't. That's what the spec says though!!! 00046 } 00047 00048 function get_imsroles() { 00049 return $this->imsroles; 00050 } 00051 00057 function determine_default_rolemapping($imscode) { 00058 global $DB; 00059 00060 switch($imscode) { 00061 case '01': 00062 case '04': 00063 $shortname = 'student'; 00064 break; 00065 case '06': 00066 case '08': 00067 $shortname = 'teacher'; 00068 break; 00069 case '02': 00070 case '03': 00071 $shortname = 'editingteacher'; 00072 break; 00073 case '05': 00074 case '07': 00075 $shortname = 'admin'; 00076 break; 00077 default: 00078 return 0; // Zero for no match 00079 } 00080 return (string)$DB->get_field('role', 'id', array('shortname'=>$shortname)); 00081 } 00082 00083 00084 } // class