ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilADNNotificationGUI Class Reference

Class ilADNNotificationGUI ilADNNotificationGUI: ilObjAdministrativeNotificationGUI ilADNNotificationGUI: ilObjAdministrativeNotificationGUI. More...

+ Inheritance diagram for ilADNNotificationGUI:
+ Collaboration diagram for ilADNNotificationGUI:

Public Member Functions

 __construct (ilADNTabHandling $tab_handling)
 
- Public Member Functions inherited from ilADNAbstractGUI
 __construct (protected \ilADNTabHandling $tab_handling)
 ilADNAbstractGUI constructor. More...
 
 executeCommand ()
 

Data Fields

const TAB_TABLE = 'notifications'
 
const CMD_DEFAULT = 'index'
 
const CMD_ADD = 'add'
 
const CMD_CREATE = 'save'
 
const CMD_UPDATE = 'update'
 
const CMD_EDIT = 'edit'
 
const CMD_DUPLICATE = 'duplicate'
 
const CMD_CANCEL = 'cancel'
 
const CMD_DELETE = 'delete'
 
const CMD_RESET = 'reset'
 
const CMD_CONFIRM_DELETE = 'confirmDelete'
 
- Data Fields inherited from ilADNAbstractGUI
const IDENTIFIER = 'identifier'
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 

Protected Member Functions

 dispatchCommand ($cmd)
 
 index ()
 
 add ()
 
 create ()
 
 cancel ()
 
 edit ()
 
 duplicate ()
 
 update ()
 
 delete ()
 
 reset ()
 
 confirmDelete ()
 
 getNotificationFromRequest ()
 PhpIncompatibleReturnTypeInspection More...
 
 getNotificationsFromRequest ()
 
- Protected Member Functions inherited from ilADNAbstractGUI
 determineCommand (?string $standard=null)
 
 dispatchCommand (string $cmd)
 

Protected Attributes

Table $table
 
- Protected Attributes inherited from ilADNAbstractGUI
UIServices $ui
 
Services $http
 
ilToolbarGUI $toolbar
 
ilTabsGUI $tabs
 
ilCtrl $ctrl
 
ilObjAdministrativeNotificationAccess $access
 

Private Attributes

readonly Factory $ui_factory
 
readonly Renderer $ui_renderer
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilADNNotificationGUI::__construct ( ilADNTabHandling  $tab_handling)

Definition at line 48 of file class.ilADNNotificationGUI.php.

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

49  {
50  global $DIC;
51  parent::__construct($tab_handling);
52  $this->table = new Table($this);
53  $this->ui_factory = $DIC->ui()->factory();
54  $this->ui_renderer = $DIC->ui()->renderer();
55  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilADNNotificationGUI::add ( )
protected

Definition at line 106 of file class.ilADNNotificationGUI.php.

References ILIAS\Repository\ctrl(), and ilADNNotificationUIFormGUI\getHTML().

Referenced by dispatchCommand().

106  : string
107  {
108  $form = new ilADNNotificationUIFormGUI(
109  new ilADNNotification(),
110  $this->ctrl->getLinkTarget($this, self::CMD_CREATE)
111  );
112  return $form->getHTML();
113  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilADNNotificationGUI::cancel ( )
protected

Definition at line 129 of file class.ilADNNotificationGUI.php.

References ILIAS\Repository\ctrl(), and null.

Referenced by delete(), duplicate(), and reset().

129  : void
130  {
131  $this->ctrl->setParameter($this, self::IDENTIFIER, null);
132  $this->ctrl->redirect($this, self::CMD_DEFAULT);
133  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDelete()

ilADNNotificationGUI::confirmDelete ( )
protected

Definition at line 185 of file class.ilADNNotificationGUI.php.

References ILIAS\Repository\ctrl(), ilADNNotification\getId(), getNotificationsFromRequest(), ilADNNotification\getTitle(), ILIAS\FileDelivery\http(), and ILIAS\Repository\lng().

Referenced by dispatchCommand().

185  : void
186  {
187  $adns = $this->getNotificationsFromRequest();
188 
189  $stream = Streams::ofString(
190  $this->ui_renderer->render(
191  $this->ui_factory->modal()->interruptive(
192  $this->lng->txt('action_confirm_delete'),
193  $this->lng->txt('action_confirm_delete_msg'),
194  $this->ctrl->getLinkTarget($this, self::CMD_DELETE)
195  )->withAffectedItems(
196  array_map(fn(ilADNNotification $adn): Standard => $this->ui_factory->modal()->interruptiveItem()->standard(
197  $adn->getId(),
198  $adn->getTitle()
199  ), $adns)
200  )
201  )
202  );
203  $this->http->saveResponse($this->http->response()->withBody($stream));
204  $this->http->sendResponse();
205  $this->http->close();
206  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilADNNotificationGUI::create ( )
protected

Definition at line 115 of file class.ilADNNotificationGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilADNNotificationUIFormGUI\setValuesByPost().

Referenced by dispatchCommand().

115  : string
116  {
117  $form = new ilADNNotificationUIFormGUI(
118  new ilADNNotification(),
119  $this->ctrl->getLinkTarget($this, self::CMD_CREATE)
120  );
121  $form->setValuesByPost();
122  if ($form->saveObject()) {
123  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_success_created'), true);
124  $this->ctrl->redirect($this, self::CMD_DEFAULT);
125  }
126  return $form->getHTML();
127  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilADNNotificationGUI::delete ( )
protected

Definition at line 165 of file class.ilADNNotificationGUI.php.

References cancel(), getNotificationsFromRequest(), and ILIAS\Repository\lng().

165  : void
166  {
167  foreach ($this->getNotificationsFromRequest() as $notification) {
168  $notification->delete();
169  }
170 
171  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_success_deleted'), true);
172  $this->cancel();
173  }
+ Here is the call graph for this function:

◆ dispatchCommand()

ilADNNotificationGUI::dispatchCommand (   $cmd)
protected

Definition at line 57 of file class.ilADNNotificationGUI.php.

References add(), ilMMSubItemGUI\CMD_VIEW_SUB_ITEMS, confirmDelete(), create(), duplicate(), edit(), index(), reset(), ilObjAdministrativeNotificationGUI\TAB_MAIN, and update().

57  : string
58  {
59  $this->tab_handling->initTabs(
62  true
63  );
64  switch ($cmd) {
65  case self::CMD_ADD:
66  return $this->add();
67  case self::CMD_CREATE:
68  return $this->create();
69  case self::CMD_EDIT:
70  return $this->edit();
71  case self::CMD_DUPLICATE:
72  $this->duplicate();
73  break;
74  case self::CMD_UPDATE:
75  return $this->update();
76  case self::CMD_DELETE:
77  $this->delete();
78  break;
79  case self::CMD_RESET:
80  $this->reset();
81  break;
82  case self::CMD_CONFIRM_DELETE:
83  $this->confirmDelete();
84  break;
85  case self::CMD_DEFAULT:
86  default:
87  return $this->index();
88  }
89 
90  return "";
91  }
+ Here is the call graph for this function:

◆ duplicate()

ilADNNotificationGUI::duplicate ( )
protected

Definition at line 144 of file class.ilADNNotificationGUI.php.

References cancel(), getNotificationFromRequest(), and ILIAS\Repository\lng().

Referenced by dispatchCommand().

144  : void
145  {
146  $notification = $this->getNotificationFromRequest();
147  $notification->setId(0);
148  $notification->create();
149  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_success_duplicated'), true);
150  $this->cancel();
151  }
getNotificationFromRequest()
PhpIncompatibleReturnTypeInspection
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit()

ilADNNotificationGUI::edit ( )
protected

Definition at line 135 of file class.ilADNNotificationGUI.php.

References ILIAS\Repository\ctrl(), ilADNNotificationUIFormGUI\getHTML(), getNotificationFromRequest(), and ilADNAbstractGUI\IDENTIFIER.

Referenced by dispatchCommand().

135  : string
136  {
137  $notification = $this->getNotificationFromRequest();
138  $this->ctrl->setParameter($this, ilADNAbstractGUI::IDENTIFIER, $notification->getId());
139 
140  $form = new ilADNNotificationUIFormGUI($notification, $this->ctrl->getLinkTarget($this, self::CMD_UPDATE));
141  return $form->getHTML();
142  }
getNotificationFromRequest()
PhpIncompatibleReturnTypeInspection
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNotificationFromRequest()

ilADNNotificationGUI::getNotificationFromRequest ( )
protected

PhpIncompatibleReturnTypeInspection

Definition at line 209 of file class.ilADNNotificationGUI.php.

References getNotificationsFromRequest().

Referenced by duplicate(), edit(), and update().

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

◆ getNotificationsFromRequest()

ilADNNotificationGUI::getNotificationsFromRequest ( )
protected
Returns
ilADNNotification[]

Definition at line 217 of file class.ilADNNotificationGUI.php.

References ActiveRecord\findOrFail(), ActiveRecord\get(), ILIAS\FileDelivery\http(), ilADNAbstractGUI\IDENTIFIER, and null.

Referenced by confirmDelete(), delete(), getNotificationFromRequest(), and reset().

217  : array
218  {
219  $query_params = $this->http->request()->getQueryParams(); // aka $_GET
220  $name = $this->table->getIdToken()->getName(); // name of the query parameter from the table
221  $field_ids = $query_params[$name] ?? []; // array of field ids
222 
223  // all objects
224  if (($field_ids[0] ?? null) === 'ALL_OBJECTS') {
225  return ilADNNotification::get();
226  }
227  // check ilADNAbstractGUI::IDENTIFIER
228  if (($field_id = $this->http->request()->getQueryParams()[ilADNAbstractGUI::IDENTIFIER] ?? false)) {
229  return [ilADNNotification::findOrFail((int) $field_id)];
230  }
231 
232  $return = [];
233  foreach ($field_ids as $field_id) {
234  $return[] = ilADNNotification::findOrFail((int) $field_id);
235  }
236 
237  // check interruptive items
238  if (($interruptive_items = $this->http->request()->getParsedBody()['interruptive_items'] ?? false)) {
239  foreach ($interruptive_items as $interruptive_item) {
240  $return[] = ilADNNotification::findOrFail((int) $interruptive_item);
241  }
242  }
243 
244  return $return;
245  }
static findOrFail($primary_key, array $add_constructor_args=[])
Tries to find the object and throws an Exception if object is not found, instead of returning null...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index()

ilADNNotificationGUI::index ( )
protected

Definition at line 93 of file class.ilADNNotificationGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), and ILIAS\Repository\ui().

Referenced by dispatchCommand().

93  : string
94  {
95  $this->table = new Table($this);
96  if ($this->access->hasUserPermissionTo('write')) {
97  $btn_add_msg = $this->ui->factory()->button()->standard(
98  $this->lng->txt('common_add_msg'),
99  $this->ctrl->getLinkTarget($this, self::CMD_ADD)
100  );
101  $this->toolbar->addComponent($btn_add_msg);
102  }
103  return $this->table->getHTML();
104  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

ilADNNotificationGUI::reset ( )
protected

Definition at line 175 of file class.ilADNNotificationGUI.php.

References cancel(), getNotificationsFromRequest(), and ILIAS\Repository\lng().

Referenced by dispatchCommand().

175  : void
176  {
177  foreach ($this->getNotificationsFromRequest() as $notification) {
178  $notification->resetForAllUsers();
179  }
180 
181  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_success_reset'), true);
182  $this->cancel();
183  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilADNNotificationGUI::update ( )
protected

Definition at line 153 of file class.ilADNNotificationGUI.php.

References ILIAS\Repository\ctrl(), getNotificationFromRequest(), ILIAS\Repository\lng(), and ilADNNotificationUIFormGUI\setValuesByPost().

Referenced by dispatchCommand().

153  : string
154  {
155  $notification = $this->getNotificationFromRequest();
156  $form = new ilADNNotificationUIFormGUI($notification, $this->ctrl->getLinkTarget($this, self::CMD_UPDATE));
157  $form->setValuesByPost();
158  if ($form->saveObject()) {
159  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_success_updated'), true);
160  $this->ctrl->redirect($this, self::CMD_DEFAULT);
161  }
162  return $form->getHTML();
163  }
getNotificationFromRequest()
PhpIncompatibleReturnTypeInspection
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $table

Table ilADNNotificationGUI::$table
protected

Definition at line 46 of file class.ilADNNotificationGUI.php.

◆ $ui_factory

readonly Factory ilADNNotificationGUI::$ui_factory
private

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

◆ $ui_renderer

readonly Renderer ilADNNotificationGUI::$ui_renderer
private

Definition at line 45 of file class.ilADNNotificationGUI.php.

◆ CMD_ADD

const ilADNNotificationGUI::CMD_ADD = 'add'

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

◆ CMD_CANCEL

const ilADNNotificationGUI::CMD_CANCEL = 'cancel'

Definition at line 40 of file class.ilADNNotificationGUI.php.

◆ CMD_CONFIRM_DELETE

const ilADNNotificationGUI::CMD_CONFIRM_DELETE = 'confirmDelete'

◆ CMD_CREATE

const ilADNNotificationGUI::CMD_CREATE = 'save'

Definition at line 36 of file class.ilADNNotificationGUI.php.

◆ CMD_DEFAULT

const ilADNNotificationGUI::CMD_DEFAULT = 'index'

Definition at line 34 of file class.ilADNNotificationGUI.php.

◆ CMD_DELETE

const ilADNNotificationGUI::CMD_DELETE = 'delete'

Definition at line 41 of file class.ilADNNotificationGUI.php.

◆ CMD_DUPLICATE

const ilADNNotificationGUI::CMD_DUPLICATE = 'duplicate'

◆ CMD_EDIT

const ilADNNotificationGUI::CMD_EDIT = 'edit'

◆ CMD_RESET

const ilADNNotificationGUI::CMD_RESET = 'reset'

◆ CMD_UPDATE

const ilADNNotificationGUI::CMD_UPDATE = 'update'

Definition at line 37 of file class.ilADNNotificationGUI.php.

◆ TAB_TABLE

const ilADNNotificationGUI::TAB_TABLE = 'notifications'

Definition at line 33 of file class.ilADNNotificationGUI.php.

Referenced by ilADNAbstractGUI\executeCommand().


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