ILIAS  release_7 Revision v7.30-3-g800a261c036
ilDidacticTemplateSettingsGUI Class Reference

Settings for a single didactic template. More...

+ Collaboration diagram for ilDidacticTemplateSettingsGUI:

Public Member Functions

 __construct ($a_parent_obj)
 Constructor. More...
 
 applyFilter ()
 Apply table filter. More...
 
 resetFilter ()
 Reset filter. More...
 
 showEditImportForm (ilPropertyFormGUI $form=null)
 
 editImportForm ()
 
 editImport ($a_settings)
 @global ilCtrl $ilCtrl More...
 

Protected Member Functions

 initObject ($a_id)
 
 overview ()
 Show didactic template administration. More...
 
 showImportForm (ilPropertyFormGUI $form=null)
 Show template import form. More...
 
 createImportForm ()
 Create template import form. More...
 
 importTemplate ()
 Import template. More...
 
 editTemplate (ilPropertyFormGUI $form=null)
 Edit template. More...
 
 updateTemplate ()
 Update template. More...
 
 handleUpdateFailure (ilPropertyFormGUI $form)
 
 initEditTemplate (ilDidacticTemplateSetting $set)
 Init edit template form. More...
 
 copyTemplate ()
 Copy on template. More...
 
 exportTemplate ()
 Export one template. More...
 
 deleteTemplates ()
 Delete chosen didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl. More...
 
 activateTemplates ()
 Activate didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl. More...
 
 deactivateTemplates ()
 Activate didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl. More...
 

Private Attributes

 $parent_object
 
 $object = null
 
 $dic
 
 $lng
 
 $rbacsystem
 
 $ctrl
 
 $objDefinition
 
 $request
 

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 16 of file class.ilDidacticTemplateSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilDidacticTemplateSettingsGUI::__construct (   $a_parent_obj)

Constructor.

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

55 {
56 global $DIC;
57
58 $this->parent_object = $a_parent_obj;
59 $this->dic = $DIC;
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();
65
66 if (isset($_REQUEST["tplid"])) {
67 $this->initObject($_REQUEST["tplid"]);
68 }
69 }
global $DIC
Definition: goto.php:24

References $DIC, and initObject().

+ Here is the call graph for this function:

Member Function Documentation

◆ activateTemplates()

ilDidacticTemplateSettingsGUI::activateTemplates ( )
protected

Activate didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl.

Returns
void

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

725 {
726 global $DIC;
727
728 $ilErr = $DIC['ilErr'];
729 $ilCtrl = $DIC['ilCtrl'];
730 $ilAccess = $DIC['ilAccess'];
731
732 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
733 $this->ctrl->redirect($this, "overview");
734 }
735 if (!$_REQUEST['tpls']) {
736 ilUtil::sendFailure($this->lng->txt('select_one'));
737 return $ilCtrl->redirect($this, 'overview');
738 }
739
740 foreach ($_REQUEST['tpls'] as $tplid) {
741 $tpl = new ilDidacticTemplateSetting($tplid);
742 $tpl->enable(true);
743 $tpl->update();
744 }
745
746 ilUtil::sendSuccess($this->lng->txt('didactic_activated_msg'), true);
747 $ilCtrl->redirect($this, 'overview');
748 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$ilErr
Definition: raiseError.php:18

References $DIC, $ilErr, $tpl, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ applyFilter()

ilDidacticTemplateSettingsGUI::applyFilter ( )

Apply table filter.

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

168 {
169 $table = new ilDidacticTemplateSettingsTableGUI($this, 'overview');
170 $table->init();
171 $table->resetOffset();
172 $table->writeFilterToSession();
173 $this->overview();
174 }
overview()
Show didactic template administration.
Description of ilDidacticTemplateSettingsTableGUI.

References overview().

+ Here is the call graph for this function:

◆ copyTemplate()

ilDidacticTemplateSettingsGUI::copyTemplate ( )
protected

