ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjExerciseAdministrationGUI.php
Go to the documentation of this file.
1<?php
2
28{
29 public function __construct($a_data, int $a_id, bool $a_call_by_reference = true, bool $a_prepare_output = true)
30 {
31 global $DIC;
32
33 $this->lng = $DIC->language();
34 $this->settings = $DIC->settings();
35 $this->ctrl = $DIC->ctrl();
36 $this->access = $DIC->access();
37 $this->type = "excs";
38 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
39
40 $this->lng->loadLanguageModule("exercise");
41 }
42
43 public function executeCommand(): void
44 {
45 $next_class = $this->ctrl->getNextClass($this);
46 $cmd = $this->ctrl->getCmd();
47
48 $this->prepareOutput();
49
50 switch ($next_class) {
51 case 'ilpermissiongui':
52 $this->tabs_gui->setTabActive('perm_settings');
53 $perm_gui = new ilPermissionGUI($this);
54 $this->ctrl->forwardCommand($perm_gui);
55 break;
56
57 default:
58 if (!$cmd || $cmd == 'view') {
59 $cmd = "editSettings";
60 }
61 $this->$cmd();
62 break;
63 }
64 }
65
66 public function getAdminTabs(): void
67 {
68 if ($this->checkPermissionBool("visible,read")) {
69 $this->tabs_gui->addTarget(
70 "settings",
71 $this->ctrl->getLinkTarget($this, "editSettings"),
72 array("editSettings", "view")
73 );
74 }
75
76 if ($this->checkPermissionBool('edit_permission')) {
77 $this->tabs_gui->addTarget(
78 "perm_settings",
79 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
80 array(),
81 'ilpermissiongui'
82 );
83 }
84 }
85
86 public function editSettings(?ilPropertyFormGUI $a_form = null): void
87 {
88 $this->tabs_gui->setTabActive('settings');
89
90 if ($a_form === null) {
91 $a_form = $this->initFormSettings();
92 }
93 $this->tpl->setContent($a_form->getHTML());
94 }
95
96 public function saveSettings(): void
97 {
98 $ilCtrl = $this->ctrl;
99
100 $this->checkPermission("write");
101
102 $form = $this->initFormSettings();
103 if ($form->checkInput()) {
104 $exc_set = new ilSetting("excs");
105 $exc_set->set("add_to_pd", (bool) $form->getInput("pd"));
106
107 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
108 $ilCtrl->redirect($this, "editSettings");
109 }
110
111 $form->setValuesByPost();
112 $this->editSettings($form);
113 }
114
115 public function cancel(): void
116 {
117 $ilCtrl = $this->ctrl;
118
119 $ilCtrl->redirect($this, "view");
120 }
121
123 {
125
126 $form = new ilPropertyFormGUI();
127 $form->setFormAction($this->ctrl->getFormAction($this));
128 $form->setTitle($this->lng->txt('exc_admin_settings'));
129
130 if ($this->checkPermissionBool("write")) {
131 $form->addCommandButton('saveSettings', $this->lng->txt('save'));
132 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
133 }
134
135 $exc_set = new ilSetting("excs");
136
137 $pd = new ilCheckboxInputGUI($lng->txt("to_desktop"), "pd");
138 $pd->setInfo($lng->txt("exc_to_desktop_info"));
139 $pd->setChecked($exc_set->get("add_to_pd", true));
140 $form->addItem($pd);
141
142 return $form;
143 }
144}
This class represents a checkbox property in a property form.
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAdminTabs()
administration tabs show only permissions and trash folder
__construct($a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
Class ilObjectGUI Basic methods of all Output classes.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
This class represents a property form user interface.
ILIAS Setting Class.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26