protected function buildJson(ilECSSetting $a_server)
 {
     global $ilLog;
     $json = $this->getJsonCore('application/ecs-course');
     // meta language
     include_once './Services/MetaData/classes/class.ilMDLanguage.php';
     $lang = ilMDLanguage::_lookupFirstLanguage($this->content_obj->getId(), $this->content_obj->getId(), $this->content_obj->getType());
     if (strlen($lang)) {
         $json->lang = $lang . '_' . strtoupper($lang);
     }
     $json->status = $this->content_obj->isActivated() ? 'online' : 'offline';
     include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php';
     $definition = ilECSUtils::getEContentDefinition($this->getECSObjectType());
     $this->addMetadataToJson($json, $a_server, $definition);
     return $json;
 }
Пример #2
0
 protected function updateCustomFromECSContent(ilECSSetting $a_server, $a_ecs_content)
 {
     // add custom values
     $this->setAvailabilityType($a_ecs_content->status == 'online' ? self::ACTIVATION_UNLIMITED : self::ACTIVATION_OFFLINE);
     // :TODO: ACTIVATION_LIMITED is currently not supported in ECS yet
     // adv. metadata
     include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php';
     include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
     $definition = ilECSUtils::getEContentDefinition($this->getECSObjectType());
     $this->importMetadataFromJson($a_ecs_content, $a_server, $definition, ilECSDataMappingSetting::MAPPING_IMPORT_RCRS);
     include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
     $import = new ilECSImport($a_server->getServerId(), $this->getId());
     $import->setContentId($a_ecs_content->courseID);
     $import->save();
 }