19 declare(strict_types=1);
    48         $this->
logger = $DIC->logger()->otpl();
    49         $this->type = $a_type;
    50         $this->objDefinition = $DIC[
'objDefinition'];
    56         $this->xmlfile = $a_file;
    75         $use_internal_errors = libxml_use_internal_errors(
true);
    77             case self::IMPORT_FILE:
    78                 $root = simplexml_load_string(file_get_contents($this->
getInputFile()));
    81         libxml_use_internal_errors($use_internal_errors);
    88         $this->
parseActions($settings, $root->didacticTemplate->actions);
    94         $status = 
new ilImportStatusFactory();
    96             return $status->collection()->withAddedStatus($status->handler()
    98                 ->withContent($status->content()->builder()->string()
    99                     ->withString(
"Invalid import status, import status 'IMPORT_FILE' expected.")));
   101         $import = 
new ilImportHandlerFactory();
   103         $xsd_schema_info = $import->schemaFolder()->handler()->getLatest(self::SCHEMA_TYPE);
   104         $xml_file_handler = $import->file()->xml()->handler()->withFileInfo($xml_spl_info);
   105         $xsd_file_handler = $import->file()->xsd()->handler()->withFileInfo($xsd_schema_info->getFile());
   106         return $import->validation()->handler()->validateXMLFile($xml_file_handler, $xsd_file_handler);
   116         foreach ($root->didacticTemplate as $tpl) {
   117             switch ((
string) $tpl->attributes()->type) {
   123             $setting->setTitle(trim((
string) $tpl->title));
   124             $setting->setDescription(trim((
string) $tpl->description));
   126             $icon = (string) $tpl->icon;
   129             foreach ((array) $tpl->info->p as $paragraph) {
   133                 $info .= trim((
string) $paragraph);
   135             $setting->setInfo($info);
   137             if (isset($tpl->effectiveFrom) && (
string) $tpl->effectiveFrom[
"nic_id"] == $this->settings->get(
'inst_id')) {
   139                 foreach ($tpl->effectiveFrom->node as $element) {
   140                     $node[] = (
int) $element;
   143                 $setting->setEffectiveFrom($node);
   146             if (isset($tpl->exclusive)) {
   147                 $setting->setExclusive(
true);
   150             foreach ($tpl->assignments->assignment as $element) {
   151                 $setting->addAssignment(trim((
string) $element));
   156         if ($icon !== 
'' && $this->
canUseIcons($setting)) {
   157             $setting->getIconHandler()->writeSvg($icon);
   160         if (isset($root->didacticTemplate->translations)) {
   161             $trans->fromXML($root->didacticTemplate->translations);
   171             if (!$this->objDefinition->isContainer($assignment)) {
   184         $act->setTemplateId($didactic_template_setting->
getId());
   186         foreach ($local_role_action->roleTemplate as $tpl) {
   188             foreach ($tpl->role as $roleDef) {
   190                 $role_id = $rimporter->importSimpleXml($roleDef);
   191                 $act->setRoleTemplateId($role_id);
   202         $act->setTemplateId($didactic_template_setting->
getId());
   204         foreach ($block_role_action->roleFilter as $rfi) {
   205             switch ((
string) $rfi->attributes()->source) {
   217             foreach ($rfi->includePattern as $pat) {
   221                 $pattern->setPattern((
string) $pat->attributes()->preg);
   222                 $act->addFilterPattern($pattern);
   224             foreach ($rfi->excludePattern as $pat) {
   228                 $pattern->setPattern((
string) $pat->attributes()->preg);
   229                 $act->addFilterPattern($pattern);
   240         $act->setTemplateId($didactic_template_setting->
getId());
   242         foreach ($local_policy_action->roleFilter as $rfi) {
   245                 'Current filter source: ' . $rfi->attributes()->source
   247             switch ((
string) $rfi->attributes()->source) {
   261             foreach ($rfi->includePattern as $pat) {
   265                 $pattern->setPattern((
string) $pat->attributes()->preg);
   266                 $act->addFilterPattern($pattern);
   268             foreach ($rfi->excludePattern as $pat) {
   272                 $pattern->setPattern((
string) $pat->attributes()->preg);
   273                 $act->addFilterPattern($pattern);
   277         foreach ($local_policy_action->localPolicyTemplate as $lpo) {
   278             switch ((
string) $lpo->attributes()->type) {
   290             foreach ($lpo->role as $roleDef) {
   293                     $role_id = $rimporter->importSimpleXml($roleDef);
   294                     $act->setRoleTemplateId($role_id);
   297                     $didactic_template_setting->
delete();
   311         if ($actions === null) {
   314         foreach ($actions->children() as $action) {
   315             if ($action->getName() === self::XML_ELEMENT_NAME_LOCAL_ROLE_ACTION) {
   319             if ($action->getName() === self::XML_ELEMENT_NAME_BLOCK_ROLE_ACIONE) {
   323             if ($action->getName() === self::XML_ELEMENT_NAME_LOCAL_POLICY_ACTION) {
   336         foreach (libxml_get_errors() as $err) {
   337             $errors .= $err->code . 
'<br/>';
 const FILTER_PARENT_ROLES
 
const XML_ELEMENT_NAME_BLOCK_ROLE_ACIONE
 
static getInstance(int $a_obj_id, string $a_type)
 
Description of ilDidacticTemplateBlockRoleAction. 
 
const TPL_ACTION_INTERSECT
 
const TPL_ACTION_OVERWRITE
 
const XML_ELEMENT_NAME_LOCAL_ROLE_ACTION
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
parseXmlErrors()
Parse xml errors from libxml_get_errors. 
 
setInputFile(string $a_file)
 
parseBlockRoleAction(ilDidacticTemplateSetting $didactic_template_setting, SimpleXMLElement $block_role_action)
 
parseSettings(SimpleXMLElement $root)
Parse settings. 
 
parseActions(ilDidacticTemplateSetting $set, SimpleXMLElement $actions=null)
Parse template action from xml. 
 
const FILTER_SOURCE_OBJ_ID
 
Implementation of an include filter pattern for didactic template actions. 
 
Description of ilDidacticTemplateImportException. 
 
Description of ilDidacticTemplateImport. 
 
parseLocalRoleAction(ilDidacticTemplateSetting $didactic_template_setting, SimpleXMLElement $local_role_action)
 
ilObjectDefinition $objDefinition
 
const XML_ELEMENT_NAME_LOCAL_POLICY_ACTION
 
represents a creation of local roles action 
 
const PATTERN_SUBTYPE_REGEX
 
parseLocalPolicyAction(ilDidacticTemplateSetting $didactic_template_setting, SimpleXMLElement $local_policy_action)
 
const FILTER_SOURCE_TITLE
 
canUseIcons(ilDidacticTemplateSetting $setting)
 
Implementation of an include filter pattern for didactic template actions.