ILIAS  release_8 Revision v8.24
ilDidacticTemplateSettingsGUI Class Reference

Settings for a single didactic template. More...

+ Collaboration diagram for ilDidacticTemplateSettingsGUI:

Public Member Functions

 __construct (ilObjectGUI $a_parent_obj)
 
 executeCommand ()
 
 applyFilter ()
 
 resetFilter ()
 
 showEditImportForm (ilPropertyFormGUI $form=null)
 
 editImportForm ()
 
 editImport (ilDidacticTemplateSetting $a_settings)
 

Protected Member Functions

 initReferenceFromRequest ()
 
 initTemplatesFromRequest ()
 transforms selected tpls from post to SplFixedArray More...
 
 initTemplateFromRequest ()
 
 overview ()
 
 showImportForm (ilPropertyFormGUI $form=null)
 
 createImportForm ()
 
 importTemplate ()
 
 editTemplate (ilPropertyFormGUI $form=null)
 
 updateTemplate ()
 
 handleUpdateFailure (ilPropertyFormGUI $form)
 
 initEditTemplate (ilDidacticTemplateSetting $set)
 
 copyTemplate ()
 
 exportTemplate ()
 
 confirmDelete ()
 
 deleteTemplates ()
 
 activateTemplates ()
 
 deactivateTemplates ()
 
 setEditTabs (string $a_tab_active="edit")
 

Private Attributes

ilLogger $logger
 
ilObjectGUI $parent_object
 
ilDidacticTemplateSetting $setting = null
 
Container $dic
 
ilLanguage $lng
 
ilRbacSystem $rbacsystem
 
ilCtrl $ctrl
 
ilAccessHandler $access
 
ilToolbarGUI $toolbar
 
ilObjectDefinition $objDefinition
 
RequestInterface $request
 
GlobalHttpState $http
 
Factory $refinery
 
ilGlobalTemplateInterface $tpl
 
ilTabsGUI $tabs
 
FileUpload $upload
 
int $ref_id
 

Detailed Description

Settings for a single didactic template.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

@ilCtrl_IsCalledBy ilDidacticTemplateSettingsGUI: ilObjRoleFolderGUI @ilCtrl_Calls ilDidacticTemplateSettingsGUI: ilMultilingualismGUI, ilPropertyFormGUI

Definition at line 33 of file class.ilDidacticTemplateSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilDidacticTemplateSettingsGUI::__construct ( ilObjectGUI  $a_parent_obj)

Definition at line 54 of file class.ilDidacticTemplateSettingsGUI.php.

55 {
56 global $DIC;
57 $this->parent_object = $a_parent_obj;
58 $this->lng = $DIC->language();
59 $this->rbacsystem = $DIC->rbac()->system();
60 $this->ctrl = $DIC->ctrl();
61 $this->objDefinition = $DIC['objDefinition'];
62 $this->request = $DIC->http()->request();
63 $this->access = $DIC->access();
64 $this->toolbar = $DIC->toolbar();
65 $this->http = $DIC->http();
66 $this->refinery = $DIC->refinery();
67 $this->logger = $DIC->logger()->otpl();
68 $this->tpl = $DIC->ui()->mainTemplate();
69 $this->tabs = $DIC->tabs();
70 $this->upload = $DIC->upload();
71 }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\upload().

+ Here is the call graph for this function:

Member Function Documentation

◆ activateTemplates()

ilDidacticTemplateSettingsGUI::activateTemplates ( )
protected

Definition at line 614 of file class.ilDidacticTemplateSettingsGUI.php.

614 : void
615 {
616 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
617 $this->ctrl->redirect($this, "overview");
618 }
619 $templates = $this->initTemplatesFromRequest();
620 if (0 === count($templates)) {
621 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
622 $this->ctrl->redirect($this, 'overview');
623 return;
624 }
625
626 foreach ($templates as $tplid) {
627 $tpl = new ilDidacticTemplateSetting((int) $tplid);
628 $tpl->enable(true);
629 $tpl->update();
630 }
631
632 $this->tpl->setOnScreenMessage('success', $this->lng->txt('didactic_activated_msg'), true);
633 $this->ctrl->redirect($this, 'overview');
634 }
initTemplatesFromRequest()
transforms selected tpls from post to SplFixedArray
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.

References $tpl, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), initTemplatesFromRequest(), ILIAS\Repository\lng(), and ilGlobalTemplateInterface\setOnScreenMessage().

+ Here is the call graph for this function:

◆ applyFilter()

ilDidacticTemplateSettingsGUI::applyFilter ( )

Definition at line 180 of file class.ilDidacticTemplateSettingsGUI.php.