Copy on template.

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

585 {
586 global $DIC;
587
588 $ilErr = $DIC['ilErr'];
589 $ilCtrl = $DIC['ilCtrl'];
590 $ilAccess = $DIC['ilAccess'];
591
592 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
593 $this->ctrl->redirect($this, "overview");
594 }
595
596 if (!$_REQUEST['tplid']) {
597 ilUtil::sendFailure($this->lng->txt('select_one'));
598 return $ilCtrl->redirect($this, 'overview');
599 }
600
601 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
602
603 $copier = new ilDidacticTemplateCopier((int) $_REQUEST['tplid']);
604 $copier->start();
605
606 ilUtil::sendSuccess($this->lng->txt('didactic_copy_suc_message'), true);
607 $ilCtrl->redirect($this, 'overview');
608 }
Copy a didactic template and all subitems.

References $DIC, $ilErr, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ createImportForm()

ilDidacticTemplateSettingsGUI::createImportForm ( )
protected

Create template import form.

Returns
ilPropertyFormGUI $form

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

222 {
223 global $DIC;
224
225 $ilCtrl = $DIC['ilCtrl'];
226
227 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
228 $form = new ilPropertyFormGUI();
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'));
234
235 $file = new ilFileInputGUI($this->lng->txt('import_file'), 'file');
236 $file->setSuffixes(['xml']);
237 $file->setRequired(true);
238 $form->addItem($file);
239
240 $icon = new ilImageFileInputGUI($this->lng->txt('icon'), 'icon');
241 $icon->setAllowDeletion(false);
242 $icon->setSuffixes(['svg']);
243 $icon->setInfo($this->lng->txt('didactic_icon_info'));
244 $form->addItem($icon);
245
246 $created = true;
247
248 return $form;
249 }
This class represents a file property in a property form.
This class represents an image file property in a property form.
This class represents a property form user interface.

References $DIC.

Referenced by importTemplate(), and showImportForm().

+ Here is the caller graph for this function:

◆ deactivateTemplates()

ilDidacticTemplateSettingsGUI::deactivateTemplates ( )
protected

Activate didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl.

Returns
void

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

757 {
758 global $DIC;
759
760 $ilErr = $DIC['ilErr'];
761 $ilCtrl = $DIC['ilCtrl'];
762 $ilAccess = $DIC['ilAccess'];
763
764 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
765 $this->ctrl->redirect($this, "overview");
766 }
767
768 if (!$_REQUEST['tpls']) {
769 ilUtil::sendFailure($this->lng->txt('select_one'));
770 $ilCtrl->redirect($this, 'overview');
771 }
772
773 foreach ($_REQUEST['tpls'] as $tplid) {
774 $tpl = new ilDidacticTemplateSetting($tplid);
775 $tpl->enable(false);
776 $tpl->update();
777 }
778
779 ilUtil::sendSuccess($this->lng->txt('didactic_deactivated_msg'), true);
780 $ilCtrl->redirect($this, 'overview');
781 }

References $DIC, $ilErr, $tpl, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ deleteTemplates()

ilDidacticTemplateSettingsGUI::deleteTemplates ( )
protected

Delete chosen didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl.

Returns
void

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

693 {
694 global $DIC;
695
696 $ilErr = $DIC['ilErr'];
697 $ilCtrl = $DIC['ilCtrl'];
698 $ilAccess = $DIC['ilAccess'];
699
700 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
701 $this->ctrl->redirect($this, "overview");
702 }
703
704 if (!$_REQUEST['tpls']) {
705 ilUtil::sendFailure($this->lng->txt('select_one'));
706 return $ilCtrl->redirect($this, 'overview');
707 }
708
709 foreach ((array) $_REQUEST['tpls'] as $tplid) {
710 $tpl = new ilDidacticTemplateSetting($tplid);
711 $tpl->delete();
712 }
713
714 ilUtil::sendSuccess($this->lng->txt('didactic_delete_msg'), true);
715 $ilCtrl->redirect($this, 'overview');
716 }

References $DIC, $ilErr, $tpl, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ editImport()

ilDidacticTemplateSettingsGUI::editImport (   $a_settings)

@global ilCtrl $ilCtrl

Parameters
ilDidacticTemplateSetting$a_settings

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

857 {
858 global $DIC;
859
860 $ilCtrl = $DIC['ilCtrl'];
861 $tplid = $_REQUEST['tplid'];
862
863 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
865
867
868 $this->object->delete();
869
870 foreach ($assignments as $obj) {
871 ilDidacticTemplateObjSettings::assignTemplate($obj["ref_id"], $obj["obj_id"], $a_settings->getId());
872 }
873
874 $ilCtrl->setParameter($this, "tplid", $a_settings->getId());
875 }
static assignTemplate($a_ref_id, $a_obj_id, $a_tpl_id)
Assign template to object @global ilDB $ilDB.
static getAssignmentsByTemplateID($a_tpl_id)
Lookup template id @global ilDB $ilDB.
static transferAutoGenerateStatus($a_src, $a_dest)
transfer auto generated flag if source is auto generated

References $DIC, ilDidacticTemplateObjSettings\assignTemplate(), ilDidacticTemplateObjSettings\getAssignmentsByTemplateID(), 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 829 of file class.ilDidacticTemplateSettingsGUI.php.

830 {
831 global $DIC;
832
833 $ilCtrl = $DIC['ilCtrl'];
834
835 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
836 $form = new ilPropertyFormGUI();
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'));
842
843 $file = new ilFileInputGUI($this->lng->txt('didactic_template_update_import'), 'file');
844 $file->setRequired(true);
845 $file->setSuffixes(['xml']);
846 $file->setInfo($this->lng->txt('didactic_template_update_import_info'));
847 $form->addItem($file);
848
849 return $form;
850 }

References $DIC.

Referenced by importTemplate(), and showEditImportForm().

+ Here is the caller graph for this function:

◆ editTemplate()

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

Edit template.

Returns
void

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

337 {
338 global $DIC;
339
340 $ilCtrl = $DIC['ilCtrl'];
341 $ilTabs = $DIC['ilTabs'];
342
343 $this->setEditTabs("edit");
344
345 if (!$_REQUEST['tplid']) {
346 ilUtil::sendFailure($this->lng->txt('select_one'), true);
347 $ilCtrl->redirect($this, 'overview');
348 }
349
350 //$ilTabs->clearTargets();
351 //$ilTabs->setBackTarget(
352 // $this->lng->txt('didactic_back_to_overview'),
353 // $ilCtrl->getLinkTarget($this,'overview')
354 //);
355
356
357 $ilCtrl->saveParameter($this, 'tplid');
358
359 if (!$form instanceof ilPropertyFormGUI) {
360 $form = $this->initEditTemplate($this->object);
361 }
362 $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
363 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
initEditTemplate(ilDidacticTemplateSetting $set)
Init edit template form.

References $DIC, $GLOBALS, initEditTemplate(), and ilUtil\sendFailure().

Referenced by handleUpdateFailure().

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

◆ exportTemplate()

ilDidacticTemplateSettingsGUI::exportTemplate ( )
protected

Export one template.

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

614 {
615 global $DIC;
616
617 $ilErr = $DIC['ilErr'];
618 $ilCtrl = $DIC['ilCtrl'];
619
620 if (!$_REQUEST['tplid']) {
621 ilUtil::sendFailure($this->lng->txt('select_one'));
622 return $ilCtrl->redirect($this, 'overview');
623 }
624
625 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateXmlWriter.php';
626 $writer = new ilDidacticTemplateXmlWriter((int) $_REQUEST['tplid']);
627 $writer->write();
628
630 $writer->xmlDumpMem(true),
631 $writer->getSetting()->getTitle() . '.xml',
632 'application/xml'
633 );
634 }
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.

