24 include_once
'./Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
51 $res =
$ilDB->query(
'SELECT mapping_id FROM ecs_container_mapping');
55 return $rules ? $rules : array();
71 if (is_null(self::$cached_active_rules)) {
72 self::$cached_active_rules = self::getActiveRules();
74 foreach (self::$cached_active_rules as
$rule) {
75 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)
100 $cat = self::getMatchingCategory($a_server_id, $a_matchable_content);
104 $all_cats = self::lookupHandledCategories();
107 foreach ($references as $ref_id => $null) {
108 if (
$tree->getParentId($ref_id) == $cat) {
112 $ilLog->write(__METHOD__ .
': Creating/Deleting references...');
113 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
116 $ilLog->write(__METHOD__ .
': Add new reference. STEP 1');
119 $new_ref_id = $obj_data->createReference();
120 $obj_data->putInTree($cat);
121 $obj_data->setPermissions($cat);
122 $ilLog->write(__METHOD__ .
': Add new reference.');
126 foreach ($references as $ref_id => $null) {
127 $parent =
$tree->getParentId($ref_id);
128 if ($parent == $cat) {
131 if (!in_array($parent, $all_cats)) {
135 $to_delete->delete();
136 $ilLog->write(__METHOD__ .
': Deleted deprecated reference.');
152 $ilDB = $DIC[
'ilDB'];
154 $res =
$ilDB->query(
"SELECT container_id FROM ecs_container_mapping ");
156 $ref_ids[] =
$row->container_id;
158 return $ref_ids ? $ref_ids : array();
174 "community" =>
$lng->txt(
"ecs_field_community"),
175 "part_id" =>
$lng->txt(
"ecs_field_part_id"),
176 "type" =>
$lng->txt(
"type")
182 include_once(
'./Services/WebServices/ECS/classes/class.ilECSUtils.php');
184 foreach ($course_fields as $field) {
185 $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)
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 ...