180 : void
181 {
182 $table = new ilDidacticTemplateSettingsTableGUI($this, 'overview', $this->ref_id);
183 $table->init();
184 $table->resetOffset();
185 $table->writeFilterToSession();
186 $this->overview();
187 }
Description of ilDidacticTemplateSettingsTableGUI.

References overview().

+ Here is the call graph for this function:

◆ confirmDelete()

ilDidacticTemplateSettingsGUI::confirmDelete ( )
protected

Definition at line 556 of file class.ilDidacticTemplateSettingsGUI.php.

556 : void
557 {
558 $templates = $this->initTemplatesFromRequest();
559 if (0 === count($templates)) {
560 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
561 $this->ctrl->redirect($this, 'overview');
562 return;
563 }
564
565 $confirm = new ilConfirmationGUI();
566 $confirm->setHeaderText($this->lng->txt('didactic_confirm_delete_msg'));
567 $confirm->setFormAction($this->ctrl->getFormAction($this));
568 $confirm->setConfirm($this->lng->txt('delete'), 'deleteTemplates');
569 $confirm->setCancel($this->lng->txt('cancel'), 'overview');
570
571 $forbidden = [];
572 foreach ($templates as $tplid) {
573 $tpl = new ilDidacticTemplateSetting((int) $tplid);
574
575 if (!$tpl->isAutoGenerated()) {
576 $confirm->addItem('tpls[]', (string) $tpl->getId(), $tpl->getPresentationTitle());
577 } else {
578 $forbidden[] = $tpl->getId();
579 }
580 }
581
582 if (count($forbidden) > 0 && count($templates) === 1) {
583 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('didactic_cannot_delete_auto_generated'), true);
584 $this->ctrl->redirect($this, "overview");
585 } elseif (count($forbidden) > 0 && count($templates) > 1) {
586 $this->tpl->setOnScreenMessage('info', $this->lng->txt('didactic_cannot_delete_auto_generated_confirmation'));
587 }
588
589 $this->tpl->setOnScreenMessage('question', $this->lng->txt('didactic_confirm_delete_msg'));
590 $this->tpl->setContent($confirm->getHTML());
591 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $tpl, ILIAS\Repository\ctrl(), initTemplatesFromRequest(), ILIAS\Repository\lng(), and ilGlobalTemplateInterface\setOnScreenMessage().

+ Here is the call graph for this function:

◆ copyTemplate()

ilDidacticTemplateSettingsGUI::copyTemplate ( )
protected

Definition at line 518 of file class.ilDidacticTemplateSettingsGUI.php.

518 : void
519 {
520 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
521 $this->ctrl->redirect($this, "overview");
522 }
523
525 if (!$setting instanceof ilDidacticTemplateSetting) {
526 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
527 $this->ctrl->redirect($this, 'overview');
528 return;
529 }
530
531 $copier = new ilDidacticTemplateCopier($setting->getId());
532 $copier->start();
533
534 $this->tpl->setOnScreenMessage('success', $this->lng->txt('didactic_copy_suc_message'), true);
535 $this->ctrl->redirect($this, 'overview');
536 }
Copy a didactic template and all subitems.

References $setting, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilDidacticTemplateSetting\getId(), initTemplateFromRequest(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ createImportForm()

ilDidacticTemplateSettingsGUI::createImportForm ( )
protected

Definition at line 217 of file class.ilDidacticTemplateSettingsGUI.php.

218 {
219 $form = new ilPropertyFormGUI();
220 $form->setShowTopButtons(false);
221 $form->setFormAction($this->ctrl->getFormAction($this));
222 $form->setTitle($this->lng->txt('didactic_import_table_title'));
223 $form->addCommandButton('importTemplate', $this->lng->txt('import'));
224 $form->addCommandButton('overview', $this->lng->txt('cancel'));
225
226 $file = new ilFileInputGUI($this->lng->txt('import_file'), 'file');
227 $file->setSuffixes(['xml']);
228 $file->setRequired(true);
229 $form->addItem($file);
230
231 $icon = new ilImageFileInputGUI($this->lng->txt('icon'), 'icon');
232 $icon->setAllowDeletion(false);
233 $icon->setSuffixes(['svg']);
234 $icon->setInfo($this->lng->txt('didactic_icon_info'));
235 $form->addItem($icon);
236
237 $created = true;
238
239 return $form;
240 }
This class represents a file property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property form user interface.
int $created
Timestamp for when the object was created.
Definition: System.php:151

References ILIAS\LTI\ToolProvider\$created, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by importTemplate(), and showImportForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deactivateTemplates()

ilDidacticTemplateSettingsGUI::deactivateTemplates ( )
protected

Definition at line 636 of file class.ilDidacticTemplateSettingsGUI.php.

636 : void
637 {
638 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
639 $this->ctrl->redirect($this, "overview");
640 }
641
642 $templates = $this->initTemplatesFromRequest();
643 if (0 === count($templates)) {
644 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
645 $this->ctrl->redirect($this, 'overview');
646 }
647 foreach ($templates as $tplid) {
648 $tpl = new ilDidacticTemplateSetting((int) $tplid);
649 $tpl->enable(false);
650 $tpl->update();
651 }
652 $this->tpl->setOnScreenMessage('success', $this->lng->txt('didactic_deactivated_msg'), true);
653 $this->ctrl->redirect($this, 'overview');
654 }

