6 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateSetting.php';
58 $this->parent_object = $a_parent_obj;
60 $this->lng = $this->dic->language();
61 $this->rbacsystem = $this->dic->rbac()->system();
62 $this->ctrl = $this->dic->ctrl();
63 $this->objDefinition = $DIC[
'objDefinition'];
64 $this->request = $DIC->http()->request();
66 if (isset($_REQUEST[
"tplid"])) {
84 public function executeCommand()
91 $ilCtrl = $DIC[
'ilCtrl'];
92 $ilAccess = $DIC[
'ilAccess'];
94 $next_class = $ilCtrl->getNextClass($this);
95 $cmd = $ilCtrl->getCmd();
97 switch ($next_class) {
98 case "ilpropertyformgui":
101 $ilCtrl->forwardCommand($form);
103 case 'ilmultilingualismgui':
104 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"]) ||
105 !isset($this->
object) ||
106 $this->
object->isAutoGenerated()) {
107 $ilCtrl->redirect($this,
"overview");
110 $this->setEditTabs(
"settings_trans");
111 include_once(
"./Services/Multilingualism/classes/class.ilMultilingualismGUI.php");
113 $defaultl = $this->
object->getTranslationObject()->getDefaultLanguage();
115 $transgui->setStartValues(
116 $this->object->getPresentationTitle($defaultl),
117 $this->
object->getPresentationDescription($defaultl)
120 $ilCtrl->forwardCommand($transgui);
142 $tpl = $DIC->ui()->mainTemplate();
144 if ($this->rbacsystem->checkAccess(
'write', $_REQUEST[
"ref_id"])) {
145 $this->dic->toolbar()->addButton(
146 $this->lng->txt(
'didactic_import_btn'),
147 $this->ctrl->getLinkTarget($this,
'showImportForm')
157 $table->parse($filter);
160 $filter->render() .
'' . $table->getHTML()
171 $table->resetOffset();
172 $table->writeFilterToSession();
183 $table->resetOffset();
184 $table->resetFilter();
198 $ilTabs = $DIC->tabs();
199 $ilCtrl = $DIC->ctrl();
201 if (isset($_REQUEST[
"tplid"])) {
202 $this->setEditTabs(
'import');
204 $ilTabs->clearTargets();
205 $ilTabs->setBackTarget(
206 $this->lng->txt(
'didactic_back_to_overview'),
207 $ilCtrl->getLinkTarget($this,
'overview')
214 $GLOBALS[
'DIC'][
'tpl']->setContent($form->getHTML());
225 $ilCtrl = $DIC[
'ilCtrl'];
227 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
229 $form->setShowTopButtons(
false);
230 $form->setFormAction($ilCtrl->getFormAction($this));
231 $form->setTitle($this->lng->txt(
'didactic_import_table_title'));
232 $form->addCommandButton(
'importTemplate', $this->lng->txt(
'import'));
233 $form->addCommandButton(
'overview', $this->lng->txt(
'cancel'));
235 $file =
new ilFileInputGUI($this->lng->txt(
'import_file'),
'file');
237 $file->setRequired(
true);
238 $form->addItem($file);
241 $icon->setAllowDeletion(
false);
243 $icon->setInfo($this->lng->txt(
'didactic_icon_info'));
244 $form->addItem($icon);
258 $ilCtrl = $DIC[
'ilCtrl'];
259 $ilAccess = $DIC[
'ilAccess'];
261 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
262 $ilCtrl->redirect($this,
"overview");
265 $edit = $this->request->getQueryParams()[
'tplid'] ??
false;
267 $this->
initObject($this->request->getQueryParams()[
'tplid']);
274 if (!$form->checkInput()) {
276 $form->setValuesByPost();
289 $file = $form->getInput(
'file');
298 $import->setInputFile($tmp);
301 $settings = $import->import();
305 if ($settings->hasIconSupport($this->objDefinition)) {
306 $settings->getIconHandler()->handleUpload($DIC->upload(), $_FILES[
'icon'][
'tmp_name']);
313 $form->setValuesByPost();
323 ilUtil::sendSuccess($this->lng->txt(
'didactic_import_success'),
true);
326 $ilCtrl->redirect($this,
'editTemplate');
328 $ilCtrl->redirect($this,
'overview');
340 $ilCtrl = $DIC[
'ilCtrl'];
341 $ilTabs = $DIC[
'ilTabs'];
343 $this->setEditTabs(
"edit");
345 if (!$_REQUEST[
'tplid']) {
347 $ilCtrl->redirect($this,
'overview');
357 $ilCtrl->saveParameter($this,
'tplid');
362 $GLOBALS[
'DIC'][
'tpl']->setContent($form->getHTML());
372 $ilCtrl = $DIC[
'ilCtrl'];
373 $ilAccess = $DIC[
'ilAccess'];
375 $tpl_id = $this->request->getQueryParams()[
'tplid'] ?? 0;
376 $this->ctrl->saveParameter($this,
'tplid');
379 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
380 $this->ctrl->redirect($this,
"overview");
386 if ($form->checkInput()) {
387 $tmp_file = $_FILES[
'icon'][
'tmp_name'];
388 $upload_element = $form->getItemByPostVar(
'icon');
390 (strlen($tmp_file) || (!strlen($tmp_file) && $temp->getIconIdentifier())) &&
391 !$this->objDefinition->isContainer($form->getInput(
'type')) &&
392 !$upload_element->getDeletionFlag()
394 $icon = $form->getItemByPostVar(
'icon')->setAlert($this->lng->txt(
'didactic_icon_error'));
398 if (count(
$lang = $temp->getTranslationObject()->getLanguages())) {
399 $temp->getTranslationObject()->setDefaultTitle($form->getInput(
'title'));
400 $temp->getTranslationObject()->setDefaultDescription($form->getInput(
'description'));
401 $temp->getTranslationObject()->save();
404 if (!$temp->isAutoGenerated()) {
405 $temp->setTitle($form->getInput(
'title'));
406 $temp->setDescription($form->getInput(
'description'));
409 $temp->setInfo($form->getInput(
'info'));
410 $temp->enable($form->getInput(
'enable'));
412 if (!$temp->isAutoGenerated()) {
413 $temp->setAssignments(array($form->getInput(
'type')));
416 if ($form->getInput(
'local_template') && count($form->getInput(
'effective_from')) > 0) {
417 $temp->setEffectiveFrom($form->getInput(
'effective_from'));
419 $temp->setEffectiveFrom(array());
422 $temp->setExclusive((
bool) $form->getInput(
'exclusive_template'));
426 $upload = $form->getItemByPostVar(
'icon');
427 if ($upload->getDeletionFlag()) {
428 $temp->getIconHandler()->delete();
430 $temp->getIconHandler()->handleUpload($DIC->upload(), $_FILES[
'icon'][
'tmp_name']);
431 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
432 $ilCtrl->redirect($this,
'overview');
454 $ilCtrl = $DIC[
'ilCtrl'];
457 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
459 $form->setShowTopButtons(
false);
460 $form->setFormAction($ilCtrl->getFormAction($this,
'updateTemplate'));
461 $form->setTitle($this->lng->txt(
'didactic_edit_tpl'));
462 $form->addCommandButton(
'updateTemplate', $this->lng->txt(
'save'));
463 $form->addCommandButton(
'overview', $this->lng->txt(
'cancel'));
468 $title->setMaxLength(64);
469 $title->setRequired(
true);
477 if (
sizeof($trans) > 1) {
478 include_once(
'Services/MetaData/classes/class.ilMDLanguageItem.php');
480 $title->setInfo($this->lng->txt(
"language") .
": " . $languages[$def[
"lang_code"]] .
481 ' <a href="' . $ilCtrl->getLinkTargetByClass(
"ilmultilingualismgui",
"listTranslations") .
482 '">» ' . $this->lng->txt(
"more_translations") .
'</a>');
489 $title->setValue($def[
"title"]);
492 $form->addItem($title);
500 $desc->setValue($def[
"description"]);
504 $form->addItem($desc);
509 $icon->setInfo($this->lng->txt(
'didactic_icon_info'));
510 $icon->getAllowDeletion(
true);
511 $icon->setSuffixes([
'svg']);
512 $form->addItem($icon);
518 $form->addItem($info);
523 $enable->setRequired(
true);
524 $form->addItem($enable);
529 $type->setRequired(
true);
530 $type->setInfo($this->lng->txt(
'dtpl_obj_type_info'));
532 $type->setValue(isset($assigned[0]) ? $assigned[0] :
'');
535 foreach (array_merge($subs, array(
'fold' => 1)) as $obj => $null) {
540 $options[$obj] = $this->lng->txt(
'obj_' . $obj);
545 $type->setOptions($options);
546 $form->addItem(
$type);
548 $lokal_templates =
new ilCheckboxInputGUI($this->lng->txt(
"activate_local_didactic_template"),
"local_template");
550 $lokal_templates->setInfo($this->lng->txt(
"activate_local_didactic_template_info"));
553 include_once(
"./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
556 $definition =
$GLOBALS[
'DIC'][
'objDefinition'];
558 foreach ($definition->getAllRepositoryTypes() as
$type) {
559 if ($definition->isContainer(
$type)) {
560 $white_list[] =
$type;
563 $effrom->getExplorerGUI()->setTypeWhiteList($white_list);
566 $lokal_templates->addSubItem($effrom);
567 $form->addItem($lokal_templates);
569 $excl =
new ilCheckboxInputGUI($this->lng->txt(
"activate_exclusive_template"),
"exclusive_template");
570 $excl->
setInfo($this->lng->txt(
"activate_exclusive_template_info"));
573 $form->addItem($excl);
589 $ilCtrl = $DIC[
'ilCtrl'];
590 $ilAccess = $DIC[
'ilAccess'];
592 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
593 $this->ctrl->redirect($this,
"overview");
596 if (!$_REQUEST[
'tplid']) {
598 return $ilCtrl->redirect($this,
'overview');
601 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
606 ilUtil::sendSuccess($this->lng->txt(
'didactic_copy_suc_message'),
true);
607 $ilCtrl->redirect($this,
'overview');
618 $ilCtrl = $DIC[
'ilCtrl'];
620 if (!$_REQUEST[
'tplid']) {
622 return $ilCtrl->redirect($this,
'overview');
625 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateXmlWriter.php';
630 $writer->xmlDumpMem(
true),
631 $writer->getSetting()->getTitle() .
'.xml',
641 protected function confirmDelete()
649 $ilCtrl = $DIC[
'ilCtrl'];
651 if (!$_REQUEST[
'tpls']) {
653 return $ilCtrl->redirect($this,
'overview');
656 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
659 $confirm->setFormAction($ilCtrl->getFormAction($this));
660 $confirm->setConfirm($this->lng->txt(
'delete'),
'deleteTemplates');
661 $confirm->setCancel($this->lng->txt(
'cancel'),
'overview');
663 $forbidden = array();
665 foreach ((array) $_REQUEST[
'tpls'] as $tplid) {
668 if (!
$tpl->isAutoGenerated()) {
669 $confirm->addItem(
'tpls[]',
$tpl->getId(),
$tpl->getPresentationTitle());
671 $forbidden[] =
$tpl->getId();
675 if (count($forbidden) > 0 && count($_REQUEST[
'tpls']) == 1) {
677 $ilCtrl->redirect($this,
"overview");
678 } elseif (count($forbidden) > 0 && count($_REQUEST[
'tpls']) > 1) {
679 ilUtil::sendInfo($this->lng->txt(
'didactic_cannot_delete_auto_generated_confirmation'));
683 $GLOBALS[
'DIC'][
'tpl']->setContent($confirm->getHTML());
697 $ilCtrl = $DIC[
'ilCtrl'];
698 $ilAccess = $DIC[
'ilAccess'];
700 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
701 $this->ctrl->redirect($this,
"overview");
704 if (!$_REQUEST[
'tpls']) {
706 return $ilCtrl->redirect($this,
'overview');
709 foreach ((array) $_REQUEST[
'tpls'] as $tplid) {
714 ilUtil::sendSuccess($this->lng->txt(
'didactic_delete_msg'),
true);
715 $ilCtrl->redirect($this,
'overview');
729 $ilCtrl = $DIC[
'ilCtrl'];
730 $ilAccess = $DIC[
'ilAccess'];
732 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
733 $this->ctrl->redirect($this,
"overview");
735 if (!$_REQUEST[
'tpls']) {
737 return $ilCtrl->redirect($this,
'overview');
740 foreach ($_REQUEST[
'tpls'] as $tplid) {
746 ilUtil::sendSuccess($this->lng->txt(
'didactic_activated_msg'),
true);
747 $ilCtrl->redirect($this,
'overview');
761 $ilCtrl = $DIC[
'ilCtrl'];
762 $ilAccess = $DIC[
'ilAccess'];
764 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
765 $this->ctrl->redirect($this,
"overview");
768 if (!$_REQUEST[
'tpls']) {
770 $ilCtrl->redirect($this,
'overview');
773 foreach ($_REQUEST[
'tpls'] as $tplid) {
779 ilUtil::sendSuccess($this->lng->txt(
'didactic_deactivated_msg'),
true);
780 $ilCtrl->redirect($this,
'overview');
786 protected function setEditTabs($a_tab_active =
"edit")
794 $ilCtrl = $DIC[
'ilCtrl'];
795 $ilTabs = $DIC[
'ilTabs'];
798 $ilTabs->clearTargets();
799 $ilTabs->setBackTarget(
800 $this->lng->txt(
'didactic_back_to_overview'),
801 $ilCtrl->getLinkTarget($this,
'overview')
803 $ilCtrl->saveParameter($this,
"tplid");
805 if (!$this->object->isAutoGenerated()) {
806 $ilTabs->addTab(
'edit', $this->lng->txt(
'settings'), $ilCtrl->getLinkTarget($this,
'editTemplate'));
807 $ilTabs->addTab(
'import', $this->lng->txt(
'import'), $ilCtrl->getLinkTarget($this,
'showEditImportForm'));
809 if (in_array($a_tab_active, array(
'edit',
'settings_trans'))) {
810 $ilTabs->addSubTab(
'edit', $this->lng->txt(
'settings'), $ilCtrl->getLinkTarget($this,
'editTemplate'));
811 $ilTabs->addSubTab(
'settings_trans', $this->lng->txt(
"obj_multilinguality"), $ilCtrl->getLinkTargetByClass(array(
"ilmultilingualismgui"),
'listTranslations'));
812 $ilTabs->setTabActive(
'edit');
813 $ilTabs->setSubTabActive($a_tab_active);
815 $ilTabs->setTabActive($a_tab_active);
822 $this->setEditTabs(
"import");
826 $GLOBALS[
'DIC'][
'tpl']->setContent($form->getHTML());
833 $ilCtrl = $DIC[
'ilCtrl'];
835 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
837 $form->setShowTopButtons(
false);
838 $form->setFormAction($ilCtrl->getFormAction($this));
839 $form->setTitle($this->lng->txt(
'didactic_import_table_title'));
840 $form->addCommandButton(
'importTemplate', $this->lng->txt(
'import'));
841 $form->addCommandButton(
'overview', $this->lng->txt(
'cancel'));
843 $file =
new ilFileInputGUI($this->lng->txt(
'didactic_template_update_import'),
'file');
845 $file->setSuffixes([
'xml']);
846 $file->setInfo($this->lng->txt(
'didactic_template_update_import_info'));
847 $form->addItem($file);
860 $ilCtrl = $DIC[
'ilCtrl'];
861 $tplid = $_REQUEST[
'tplid'];
863 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
868 $this->
object->delete();
870 foreach ($assignments as $obj) {
874 $ilCtrl->setParameter($this,
"tplid", $a_settings->getId());
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.
static lookupTxtById($plugin_id, $lang_var)
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.
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.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
resetFilter()
Reset filter.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
getPresentationDescription($a_lng="")
getPresentationTitle($a_lng="")
Description of ilDidacticTemplateImportException.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
Description of ilDidacticTemplateImport.
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)
Returns a unique and non existing Path for e temporary file or directory.
This class represents a text area property in a property form.
getInfo()
Get installation info text.
Settings for a single didactic template.
static getLogger($a_component_id)
Get component logger.
editImport($a_settings)
ilCtrl $ilCtrl
importTemplate()
Import template.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
getTranslations()
get all translations from this object
applyFilter()
Apply table filter.
activateTemplates()
Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.
handleUpdateFailure(ilPropertyFormGUI $form)
Confirmation screen class.
overview()
Show didactic template administration.
showEditImportForm(ilPropertyFormGUI $form=null)