/** * Singleton instance * @return ilECSCommunitiesCache */ public static function getInstance() { if (isset(self::$instance)) { return self::$instance; } return self::$instance = new ilECSCommunitiesCache(); }
/** * Do delete */ protected function doDelete() { $this->initSettings($_REQUEST['server_id']); $this->settings->delete(); // Delete communities include_once './Services/WebServices/ECS/classes/class.ilECSCommunitiesCache.php'; ilECSCommunitiesCache::delete((int) $_REQUEST['server_id']); include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php'; ilECSDataMappingSettings::delete((int) $_REQUEST['server_id']); include_once './Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php'; ilECSEventQueueReader::deleteServer((int) $_REQUEST['server_id']); include_once './Services/WebServices/ECS/classes/class.ilECSExport.php'; ilECSExport::deleteByServer((int) $_REQUEST['server_id']); include_once './Services/WebServices/ECS/classes/class.ilECSImport.php'; ilECSImport::deleteByServer((int) $_REQUEST['server_id']); include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php'; ilECSParticipantSettings::deleteByServer((int) $_REQUEST['server_id']); ilUtil::sendSuccess($this->lng->txt('ecs_setting_deleted'), true); $this->ctrl->redirect($this, 'overview'); }
/** * Convert ECS content to rule matchable values * * @param string $a_resource_id * @param int $a_server_id * @param object $a_ecs_content * @param int $a_owner * @return array */ public static function getMatchableContent($a_resource_id, $a_server_id, $a_ecs_content, $a_owner) { 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), ilECSCategoryMappingRule::ATTR_STRING); $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) { case ilECSUtils::TYPE_ARRAY: $value = array(implode(',', (array) $a_ecs_content->{$target}), ilECSCategoryMappingRule::ATTR_ARRAY); break; case ilECSUtils::TYPE_INT: $value = array((int) $a_ecs_content->{$target}, ilECSCategoryMappingRule::ATTR_INT); break; case ilECSUtils::TYPE_STRING: $value = array((string) $a_ecs_content->{$target}, ilECSCategoryMappingRule::ATTR_STRING); break; case ilECSUtils::TYPE_TIMEPLACE: 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)}(), ilECSCategoryMappingRule::ATTR_INT); break; case 'room': case 'cycle': $value = array($timePlace->{'get' . ucfirst($id)}(), ilECSCategoryMappingRule::ATTR_STRING); break; } break; } $res[$id] = $value; } return $res; }