References $tpl, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), initTemplatesFromRequest(), ILIAS\Repository\lng(), and ilGlobalTemplateInterface\setOnScreenMessage().

+ Here is the call graph for this function:

◆ deleteTemplates()

ilDidacticTemplateSettingsGUI::deleteTemplates ( )
protected

Definition at line 593 of file class.ilDidacticTemplateSettingsGUI.php.

593 : void
594 {
595 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
596 $this->ctrl->redirect($this, "overview");
597 }
598 $templates = $this->initTemplatesFromRequest();
599 if (0 === count($templates)) {
600 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
601 $this->ctrl->redirect($this, 'overview');
602 return;
603 }
604
605 foreach ($templates as $tplid) {
606 $tpl = new ilDidacticTemplateSetting((int) $tplid);
607 $tpl->delete();
608 }
609
610 $this->tpl->setOnScreenMessage('success', $this->lng->txt('didactic_delete_msg'), true);
611 $this->ctrl->redirect($this, 'overview');
612 }

References $tpl, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), initTemplatesFromRequest(), ILIAS\Repository\lng(), and ilGlobalTemplateInterface\setOnScreenMessage().

+ Here is the call graph for this function:

◆ editImport()

ilDidacticTemplateSettingsGUI::editImport ( ilDidacticTemplateSetting  $a_settings)

Definition at line 721 of file class.ilDidacticTemplateSettingsGUI.php.

721 : void
722 {
725 $a_settings->delete();
726 foreach ($assignments as $obj) {
727 ilDidacticTemplateObjSettings::assignTemplate($obj["ref_id"], $obj["obj_id"], $a_settings->getId());
728 }
729 $this->ctrl->setParameter($this, "tplid", $a_settings->getId());
730 }
static transferAutoGenerateStatus(int $a_src, int $a_dest)
Transfer auto generated flag if source is auto generated.
static assignTemplate(int $a_ref_id, int $a_obj_id, int $a_tpl_id)

References ilDidacticTemplateObjSettings\assignTemplate(), ILIAS\Repository\ctrl(), ilDidacticTemplateSetting\delete(), ilDidacticTemplateObjSettings\getAssignmentsByTemplateID(), ilDidacticTemplateSetting\getId(), and ilDidacticTemplateObjSettings\transferAutoGenerateStatus().

Referenced by importTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editImportForm()

ilDidacticTemplateSettingsGUI::editImportForm ( )

Definition at line 703 of file class.ilDidacticTemplateSettingsGUI.php.

704 {
705 $form = new ilPropertyFormGUI();
706 $form->setShowTopButtons(false);
707 $form->setFormAction($this->ctrl->getFormAction($this));
708 $form->setTitle($this->lng->txt('didactic_import_table_title'));
709 $form->addCommandButton('importTemplate', $this->lng->txt('import'));
710 $form->addCommandButton('overview', $this->lng->txt('cancel'));
711
712 $file = new ilFileInputGUI($this->lng->txt('didactic_template_update_import'), 'file');
713 $file->setRequired(true);
714 $file->setSuffixes(['xml']);
715 $file->setInfo($this->lng->txt('didactic_template_update_import_info'));
716 $form->addItem($file);
717
718 return $form;
719 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by importTemplate(), and showEditImportForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editTemplate()

ilDidacticTemplateSettingsGUI::editTemplate ( ilPropertyFormGUI  $form = null)
protected

Definition at line 310 of file class.ilDidacticTemplateSettingsGUI.php.

310 : void
311 {
313 if (!$setting instanceof ilDidacticTemplateSetting) {
314 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
315 $this->ctrl->redirect($this, 'overview');
316 }
317 $this->setEditTabs("edit");
318 $this->ctrl->saveParameter($this, 'tplid');
319 if (!$form instanceof ilPropertyFormGUI) {
320 $form = $this->initEditTemplate($this->setting);
321 }
322 $this->tpl->setContent($form->getHTML());
323 }
initEditTemplate(ilDidacticTemplateSetting $set)

References $setting, ILIAS\Repository\ctrl(), initEditTemplate(), initTemplateFromRequest(), ILIAS\Repository\lng(), and setEditTabs().

Referenced by handleUpdateFailure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilDidacticTemplateSettingsGUI::executeCommand ( )

@noinspection PhpMissingBreakStatementInspection

Definition at line 115 of file class.ilDidacticTemplateSettingsGUI.php.

115 : string
116 {
118
119 $next_class = $this->ctrl->getNextClass($this);
120 $cmd = $this->ctrl->getCmd();
121
122 switch ($next_class) {
124 case "ilpropertyformgui":
126 if (!$setting instanceof ilDidacticTemplateSetting) {
128 }
129 $form = $this->initEditTemplate($setting);
130 $this->ctrl->forwardCommand($form);
131 // no break
132 case 'ilmultilingualismgui':
134 if (
135 !$this->access->checkAccess('write', '', $this->ref_id) ||
138 $this->ctrl->redirect($this, "overview");
139 }
140 $this->setEditTabs("settings_trans");
141 $transgui = new ilMultilingualismGUI($this->setting->getId(), 'dtpl');
142 $defaultl = $this->setting->getTranslationObject()->getDefaultLanguage();
143 $transgui->setStartValues(
144 $this->setting->getPresentationTitle($defaultl),
145 $this->setting->getPresentationDescription($defaultl)
146 );
147 $this->ctrl->forwardCommand($transgui);
148 break;
149 default:
150 if (!$cmd) {
151 $cmd = 'overview';
152 }
153 $this->$cmd();
154 break;
155 }
156 return '';
157 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $setting, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), initEditTemplate(), initReferenceFromRequest(), initTemplateFromRequest(), ilDidacticTemplateSetting\isAutoGenerated(), and setEditTabs().

+ Here is the call graph for this function:

◆ exportTemplate()

ilDidacticTemplateSettingsGUI::exportTemplate ( )
protected

Definition at line 538 of file class.ilDidacticTemplateSettingsGUI.php.

538 : void
539 {
541 if (!$setting instanceof ilDidacticTemplateSetting) {
542 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
543 $this->ctrl->redirect($this, 'overview');
544 return;
545 }
547 $writer->write();
548
550 $writer->xmlDumpMem(true),
551 $writer->getSetting()->getTitle() . '.xml',
552 'application/xml'
553 );
554 }
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")

References $setting, ILIAS\Repository\ctrl(), ilUtil\deliverData(), ilDidacticTemplateSetting\getId(), initTemplateFromRequest(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ handleUpdateFailure()

ilDidacticTemplateSettingsGUI::handleUpdateFailure ( ilPropertyFormGUI  $form)
protected

Definition at line 388 of file class.ilDidacticTemplateSettingsGUI.php.

388 : void
389 {
390 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
391 $form->setValuesByPost();
392 $this->editTemplate($form);
393 }

References editTemplate(), ILIAS\Repository\lng(), and ilPropertyFormGUI\setValuesByPost().

Referenced by updateTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importTemplate()

ilDidacticTemplateSettingsGUI::importTemplate ( )
protected

Definition at line 242 of file class.ilDidacticTemplateSettingsGUI.php.

242 : void
243 {
244 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
245 $this->ctrl->redirect($this, "overview");
246 }
247
249 if ($setting instanceof ilDidacticTemplateSetting) {
250 $form = $this->editImportForm();
251 } else {
252 $form = $this->createImportForm();
253 }
254
255 if (!$form->checkInput()) {
256 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
257 $form->setValuesByPost();
258
259 if ($setting instanceof ilDidacticTemplateSetting) {
260 $this->showEditImportForm($form);
261 } else {
262 $this->showImportForm($form);
263 }
264 return;
265 }
266
267 // Do import
269
270 $file = $form->getInput('file');
271 $tmp = ilFileUtils::ilTempnam() . '.xml';
272
273 // move uploaded file
275 $file['tmp_name'],
276 $file['name'],
277 $tmp
278 );
279 $import->setInputFile($tmp);
280
281 try {
282 $settings = $import->import();
283 if ($setting instanceof ilDidacticTemplateSetting) {
284 $this->editImport($settings);
285 } elseif ($settings->hasIconSupport($this->objDefinition)) {
286 $settings->getIconHandler()->handleUpload($this->upload, $_FILES['icon']['tmp_name']);
287 }
289 $this->logger->error('Import failed with message: ' . $e->getMessage());
290 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('didactic_import_failed') . ': ' . $e->getMessage());
291 $form->setValuesByPost();
292
293 if ($setting instanceof ilDidacticTemplateSetting) {
294 $this->showEditImportForm($form);
295 } else {
296 $this->showImportForm($form);
297 }
298 return;
299 }
300
301 $this->tpl->setOnScreenMessage('success', $this->lng->txt('didactic_import_success'), true);
302
303 if ($setting instanceof ilDidacticTemplateSetting) {
304 $this->ctrl->redirect($this, 'editTemplate');
305 } else {
306 $this->ctrl->redirect($this, 'overview');
307 }
308 }
Description of ilDidacticTemplateImportException.
Description of ilDidacticTemplateImport.
editImport(ilDidacticTemplateSetting $a_settings)
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

References Vendor\Package\$e, $setting, ILIAS\LTI\ToolProvider\$settings, ILIAS\Repository\access(), createImportForm(), ILIAS\Repository\ctrl(), editImport(), editImportForm(), ilFileUtils\ilTempnam(), ilDidacticTemplateImport\IMPORT_FILE, initTemplateFromRequest(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), ilFileUtils\moveUploadedFile(), showEditImportForm(), showImportForm(), and ILIAS\Repository\upload().

+ Here is the call graph for this function:

◆ initEditTemplate()

ilDidacticTemplateSettingsGUI::initEditTemplate ( ilDidacticTemplateSetting  $set)
protected

Definition at line 395 of file class.ilDidacticTemplateSettingsGUI.php.

396 {
397 $form = new ilPropertyFormGUI();
398 $form->setShowTopButtons(false);
399 $form->setFormAction($this->ctrl->getFormAction($this, 'updateTemplate'));
400 $form->setTitle($this->lng->txt('didactic_edit_tpl'));
401 $form->addCommandButton('updateTemplate', $this->lng->txt('save'));
402 $form->addCommandButton('overview', $this->lng->txt('cancel'));
403
404 // title
405 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
406 $title->setSize(40);
407 $title->setMaxLength(64);
408 $title->setRequired(true);
409 //use presentation title if autogenerated is set
410 $title->setDisabled($set->isAutoGenerated());
411
412 $def = [];
413 if (!$set->isAutoGenerated()) {
414 $trans = $set->getTranslations();
415 $def = $trans[0]; // default
416
417 if (count($trans) > 1) {
418 $languages = ilMDLanguageItem::_getLanguages();
419 $title->setInfo($this->lng->txt("language") . ": " . $languages[$def["lang_code"]] .
420 ' <a href="' . $this->ctrl->getLinkTargetByClass("ilmultilingualismgui", "listTranslations") .
421 '">&raquo; ' . $this->lng->txt("more_translations") . '</a>');
422 }
423 }
424
425 if ($set->isAutoGenerated()) {
426 $title->setValue($set->getPresentationTitle());
427 } elseif (isset($def['title'])) {
428 $title->setValue($def["title"]);
429 }
430
431 $form->addItem($title);
432
433 // desc
434 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
435 //use presentation title if autogenerated is set
436 if ($set->isAutoGenerated()) {
437 $desc->setValue($set->getPresentationDescription());
438 } elseif (isset($def['description'])) {
439 $desc->setValue($def["description"]);
440 }
441 $desc->setRows(3);
442 $desc->setDisabled($set->isAutoGenerated());
443 $form->addItem($desc);
444
445 $icon = new ilImageFileInputGUI($this->lng->txt('didactic_icon'), 'icon');
446 $icon->setImage($set->getIconHandler()->getAbsolutePath());
447 $icon->setInfo($this->lng->txt('didactic_icon_info'));
448 $icon->setAllowDeletion(true);
449 $icon->setSuffixes(['svg']);
450 $form->addItem($icon);
451
452 // info
453 $info = new ilTextAreaInputGUI($this->lng->txt('didactic_install_info'), 'info');
454 $info->setValue($set->getInfo());
455 $info->setRows(6);
456 $form->addItem($info);
457
458 //activate
459 $enable = new ilCheckboxInputGUI($this->lng->txt('active'), 'enable');
460 $enable->setChecked($set->isEnabled());
461 $form->addItem($enable);
462
463 // object type
464 if (!$set->isAutoGenerated()) {
465 $type = new ilSelectInputGUI($this->lng->txt('obj_type'), 'type');
466 $type->setRequired(true);
467 $type->setInfo($this->lng->txt('dtpl_obj_type_info'));
468 $assigned = $set->getAssignments();
469 $type->setValue($assigned[0] ?? '');
470 $subs = $this->objDefinition->getSubObjectsRecursively('root', false);
471 $options = [];
472 foreach (array_merge($subs, ['fold' => 1]) as $obj => $null) {
473 ilLoggerFactory::getLogger('root')->dump($null);
474 if ($this->objDefinition->isPlugin($obj)) {
475 $options[$obj] = ilObjectPlugin::lookupTxtById($obj, "obj_" . $obj);
476 } elseif ($this->objDefinition->isAllowedInRepository($obj)) {
477 $options[$obj] = $this->lng->txt('obj_' . $obj);
478 }
479 }
480 asort($options);
481
482 $type->setOptions($options);
483 $form->addItem($type);
484
485 $lokal_templates = new ilCheckboxInputGUI(
486 $this->lng->txt("activate_local_didactic_template"),
487 "local_template"
488 );
489 $lokal_templates->setChecked(count($set->getEffectiveFrom()) > 0);
490 $lokal_templates->setInfo($this->lng->txt("activate_local_didactic_template_info"));
491
492 //effective from (multinode)
493
494 $effrom = new ilRepositorySelector2InputGUI($this->lng->txt("effective_form"), "effective_from", true);
495 //$effrom->setMulti(true);
496 $white_list = [];
497 foreach ($this->objDefinition->getAllRepositoryTypes() as $type) {
498 if ($this->objDefinition->isContainer($type)) {
499 $white_list[] = $type;
500 }
501 }
502 $effrom->getExplorerGUI()->setTypeWhiteList($white_list);
503 $effrom->setValue($set->getEffectiveFrom());
504
505 $lokal_templates->addSubItem($effrom);
506 $form->addItem($lokal_templates);
507
508 $excl = new ilCheckboxInputGUI($this->lng->txt("activate_exclusive_template"), "exclusive_template");
509 $excl->setInfo($this->lng->txt("activate_exclusive_template_info"));
510 $excl->setChecked($set->isExclusive());
511
512 $form->addItem($excl);
513 }
514
515 return $form;
516 }
This class represents a checkbox property in a property form.
getTranslations()
Get all translations from this object.
getInfo()
Get installation info text.
static getLogger(string $a_component_id)
Get component logger.
static lookupTxtById(string $plugin_id, string $lang_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.
$type

References $type, ilMDLanguageItem\_getLanguages(), ILIAS\Repository\ctrl(), ilDidacticTemplateSetting\getAssignments(), ilDidacticTemplateSetting\getEffectiveFrom(), ilDidacticTemplateSetting\getIconHandler(), ilDidacticTemplateSetting\getInfo(), ilLoggerFactory\getLogger(), ilDidacticTemplateSetting\getPresentationDescription(), ilDidacticTemplateSetting\getPresentationTitle(), ilDidacticTemplateSetting\getTranslations(), ilDidacticTemplateSetting\isAutoGenerated(), ilDidacticTemplateSetting\isEnabled(), ilDidacticTemplateSetting\isExclusive(), ILIAS\Repository\lng(), and ilObjectPlugin\lookupTxtById().

Referenced by editTemplate(), executeCommand(), and updateTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initReferenceFromRequest()

ilDidacticTemplateSettingsGUI::initReferenceFromRequest ( )
protected

Definition at line 73 of file class.ilDidacticTemplateSettingsGUI.php.

73 : void
74 {
75 if ($this->http->wrapper()->query()->has('ref_id')) {
76 $this->ref_id = $this->http->wrapper()->query()->retrieve(
77 'ref_id',
78 $this->refinery->kindlyTo()->int()
79 );
80 }
81 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTemplateFromRequest()

ilDidacticTemplateSettingsGUI::initTemplateFromRequest ( )
protected

Definition at line 102 of file class.ilDidacticTemplateSettingsGUI.php.

103 {
104 if ($this->http->wrapper()->query()->has('tplid')) {
105 $tpl_id = $this->http->wrapper()->query()->retrieve(
106 'tplid',
107 $this->refinery->kindlyTo()->int()
108 );
109 return $this->setting = new ilDidacticTemplateSetting($tpl_id);
110 }
111
112 return null;
113 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by copyTemplate(), editTemplate(), executeCommand(), exportTemplate(), importTemplate(), showEditImportForm(), showImportForm(), and updateTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTemplatesFromRequest()

ilDidacticTemplateSettingsGUI::initTemplatesFromRequest ( )
protected

transforms selected tpls from post to SplFixedArray

Definition at line 86 of file class.ilDidacticTemplateSettingsGUI.php.

86 : SplFixedArray
87 {
88 if ($this->http->wrapper()->post()->has('tpls')) {
89 return SplFixedArray::fromArray(
90 $this->http->wrapper()->post()->retrieve(
91 'tpls',
92 $this->refinery->kindlyTo()->listOf(
93 $this->refinery->kindlyTo()->int()
94 )
95 )
96 );
97 }
98
99 return new SplFixedArray(0);
100 }

References ILIAS\FileDelivery\http().

Referenced by activateTemplates(), confirmDelete(), deactivateTemplates(), and deleteTemplates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ overview()

ilDidacticTemplateSettingsGUI::overview ( )
protected

Definition at line 159 of file class.ilDidacticTemplateSettingsGUI.php.

159 : void
160 {
161 if ($this->rbacsystem->checkAccess('write', $this->ref_id)) {
162 $this->toolbar->addButton(
163 $this->lng->txt('didactic_import_btn'),
164 $this->ctrl->getLinkTarget($this, 'showImportForm')
165 );
166 }
167
168 $filter = new ilDidacticTemplateSettingsTableFilter($this->ctrl->getFormAction($this, 'overview'));
169 $filter->init();
170
171 $table = new ilDidacticTemplateSettingsTableGUI($this, 'overview', $this->ref_id);
172 $table->init();
173 $table->parse($filter);
174
175 $this->tpl->setContent(
176 $filter->render() . $table->getHTML()
177 );
178 }

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by applyFilter(), and resetFilter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilter()

ilDidacticTemplateSettingsGUI::resetFilter ( )

Definition at line 189 of file class.ilDidacticTemplateSettingsGUI.php.

189 : void
190 {
191 $table = new ilDidacticTemplateSettingsTableGUI($this, 'overview', $this->ref_id);
192 $table->init();
193 $table->resetOffset();
194 $table->resetFilter();
195 $this->overview();
196 }

References overview().

+ Here is the call graph for this function:

◆ setEditTabs()

ilDidacticTemplateSettingsGUI::setEditTabs ( string  $a_tab_active = "edit")
protected

Definition at line 656 of file class.ilDidacticTemplateSettingsGUI.php.

656 : void
657 {
658 $this->lng->loadLanguageModule('obj');
659 $this->tabs->clearTargets();
660 $this->tabs->setBackTarget(
661 $this->lng->txt('didactic_back_to_overview'),
662 $this->ctrl->getLinkTarget($this, 'overview')
663 );
664 $this->ctrl->saveParameter($this, "tplid");
665
666 if (!$this->setting->isAutoGenerated()) {
667 $this->tabs->addTab('edit', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this, 'editTemplate'));
668 $this->tabs->addTab(
669 'import',
670 $this->lng->txt('import'),
671 $this->ctrl->getLinkTarget($this, 'showEditImportForm')
672 );
673
674 if (in_array($a_tab_active, ['edit', 'settings_trans'])) {
675 $this->tabs->addSubTab(
676 'edit',
677 $this->lng->txt('settings'),
678 $this->ctrl->getLinkTarget($this, 'editTemplate')
679 );
680 $this->tabs->addSubTab(
681 'settings_trans',
682 $this->lng->txt("obj_multilinguality"),
683 $this->ctrl->getLinkTargetByClass(["ilmultilingualismgui"], 'listTranslations')
684 );
685 $this->tabs->setTabActive('edit');
686 $this->tabs->setSubTabActive($a_tab_active);
687 } else {
688 $this->tabs->setTabActive($a_tab_active);
689 }
690 }
691 }

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by editTemplate(), executeCommand(), showEditImportForm(), and showImportForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showEditImportForm()

ilDidacticTemplateSettingsGUI::showEditImportForm ( ilPropertyFormGUI  $form = null)

Definition at line 693 of file class.ilDidacticTemplateSettingsGUI.php.

693 : void
694 {
696 $this->setEditTabs("import");
697 if (!$form instanceof ilPropertyFormGUI) {
698 $form = $this->editImportForm();
699 }
700 $this->tpl->setContent($form->getHTML());
701 }

References editImportForm(), initTemplateFromRequest(), and setEditTabs().

Referenced by importTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showImportForm()

ilDidacticTemplateSettingsGUI::showImportForm ( ilPropertyFormGUI  $form = null)
protected

Definition at line 198 of file class.ilDidacticTemplateSettingsGUI.php.

198 : void
199 {
201 if ($setting instanceof ilDidacticTemplateSetting) {
202 $this->setEditTabs('import');
203 } else {
204 $this->tabs->clearTargets();
205 $this->tabs->setBackTarget(
206 $this->lng->txt('didactic_back_to_overview'),
207 $this->ctrl->getLinkTarget($this, 'overview')
208 );
209 }
210
211 if (!$form instanceof ilPropertyFormGUI) {
212 $form = $this->createImportForm();
213 }
214 $this->tpl->setContent($form->getHTML());
215 }

References $setting, createImportForm(), initTemplateFromRequest(), ILIAS\Repository\lng(), setEditTabs(), and ILIAS\Repository\tabs().

Referenced by importTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateTemplate()

ilDidacticTemplateSettingsGUI::updateTemplate ( )
protected

Definition at line 325 of file class.ilDidacticTemplateSettingsGUI.php.

325 : void
326 {
328 $this->ctrl->saveParameter($this, 'tplid');
329
330 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
331 $this->ctrl->redirect($this, "overview");
332 }
333
334 $form = $this->initEditTemplate($this->setting);
335
336 if ($form->checkInput()) {
337 $tmp_file = $_FILES['icon']['tmp_name'] ?? '';
338 $upload_element = $form->getItemByPostVar('icon');
339 if (
340 ($tmp_file !== '' || ($tmp_file === '' && $this->setting->getIconIdentifier())) &&
341 !$this->objDefinition->isContainer($form->getInput('type')) &&
342 !$upload_element->getDeletionFlag()
343 ) {
344 $form->getItemByPostVar('icon')->setAlert($this->lng->txt('didactic_icon_error'));
345 $this->handleUpdateFailure($form);
346 return;
347 }
348 //change default entries if translation is active
349 if (count($lang = $this->setting->getTranslationObject()->getLanguages())) {
350 $this->setting->getTranslationObject()->setDefaultTitle($form->getInput('title'));
351 $this->setting->getTranslationObject()->setDefaultDescription($form->getInput('description'));
352 $this->setting->getTranslationObject()->save();
353 }
354
355 if (!$this->setting->isAutoGenerated()) {
356 $this->setting->setTitle($form->getInput('title'));
357 $this->setting->setDescription($form->getInput('description'));
358 }
359
360 $this->setting->setInfo($form->getInput('info'));
361 $this->setting->enable((bool) $form->getInput('enable'));
362
363 if (!$this->setting->isAutoGenerated()) {
364 $this->setting->setAssignments([$form->getInput('type')]);
365 }
366
367 if ($form->getInput('local_template') && count($form->getInput('effective_from')) > 0) {
368 $this->setting->setEffectiveFrom($form->getInput('effective_from'));
369 } else {
370 $this->setting->setEffectiveFrom([]);
371 }
372
373 $this->setting->setExclusive((bool) $form->getInput('exclusive_template'));
374
375 $this->setting->update();
376
377 $upload = $form->getItemByPostVar('icon');
378 if ($upload->getDeletionFlag()) {
379 $this->setting->getIconHandler()->delete();
380 }
381 $this->setting->getIconHandler()->handleUpload($this->upload, $_FILES['icon']['tmp_name']);
382 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
383 $this->ctrl->redirect($this, 'overview');
384 }
385 $this->handleUpdateFailure($form);
386 }
$lang
Definition: xapiexit.php:26

References $lang, $setting, $upload, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), handleUpdateFailure(), initEditTemplate(), initTemplateFromRequest(), ILIAS\Repository\lng(), and ILIAS\Repository\upload().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilDidacticTemplateSettingsGUI::$access
private

