Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions components/ILIAS/Calendar/classes/class.ilCalendarCategoryGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ protected function initSelectedCategoryIdsFromPost(): array
return [];
}

protected function initSelectedCategoryIdFromGet(): int
{
if ($this->http->wrapper()->query()->has('selected_cat_id')) {
return $this->http->wrapper()->query()->retrieve(
'selected_cat_id',
$this->refinery->kindlyTo()->int()
);
}
return 0;
}

public function executeCommand(): void
{
$next_class = $this->ctrl->getNextClass($this);
Expand Down Expand Up @@ -334,15 +345,15 @@ protected function update(): void
protected function confirmDelete(): void
{
$cat_ids = $this->initSelectedCategoryIdsFromPost();
if (
!count($cat_ids) &&
$this->initCategoryIdFromQuery() > 0
) {
$cat_ids = [$this->initCategoryIdFromQuery()];
$selected_cat_id = $this->initSelectedCategoryIdFromGet();

if (!count($cat_ids) && $selected_cat_id > 0) {
$cat_ids = [$selected_cat_id];
}
if (!count($cat_ids)) {
$this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
$this->manage();
return;
}
$confirmation_gui = new ilConfirmationGUI();
$confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,14 @@ protected function fillRow(array $a_set): void
$url
);
}
$this->ctrl->clearParameterByClass($this->getParentObject()::class, 'category_id');

// delete
if ($this->actions->checkDeleteCal($a_set['id'])) {
$this->ctrl->setParameter($this->getParentObject(), 'selected_cat_id', $a_set['id']);
$url = $this->ctrl->getLinkTarget($this->getParentObject(), 'confirmDelete');
$this->ctrl->clearParameterByClass($this->getParentObject()::class, 'selected_cat_id');

$dropDownItems[] = $this->ui_factory->button()->shy(
$this->lng->txt('delete'),
$url
Expand All @@ -142,8 +146,6 @@ protected function fillRow(array $a_set): void
$this->tpl->parseCurrentBlock();
}

$this->ctrl->setParameter($this->getParentObject(), 'category_id', '');

switch ($a_set['type']) {
case ilCalendarCategory::TYPE_GLOBAL:
$this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('standard/icon_calg.svg'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ protected function prepareOutput(): void

// delete action
if ($this->actions->checkDeleteCal($this->category_id)) {
$ctrl->setParameterByClass("ilcalendarcategorygui", "category_id", $this->category_id);
$ctrl->setParameterByClass("ilcalendarcategorygui", "selected_cat_id", $this->category_id);
$dropDownItems[] = $this->ui_factory->button()->shy(
$this->lng->txt("cal_delete_cal"),
$ctrl->getLinkTargetByClass("ilcalendarcategorygui", "confirmDelete")
Expand Down
Loading