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);
64 case self::IMPORT_FILE:
76 $this->
parseActions($settings, $root->didacticTemplate->actions);
89 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateSetting.php';
92 foreach ($root->didacticTemplate as
$tpl) {
93 switch ((
string) $tpl->attributes()->type) {
99 $setting->setTitle(trim((
string) $tpl->title));
100 $setting->setDescription(trim((
string) $tpl->description));
103 foreach ((
array) $tpl->info->p as $paragraph) {
107 $info .= trim((
string) $paragraph);
109 $setting->setInfo(
$info);
111 if (isset($tpl->effectiveFrom) && (
string) $tpl->effectiveFrom[
"nic_id"] == $ilSetting->get(
'inst_id')) {
113 foreach ($tpl->effectiveFrom->node as $element) {
114 $node[] = (int) $element;
117 $setting->setEffectiveFrom($node);
120 if (isset($tpl->exclusive)) {
121 $setting->setExclusive(
true);
124 foreach ($tpl->assignments->assignment as $element) {
125 $setting->addAssignment(trim((
string) $element));
130 include_once(
"./Services/Multilingualism/classes/class.ilMultilingualism.php");
133 if (isset($root->didacticTemplate->translations)) {
134 $trans->fromXML($root->didacticTemplate->translations);
149 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
151 if ($actions === null) {
158 foreach ($actions->localRoleAction as $ele) {
159 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateLocalRoleAction.php';
161 $act->setTemplateId($set->
getId());
163 foreach ($ele->roleTemplate as
$tpl) {
165 foreach ($tpl->role as $roleDef) {
166 include_once
'./Services/AccessControl/classes/class.ilRoleXmlImporter.php';
168 $role_id = $rimporter->importSimpleXml($roleDef);
169 $act->setRoleTemplateId($role_id);
178 foreach ($actions->blockRoleAction as $ele) {
179 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateBlockRoleAction.php';
181 $act->setTemplateId($set->
getId());
184 foreach ($ele->roleFilter as $rfi) {
185 $act->setFilterType((
string) $rfi->attributes()->source);
186 foreach ($rfi->includePattern as $pat) {
188 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateIncludeFilterPattern.php';
191 $pattern->setPattern((
string) $pat->attributes()->preg);
192 $act->addFilterPattern($pattern);
194 foreach ($rfi->excludePattern as $pat) {
196 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateExcludeFilterPattern.php';
199 $pattern->setPattern((
string) $pat->attributes()->preg);
200 $act->addFilterPattern($pattern);
212 foreach ($actions->localPolicyAction as $ele) {
213 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateLocalPolicyAction.php';
215 $act->setTemplateId($set->
getId());
218 foreach ($ele->roleFilter as $rfi) {
219 $act->setFilterType((
string) $rfi->attributes()->source);
220 foreach ($rfi->includePattern as $pat) {
222 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateIncludeFilterPattern.php';
225 $pattern->setPattern((
string) $pat->attributes()->preg);
226 $act->addFilterPattern($pattern);
228 foreach ($rfi->excludePattern as $pat) {
230 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateExcludeFilterPattern.php';
233 $pattern->setPattern((
string) $pat->attributes()->preg);
234 $act->addFilterPattern($pattern);
239 foreach ($ele->localPolicyTemplate as $lpo) {
241 switch ((
string) $lpo->attributes()->type) {
256 foreach ($lpo->role as $roleDef) {
257 include_once
'./Services/AccessControl/classes/class.ilRoleXmlImporter.php';
259 $role_id = $rimporter->importSimpleXml($roleDef);
260 $act->setRoleTemplateId($role_id);
277 foreach (libxml_get_errors() as $err) {
278 $errors .= $err->code .
'<br/>';
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.
parseActions(ilDidacticTemplateSetting $set, SimpleXMLElement $actions=null)
Parse template action from xml.
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.
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.