ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilECSUtils Class Reference
+ Collaboration diagram for ilECSUtils:

Static Public Member Functions

static lookupParticipantName ($a_owner, $a_server_id)
 Lookup participant name. More...
 
static _getOptionalEContentFields ()
 get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions More...
 
static _getOptionalECourseFields ()
 get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions More...
 
static getPossibleRemoteTypes ($a_with_captions=false)
 Get all possible remote object types. More...
 
static getPossibleReleaseTypes ($a_with_captions=false)
 Get all possible release object types. More...
 
static getEContentDefinition ($a_resource_id)
 Get econtent / metadata definition. More...
 
static getMatchableContent ($a_resource_id, $a_server_id, $a_ecs_content, $a_owner)
 Convert ECS content to rule matchable values. More...
 
static getAdvancedMDValuesForObjId ($a_obj_id)
 Get advanced metadata values for object id. More...
 

Data Fields

const TYPE_ARRAY = 1
 
const TYPE_INT = 2
 
const TYPE_STRING = 3
 
const TYPE_TIMEPLACE = 4
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

@ilCtrl_Calls

Definition at line 34 of file class.ilECSUtils.php.

Member Function Documentation

◆ _getOptionalEContentFields()

static ilECSUtils::_getOptionalEContentFields ( )
static

get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions

@access public

Definition at line 72 of file class.ilECSUtils.php.

73 {
74 // :TODO: ?
75 $def = self::getEContentDefinition('/campusconnect/courselinks');
76 return array_keys($def);
77 }
static getEContentDefinition($a_resource_id)
Get econtent / metadata definition.
$def
Definition: croninfo.php:21

References $def, and getEContentDefinition().

Referenced by ilECSSettingsGUI\initMappingsForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getOptionalECourseFields()

static ilECSUtils::_getOptionalECourseFields ( )
static

get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions

@access public

Definition at line 87 of file class.ilECSUtils.php.

88 {
89 // :TODO: ?
90 $def = self::getEContentDefinition('/campusconnect/courselinks');
91 return array_keys($def);
92 }

References $def, and getEContentDefinition().

Referenced by ilECSCategoryMapping\getPossibleFields(), and ilECSSettingsGUI\initMappingsForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdvancedMDValuesForObjId()

static ilECSUtils::getAdvancedMDValuesForObjId (   $a_obj_id)
static

Get advanced metadata values for object id.

Parameters
int$a_obj_id
Returns
array

Definition at line 256 of file class.ilECSUtils.php.

257 {
258 $res = array();
259
260 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
261
262 // getting all records
263 foreach (ilAdvancedMDValues::getInstancesForObjectId($a_obj_id) as $a_values) {
264 // this correctly binds group and definitions
265 $a_values->read();
266
267 // getting elements for record
268 $defs = $a_values->getDefinitions();
269 foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
270 if (!$element->isNull()) {
271 // :TODO: using this for a "flat" presentation
272 $res[$element_id] = $defs[$element_id]->getValueForXML($element);
273 } else {
274 // :TODO: is this needed?
275 $res[$element_id] = null;
276 }
277 }
278 }
279
280 return $res;
281 }
static getInstancesForObjectId($a_obj_id, $a_obj_type=null, $a_sub_type="-", $a_sub_id=0)
Get instances for given object id.
foreach($_POST as $key=> $value) $res

References $res, and ilAdvancedMDValues\getInstancesForObjectId().

Referenced by ilECSObjectSettings\addMetadataToJson(), ilECSSettingsGUI\exportImported(), ilECSSettingsGUI\exportReleased(), ilECSImportedContentTableGUI\fillRow(), and ilECSReleasedContentTableGUI\fillRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEContentDefinition()

static ilECSUtils::getEContentDefinition (   $a_resource_id)
static

Get econtent / metadata definition.

Parameters
string$a_resource_id
Returns
array

Definition at line 146 of file class.ilECSUtils.php.

147 {
148 switch ($a_resource_id) {
149 case '/campusconnect/courselinks':
150 return array(
151 'study_courses' => self::TYPE_ARRAY,
152 'lecturer' => self::TYPE_ARRAY,
153 'courseType' => self::TYPE_STRING,
154 'courseID' => self::TYPE_INT,
155 'credits' => self::TYPE_INT,
156 'semester_hours' => self::TYPE_INT,
157 'term' => self::TYPE_STRING,
158 'begin' => array(self::TYPE_TIMEPLACE, 'timePlace'),
159 'end' => array(self::TYPE_TIMEPLACE, 'timePlace'),
160 'room' => array(self::TYPE_TIMEPLACE, 'timePlace'),
161 'cycle' => array(self::TYPE_TIMEPLACE, 'timePlace')
162 );
163
164 case '/campusconnect/categories':
165 case '/campusconnect/files':
166 case '/campusconnect/glossaries':
167 case '/campusconnect/groups':
168 case '/campusconnect/learningmodules':
169 case '/campusconnect/wikis':
170 // no metadata mapping yet
171 return array();
172 }
173 }

Referenced by _getOptionalEContentFields(), _getOptionalECourseFields(), ilECSCourseSettings\buildJson(), getMatchableContent(), and ilObjRemoteCourse\updateCustomFromECSContent().

+ Here is the caller graph for this function:

◆ getMatchableContent()

static ilECSUtils::getMatchableContent (   $a_resource_id,
  $a_server_id,
  $a_ecs_content,
  $a_owner 
)
static

Convert ECS content to rule matchable values.

Parameters
string$a_resource_id
int$a_server_id
object$a_ecs_content
int$a_owner
Returns
array

Definition at line 184 of file class.ilECSUtils.php.

