30 protected \ILIAS\Exercise\InternalGUIService
$gui;
42 $this->
ctrl = $DIC->ctrl();
43 $this->
toolbar = $DIC->toolbar();
44 $this->
lng = $DIC->language();
45 $this->tpl =
$DIC[
"tpl"];
46 $this->cat_id = $a_cat_id;
47 $this->request =
$DIC->exercise()->internal()->gui()->request();
48 $this->gui =
$DIC->exercise()->internal()->gui();
56 $cmd = $ilCtrl->getCmd(
"view");
58 switch ($next_class) {
70 protected function view(): void
77 $ilToolbar->setFormAction($ilCtrl->getFormAction($this,
"add"));
81 $ilToolbar->addStickyItem($types);
86 )->submit()->toToolbar(
true);
100 $req_positions = $this->request->getPositions();
101 asort($req_positions);
102 foreach (array_keys($req_positions) as
$id) {
103 if (array_key_exists(
$id, $all_cat)) {
105 $all_cat[
$id]->setPosition($pos);
106 $all_cat[
$id]->update();
110 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"settings_saved"),
true);
111 $ilCtrl->redirect($this,
"view");
120 $ids = $this->request->getCriteriaIds();
121 if (count($ids) == 0) {
123 $ilCtrl->redirect($this,
"view");
127 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this,
"delete"));
128 $confirmation_gui->setHeaderText(
$lng->
txt(
"exc_criteria_deletion_confirmation"));
129 $confirmation_gui->setCancel(
$lng->
txt(
"cancel"),
"view");
130 $confirmation_gui->setConfirm(
$lng->
txt(
"delete"),
"delete");
133 if (in_array($item->getId(), $ids)) {
134 $confirmation_gui->addItem(
"id[]", $item->getId(), $item->getTitle());
141 protected function delete():
void
146 $ids = $this->request->getCriteriaIds();
147 if (count($ids) == 0) {
148 $ilCtrl->redirect($this,
"view");
152 if (in_array($item->getId(), $ids)) {
157 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"settings_saved"),
true);
158 $ilCtrl->redirect($this,
"view");
173 $is_edit = (bool) $a_crit_obj->
getId();
175 $form->setFormAction($ilCtrl->getFormAction($this,
"create"));
176 $form->setTitle(
$lng->
txt(
"exc_criteria_create_form"));
177 $form->addCommandButton(
"create",
$lng->
txt(
"create"));
179 $form->setFormAction($ilCtrl->getFormAction($this,
"update"));
180 $form->setTitle(
$lng->
txt(
"exc_criteria_update_form"));
181 $form->addCommandButton(
"update",
$lng->
txt(
"save"));
184 $form->addCommandButton(
"view",
$lng->
txt(
"cancel"));
188 $form->addItem($type);
191 $title->setRequired(
true);
192 $form->addItem($title);
195 $form->addItem($desc);
198 $form->addItem(
$req);
210 $new_type = $this->request->getCriteriaType();
215 $ilCtrl->setParameter($this,
"type", $new_type);
219 $a_form = $this->
initForm($crit_obj);
229 $a_form->getItemByPostVar(
"title")->setValue($a_crit_obj->
getTitle());
239 $ilCtrl = $this->
ctrl;
242 $is_edit = (bool) $a_crit_obj->
getId();
243 $ilCtrl->setParameter($this,
"type", $this->request->getCriteriaType());
244 $form = $this->initForm($a_crit_obj);
245 if ($form->checkInput()) {
246 $a_crit_obj->
setTitle($form->getInput(
"title"));
259 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"settings_saved"),
true);
260 $ilCtrl->redirect($this,
"view");
263 $form->setValuesByPost();
264 $this->{$is_edit ?
"edit" :
"add"}($form);
269 $ilCtrl = $this->ctrl;
271 $new_type = $this->request->getCriteriaType();
273 $ilCtrl->redirect($this,
"view");
277 $this->importForm($crit_obj);
282 $ilCtrl = $this->ctrl;
284 $id = $this->request->getCritId();
287 if ($crit_obj->getParent() == $this->cat_id) {
288 $ilCtrl->setParameter($this,
"crit_id",
$id);
293 $ilCtrl->redirect($this,
"view");
302 $crit_obj = $this->getCurrentCritera();
305 $a_form = $this->initForm($crit_obj);
306 $this->exportForm($crit_obj, $a_form);
314 $crit_obj = $this->getCurrentCritera();
315 $this->importForm($crit_obj);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Exercise gui request wrapper.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
getNextClass($a_gui_class=null)
@inheritDoc
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
add(?ilPropertyFormGUI $a_form=null)
initForm(ilExcCriteria $a_crit_obj)
__construct(int $a_cat_id)
ilGlobalTemplateInterface $tpl
edit(?ilPropertyFormGUI $a_form=null)
ILIAS Exercise InternalGUIService $gui
importForm(ilExcCriteria $a_crit_obj)
exportForm(ilExcCriteria $a_crit_obj, ilPropertyFormGUI $a_form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initCustomForm(ilPropertyFormGUI $a_form)
exportCustomForm(ilPropertyFormGUI $a_form)
setRequired(bool $a_value)
setTitle(?string $a_value)
importCustomForm(ilPropertyFormGUI $a_form)
setDescription(?string $a_value)
static getInstancesByParentId(int $a_parent_id)
static getInstanceById(int $a_id)
static getInstanceByType(string $a_type)
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 class represents a non editable value 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.
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setContent(string $a_html)
Sets content for standard template.
catch(\Exception $e) $req