ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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$

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

public

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

Referenced by ilECSSettingsGUI\initMappingsForm().

76  {
77  // :TODO: ?
78  $def = self::getEContentDefinition('/campusconnect/courselinks');
79  return array_keys($def);
80  }
+ 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

public

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

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

91  {
92  // :TODO: ?
93  $def = self::getEContentDefinition('/campusconnect/courselinks');
94  return array_keys($def);
95  }
+ 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 274 of file class.ilECSUtils.php.

References $res, array, and ilAdvancedMDValues\getInstancesForObjectId().

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

275  {
276  $res = array();
277 
278  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
279 
280  // getting all records
281  foreach(ilAdvancedMDValues::getInstancesForObjectId($a_obj_id) as $a_values)
282  {
283  // this correctly binds group and definitions
284  $a_values->read();
285 
286  // getting elements for record
287  $defs = $a_values->getDefinitions();
288  foreach($a_values->getADTGroup()->getElements() as $element_id => $element)
289  {
290  if(!$element->isNull())
291  {
292  // :TODO: using this for a "flat" presentation
293  $res[$element_id] = $defs[$element_id]->getValueForXML($element);
294  }
295  else
296  {
297  // :TODO: is this needed?
298  $res[$element_id] = null;
299  }
300  }
301  }
302 
303  return $res;
304  }
static getInstancesForObjectId($a_obj_id, $a_obj_type=null, $a_sub_type="-", $a_sub_id=0)
Get instances for given object id.
Create styles array
The data for the language used.
+ 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 153 of file class.ilECSUtils.php.

References array.

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

154  {
155  switch($a_resource_id)
156  {
157  case '/campusconnect/courselinks':
158  return array(
159  'study_courses' => self::TYPE_ARRAY,
160  'lecturer' => self::TYPE_ARRAY,
161  'courseType' => self::TYPE_STRING,
162  'courseID' => self::TYPE_INT,
163  'credits' => self::TYPE_INT,
164  'semester_hours' => self::TYPE_INT,
165  'term' => self::TYPE_STRING,
166  'begin' => array(self::TYPE_TIMEPLACE, 'timePlace'),
167  'end' => array(self::TYPE_TIMEPLACE, 'timePlace'),
168  'room' => array(self::TYPE_TIMEPLACE, 'timePlace'),
169  'cycle' => array(self::TYPE_TIMEPLACE, 'timePlace')
170  );
171 
172  case '/campusconnect/categories':
173  case '/campusconnect/files':
174  case '/campusconnect/glossaries':
175  case '/campusconnect/groups':
176  case '/campusconnect/learningmodules':
177  case '/campusconnect/wikis':
178  // no metadata mapping yet
179  return array();
180  }
181  }
Create styles array
The data for the language used.
+ 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 192 of file class.ilECSUtils.php.

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

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

193  {
194  include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
195  include_once './Services/WebServices/ECS/classes/class.ilECSCommunitiesCache.php';
196 
197  // see ilECSCategoryMapping::getPossibleFields();
198  $res = array();
199  $res["part_id"] = array($a_owner, ilECSCategoryMappingRule::ATTR_INT);
200  $res["community"] = array(ilECSCommunitiesCache::getInstance()->lookupTitle($a_server_id, $a_owner),
202 
203  $definition = self::getEContentDefinition($a_resource_id);
204 
205  $timePlace = null;
206  foreach($definition as $id => $type)
207  {
208  if(is_array($type))
209  {
210  $target = $type[1];
211  $type = $type[0];
212  }
213  else
214  {
215  $target = $id;
216  }
217  switch($type)
218  {
220  $value = array(implode(',', (array) $a_ecs_content->$target), ilECSCategoryMappingRule::ATTR_ARRAY);
221  break;
222 
224  $value = array((int)$a_ecs_content->$target, ilECSCategoryMappingRule::ATTR_INT);
225  break;
226 
228  $value = array((string)$a_ecs_content->$target, ilECSCategoryMappingRule::ATTR_STRING);
229  break;
230 
232  if(!is_object($timePlace))
233  {
234  include_once('./Services/WebServices/ECS/classes/class.ilECSTimePlace.php');
235  if(is_object($a_ecs_content->$target))
236  {
237  $timePlace = new ilECSTimePlace();
238  $timePlace->loadFromJSON($a_ecs_content->$target);
239  }
240  else
241  {
242  $timePlace = new ilECSTimePlace();
243  }
244  }
245  switch($id)
246  {
247  case 'begin':
248  case 'end':
249  $value = array($timePlace->{'getUT'.ucfirst($id)}(),
251  break;
252 
253  case 'room':
254  case 'cycle':
255  $value = array($timePlace->{'get'.ucfirst($id)}(),
257  break;
258  }
259  break;
260  }
261 
262  $res[$id] = $value;
263  }
264 
265  return $res;
266  }
Representation of ECS EContent Time Place.
const TYPE_TIMEPLACE
static getInstance()
Singleton instance.
Create styles array
The data for the language used.
+ 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 128 of file class.ilECSUtils.php.

References $lng, $res, and array.

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

129  {
130  global $lng;
131 
132  $all = array("crs", "cat", "file", "glo", "grp", "lm", "wiki");
133 
134  if(!$a_with_captions)
135  {
136  return $all;
137  }
138 
139  $res = array();
140  foreach($all as $id)
141  {
142  $res[$id] = $lng->txt("obj_".$id);
143  }
144  return $res;
145  }
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ 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 103 of file class.ilECSUtils.php.

References $lng, $res, and array.

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

104  {
105  global $lng;
106 
107  $all = array("rcrs", "rcat", "rfil", "rglo", "rgrp", "rlm", "rwik");
108 
109  if(!$a_with_captions)
110  {
111  return $all;
112  }
113 
114  $res = array();
115  foreach($all as $id)
116  {
117  $res[$id] = $lng->txt("obj_".$id);
118  }
119  return $res;
120  }
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ 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.

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

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

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  {
56  return $part->getParticipantName();
57  }
58  return '';
59  }
60  catch(ilECSConnectorException $e)
61  {
62  $ilLog->write(__METHOD__.': Error reading participants.');
63  return '';
64  }
65  }
static getInstanceByServerId($a_server_id)
Get instance by server id.
+ 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: