4 include_once
'./Services/DidacticTemplate/exceptions/class.ilDidacticTemplateImportException.php';
35 $this->xmlfile = $a_file;
59 public function import($a_dtpl_id = 0)
61 libxml_use_internal_errors(
true);
65 case self::IMPORT_FILE:
78 $this->
parseActions($settings,$root->didacticTemplate->actions);
91 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateSetting.php';
94 foreach($root->didacticTemplate as
$tpl)
96 switch((
string) $tpl->attributes()->type)
103 $setting->setTitle(trim((
string) $tpl->title));
104 $setting->setDescription(trim((
string) $tpl->description));
107 foreach((
array) $tpl->info->p as $paragraph)
113 $info .= trim((
string) $paragraph);
115 $setting->setInfo(
$info);
117 if(isset($tpl->effectiveFrom) && (
string)$tpl->effectiveFrom[
"nic_id"] == $ilSetting->get(
'inst_id') )
120 foreach($tpl->effectiveFrom->node as $element)
122 $node[] = (int) $element;
125 $setting->setEffectiveFrom($node);
128 if(isset($tpl->exclusive))
130 $setting->setExclusive(
true);
133 foreach($tpl->assignments->assignment as $element)
135 $setting->addAssignment(trim((
string) $element));
140 include_once(
"./Services/Multilingualism/classes/class.ilMultilingualism.php");
143 if(isset($root->didacticTemplate->translations))
145 $trans->fromXML($root->didacticTemplate->translations);
160 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
162 if($actions === NULL)
170 foreach($actions->localRoleAction as $ele)
172 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateLocalRoleAction.php';
174 $act->setTemplateId($set->
getId());
176 foreach($ele->roleTemplate as
$tpl)
179 foreach($tpl->role as $roleDef)
181 include_once
'./Services/AccessControl/classes/class.ilRoleXmlImporter.php';
183 $role_id = $rimporter->importSimpleXml($roleDef);
184 $act->setRoleTemplateId($role_id);
193 foreach($actions->blockRoleAction as $ele)
195 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateBlockRoleAction.php';
197 $act->setTemplateId($set->
getId());
200 foreach($ele->roleFilter as $rfi)
202 $act->setFilterType((
string) $rfi->attributes()->source);
203 foreach($rfi->includePattern as $pat)
206 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateIncludeFilterPattern.php';
209 $pattern->setPattern((
string) $pat->attributes()->preg);
210 $act->addFilterPattern($pattern);
212 foreach($rfi->excludePattern as $pat)
215 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateExcludeFilterPattern.php';
218 $pattern->setPattern((
string) $pat->attributes()->preg);
219 $act->addFilterPattern($pattern);
231 foreach($actions->localPolicyAction as $ele)
233 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateLocalPolicyAction.php';
235 $act->setTemplateId($set->
getId());
238 foreach($ele->roleFilter as $rfi)
240 $act->setFilterType((
string) $rfi->attributes()->source);
241 foreach($rfi->includePattern as $pat)
244 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateIncludeFilterPattern.php';
247 $pattern->setPattern((
string) $pat->attributes()->preg);
248 $act->addFilterPattern($pattern);
250 foreach($rfi->excludePattern as $pat)
253 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateExcludeFilterPattern.php';
256 $pattern->setPattern((
string) $pat->attributes()->preg);
257 $act->addFilterPattern($pattern);
262 foreach($ele->localPolicyTemplate as $lpo)
265 switch((
string) $lpo->attributes()->type)
281 foreach($lpo->role as $roleDef)
283 include_once
'./Services/AccessControl/classes/class.ilRoleXmlImporter.php';
285 $role_id = $rimporter->importSimpleXml($roleDef);
286 $act->setRoleTemplateId($role_id);
304 foreach(libxml_get_errors() as $err)
static getInstance($a_obj_id, $a_type)
Get instance.
Description of ilDidacticTemplateBlockRoleAction.
const TPL_ACTION_INTERSECT
getInputType()
Get input type.
const TPL_ACTION_OVERWRITE
parseXmlErrors()
Parse xml errors from libxml_get_errors.
parseSettings(SimpleXMLElement $root)
Parse settings.
Implementation of an include filter pattern for didactic template actions.
Description of ilDidacticTemplateImportException.
Description of ilDidacticTemplateImport.
Create styles array
The data for the language used.
represents a creation of local roles action
setInputFile($a_file)
Set input file.
parseActions(ilDidacticTemplateSetting $set, SimpleXMLElement $actions=NULL)
Parse template action from xml.
const PATTERN_SUBTYPE_REGEX
__construct($a_type)
Constructor.
const FILTER_SOURCE_TITLE
getInputFile()
Get inputfile.
Implementation of an include filter pattern for didactic template actions.