Definition at line 42 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $ctrl

ilCtrl ilDidacticTemplateSettingsGUI::$ctrl
private

Definition at line 41 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $dic

Container ilDidacticTemplateSettingsGUI::$dic
private

Definition at line 38 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $http

GlobalHttpState ilDidacticTemplateSettingsGUI::$http
private

Definition at line 46 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $lng

ilLanguage ilDidacticTemplateSettingsGUI::$lng
private

Definition at line 39 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $logger

ilLogger ilDidacticTemplateSettingsGUI::$logger
private

Definition at line 35 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $objDefinition

ilObjectDefinition ilDidacticTemplateSettingsGUI::$objDefinition
private

Definition at line 44 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $parent_object

ilObjectGUI ilDidacticTemplateSettingsGUI::$parent_object
private

Definition at line 36 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $rbacsystem

ilRbacSystem ilDidacticTemplateSettingsGUI::$rbacsystem
private

Definition at line 40 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $ref_id

int ilDidacticTemplateSettingsGUI::$ref_id
private

Definition at line 52 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $refinery

Factory ilDidacticTemplateSettingsGUI::$refinery
private

Definition at line 47 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $request

RequestInterface ilDidacticTemplateSettingsGUI::$request
private

Definition at line 45 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $setting

ilDidacticTemplateSetting ilDidacticTemplateSettingsGUI::$setting = null
private

◆ $tabs

ilTabsGUI ilDidacticTemplateSettingsGUI::$tabs
private

Definition at line 49 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $toolbar

ilToolbarGUI ilDidacticTemplateSettingsGUI::$toolbar
private

Definition at line 43 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilDidacticTemplateSettingsGUI::$tpl
private

◆ $upload

FileUpload ilDidacticTemplateSettingsGUI::$upload
private

Definition at line 50 of file class.ilDidacticTemplateSettingsGUI.php.

Referenced by updateTemplate().


The documentation for this class was generated from the following file: