ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 if (ilECSNodeMappingAssignments::isWholeTreeMapped($a_server_id, $a_mid, $a_tree_id)) {
34 }
36 }
38 }
39
44 public static function mappingStatusToString($a_status)
45 {
46 global $lng;
47
48 return $lng->txt('ecs_node_mapping_status_' . $a_status);
49 }
50
51
52 public static function getCourseMappingFieldInfo()
53 {
54 global $lng;
55
56 $field_info = array();
57 $counter = 0;
58 foreach (
59 array(
60 'organisation',
61 'orgunit',
62 'term',
63 'title',
64 'lecturer',
65 'courseType',
66 'degreeProgramme',
67 'module',
68 'venue'
69 ) as $field) {
70 $field_info[$counter]['name'] = $field;
71 $field_info[$counter]['translation'] = $lng->txt('ecs_cmap_att_' . $field);
72 $counter++;
73 }
74 return $field_info;
75 }
76
77 public static function getCourseMappingFieldSelectOptions()
78 {
79 global $lng;
80
81 $options[''] = $lng->txt('select_one');
82 foreach (self::getCourseMappingFieldInfo() as $info) {
83 $options[$info['name']] = $info['translation'];
84 }
85 return $options;
86 }
87
94 public static function getCourseValueByMappingAttribute($course, $a_field)
95 {
96 switch ($a_field) {
97 case 'organisation':
98 return array((string) $course->organisation);
99
100 case 'term':
101 return array((string) $course->term);
102
103 case 'title':
104 return array((string) $course->title);
105
106 case 'orgunit':
107 $units = array();
108 foreach ((array) $course->organisationalUnits as $unit) {
109 $units[] = (string) $unit->title;
110 }
111 return $units;
112
113 case 'lecturer':
114 $lecturers = array();
115 foreach ((array) $course->groups as $group) {
116 foreach ((array) $group->lecturers as $lecturer) {
117 $lecturers[] = (string) ($lecturer->lastName . ', ' . $lecturer->firstName);
118 }
119 }
120 return $lecturers;
121
122 case 'courseType':
123 return array((string) $course->lectureType);
124
125 case 'degreeProgramme':
126 $degree_programmes = array();
127 foreach ((array) $course->degreeProgrammes as $prog) {
128 $degree_programmes[] = (string) $prog->title;
129 }
130 return $degree_programmes;
131
132 case 'module':
133 $modules = array();
134 foreach ((array) $course->modules as $mod) {
135 $modules[] = (string) $mod->title;
136 }
137 return $modules;
138
139 case 'venue':
140 $venues[] = array();
141 foreach ((array) $course->groups as $group) {
142 foreach ((array) $group->datesAndVenues as $venue) {
143 $venues[] = (string) $venue->venue;
144 }
145 }
146 return $venues;
147 }
148 return array();
149 }
150
151
155 public static function getRoleMappingInfo($a_role_type_info = 0)
156 {
157 include_once './Services/Membership/classes/class.ilParticipants.php';
158 $roles = array(
159 IL_CRS_ADMIN => array(
160 'role' => IL_CRS_ADMIN,
161 'lang' => 'il_crs_admin',
162 'create' => true,
163 'required' => true,
164 'type' => 'crs'),
165 IL_CRS_TUTOR => array(
166 'role' => IL_CRS_TUTOR,
167 'lang' => 'il_crs_tutor',
168 'create' => true,
169 'required' => false,
170 'type' => 'crs'),
171 IL_CRS_MEMBER => array(
172 'role' => IL_CRS_MEMBER,
173 'lang' => 'il_crs_member',
174 'create' => false,
175 'required' => true,
176 'type' => 'crs'),
177 IL_GRP_ADMIN => array(
178 'role' => IL_GRP_ADMIN,
179 'lang' => 'il_grp_admin',
180 'create' => true,
181 'required' => false,
182 'type' => 'grp'),
183 IL_GRP_MEMBER => array(
184 'role' => IL_GRP_MEMBER,
185 'lang' => 'il_grp_member',
186 'create' => false,
187 'required' => false,
188 'type' => 'grp')
189 );
190 if (!$a_role_type_info) {
191 return $roles;
192 } else {
193 return $roles[$a_role_type_info];
194 }
195 }
196
200 public static function getAuthModeSelection()
201 {
202 global $DIC;
203 global $ilSetting;
204
205 $lng = $DIC->language();
206
207
208 $options[0] = $GLOBALS['lng']->txt('select_one');
209 $options['local'] = $GLOBALS['lng']->txt('auth_local');
210
211 include_once './Services/LDAP/classes/class.ilLDAPServer.php';
212 foreach (ilLDAPServer::getServerIds() as $sid) {
214 $options['ldap_' . $server->getServerId()] = 'LDAP (' . $server->getName() . ')';
215 }
216
217 if ($ilSetting->get('shib_active', 0)) {
219 $lng->txt('auth_shibboleth');
220 }
221
222 return $options;
223 }
224}
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
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
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$server
Definition: getUserInfo.php:12
$info
Definition: index.php:5
global $lng
Definition: privfeed.php:17
global $ilSetting
Definition: privfeed.php:17
global $DIC
Definition: saml.php:7