24 include_once
'./Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
49 $res = $ilDB->query(
'SELECT mapping_id FROM ecs_container_mapping');
54 return $rules ? $rules :
array();
68 if(is_null(self::$cached_active_rules))
70 self::$cached_active_rules = self::getActiveRules();
72 foreach(self::$cached_active_rules as $rule)
74 if($rule->matches($a_matchable_content))
76 $ilLog->write(__METHOD__.
': Found assignment for field type: '.$rule->getFieldName());
77 return $rule->getContainerId();
79 $ilLog->write(__METHOD__.
': Category assignment failed for field: '.$rule->getFieldName());
82 $ilLog->write(__METHOD__.
': Using default container');
93 public static function handleUpdate($a_obj_id, $a_server_id, $a_matchable_content)
97 $cat = self::getMatchingCategory($a_server_id, $a_matchable_content);
101 $all_cats = self::lookupHandledCategories();
104 foreach($references as
$ref_id => $null)
106 if($tree->getParentId(
$ref_id) == $cat)
111 $ilLog->write(__METHOD__.
': Creating/Deleting references...');
112 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
116 $ilLog->write(__METHOD__.
': Add new reference. STEP 1');
120 $new_ref_id = $obj_data->createReference();
121 $obj_data->putInTree($cat);
122 $obj_data->setPermissions($cat);
123 $ilLog->write(__METHOD__.
': Add new reference.');
127 foreach($references as
$ref_id => $null)
129 $parent = $tree->getParentId(
$ref_id);
134 if(!in_array($parent,$all_cats))
140 $to_delete->delete();
141 $ilLog->write(__METHOD__.
': Deleted deprecated reference.');
157 $res = $ilDB->query(
"SELECT container_id FROM ecs_container_mapping ");
160 $ref_ids[] =
$row->container_id;
162 return $ref_ids ? $ref_ids :
array();
176 "community" => $lng->txt(
"ecs_field_community"),
177 "part_id" => $lng->txt(
"ecs_field_part_id"),
178 "type" => $lng->txt(
"type")
184 include_once(
'./Services/WebServices/ECS/classes/class.ilECSUtils.php');
186 foreach($course_fields as $field)
188 $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
if(!is_array($argv)) $options
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
static _getOptionalECourseFields()
get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions ...