ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBTControllerGUI Class Reference

Class ilBTControllerGUI. More...

+ Collaboration diagram for ilBTControllerGUI:

Public Member Functions

 executeCommand ()
 

Static Public Member Functions

static hash ($url)
 
static unhash ($url)
 

Data Fields

const FROM_URL = 'from_url'
 
const OBSERVER_ID = 'observer_id'
 
const SELECTED_OPTION = 'selected_option'
 
const CMD_ABORT = 'abortBucket'
 
const CMD_REMOVE = 'abortBucket'
 
const CMD_USER_INTERACTION = 'userInteraction'
 
const IS_ASYNC = 'bt_task_is_async'
 
const CMD_GET_REPLACEMENT_ITEM = "getAsyncReplacementItem"
 

Protected Member Functions

 userInteraction ()
 
 abortBucket ()
 
 getAsyncReplacementItem ()
 Loads one single aggregate notification item representing a button async to replace an existing one. More...
 
 getFromURL ()
 

Detailed Description

Member Function Documentation

◆ abortBucket()

ilBTControllerGUI::abortBucket ( )
protected

Definition at line 64 of file class.ilBTControllerGUI.php.

References exit, getFromURL(), and ILIAS\FileDelivery\http().

Referenced by executeCommand().

65  {
66  $observer_id = (int) $this->http()->request()->getQueryParams()[self::OBSERVER_ID];
67  $from_url = $this->getFromURL();
68 
69  $bucket = $this->dic()->backgroundTasks()->persistence()->loadBucket($observer_id);
70 
71  $this->dic()->backgroundTasks()->taskManager()->quitBucket($bucket);
72  if ($this->http()->request()->getQueryParams()[self::IS_ASYNC] === "true") {
73  exit;
74  }
75  $this->ctrl()->redirectToURL($from_url);
76  }
exit
Definition: login.php:29
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:

◆ executeCommand()

ilBTControllerGUI::executeCommand ( )

Definition at line 25 of file class.ilBTControllerGUI.php.

References abortBucket(), getAsyncReplacementItem(), and userInteraction().

25  : void
26  {
27  $cmd = $this->ctrl()->getCmd();
28  switch ($cmd) {
29  case self::CMD_GET_REPLACEMENT_ITEM:
30  $this->getAsyncReplacementItem();
31  break;
32  case self::CMD_USER_INTERACTION:
33  $this->userInteraction();
34  break;
35  case self::CMD_ABORT:
36  case self::CMD_REMOVE:
37  $this->abortBucket();
38  break;
39  default:
40  break;
41  }
42  }
getAsyncReplacementItem()
Loads one single aggregate notification item representing a button async to replace an existing one...
+ Here is the call graph for this function:

◆ getAsyncReplacementItem()

ilBTControllerGUI::getAsyncReplacementItem ( )
protected

Loads one single aggregate notification item representing a button async to replace an existing one.

Definition at line 83 of file class.ilBTControllerGUI.php.

References exit, and ILIAS\FileDelivery\http().

Referenced by executeCommand().

84  {
85  $observer_id = (int) $this->http()->request()->getQueryParams()[self::OBSERVER_ID];
86  $bucket = $this->dic()->backgroundTasks()->persistence()->loadBucket($observer_id);
87 
88  $item_source = new ilBTPopOverGUI($this->dic());
89  $this->dic()->language()->loadLanguageModule('background_tasks');
90  $item = $item_source->getItemForObserver($bucket);
91  echo $this->dic()->ui()->renderer()->renderAsync($item);
92  exit;
93  }
exit
Definition: login.php:29
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:

◆ getFromURL()

ilBTControllerGUI::getFromURL ( )
protected
Returns
string

Definition at line 99 of file class.ilBTControllerGUI.php.

References ILIAS\FileDelivery\http().

Referenced by abortBucket(), and userInteraction().

100  {
101  $from_url = self::unhash($this->http()->request()->getQueryParams()[self::FROM_URL]);
102 
103  return $from_url;
104  }
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:

◆ hash()

static ilBTControllerGUI::hash (   $url)
static
Parameters
$url
Returns
string

Definition at line 112 of file class.ilBTControllerGUI.php.

References $url.

Referenced by ilBTPopOverGUI\addFromUrlToNextRequest(), ilBTPopOverGUI\getDefaultCardContent(), and ilMainMenuGUI\renderBackgroundTasks().

113  {
114  return base64_encode($url);
115  }
$url
+ Here is the caller graph for this function:

◆ unhash()

static ilBTControllerGUI::unhash (   $url)
static
Parameters
$url
Returns
string

Definition at line 123 of file class.ilBTControllerGUI.php.

References $url.

124  {
125  return base64_decode($url);
126  }
$url

◆ userInteraction()

ilBTControllerGUI::userInteraction ( )
protected

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

References getFromURL(), ILIAS\FileDelivery\http(), and user().

Referenced by executeCommand().

45  : void
46  {
47  $observer_id = (int) $this->http()->request()->getQueryParams()[self::OBSERVER_ID];
48  $selected_option = $this->http()->request()->getQueryParams()[self::SELECTED_OPTION];
49  $from_url = $this->getFromURL();
50 
51  $observer = $this->dic()->backgroundTasks()->persistence()->loadBucket($observer_id);
52  if ((int) $observer->getUserId() !== (int) $this->user()->getId()) {
53  return;
54  }
55  $option = new UserInteractionOption("", $selected_option);
56  $this->dic()->backgroundTasks()->taskManager()->continueTask($observer, $option);
57  if ($this->http()->request()->getQueryParams()[self::IS_ASYNC] === "true") {
58  $this->http()->close();
59  }
60  $this->ctrl()->redirectToURL($from_url);
61  }
user()
Definition: user.php:4
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:

Field Documentation

◆ CMD_ABORT

const ilBTControllerGUI::CMD_ABORT = 'abortBucket'

Definition at line 18 of file class.ilBTControllerGUI.php.

Referenced by ilBTPopOverGUI\getCloseButtonAction().

◆ CMD_GET_REPLACEMENT_ITEM

const ilBTControllerGUI::CMD_GET_REPLACEMENT_ITEM = "getAsyncReplacementItem"

Definition at line 22 of file class.ilBTControllerGUI.php.

Referenced by ilBTPopOverGUI\getRefreshUrl().

◆ CMD_REMOVE

const ilBTControllerGUI::CMD_REMOVE = 'abortBucket'

Definition at line 19 of file class.ilBTControllerGUI.php.

Referenced by ilBTPopOverGUI\getCloseButtonAction().

◆ CMD_USER_INTERACTION

const ilBTControllerGUI::CMD_USER_INTERACTION = 'userInteraction'

◆ FROM_URL

const ilBTControllerGUI::FROM_URL = 'from_url'

◆ IS_ASYNC

const ilBTControllerGUI::IS_ASYNC = 'bt_task_is_async'

Definition at line 21 of file class.ilBTControllerGUI.php.

Referenced by ilBTPopOverGUI\getCloseButtonAction().

◆ OBSERVER_ID

const ilBTControllerGUI::OBSERVER_ID = 'observer_id'

◆ SELECTED_OPTION

const ilBTControllerGUI::SELECTED_OPTION = 'selected_option'

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