ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilECSMappingUtils.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
11{
13 const MAPPED_MANUAL = 2;
14 const MAPPED_UNMAPPED = 3;
15
20
27 public static function lookupMappingStatus($a_server_id, $a_mid, $a_tree_id)
28 {
29 include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignments.php';
30
31 if(ilECSNodeMappingAssignments::hasAssignments($a_server_id, $a_mid, $a_tree_id))
32 {
33 if(ilECSNodeMappingAssignments::isWholeTreeMapped($a_server_id, $a_mid, $a_tree_id))
34 {
36 }
38 }
40 }
41
46 public static function mappingStatusToString($a_status)
47 {
48 global $lng;
49
50 return $lng->txt('ecs_node_mapping_status_'.$a_status);
51 }
52
53
54 public static function getCourseMappingFieldInfo()
55 {
56 global $lng;
57
58 $field_info = array();
59 $counter = 0;
60 foreach(
61 array(
62 'organisation',
63 'orgunit',
64 'term',
65 'title',
66 'lecturer',
67 'courseType',
68 'degreeProgramme',
69 'module',
70 'venue'
71 ) as $field)
72 {
73 $field_info[$counter]['name'] = $field;
74 $field_info[$counter]['translation'] = $lng->txt('ecs_cmap_att_'.$field);
75 $counter++;
76 }
77 return $field_info;
78 }
79
80 public static function getCourseMappingFieldSelectOptions()
81 {
82 global $lng;
83
84 $options[''] = $lng->txt('select_one');
85 foreach(self::getCourseMappingFieldInfo() as $info)
86 {
87 $options[$info['name']] = $info['translation'];
88 }
89 return $options;
90 }
91
98 public static function getCourseValueByMappingAttribute($course, $a_field)
99 {
100 switch($a_field)
101 {
102 case 'organisation':
103 return array((string) $course->organisation);
104
105 case 'term':
106 return array((string) $course->term);
107
108 case 'title':
109 return array((string) $course->title);
110
111 case 'orgunit':
112 $units = array();
113 foreach((array) $course->organisationalUnits as $unit)
114 {
115 $units[] = (string) $unit->title;
116 }
117 return $units;
118
119 case 'lecturer':
120 $lecturers = array();
121 foreach((array) $course->groups as $group)
122 {
123 foreach((array) $group->lecturers as $lecturer)
124 {
125 $lecturers[] = (string) ($lecturer->lastName.', '. $lecturer->firstName);
126 }
127 }
128 return $lecturers;
129
130 case 'courseType':
131 return array((string) $course->lectureType);
132
133 case 'degreeProgramme':
134 $degree_programmes = array();
135 foreach((array) $course->degreeProgrammes as $prog)
136 {
137 $degree_programmes[] = (string) $prog->title;
138 }
139 return $degree_programmes;
140
141 case 'module':
142 $modules = array();
143 foreach((array) $course->modules as $mod)
144 {
145 $modules[] = (string) $mod->title;
146 }
147 return $modules;
148
149 case 'venue':
150 $venues[] = array();
151 foreach((array) $course->groups as $group)
152 {
153 foreach((array) $group->datesAndVenues as $venue)
154 {
155 $venues[] = (string) $venue->venue;
156 }
157 }
158 return $venues;
159 }
160 return array();
161 }
162
163
167 public static function getRoleMappingInfo($a_role_type_info = 0)
168 {
169 include_once './Services/Membership/classes/class.ilParticipants.php';
170 $roles = array(
171 IL_CRS_ADMIN => array(
172 'role' => IL_CRS_ADMIN,
173 'lang' => 'il_crs_admin',
174 'create' => true,
175 'required' => true,
176 'type' => 'crs'),
177 IL_CRS_TUTOR => array(
178 'role' => IL_CRS_TUTOR,
179 'lang' => 'il_crs_tutor',
180 'create' => true,
181 'required' => false,
182 'type' => 'crs'),
183 IL_CRS_MEMBER => array(
184 'role' => IL_CRS_MEMBER,
185 'lang' => 'il_crs_member',
186 'create' => false,
187 'required' => true,
188 'type' => 'crs'),
189 IL_GRP_ADMIN => array(
190 'role' => IL_GRP_ADMIN,
191 'lang' => 'il_grp_admin',
192 'create' => true,
193 'required' => false,
194 'type' => 'grp'),
195 IL_GRP_MEMBER => array(
196 'role' => IL_GRP_MEMBER,
197 'lang' => 'il_grp_member',
198 'create' => false,
199 'required' => false,
200 'type' => 'grp')
201 );
202 if(!$a_role_type_info)
203 {
204 return $roles;
205 }
206 else
207 {
208 return $roles[$a_role_type_info];
209 }
210 }
211
215 public static function getAuthModeSelection()
216 {
217 global $DIC;
218 global $ilSetting;
219
220 $lng = $DIC->language();
221
222
223 $options[0] = $GLOBALS['lng']->txt('select_one');
224 $options['local'] = $GLOBALS['lng']->txt('auth_local');
225
226 include_once './Services/LDAP/classes/class.ilLDAPServer.php';
227 foreach(ilLDAPServer::getServerIds() as $sid)
228 {
230 $options['ldap_'.$server->getServerId()] = 'LDAP (' . $server->getName().')';
231 }
232
233 if($ilSetting->get('shib_active', 0))
234 {
236 $lng->txt('auth_shibboleth');
237 }
238
239 return $options;
240 }
241
242}
243?>
An exception for terminatinating execution or to throw for unit testing.
const AUTH_SHIBBOLETH
const IL_CRS_ADMIN
Base class for course and group participants.
const IL_CRS_MEMBER
const IL_GRP_MEMBER
const IL_CRS_TUTOR
const IL_GRP_ADMIN
static _getAuthModeName($a_auth_key)
static getRoleMappingInfo($a_role_type_info=0)
Get role mapping info.
static mappingStatusToString($a_status)
Get mapping status as string.
static getAuthModeSelection()
Get auth mode selection.
static getCourseValueByMappingAttribute($course, $a_field)
Get course value by mapping.
static getCourseMappingFieldSelectOptions()
static lookupMappingStatus($a_server_id, $a_mid, $a_tree_id)
Lookup mapping status.
static hasAssignments($a_server_id, $a_mid, $a_tree_id)
Check if there is any assignment for a cms tree.
static isWholeTreeMapped($a_server_id, $a_mid, $a_tree_id)
Check if whole tree is mapped.
static getInstanceByServerId($a_server_id)
Get instance by server id.
static getServerIds()
Get all server ids @global ilDB $ilDB.
$counter
$server
$info
Definition: example_052.php:80
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $lng
Definition: privfeed.php:17
global $ilSetting
Definition: privfeed.php:17
if(!is_array($argv)) $options
global $DIC