References $DIC, $ilErr, ilUtil\deliverData(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ handleUpdateFailure()

ilDidacticTemplateSettingsGUI::handleUpdateFailure ( ilPropertyFormGUI  $form)
protected

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

438 {
439 ilUtil::sendFailure($this->lng->txt('err_check_input'));
440 $form->setValuesByPost();
441 $this->editTemplate($form);
442 }
editTemplate(ilPropertyFormGUI $form=null)
Edit template.
setValuesByPost()
Set form values from POST values.

References editTemplate(), ilUtil\sendFailure(), 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

Import template.

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

255 {
256 global $DIC;
257
258 $ilCtrl = $DIC['ilCtrl'];
259 $ilAccess = $DIC['ilAccess'];
260
261 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
262 $ilCtrl->redirect($this, "overview");
263 }
264
265 $edit = $this->request->getQueryParams()['tplid'] ?? false;
266 if ($edit) {
267 $this->initObject($this->request->getQueryParams()['tplid']);
268 $form = $this->editImportForm();
269 } else {
270 $form = $this->createImportForm();
271 }
272
273
274 if (!$form->checkInput()) {
275 ilUtil::sendFailure($this->lng->txt('err_check_input'));
276 $form->setValuesByPost();
277
278 if ($edit) {
279 $this->showEditImportForm($form);
280 } else {
281 $this->showImportForm($form);
282 }
283 return;
284 }
285
286 // Do import
288
289 $file = $form->getInput('file');
290 $tmp = ilUtil::ilTempnam() . '.xml';
291
292 // move uploaded file
294 $file['tmp_name'],
295 $file['name'],
296 $tmp
297 );
298 $import->setInputFile($tmp);
299
300 try {
301 $settings = $import->import();
302 if ($edit) {
303 $this->editImport($settings);
304 } else {
305 if ($settings->hasIconSupport($this->objDefinition)) {
306 $settings->getIconHandler()->handleUpload($DIC->upload(), $_FILES['icon']['tmp_name']);
307 }
308 }
310 ilLoggerFactory::getLogger('otpl')->error('Import failed with message: ' . $e->getMessage());
311 ilUtil::sendFailure($this->lng->txt('didactic_import_failed') . ': ' . $e->getMessage());
312
313 $form->setValuesByPost();
314
315 if ($edit) {
316 $this->showEditImportForm($form);
317 } else {
318 $this->showImportForm($form);
319 }
320 return;
321 }
322
323 ilUtil::sendSuccess($this->lng->txt('didactic_import_success'), true);
324
325 if ($edit) {
326 $ilCtrl->redirect($this, 'editTemplate');
327 } else {
328 $ilCtrl->redirect($this, 'overview');
329 }
330 }
Description of ilDidacticTemplateImportException.
Description of ilDidacticTemplateImport.
editImport($a_settings)
@global ilCtrl $ilCtrl
showImportForm(ilPropertyFormGUI $form=null)
Show template import form.
static getLogger($a_component_id)
Get component logger.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.

References $DIC, Vendor\Package\$e, createImportForm(), editImport(), editImportForm(), ilLoggerFactory\getLogger(), ilUtil\ilTempnam(), ilDidacticTemplateImport\IMPORT_FILE, initObject(), ilUtil\moveUploadedFile(), ilUtil\sendFailure(), showEditImportForm(), and showImportForm().

+ Here is the call graph for this function:

◆ initEditTemplate()

ilDidacticTemplateSettingsGUI::initEditTemplate ( ilDidacticTemplateSetting  $set)
protected

Init edit template form.

Parameters
ilDidacticTemplateSetting$set
Returns
ilPropertyFormGUI

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

451 {
452 global $DIC;
453
454 $ilCtrl = $DIC['ilCtrl'];
455 $objDefinition = $DIC['objDefinition'];
456
457 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
458 $form = new ilPropertyFormGUI();
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'));
464
465 // title
466 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
467 $title->setSize(40);
468 $title->setMaxLength(64);
469 $title->setRequired(true);
470 //use presentation title if autogenerated is set
471 $title->setDisabled($set->isAutoGenerated());
472
473 if (!$set->isAutoGenerated()) {
474 $trans = $set->getTranslations();
475 $def = $trans[0]; // default
476
477 if (sizeof($trans) > 1) {
478 include_once('Services/MetaData/classes/class.ilMDLanguageItem.php');
479 $languages = ilMDLanguageItem::_getLanguages();
480 $title->setInfo($this->lng->txt("language") . ": " . $languages[$def["lang_code"]] .
481 ' <a href="' . $ilCtrl->getLinkTargetByClass("ilmultilingualismgui", "listTranslations") .
482 '">&raquo; ' . $this->lng->txt("more_translations") . '</a>');
483 }
484 }
485
486 if ($set->isAutoGenerated()) {
487 $title->setValue($set->getPresentationTitle());
488 } else {
489 $title->setValue($def["title"]);
490 }
491
492 $form->addItem($title);
493
494 // desc
495 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
496 //use presentation title if autogenerated is set
497 if ($set->isAutoGenerated()) {
498 $desc->setValue($set->getPresentationDescription());
499 } else {
500 $desc->setValue($def["description"]);
501 }
502 $desc->setRows(3);
503 $desc->setDisabled($set->isAutoGenerated());
504 $form->addItem($desc);
505
506
507 $icon = new ilImageFileInputGUI($this->lng->txt('didactic_icon'), 'icon');
508 $icon->setImage($set->getIconHandler()->getAbsolutePath());
509 $icon->setInfo($this->lng->txt('didactic_icon_info'));
510 $icon->getAllowDeletion(true);
511 $icon->setSuffixes(['svg']);
512 $form->addItem($icon);
513
514 // info
515 $info = new ilTextAreaInputGUI($this->lng->txt('didactic_install_info'), 'info');
516 $info->setValue($set->getInfo());
517 $info->setRows(6);
518 $form->addItem($info);
519
520 //activate
521 $enable = new ilCheckboxInputGUI($this->lng->txt('active'), 'enable');
522 $enable->setChecked($set->isEnabled());
523 $enable->setRequired(true);
524 $form->addItem($enable);
525
526 // object type
527 if (!$set->isAutoGenerated()) {
528 $type = new ilSelectInputGUI($this->lng->txt('obj_type'), 'type');
529 $type->setRequired(true);
530 $type->setInfo($this->lng->txt('dtpl_obj_type_info'));
531 $assigned = $set->getAssignments();
532 $type->setValue(isset($assigned[0]) ? $assigned[0] : '');
533 $subs = $objDefinition->getSubObjectsRecursively('root', false);
534 $options = array();
535 foreach (array_merge($subs, array('fold' => 1)) as $obj => $null) {
536 ilLoggerFactory::getLogger('root')->dump($null);
537 if ($objDefinition->isPlugin($obj)) {
538 $options[$obj] = ilObjectPlugin::lookupTxtById($obj, "obj_" . $obj);
539 } elseif ($objDefinition->isAllowedInRepository($obj)) {
540 $options[$obj] = $this->lng->txt('obj_' . $obj);
541 }
542 }
543 asort($options);
544
545 $type->setOptions($options);
546 $form->addItem($type);
547
548 $lokal_templates = new ilCheckboxInputGUI($this->lng->txt("activate_local_didactic_template"), "local_template");
549 $lokal_templates->setChecked(count($set->getEffectiveFrom()) > 0);
550 $lokal_templates->setInfo($this->lng->txt("activate_local_didactic_template_info"));
551
552 //effective from (multinode)
553 include_once("./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
554 $effrom = new ilRepositorySelector2InputGUI($this->lng->txt("effective_form"), "effective_from", true);
555 //$effrom->setMulti(true);
556 $definition = $GLOBALS['DIC']['objDefinition'];
557 $white_list = [];
558 foreach ($definition->getAllRepositoryTypes() as $type) {
559 if ($definition->isContainer($type)) {
560 $white_list[] = $type;
561 }
562 }
563 $effrom->getExplorerGUI()->setTypeWhiteList($white_list);
564 $effrom->setValue($set->getEffectiveFrom());
565
566 $lokal_templates->addSubItem($effrom);
567 $form->addItem($lokal_templates);
568
569 $excl = new ilCheckboxInputGUI($this->lng->txt("activate_exclusive_template"), "exclusive_template");
570 $excl->setInfo($this->lng->txt("activate_exclusive_template_info"));
571 $excl->setChecked($set->isExclusive());
572
573 $form->addItem($excl);
574 }
575
576
577
578 return $form;
579 }
This class represents a checkbox property in a property form.
getTranslations()
get all translations from this object
getInfo()
Get installation info text.
isEnabled()
Check if template is enabled.
static lookupTxtById($plugin_id, $lang_var)
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 $DIC, $GLOBALS, $objDefinition, $type, ilMDLanguageItem\_getLanguages(), ilDidacticTemplateSetting\getAssignments(), ilDidacticTemplateSetting\getEffectiveFrom(), ilDidacticTemplateSetting\getIconHandler(), ilDidacticTemplateSetting\getInfo(), ilLoggerFactory\getLogger(), ilDidacticTemplateSetting\getPresentationDescription(), ilDidacticTemplateSetting\getPresentationTitle(), ilDidacticTemplateSetting\getTranslations(), ilDidacticTemplateSetting\isAutoGenerated(), ilDidacticTemplateSetting\isEnabled(), ilDidacticTemplateSetting\isExclusive(), and ilObjectPlugin\lookupTxtById().

Referenced by editTemplate(), and updateTemplate().

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

◆ initObject()

ilDidacticTemplateSettingsGUI::initObject (   $a_id)
protected
Parameters
int$a_id
Returns
ilDidacticTemplateSetting

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

76 {
77 return $this->object = new ilDidacticTemplateSetting($a_id);
78 }

Referenced by __construct(), and importTemplate().

+ Here is the caller graph for this function:

◆ overview()

ilDidacticTemplateSettingsGUI::overview ( )
protected

Show didactic template administration.

@global ilToolbarGUI $ilToolbar

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

139 {
140 global $DIC;
141
142 $tpl = $DIC->ui()->mainTemplate();
143
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')
148 );
149 }
150
151 $filter = new ilDidacticTemplateSettingsTableFilter($this->ctrl->getFormAction($this, 'overview'));
152 $filter->init();
153
154
155 $table = new ilDidacticTemplateSettingsTableGUI($this, 'overview');
156 $table->init();
157 $table->parse($filter);
158
159 $tpl->setContent(
160 $filter->render() . '' . $table->getHTML()
161 );
162 }

References $DIC, and $tpl.

Referenced by applyFilter(), and resetFilter().

+ Here is the caller graph for this function:

◆ resetFilter()

ilDidacticTemplateSettingsGUI::resetFilter ( )

Reset filter.

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

180 {
181 $table = new ilDidacticTemplateSettingsTableGUI($this, 'overview');
182 $table->init();
183 $table->resetOffset();
184 $table->resetFilter();
185 $this->overview();
186 }

References overview().

+ Here is the call graph for this function:

◆ showEditImportForm()

ilDidacticTemplateSettingsGUI::showEditImportForm ( ilPropertyFormGUI  $form = null)

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

821 {
822 $this->setEditTabs("import");
823 if (!$form instanceof ilPropertyFormGUI) {
824 $form = $this->editImportForm();
825 }
826 $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
827 }

References $GLOBALS, and editImportForm().

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

Show template import form.

@global ilTabsGUI $ilTabs

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

195 {
196 global $DIC;
197
198 $ilTabs = $DIC->tabs();
199 $ilCtrl = $DIC->ctrl();
200
201 if (isset($_REQUEST["tplid"])) {
202 $this->setEditTabs('import');
203 } else {
204 $ilTabs->clearTargets();
205 $ilTabs->setBackTarget(
206 $this->lng->txt('didactic_back_to_overview'),
207 $ilCtrl->getLinkTarget($this, 'overview')
208 );
209 }
210
211 if (!$form instanceof ilPropertyFormGUI) {
212 $form = $this->createImportForm();
213 }
214 $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
215 }

References $DIC, $GLOBALS, and createImportForm().

Referenced by importTemplate().

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

◆ updateTemplate()

ilDidacticTemplateSettingsGUI::updateTemplate ( )
protected

Update template.

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

369 {
370 global $DIC;
371
372 $ilCtrl = $DIC['ilCtrl'];
373 $ilAccess = $DIC['ilAccess'];
374
375 $tpl_id = $this->request->getQueryParams()['tplid'] ?? 0;
376 $this->ctrl->saveParameter($this, 'tplid');
377
378
379 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
380 $this->ctrl->redirect($this, "overview");
381 }
382
383 $temp = new ilDidacticTemplateSetting((int) $tpl_id);
384 $form = $this->initEditTemplate($temp);
385
386 if ($form->checkInput()) {
387 $tmp_file = $_FILES['icon']['tmp_name'];
388 $upload_element = $form->getItemByPostVar('icon');
389 if (
390 (strlen($tmp_file) || (!strlen($tmp_file) && $temp->getIconIdentifier())) &&
391 !$this->objDefinition->isContainer($form->getInput('type')) &&
392 !$upload_element->getDeletionFlag()
393 ) {
394 $icon = $form->getItemByPostVar('icon')->setAlert($this->lng->txt('didactic_icon_error'));
395 return $this->handleUpdateFailure($form);
396 }
397 //change default entries if translation is active
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();
402 }
403
404 if (!$temp->isAutoGenerated()) {
405 $temp->setTitle($form->getInput('title'));
406 $temp->setDescription($form->getInput('description'));
407 }
408
409 $temp->setInfo($form->getInput('info'));
410 $temp->enable($form->getInput('enable'));
411
412 if (!$temp->isAutoGenerated()) {
413 $temp->setAssignments(array($form->getInput('type')));
414 }
415
416 if ($form->getInput('local_template') && count($form->getInput('effective_from')) > 0) {
417 $temp->setEffectiveFrom($form->getInput('effective_from'));
418 } else {
419 $temp->setEffectiveFrom(array());
420 }
421
422 $temp->setExclusive((bool) $form->getInput('exclusive_template'));
423
424 $temp->update();
425
426 $upload = $form->getItemByPostVar('icon');
427 if ($upload->getDeletionFlag()) {
428 $temp->getIconHandler()->delete();
429 }
430 $temp->getIconHandler()->handleUpload($DIC->upload(), $_FILES['icon']['tmp_name']);
431 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
432 $ilCtrl->redirect($this, 'overview');
433 }
434 $this->handleUpdateFailure($form);
435 }
$lang
Definition: xapiexit.php:8

References $DIC, $lang, handleUpdateFailure(), and initEditTemplate().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilDidacticTemplateSettingsGUI::$ctrl
private

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

◆ $dic

ilDidacticTemplateSettingsGUI::$dic
private

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

◆ $lng

ilDidacticTemplateSettingsGUI::$lng
private

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

◆ $objDefinition

ilDidacticTemplateSettingsGUI::$objDefinition
private

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

Referenced by initEditTemplate().

◆ $object

ilDidacticTemplateSettingsGUI::$object = null
private

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

◆ $parent_object

ilDidacticTemplateSettingsGUI::$parent_object
private

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

◆ $rbacsystem

ilDidacticTemplateSettingsGUI::$rbacsystem
private

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

◆ $request

ilDidacticTemplateSettingsGUI::$request
private

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


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