4 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateSetting.php';
32 $this->parent_object = $a_parent_obj;
35 if(isset($_REQUEST[
"tplid"]))
54 public function executeCommand()
61 $next_class = $ilCtrl->getNextClass($this);
62 $cmd = $ilCtrl->getCmd();
66 case "ilpropertyformgui":
69 $ilCtrl->forwardCommand($form);
70 case 'ilmultilingualismgui':
71 if(!$ilAccess->checkAccess(
'write',
'',$_REQUEST[
"ref_id"]) ||
72 !isset($this->
object) ||
73 $this->
object->isAutoGenerated())
75 $ilCtrl->redirect($this,
"overview");
78 $this->setEditTabs(
"settings_trans");
79 include_once(
"./Services/Multilingualism/classes/class.ilMultilingualismGUI.php");
81 $defaultl = $this->
object->getTranslationObject()->getDefaultLanguage();
83 $transgui->setStartValues($this->
object->getPresentationTitle($defaultl),
84 $this->
object->getPresentationDescription($defaultl));
86 $ilCtrl->forwardCommand($transgui);
109 if($ilAccess->checkAccess(
'write',
'',$_REQUEST[
"ref_id"]))
111 $ilToolbar->addButton(
112 $lng->txt(
'didactic_import_btn'),
113 $ilCtrl->getLinkTarget($this,
'showImportForm')
118 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateSettingsTableGUI.php';
123 $GLOBALS[
'tpl']->setContent($table->getHTML());
135 if(isset($_REQUEST[
"tplid"]))
137 $this->setEditTabs(
'import');
140 $ilTabs->clearTargets();
141 $ilTabs->setBackTarget(
142 $this->lng->txt(
'didactic_back_to_overview'),
143 $ilCtrl->getLinkTarget($this,
'overview')
152 $GLOBALS[
'tpl']->setContent($form->getHTML());
163 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
165 $form->setShowTopButtons(
false);
166 $form->setFormAction($ilCtrl->getFormAction($this));
167 $form->setTitle($this->lng->txt(
'didactic_import_table_title'));
168 $form->addCommandButton(
'importTemplate', $this->lng->txt(
'import'));
169 $form->addCommandButton(
'overview', $this->lng->txt(
'cancel'));
173 $file->setRequired(TRUE);
174 $form->addItem(
$file);
188 if(!$ilAccess->checkAccess(
'write',
'',$_REQUEST[
"ref_id"]))
190 $ilCtrl->redirect($this,
"overview");
193 $edit = isset($_REQUEST[
'tplid']);
204 if(!$form->checkInput())
207 $form->setValuesByPost();
222 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateImport.php';
226 $file = $form->getInput(
'file');
235 $import->setInputFile($tmp);
238 $settings = $import->import();
255 $ilCtrl->redirect($this,
'editTemplate');
259 $ilCtrl->redirect($this,
'overview');
272 $this->setEditTabs(
"edit");
274 if(!$_REQUEST[
'tplid'])
277 $ilCtrl->redirect($this,
'overview');
287 $ilCtrl->saveParameter($this,
'tplid');
293 $GLOBALS[
'tpl']->setContent($form->getHTML());
303 if(!$ilAccess->checkAccess(
'write',
'',$_REQUEST[
"ref_id"]))
305 $this->ctrl->redirect($this,
"overview");
311 if($form->checkInput())
314 if(count(
$lang = $temp->getTranslationObject()->getLanguages()))
316 $temp->getTranslationObject()->setDefaultTitle($form->getInput(
'title'));
317 $temp->getTranslationObject()->setDefaultDescription($form->getInput(
'description'));
318 $temp->getTranslationObject()->save();
321 if(!$temp->isAutoGenerated())
323 $temp->setTitle($form->getInput(
'title'));
324 $temp->setDescription($form->getInput(
'description'));
327 $temp->setInfo($form->getInput(
'info'));
328 $temp->enable($form->getInput(
'enable'));
330 if(!$temp->isAutoGenerated())
332 $temp->setAssignments(
array($form->getInput(
'type')));
335 if($form->getInput(
'local_template') && count($form->getInput(
'effective_from')) > 0)
337 $temp->setEffectiveFrom($form->getInput(
'effective_from'));
341 $temp->setEffectiveFrom(
array());
344 $temp->setExclusive((
bool) $form->getInput(
'exclusive_template'));
349 $ilCtrl->redirect($this,
'overview');
353 $form->setValuesByPost();
367 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
369 $form->setShowTopButtons(
false);
370 $form->setFormAction($ilCtrl->getFormAction($this,
'updateTemplate'));
371 $form->setTitle($this->lng->txt(
'didactic_edit_tpl'));
372 $form->addCommandButton(
'updateTemplate', $this->lng->txt(
'save'));
373 $form->addCommandButton(
'overview', $this->lng->txt(
'cancel'));
379 $title->setRequired(
true);
388 if(
sizeof($trans) > 1)
390 include_once(
'Services/MetaData/classes/class.ilMDLanguageItem.php');
392 $title->setInfo($this->lng->txt(
"language").
": ".
$languages[$def[
"lang_code"]].
393 ' <a href="'.$ilCtrl->getLinkTargetByClass(
"ilmultilingualismgui",
"listTranslations").
394 '">» '.$this->lng->txt(
"more_translations").
'</a>');
404 $title->setValue($def[
"title"]);
417 $desc->setValue($def[
"description"]);
421 $form->addItem($desc);
427 $form->addItem(
$info);
432 $enable->setRequired(
true);
433 $form->addItem($enable);
441 $type->setInfo($this->lng->txt(
'dtpl_obj_type_info'));
443 $type->setValue(isset($assigned[0]) ? $assigned[0] :
'');
444 $subs = $objDefinition->getCreatableSubobjects(
'root',
false);
446 foreach(array_merge($subs,
array(
'fold' => 1)) as $obj => $null)
448 if($objDefinition->isAllowedInRepository($obj))
450 $options[$obj] = $this->lng->txt(
'obj_'.$obj);
456 $form->addItem($type);
458 $lokal_templates =
new ilCheckboxInputGUI($this->lng->txt(
"activate_local_didactic_template"),
"local_template");
460 $lokal_templates->setInfo($this->lng->txt(
"activate_local_didactic_template_info"));
463 include_once(
"./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
469 $lokal_templates->addSubItem($effrom);
470 $form->addItem($lokal_templates);
472 $excl =
new ilCheckboxInputGUI($this->lng->txt(
"activate_exclusive_template"),
"exclusive_template");
473 $excl->
setInfo($this->lng->txt(
"activate_exclusive_template_info"));
476 $form->addItem($excl);
491 if(!$ilAccess->checkAccess(
'write',
'',$_REQUEST[
"ref_id"]))
493 $this->ctrl->redirect($this,
"overview");
496 if(!$_REQUEST[
'tplid'])
499 return $ilCtrl->redirect($this,
'overview');
502 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
508 $ilCtrl->redirect($this,
'overview');
518 if(!$_REQUEST[
'tplid'])
521 return $ilCtrl->redirect($this,
'overview');
524 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateXmlWriter.php';
529 $writer->xmlDumpMem(TRUE),
530 $writer->getSetting()->getTitle().
'.xml',
540 protected function confirmDelete()
547 if(!$_REQUEST[
'tpls'])
550 return $ilCtrl->redirect($this,
'overview');
553 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
556 $confirm->setFormAction($ilCtrl->getFormAction($this));
557 $confirm->setConfirm($this->lng->txt(
'delete'),
'deleteTemplates');
558 $confirm->setCancel($this->lng->txt(
'cancel'),
'overview');
560 $forbidden =
array();
562 foreach((
array) $_REQUEST[
'tpls'] as $tplid)
566 if(!
$tpl->isAutoGenerated())
568 $confirm->addItem(
'tpls[]',
$tpl->getId(),
$tpl->getPresentationTitle());
571 $forbidden[] =
$tpl->getId();
576 if(count($forbidden) > 0 && count($_REQUEST[
'tpls']) == 1) {
578 $ilCtrl->redirect($this,
"overview");
580 elseif (count($forbidden) > 0 && count($_REQUEST[
'tpls']) > 1) {
581 ilUtil::sendInfo($this->lng->txt(
'didactic_cannot_delete_auto_generated_confirmation'));
585 $GLOBALS[
'tpl']->setContent($confirm->getHTML());
598 if(!$ilAccess->checkAccess(
'write',
'',$_REQUEST[
"ref_id"]))
600 $this->ctrl->redirect($this,
"overview");
603 if(!$_REQUEST[
'tpls'])
606 return $ilCtrl->redirect($this,
'overview');
609 foreach((
array) $_REQUEST[
'tpls'] as $tplid)
616 $ilCtrl->redirect($this,
'overview');
629 if(!$ilAccess->checkAccess(
'write',
'',$_REQUEST[
"ref_id"]))
631 $this->ctrl->redirect($this,
"overview");
633 if(!$_REQUEST[
'tpls'])
636 return $ilCtrl->redirect($this,
'overview');
639 foreach($_REQUEST[
'tpls'] as $tplid)
647 $ilCtrl->redirect($this,
'overview');
660 if(!$ilAccess->checkAccess(
'write',
'',$_REQUEST[
"ref_id"]))
662 $this->ctrl->redirect($this,
"overview");
665 if(!$_REQUEST[
'tpls'])
668 $ilCtrl->redirect($this,
'overview');
671 foreach($_REQUEST[
'tpls'] as $tplid)
679 $ilCtrl->redirect($this,
'overview');
685 protected function setEditTabs($a_tab_active =
"edit")
694 $ilTabs->clearTargets();
695 $ilTabs->setBackTarget(
696 $this->lng->txt(
'didactic_back_to_overview'),
697 $ilCtrl->getLinkTarget($this,
'overview')
699 $ilCtrl->saveParameter($this,
"tplid");
701 if(!$this->
object->isAutoGenerated())
703 $ilTabs->addTab(
'edit',$this->lng->txt(
'settings'), $ilCtrl->getLinkTarget($this,
'editTemplate'));
704 $ilTabs->addTab(
'import',$this->lng->txt(
'import'), $ilCtrl->getLinkTarget($this,
'showEditImportForm'));
706 if(in_array($a_tab_active,
array(
'edit',
'settings_trans')))
708 $ilTabs->addSubTab(
'edit',$this->lng->txt(
'settings'), $ilCtrl->getLinkTarget($this,
'editTemplate'));
709 $ilTabs->addSubTab(
'settings_trans',$this->lng->txt(
"obj_multilinguality"), $ilCtrl->getLinkTargetByClass(
array(
"ilmultilingualismgui"),
'listTranslations'));
710 $ilTabs->setTabActive(
'edit');
711 $ilTabs->setSubTabActive($a_tab_active);
714 $ilTabs->setTabActive($a_tab_active);
721 $this->setEditTabs(
"import");
725 $GLOBALS[
'tpl']->setContent($form->getHTML());
732 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
734 $form->setShowTopButtons(
false);
735 $form->setFormAction($ilCtrl->getFormAction($this));
736 $form->setTitle($this->lng->txt(
'didactic_import_table_title'));
737 $form->addCommandButton(
'importTemplate', $this->lng->txt(
'import'));
738 $form->addCommandButton(
'overview', $this->lng->txt(
'cancel'));
742 $file->setInfo($this->lng->txt(
'didactic_template_update_import_info'));
743 $form->addItem(
$file);
755 $tplid = $_REQUEST[
'tplid'];
757 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
762 $this->
object->delete();
764 foreach($assignments as $obj)
769 $ilCtrl->setParameter($this,
"tplid", $a_settings->getId());
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
GUI class for object translation handling.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
isEnabled()
Check if template is enabled.
Description of ilDidacticTemplateSettingsTableGUI.
exportTemplate()
Export one template.
deleteTemplates()
Delete chosen didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.
deactivateTemplates()
Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.
getAssignments()
Get object assignemnts.
createImportForm()
Create template import form.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static transferAutoGenerateStatus($a_src, $a_dest)
transfer auto generated flag if source is auto generated
static getAssignmentsByTemplateID($a_tpl_id)
Lookup template id ilDB $ilDB.
setValue($a_value)
Set Value.
__construct($a_parent_obj)
Constructor.
initEditTemplate(ilDidacticTemplateSetting $set)
Init edit template form.
showImportForm(ilPropertyFormGUI $form=NULL)
Show template import form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static assignTemplate($a_ref_id, $a_obj_id, $a_tpl_id)
Assign template to object ilDB $ilDB.
editTemplate(ilPropertyFormGUI $form=null)
Edit template.
if(!is_array($argv)) $options
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
This class represents a text property in a property form.
getPresentationDescription($a_lng="")
getPresentationTitle($a_lng="")
Description of ilDidacticTemplateImportException.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
Description of ilDidacticTemplateImport.
Create styles array
The data for the language used.
Copy a didactic template and all subitems.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
copyTemplate()
Copy on template.
updateTemplate()
Update template.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
Create new PHPExcel object
obj_idprivate
This class represents a text area property in a property form.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
getInfo()
Get installation info text.
Settings for a single didactic template.
static getLogger($a_component_id)
Get component logger.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
editImport($a_settings)
ilCtrl $ilCtrl
importTemplate()
Import template.
getTranslations()
get all translations from this object
activateTemplates()
Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.
Confirmation screen class.
overview()
Show didactic template administration.