185 {
186 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
187 include_once './Services/WebServices/ECS/classes/class.ilECSCommunitiesCache.php';
188
189 // see ilECSCategoryMapping::getPossibleFields();
190 $res = array();
191 $res["part_id"] = array($a_owner, ilECSCategoryMappingRule::ATTR_INT);
192 $res["community"] = array(ilECSCommunitiesCache::getInstance()->lookupTitle($a_server_id, $a_owner),
194
195 $definition = self::getEContentDefinition($a_resource_id);
196
197 $timePlace = null;
198 foreach ($definition as $id => $type) {
199 if (is_array($type)) {
200 $target = $type[1];
201 $type = $type[0];
202 } else {
203 $target = $id;
204 }
205 switch ($type) {
207 $value = array(implode(',', (array) $a_ecs_content->$target), ilECSCategoryMappingRule::ATTR_ARRAY);
208 break;
209
211 $value = array((int) $a_ecs_content->$target, ilECSCategoryMappingRule::ATTR_INT);
212 break;
213
215 $value = array((string) $a_ecs_content->$target, ilECSCategoryMappingRule::ATTR_STRING);
216 break;
217
219 if (!is_object($timePlace)) {
220 include_once('./Services/WebServices/ECS/classes/class.ilECSTimePlace.php');
221 if (is_object($a_ecs_content->$target)) {
222 $timePlace = new ilECSTimePlace();
223 $timePlace->loadFromJSON($a_ecs_content->$target);
224 } else {
225 $timePlace = new ilECSTimePlace();
226 }
227 }
228 switch ($id) {
229 case 'begin':
230 case 'end':
231 $value = array($timePlace->{'getUT' . ucfirst($id)}(),
233 break;
234
235 case 'room':
236 case 'cycle':
237 $value = array($timePlace->{'get' . ucfirst($id)}(),
239 break;
240 }
241 break;
242 }
243
244 $res[$id] = $value;
245 }
246
247 return $res;
248 }
static getInstance()
Singleton instance.
Representation of ECS EContent Time Place.
const TYPE_TIMEPLACE
if(!array_key_exists('StateId', $_REQUEST)) $id
$type

References $id, $res, $target, $type, ilECSCategoryMappingRule\ATTR_ARRAY, ilECSCategoryMappingRule\ATTR_INT, ilECSCategoryMappingRule\ATTR_STRING, getEContentDefinition(), ilECSCommunitiesCache\getInstance(), TYPE_ARRAY, TYPE_INT, TYPE_STRING, and TYPE_TIMEPLACE.

Referenced by ilRemoteObjectBase\createFromECSEContent(), and ilRemoteObjectBase\updateFromECSContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPossibleReleaseTypes()

static ilECSUtils::getPossibleReleaseTypes (   $a_with_captions = false)
static

Get all possible release object types.

Parameters
bool$a_with_captions
Returns
array

Definition at line 123 of file class.ilECSUtils.php.

124 {
125 global $lng;
126
127 $all = array("crs", "cat", "file", "glo", "grp", "lm", "wiki");
128
129 if (!$a_with_captions) {
130 return $all;
131 }
132
133 $res = array();
134 foreach ($all as $id) {
135 $res[$id] = $lng->txt("obj_" . $id);
136 }
137 return $res;
138 }
global $lng
Definition: privfeed.php:17

References $id, $lng, and $res.

Referenced by ilECSParticipantSettingsGUI\initFormSettings(), and ilECSSettingsGUI\released().

+ Here is the caller graph for this function:

◆ getPossibleRemoteTypes()

static ilECSUtils::getPossibleRemoteTypes (   $a_with_captions = false)
static

Get all possible remote object types.

Parameters
bool$a_with_captions
Returns
array

Definition at line 100 of file class.ilECSUtils.php.

101 {
102 global $lng;
103
104 $all = array("rcrs", "rcat", "rfil", "rglo", "rgrp", "rlm", "rwik");
105
106 if (!$a_with_captions) {
107 return $all;
108 }
109
110 $res = array();
111 foreach ($all as $id) {
112 $res[$id] = $lng->txt("obj_" . $id);
113 }
114 return $res;
115 }

References $id, $lng, and $res.

Referenced by ilECSImport\getAllImportedRemoteObjects(), ilECSEventQueueReader\handleImportReset(), ilECSSettingsGUI\imported(), ilECSSettingsGUI\initCategoryMappingForm(), and ilECSParticipantSettingsGUI\initFormSettings().

+ Here is the caller graph for this function:

◆ lookupParticipantName()

static ilECSUtils::lookupParticipantName (   $a_owner,
  $a_server_id 
)
static

Lookup participant name.

Parameters
int$a_ownerMid of participant
int$a_server_id
Returns

Definition at line 47 of file class.ilECSUtils.php.

48 {
49 global $ilLog;
50
51 try {
52 include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
54 if ($part = $reader->getParticipantByMID($a_owner)) {
55 return $part->getParticipantName();
56 }
57 return '';
58 } catch (ilECSConnectorException $e) {
59 $ilLog->write(__METHOD__ . ': Error reading participants.');
60 return '';
61 }
62 }
static getInstanceByServerId($a_server_id)
Get instance by server id.

References $ilLog, $reader, and ilECSCommunityReader\getInstanceByServerId().

Referenced by ilECSCategoryMappingRule\participantsToString(), and ilRemoteObjectBase\updateFromECSContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ TYPE_ARRAY

const ilECSUtils::TYPE_ARRAY = 1

◆ TYPE_INT

const ilECSUtils::TYPE_INT = 2

◆ TYPE_STRING

const ilECSUtils::TYPE_STRING = 3

◆ TYPE_TIMEPLACE


The documentation for this class was generated from the following file: