ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 REPLACE_SIGNAL = 'replaceSignal'
 
const CMD_ABORT = 'abortBucket'
 
const CMD_REMOVE = 'abortBucket'
 
const CMD_GET_POPOVER_CONTENT = 'getPopoverContent'
 
const CMD_USER_INTERACTION = 'userInteraction'
 
const IS_ASYNC = 'bt_task_is_async'
 
const CMD_GET_REPLACEMENT_ITEM = "getAsyncReplacementItem"
 

Protected Member Functions

 performCommand ()
 
 userInteraction ()
 
 abortBucket ()
 
 getFromURL ()
 

Detailed Description

Member Function Documentation

◆ abortBucket()

ilBTControllerGUI::abortBucket ( )
protected

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

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

Referenced by performCommand().

76  {
77  $observer_id = (int) $this->http()->request()->getQueryParams()[self::OBSERVER_ID];
78  $from_url = $this->getFromURL();
79 
80  $bucket = $this->dic()->backgroundTasks()->persistence()->loadBucket($observer_id);
81 
82  $this->dic()->backgroundTasks()->taskManager()->quitBucket($bucket);
83  if ($this->http()->request()->getQueryParams()[self::IS_ASYNC] === "true") {
84  exit;
85  }
86  $this->ctrl()->redirectToURL($from_url);
87  }
static http()
Fetches the global http state from ILIAS.
exit
Definition: backend.php:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilBTControllerGUI::executeCommand ( )

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

References performCommand().

28  {
29  switch ($this->ctrl()->getCmdClass()) {
30  default:
31  $this->performCommand();
32  }
33  }
+ Here is the call graph for this function:

◆ getFromURL()

ilBTControllerGUI::getFromURL ( )
protected
Returns
string

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

References ILIAS\FileDelivery\http().

Referenced by abortBucket(), and userInteraction().

112  {
113  $from_url = self::unhash($this->http()->request()->getQueryParams()[self::FROM_URL]);
114 
115  return $from_url;
116  }
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 124 of file class.ilBTControllerGUI.php.

References $url.

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

125  {
126  return base64_encode($url);
127  }
$url
+ Here is the caller graph for this function:

◆ performCommand()

ilBTControllerGUI::performCommand ( )
protected

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

References abortBucket(), and userInteraction().

Referenced by executeCommand().

37  {
38  $cmd = $this->ctrl()->getCmd();
39  switch ($cmd) {
40  case self::CMD_GET_POPOVER_CONTENT:
41  $this->getPopoverContent();
42  break;
43  case self::CMD_USER_INTERACTION:
44  $this->userInteraction();
45  break;
46  case self::CMD_ABORT:
47  case self::CMD_REMOVE:
48  $this->abortBucket();
49  break;
50  default:
51  break;
52  }
53  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unhash()

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

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

References $url.

136  {
137  return base64_decode($url);
138  }
$url

◆ userInteraction()

ilBTControllerGUI::userInteraction ( )
protected

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

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

Referenced by performCommand().

57  {
58  $observer_id = (int) $this->http()->request()->getQueryParams()[self::OBSERVER_ID];
59  $selected_option = $this->http()->request()->getQueryParams()[self::SELECTED_OPTION];
60  $from_url = $this->getFromURL();
61  try {
62  $observer = $this->dic()->backgroundTasks()->persistence()->loadBucket($observer_id);
63  } catch (Throwable $t) {
64  $this->ctrl()->redirectToURL($from_url);
65  }
66  $option = new UserInteractionOption("", $selected_option);
67  $this->dic()->backgroundTasks()->taskManager()->continueTask($observer, $option);
68  if ($this->http()->request()->getQueryParams()[self::IS_ASYNC] === "true") {
69  exit;
70  }
71  $this->ctrl()->redirectToURL($from_url);
72  }
static http()
Fetches the global http state from ILIAS.
exit
Definition: backend.php:16
+ 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 19 of file class.ilBTControllerGUI.php.

Referenced by ilBTPopOverGUI\addButton().

◆ CMD_GET_POPOVER_CONTENT

const ilBTControllerGUI::CMD_GET_POPOVER_CONTENT = 'getPopoverContent'

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

Referenced by ilMainMenuGUI\renderBackgroundTasks().

◆ CMD_GET_REPLACEMENT_ITEM

const ilBTControllerGUI::CMD_GET_REPLACEMENT_ITEM = "getAsyncReplacementItem"

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

◆ CMD_REMOVE

const ilBTControllerGUI::CMD_REMOVE = 'abortBucket'

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

Referenced by ilBTPopOverGUI\addButton().

◆ 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 23 of file class.ilBTControllerGUI.php.

◆ OBSERVER_ID

const ilBTControllerGUI::OBSERVER_ID = 'observer_id'

◆ REPLACE_SIGNAL

const ilBTControllerGUI::REPLACE_SIGNAL = 'replaceSignal'

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

Referenced by ilMainMenuGUI\renderBackgroundTasks().

◆ SELECTED_OPTION

const ilBTControllerGUI::SELECTED_OPTION = 'selected_option'

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