4 include_once
'./Services/DidacticTemplate/exceptions/class.ilDidacticTemplateImportException.php';
26 $this->type = $a_type;
35 $this->xmlfile = $a_file;
59 public function import()
61 libxml_use_internal_errors(
true);
65 case self::IMPORT_FILE:
78 $this->
parseActions($settings,$root->didacticTemplate->actions);
90 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateSetting.php';
93 foreach($root->didacticTemplate as
$tpl)
95 switch((
string) $tpl->attributes()->type)
102 $setting->setTitle(trim((
string) $tpl->title));
103 $setting->setDescription(trim((
string) $tpl->description));
106 foreach((array) $tpl->info->p as $paragraph)
112 $info .= trim((
string) $paragraph);
114 $setting->setInfo($info);
116 foreach($tpl->assignments->assignment as $element)
118 $setting->addAssignment(trim((
string) $element));
133 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
135 if($actions === NULL)
143 foreach($actions->localRoleAction as $ele)
145 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateLocalRoleAction.php';
147 $act->setTemplateId($set->
getId());
149 foreach($ele->roleTemplate as
$tpl)
152 foreach($tpl->role as $roleDef)
154 include_once
'./Services/AccessControl/classes/class.ilRoleXmlImporter.php';
156 $role_id = $rimporter->importSimpleXml($roleDef);
157 $act->setRoleTemplateId($role_id);
166 foreach($actions->blockRoleAction as $ele)
168 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateBlockRoleAction.php';
170 $act->setTemplateId($set->
getId());
173 foreach($ele->roleFilter as $rfi)
175 $act->setFilterType((
string) $rfi->attributes()->source);
176 foreach($rfi->includePattern as $pat)
179 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateIncludeFilterPattern.php';
182 $pattern->setPattern((
string) $pat->attributes()->preg);
183 $act->addFilterPattern($pattern);
185 foreach($rfi->excludePattern as $pat)
188 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateExcludeFilterPattern.php';
191 $pattern->setPattern((
string) $pat->attributes()->preg);
192 $act->addFilterPattern($pattern);
204 foreach($actions->localPolicyAction as $ele)
206 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateLocalPolicyAction.php';
208 $act->setTemplateId($set->
getId());
211 foreach($ele->roleFilter as $rfi)
213 $act->setFilterType((
string) $rfi->attributes()->source);
214 foreach($rfi->includePattern as $pat)
217 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateIncludeFilterPattern.php';
220 $pattern->setPattern((
string) $pat->attributes()->preg);
221 $act->addFilterPattern($pattern);
223 foreach($rfi->excludePattern as $pat)
226 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateExcludeFilterPattern.php';
229 $pattern->setPattern((
string) $pat->attributes()->preg);
230 $act->addFilterPattern($pattern);
235 foreach($ele->localPolicyTemplate as $lpo)
238 switch((
string) $lpo->attributes()->type)
254 foreach($lpo->role as $roleDef)
256 include_once
'./Services/AccessControl/classes/class.ilRoleXmlImporter.php';
258 $role_id = $rimporter->importSimpleXml($roleDef);
259 $act->setRoleTemplateId($role_id);
277 foreach(libxml_get_errors() as $err)