24 include_once
'./Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
49 $res = $ilDB->query(
'SELECT mapping_id FROM ecs_container_mapping');
53 return $rules ? $rules :
array();
67 if (is_null(self::$cached_active_rules)) {
68 self::$cached_active_rules = self::getActiveRules();
70 foreach (self::$cached_active_rules as
$rule) {
71 if ($rule->matches($a_matchable_content)) {
72 $ilLog->write(__METHOD__ .
': Found assignment for field type: ' . $rule->getFieldName());
73 return $rule->getContainerId();
75 $ilLog->write(__METHOD__ .
': Category assignment failed for field: ' . $rule->getFieldName());
78 $ilLog->write(__METHOD__ .
': Using default container');
89 public static function handleUpdate($a_obj_id, $a_server_id, $a_matchable_content)
93 $cat = self::getMatchingCategory($a_server_id, $a_matchable_content);
97 $all_cats = self::lookupHandledCategories();
100 foreach ($references as $ref_id => $null) {
101 if ($tree->getParentId($ref_id) == $cat) {
105 $ilLog->write(__METHOD__ .
': Creating/Deleting references...');
106 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
109 $ilLog->write(__METHOD__ .
': Add new reference. STEP 1');
112 $new_ref_id = $obj_data->createReference();
113 $obj_data->putInTree($cat);
114 $obj_data->setPermissions($cat);
115 $ilLog->write(__METHOD__ .
': Add new reference.');
119 foreach ($references as $ref_id => $null) {
120 $parent = $tree->getParentId($ref_id);
121 if ($parent == $cat) {
124 if (!in_array($parent, $all_cats)) {
128 $to_delete->delete();
129 $ilLog->write(__METHOD__ .
': Deleted deprecated reference.');
145 $res = $ilDB->query(
"SELECT container_id FROM ecs_container_mapping ");
147 $ref_ids[] =
$row->container_id;
149 return $ref_ids ? $ref_ids :
array();
163 "community" => $lng->txt(
"ecs_field_community"),
164 "part_id" => $lng->txt(
"ecs_field_part_id"),
165 "type" => $lng->txt(
"type")
171 include_once(
'./Services/WebServices/ECS/classes/class.ilECSUtils.php');
173 foreach ($course_fields as $field) {
174 $options[$field] = $lng->txt(
"obj_rcrs") .
" - " . $lng->txt(
"ecs_field_" . $field);
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
static handleUpdate($a_obj_id, $a_server_id, $a_matchable_content)
Handle update of ecs content and create references.
Defines a rule for the assignment of ECS remote courses to categories.
static $cached_active_rules
static _getAllReferences($a_id)
get all reference ids of object
static getPossibleFields()
static getActiveRules()
get active rules
foreach($_POST as $key=> $value) $res
static getMatchingCategory($a_server_id, $a_matchable_content)
get matching category
static _lookupObjId($a_id)
Create styles array
The data for the language used.
static lookupHandledCategories()
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
static _getOptionalECourseFields()
get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions ...