diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-06-19 07:24:04 +0200 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-06-25 14:44:24 +0200 |
| commit | 562bf5da3de837ac29d33206bff19aac4907cdd5 (patch) | |
| tree | 65140f4922d02610d59a28ae0e319c5e4c05dfe4 /lib/classes/MultiPersonSearch.class.php | |
| parent | d8da7d587f6a3f888015d6c2be48dc67c4572337 (diff) | |
fix multipersonsearch regarding removed and selected users and prevent warnings, fixes #5629
Closes #5629
Merge request studip/studip!4246
Diffstat (limited to 'lib/classes/MultiPersonSearch.class.php')
| -rw-r--r-- | lib/classes/MultiPersonSearch.class.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/classes/MultiPersonSearch.class.php b/lib/classes/MultiPersonSearch.class.php index 137c249..61a88b0 100644 --- a/lib/classes/MultiPersonSearch.class.php +++ b/lib/classes/MultiPersonSearch.class.php @@ -35,6 +35,7 @@ class MultiPersonSearch { private $navigationItem = ""; private $dataDialogStatus = false; private $verified = null; + private bool $allowRemoval = false; /** * restores a MultiPersonSearch object. @@ -103,6 +104,17 @@ class MultiPersonSearch { } /** + * Defines whether the removal of pre-selected users should be allowed or + * not + */ + public function allowRemovalOfDefaultSeselectedUsers(bool $allowRemoval): self + { + $this->allowRemoval = $allowRemoval; + + return $this; + } + + /** * returns the removed persons. The array will contain all * persons which were selected by default (on the right side of the * dialog) and then removed by the user. @@ -110,7 +122,7 @@ class MultiPersonSearch { * @return array containing all removed persons */ public function getRemovedUsers() { - return $_SESSION['multipersonsearch'][$this->name]['removed']; + return $_SESSION['multipersonsearch'][$this->name]['removed'] ?? []; } /** @@ -141,6 +153,7 @@ class MultiPersonSearch { $template->set_attribute('description', $this->description); $template->set_attribute('executeURL', $this->executeURL); $template->set_attribute('jsFunction', $this->jsFunction); + $template->set_attribute('allowRemoval', $this->allowRemoval); $this->storeToSession(); return $template->render(); } |
