ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilECSUtils Class Reference
+ Collaboration diagram for ilECSUtils:

Static Public Member Functions

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 (bool $a_with_captions=false)
 Get all possible remote object types. More...
 
static getPossibleReleaseTypes (bool $a_with_captions=false)
 Get all possible release object types. More...
 
static getEContentDefinition (string $a_resource_id)
 Get econtent / metadata definition. More...
 
static getMatchableContent (string $a_resource_id, int $a_server_id, object $a_ecs_content, int $a_owner)
 Convert ECS content to rule matchable values. More...
 
static getAdvancedMDValuesForObjId (int $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

Definition at line 24 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

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

Referenced by ilECSSettingsGUI\initMappingsForm().

35  : array
36  {
37  // :TODO: ?
38  $def = self::getEContentDefinition('/campusconnect/courselinks');
39  return array_keys($def);
40  }
+ 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

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

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

46  : array
47  {
48  // :TODO: ?
49  $def = self::getEContentDefinition('/campusconnect/courselinks');
50  return array_keys($def);
51  }
+ Here is the caller graph for this function:

◆ getAdvancedMDValuesForObjId()

static ilECSUtils::getAdvancedMDValuesForObjId ( int  $a_obj_id)
static

Get advanced metadata values for object id.

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

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

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

208  : array
209  {
210  $res = array();
211 
212  // getting all records
213  foreach (ilAdvancedMDValues::getInstancesForObjectId($a_obj_id) as $a_values) {
214  // this correctly binds group and definitions
215  $a_values->read();
216 
217  // getting elements for record
218  $defs = $a_values->getDefinitions();
219  foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
220  if (!$element->isNull()) {
221  // :TODO: using this for a "flat" presentation
222  $res[$element_id] = $defs[$element_id]->getValueForXML($element);
223  } else {
224  // :TODO: is this needed?
225  $res[$element_id] = null;
226  }
227  }
228  }
229 
230  return $res;
231  }
static getInstancesForObjectId(int $a_obj_id, ?string $a_obj_type=null, string $a_sub_type="-", int $a_sub_id=0)
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEContentDefinition()

static ilECSUtils::getEContentDefinition ( string  $a_resource_id)
static

Get econtent / metadata definition.

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

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

100  : array
101  {
102  switch ($a_resource_id) {
103  case '/campusconnect/courselinks':
104  return array(
105  'study_courses' => self::TYPE_ARRAY,
106  'lecturer' => self::TYPE_ARRAY,
107  'courseType' => self::TYPE_STRING,
108  'courseID' => self::TYPE_INT,
109  'credits' => self::TYPE_INT,
110  'semester_hours' => self::TYPE_INT,
111  'term' => self::TYPE_STRING,
112  'begin' => array(self::TYPE_TIMEPLACE, 'timePlace'),
113  'end' => array(self::TYPE_TIMEPLACE, 'timePlace'),
114  'room' => array(self::TYPE_TIMEPLACE, 'timePlace'),
115  'cycle' => array(self::TYPE_TIMEPLACE, 'timePlace')
116  );
117 
118  case '/campusconnect/categories':
119  case '/campusconnect/files':
120  case '/campusconnect/glossaries':
121  case '/campusconnect/groups':
122  case '/campusconnect/learningmodules':
123  case '/campusconnect/wikis':
124  // no metadata mapping yet
125  default:
126  return [];
127  }
128  }
+ Here is the caller graph for this function:

◆ getMatchableContent()

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

Convert ECS content to rule matchable values.

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

References $id, $res, ilECSCategoryMappingRule\ATTR_ARRAY, ilECSCategoryMappingRule\ATTR_INT, ilECSCategoryMappingRule\ATTR_STRING, ilECSCommunitiesCache\getInstance(), and null.

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

133  : array
134  {
135  // see ilECSCategoryMapping::getPossibleFields();
136  $res = array();
137  $res["part_id"] = array($a_owner, ilECSCategoryMappingRule::ATTR_INT);
138  $res["community"] = array(ilECSCommunitiesCache::getInstance()->lookupTitle($a_server_id, $a_owner),
140 
141  $definition = self::getEContentDefinition($a_resource_id);
142 
143  $timePlace = null;
144  $value = null;
145  foreach ($definition as $id => $type) {
146  if (is_array($type)) {
147  [$type, $target] = $type;
148  } else {
149  $target = $id;
150  }
151  switch ($type) {
152  case self::TYPE_ARRAY:
153  if (isset($a_ecs_content->{$target})) {
154  $value = array(implode(',', (array) $a_ecs_content->{$target}), ilECSCategoryMappingRule::ATTR_ARRAY);
155  } else {
156  $value = [];
157  }
158  break;
159 
160  case self::TYPE_INT:
161  if (isset($a_ecs_content->{$target})) {
162  $value = array((int) $a_ecs_content->{$target}, ilECSCategoryMappingRule::ATTR_INT);
163  } else {
164  $value = 0;
165  }
166  break;
167 
168  case self::TYPE_STRING:
169  if (isset($a_ecs_content->{$target})) {
170  $value = array((string) $a_ecs_content->{$target}, ilECSCategoryMappingRule::ATTR_STRING);
171  } else {
172  $value = "";
173  }
174  break;
175 
176  case self::TYPE_TIMEPLACE:
177  if (!is_object($timePlace)) {
178  $timePlace = new ilECSTimePlace();
179  if (isset($a_ecs_content->{$target}) && is_object($a_ecs_content->{$target})) {
180  $timePlace->loadFromJSON($a_ecs_content->{$target});
181  }
182  }
183  switch ($id) {
184  case 'begin':
185  case 'end':
186  $value = array($timePlace->{'getUT' . ucfirst($id)}(),
188  break;
189 
190  case 'room':
191  case 'cycle':
192  $value = array($timePlace->{'get' . ucfirst($id)}(),
194  break;
195  }
196  break;
197  }
198 
199  $res[$id] = $value;
200  }
201 
202  return $res;
203  }
$res
Definition: ltiservices.php:66
Representation of ECS EContent Time Place.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getInstance()
Singleton instance.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPossibleReleaseTypes()

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

Get all possible release object types.

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

References $DIC, $id, $lng, and $res.

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

78  : array
79  {
80  global $DIC;
81 
82  $lng = $DIC['lng'];
83 
84  $all = array("crs", "cat", "file", "glo", "grp", "lm", "wiki");
85 
86  if (!$a_with_captions) {
87  return $all;
88  }
89 
90  $res = array();
91  foreach ($all as $id) {
92  $res[$id] = $lng->txt("obj_" . $id);
93  }
94  return $res;
95  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:26
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $lng
Definition: privfeed.php:31
+ Here is the caller graph for this function:

◆ getPossibleRemoteTypes()

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

Get all possible remote object types.

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

References $DIC, $id, $lng, and $res.

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

56  : array
57  {
58  global $DIC;
59 
60  $lng = $DIC['lng'];
61 
62  $all = array("rcrs", "rcat", "rfil", "rglo", "rgrp", "rlm", "rwik");
63 
64  if (!$a_with_captions) {
65  return $all;
66  }
67 
68  $res = array();
69  foreach ($all as $id) {
70  $res[$id] = $lng->txt("obj_" . $id);
71  }
72  return $res;
73  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:26
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $lng
Definition: privfeed.php:31
+ 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: