ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilECSUtils Class Reference
+ Collaboration diagram for ilECSUtils:

Static Public Member Functions

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

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

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.

References getEContentDefinition().

Referenced by ilECSSettingsGUI\initMappingsForm().

{
// :TODO: ?
$def = self::getEContentDefinition('/campusconnect/courselinks');
return array_keys($def);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

References getEContentDefinition().

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

{
// :TODO: ?
$def = self::getEContentDefinition('/campusconnect/courselinks');
return array_keys($def);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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, and ilAdvancedMDValues\getInstancesForObjectId().

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

{
$res = array();
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
// getting all records
foreach(ilAdvancedMDValues::getInstancesForObjectId($a_obj_id) as $a_values)
{
// this correctly binds group and definitions
$a_values->read();
// getting elements for record
$defs = $a_values->getDefinitions();
foreach($a_values->getADTGroup()->getElements() as $element_id => $element)
{
if(!$element->isNull())
{
// :TODO: using this for a "flat" presentation
$res[$element_id] = $defs[$element_id]->getValueForXML($element);
}
else
{
// :TODO: is this needed?
$res[$element_id] = null;
}
}
}
return $res;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

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

{
switch($a_resource_id)
{
case '/campusconnect/courselinks':
return array(
'study_courses' => self::TYPE_ARRAY,
'lecturer' => self::TYPE_ARRAY,
'courseType' => self::TYPE_STRING,
'courseID' => self::TYPE_INT,
'credits' => self::TYPE_INT,
'semester_hours' => self::TYPE_INT,
'term' => self::TYPE_STRING,
'begin' => array(self::TYPE_TIMEPLACE, 'timePlace'),
'end' => array(self::TYPE_TIMEPLACE, 'timePlace'),
'room' => array(self::TYPE_TIMEPLACE, 'timePlace'),
'cycle' => array(self::TYPE_TIMEPLACE, 'timePlace')
);
case '/campusconnect/categories':
case '/campusconnect/files':
case '/campusconnect/glossaries':
case '/campusconnect/groups':
case '/campusconnect/learningmodules':
case '/campusconnect/wikis':
// no metadata mapping yet
return array();
}
}

+ Here is the caller graph for this function:

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, 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().

{
include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
include_once './Services/WebServices/ECS/classes/class.ilECSCommunitiesCache.php';
// see ilECSCategoryMapping::getPossibleFields();
$res = array();
$res["part_id"] = array($a_owner, ilECSCategoryMappingRule::ATTR_INT);
$res["community"] = array(ilECSCommunitiesCache::getInstance()->lookupTitle($a_server_id, $a_owner),
$definition = self::getEContentDefinition($a_resource_id);
$timePlace = null;
foreach($definition as $id => $type)
{
if(is_array($type))
{
$target = $type[1];
$type = $type[0];
}
else
{
$target = $id;
}
switch($type)
{
$value = array(implode(',', (array) $a_ecs_content->$target), ilECSCategoryMappingRule::ATTR_ARRAY);
break;
$value = array((int)$a_ecs_content->$target, ilECSCategoryMappingRule::ATTR_INT);
break;
$value = array((string)$a_ecs_content->$target, ilECSCategoryMappingRule::ATTR_STRING);
break;
if(!is_object($timePlace))
{
include_once('./Services/WebServices/ECS/classes/class.ilECSTimePlace.php');
if(is_object($a_ecs_content->$target))
{
$timePlace = new ilECSTimePlace();
$timePlace->loadFromJSON($a_ecs_content->$target);
}
else
{
$timePlace = new ilECSTimePlace();
}
}
switch($id)
{
case 'begin':
case 'end':
$value = array($timePlace->{'getUT'.ucfirst($id)}(),
break;
case 'room':
case 'cycle':
$value = array($timePlace->{'get'.ucfirst($id)}(),
break;
}
break;
}
$res[$id] = $value;
}
return $res;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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, and $res.

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

{
global $lng;
$all = array("crs", "cat", "file", "glo", "grp", "lm", "wiki");
if(!$a_with_captions)
{
return $all;
}
$res = array();
foreach($all as $id)
{
$res[$id] = $lng->txt("obj_".$id);
}
return $res;
}

+ Here is the caller graph for this function:

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, and $res.

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

{
global $lng;
$all = array("rcrs", "rcat", "rfil", "rglo", "rgrp", "rlm", "rwik");
if(!$a_with_captions)
{
return $all;
}
$res = array();
foreach($all as $id)
{
$res[$id] = $lng->txt("obj_".$id);
}
return $res;
}

+ Here is the caller graph for this function:

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().

{
global $ilLog;
try {
include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
if($part = $reader->getParticipantByMID($a_owner))
{
return $part->getParticipantName();
}
return '';
}
{
$ilLog->write(__METHOD__.': Error reading participants.');
return '';
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

const ilECSUtils::TYPE_ARRAY = 1
const ilECSUtils::TYPE_INT = 2
const ilECSUtils::TYPE_STRING = 3

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