ILIAS  release_7 Revision v7.30-3-g800a261c036
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 74 of file class.ilECSUtils.php.

Referenced by ilECSSettingsGUI\initMappingsForm().

75  {
76  // :TODO: ?
77  $def = self::getEContentDefinition('/campusconnect/courselinks');
78  return array_keys($def);
79  }
+ 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 89 of file class.ilECSUtils.php.

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

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

References $res, and ilAdvancedMDValues\getInstancesForObjectId().

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

263  {
264  $res = array();
265 
266  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
267 
268  // getting all records
269  foreach (ilAdvancedMDValues::getInstancesForObjectId($a_obj_id) as $a_values) {
270  // this correctly binds group and definitions
271  $a_values->read();
272 
273  // getting elements for record
274  $defs = $a_values->getDefinitions();
275  foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
276  if (!$element->isNull()) {
277  // :TODO: using this for a "flat" presentation
278  $res[$element_id] = $defs[$element_id]->getValueForXML($element);
279  } else {
280  // :TODO: is this needed?
281  $res[$element_id] = null;
282  }
283  }
284  }
285 
286  return $res;
287  }
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
+ 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 152 of file class.ilECSUtils.php.

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

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

References $res, $type, 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().

191  {
192  include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
193  include_once './Services/WebServices/ECS/classes/class.ilECSCommunitiesCache.php';
194 
195  // see ilECSCategoryMapping::getPossibleFields();
196  $res = array();
197  $res["part_id"] = array($a_owner, ilECSCategoryMappingRule::ATTR_INT);
198  $res["community"] = array(ilECSCommunitiesCache::getInstance()->lookupTitle($a_server_id, $a_owner),
200 
201  $definition = self::getEContentDefinition($a_resource_id);
202 
203  $timePlace = null;
204  foreach ($definition as $id => $type) {
205  if (is_array($type)) {
206  $target = $type[1];
207  $type = $type[0];
208  } else {
209  $target = $id;
210  }
211  switch ($type) {
213  $value = array(implode(',', (array) $a_ecs_content->$target), ilECSCategoryMappingRule::ATTR_ARRAY);
214  break;
215 
217  $value = array((int) $a_ecs_content->$target, ilECSCategoryMappingRule::ATTR_INT);
218  break;
219 
221  $value = array((string) $a_ecs_content->$target, ilECSCategoryMappingRule::ATTR_STRING);
222  break;
223 
225  if (!is_object($timePlace)) {
226  include_once('./Services/WebServices/ECS/classes/class.ilECSTimePlace.php');
227  if (is_object($a_ecs_content->$target)) {
228  $timePlace = new ilECSTimePlace();
229  $timePlace->loadFromJSON($a_ecs_content->$target);
230  } else {
231  $timePlace = new ilECSTimePlace();
232  }
233  }
234  switch ($id) {
235  case 'begin':
236  case 'end':
237  $value = array($timePlace->{'getUT' . ucfirst($id)}(),
239  break;
240 
241  case 'room':
242  case 'cycle':
243  $value = array($timePlace->{'get' . ucfirst($id)}(),
245  break;
246  }
247  break;
248  }
249 
250  $res[$id] = $value;
251  }
252 
253  return $res;
254  }
Representation of ECS EContent Time Place.
$type
const TYPE_TIMEPLACE
foreach($_POST as $key=> $value) $res
static getInstance()
Singleton instance.
+ 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 127 of file class.ilECSUtils.php.

References $DIC, $lng, and $res.

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

128  {
129  global $DIC;
130 
131  $lng = $DIC['lng'];
132 
133  $all = array("crs", "cat", "file", "glo", "grp", "lm", "wiki");
134 
135  if (!$a_with_captions) {
136  return $all;
137  }
138 
139  $res = array();
140  foreach ($all as $id) {
141  $res[$id] = $lng->txt("obj_" . $id);
142  }
143  return $res;
144  }
foreach($_POST as $key=> $value) $res
$lng
global $DIC
Definition: goto.php:24
+ 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 102 of file class.ilECSUtils.php.

References $DIC, $lng, and $res.

Referenced by ilAdvancedMDRecord\_getAllRecordsByObjectType(), ilAdvancedMDRecord\_getAssignableObjectTypes(), ilObjRole\_removeObjectId(), ilECSImport\getAllImportedRemoteObjects(), ilECSEventQueueReader\handleImportReset(), ilECSSettingsGUI\imported(), ilECSSettingsGUI\initCategoryMappingForm(), and ilECSParticipantSettingsGUI\initFormSettings().

103  {
104  global $DIC;
105 
106  $lng = $DIC['lng'];
107 
108  $all = array("rcrs", "rcat", "rfil", "rglo", "rgrp", "rlm", "rwik");
109 
110  if (!$a_with_captions) {
111  return $all;
112  }
113 
114  $res = array();
115  foreach ($all as $id) {
116  $res[$id] = $lng->txt("obj_" . $id);
117  }
118  return $res;
119  }
foreach($_POST as $key=> $value) $res
$lng
global $DIC
Definition: goto.php:24
+ 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 $DIC, Vendor\Package\$e, and ilECSCommunityReader\getInstanceByServerId().

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

48  {
49  global $DIC;
50 
51  $ilLog = $DIC['ilLog'];
52 
53  try {
54  include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
55  $reader = ilECSCommunityReader::getInstanceByServerId($a_server_id);
56  if ($part = $reader->getParticipantByMID($a_owner)) {
57  return $part->getParticipantName();
58  }
59  return '';
60  } catch (ilECSConnectorException $e) {
61  $ilLog->write(__METHOD__ . ': Error reading participants.');
62  return '';
63  }
64  }
static getInstanceByServerId($a_server_id)
Get instance by server id.
global $DIC
Definition: goto.php:24
+ 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: