ILIAS  release_8 Revision v8.24
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 23 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 34 of file class.ilECSUtils.php.

34 : array
35 {
36 // :TODO: ?
37 $def = self::getEContentDefinition('/campusconnect/courselinks');
38 return array_keys($def);
39 }
static getEContentDefinition(string $a_resource_id)
Get econtent / metadata definition.

References 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

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

45 : array
46 {
47 // :TODO: ?
48 $def = self::getEContentDefinition('/campusconnect/courselinks');
49 return array_keys($def);
50 }

References 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 ( int  $a_obj_id)
static

Get advanced metadata values for object id.

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

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

References $res, and ilAdvancedMDValues\getInstancesForObjectId().

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

+ 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 99 of file class.ilECSUtils.php.

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

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

+ 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 132 of file class.ilECSUtils.php.

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

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

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 ( bool  $a_with_captions = false)
static

Get all possible release object types.

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

77 : array
78 {
79 global $DIC;
80
81 $lng = $DIC['lng'];
82
83 $all = array("crs", "cat", "file", "glo", "grp", "lm", "wiki");
84
85 if (!$a_with_captions) {
86 return $all;
87 }
88
89 $res = array();
90 foreach ($all as $id) {
91 $res[$id] = $lng->txt("obj_" . $id);
92 }
93 return $res;
94 }
global $DIC
Definition: feed.php:28
$lng

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

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

+ 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 55 of file class.ilECSUtils.php.

55 : array
56 {
57 global $DIC;
58
59 $lng = $DIC['lng'];
60
61 $all = array("rcrs", "rcat", "rfil", "rglo", "rgrp", "rlm", "rwik");
62
63 if (!$a_with_captions) {
64 return $all;
65 }
66
67 $res = array();
68 foreach ($all as $id) {
69 $res[$id] = $lng->txt("obj_" . $id);
70 }
71 return $res;
72 }

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

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

+ 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: