ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAsyncOutputHandler Class Reference

Class ilAsyncOutputHandler Handles the output for async-requests. More...

+ Collaboration diagram for ilAsyncOutputHandler:

Public Member Functions

 __construct ($content=null, $heading=null, $windows_properties=array())
 
 terminate ($type=self::OUTPUT_MODAL)
 Output content in different ways self::OUTPUT_MODAL: Output as bootstrap modal self::OUTPUT_EMPTY: Only content without ILIAS-layout. More...
 
 getContent ()
 Returns the content of the modal output. More...
 
 setContent ($content)
 Sets the content of the modal output. More...
 
 getHeading ()
 Return the heading of a modal. More...
 
 setHeading ($heading)
 Sets the heading of a modal-output. More...
 
 getWindowProperties ()
 Return all window properties. More...
 
 setWindowProperties ($window_properties)
 Set windows properties. More...
 

Static Public Member Functions

static encodeAsyncResponse (array $data=array())
 Encode data as json for async output. More...
 
static handleAsyncOutput ($normal_content, $async_content=null, $apply_to_tpl=true)
 Handles async output. More...
 

Data Fields

const OUTPUT_MODAL = "output_modal"
 
const OUTPUT_EMPTY = "output_empty"
 

Protected Attributes

 $content
 
 $heading
 
 $window_properties
 

Detailed Description

Class ilAsyncOutputHandler Handles the output for async-requests.

The class allows to generate the basic structure of a bootstrap-modal (for modal-content)

Author
Michael Herren mh@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

Definition at line 11 of file class.ilAsyncOutputHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ilAsyncOutputHandler::__construct (   $content = null,
  $heading = null,
  $windows_properties = array() 
)

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

References $content, and $heading.

21  {
22  $this->content = $content;
23  $this->heading = $heading;
24 
25  $this->window_properties = $windows_properties;
26  }

Member Function Documentation

◆ encodeAsyncResponse()

static ilAsyncOutputHandler::encodeAsyncResponse ( array  $data = array())
static

Encode data as json for async output.

Parameters
array$data
Returns
string

Definition at line 69 of file class.ilAsyncOutputHandler.php.

References $data, and $ilCtrl.

Referenced by ilObjStudyProgrammeGUI\afterSave(), ilObjStudyProgrammeSettingsGUI\cancel(), ilObjStudyProgrammeTreeGUI\cancel(), ilObjStudyProgrammeGUI\cancel(), ilObjStudyProgrammeTreeGUI\cancelDelete(), ilObjStudyProgrammeTreeGUI\confirmedDelete(), ilObjStudyProgrammeTreeGUI\createNewLeaf(), ilObjStudyProgrammeGUI\save(), ilObjStudyProgrammeTreeGUI\saveTreeOrder(), and ilObjStudyProgrammeSettingsGUI\update().

69  {
70  global $ilCtrl;
71 
72  $data['cmd'] = $ilCtrl->getCmd();
73 
74  return json_encode($data);
75  }
global $ilCtrl
Definition: ilias.php:18
$data
+ Here is the caller graph for this function:

◆ getContent()

ilAsyncOutputHandler::getContent ( )

Returns the content of the modal output.

Returns
mixed

Definition at line 108 of file class.ilAsyncOutputHandler.php.

References $content.

Referenced by terminate().

108  {
109  return $this->content;
110  }
+ Here is the caller graph for this function:

◆ getHeading()

ilAsyncOutputHandler::getHeading ( )

Return the heading of a modal.

Returns
mixed

Definition at line 128 of file class.ilAsyncOutputHandler.php.

References $heading.

Referenced by terminate().

128  {
129  return $this->heading;
130  }
+ Here is the caller graph for this function:

◆ getWindowProperties()

ilAsyncOutputHandler::getWindowProperties ( )

Return all window properties.

Returns
mixed

Definition at line 148 of file class.ilAsyncOutputHandler.php.

References $window_properties.

◆ handleAsyncOutput()

static ilAsyncOutputHandler::handleAsyncOutput (   $normal_content,
  $async_content = null,
  $apply_to_tpl = true 
)
static

Handles async output.

Parameters
$normal_content
null$async_content
bool$apply_to_tpl
Returns
null

Definition at line 86 of file class.ilAsyncOutputHandler.php.

References $content, $ilCtrl, $tpl, and exit.

Referenced by ilObjStudyProgrammeGUI\afterSave(), ilObjStudyProgrammeSettingsGUI\cancel(), ilObjStudyProgrammeGUI\cancel(), ilObjStudyProgrammeTreeGUI\executeCommand(), and ilObjStudyProgrammeSettingsGUI\update().

86  {
87  global $ilCtrl, $tpl;
88 
89  $content = ($ilCtrl->isAsynch() && $async_content != null)? $async_content : $normal_content;
90 
91  if($ilCtrl->isAsynch()) {
92  echo $content;
93  exit();
94  } else {
95  if($apply_to_tpl) {
96  $tpl->setContent($content);
97  } else {
98  return $content;
99  }
100  }
101  }
exit
Definition: login.php:54
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ setContent()

ilAsyncOutputHandler::setContent (   $content)

Sets the content of the modal output.

Parameters
mixed$content

Definition at line 118 of file class.ilAsyncOutputHandler.php.

References $content.

118  {
119  $this->content = $content;
120  }

◆ setHeading()

ilAsyncOutputHandler::setHeading (   $heading)

Sets the heading of a modal-output.

Parameters
mixed$heading

Definition at line 138 of file class.ilAsyncOutputHandler.php.

References $heading.

138  {
139  $this->heading = $heading;
140  }

◆ setWindowProperties()

ilAsyncOutputHandler::setWindowProperties (   $window_properties)

Set windows properties.

Parameters
mixed$window_properties

Definition at line 158 of file class.ilAsyncOutputHandler.php.

References $window_properties.

158  {
159  $this->window_properties = $window_properties;
160  }

◆ terminate()

ilAsyncOutputHandler::terminate (   $type = self::OUTPUT_MODAL)

Output content in different ways self::OUTPUT_MODAL: Output as bootstrap modal self::OUTPUT_EMPTY: Only content without ILIAS-layout.

Parameters
string$type

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

References $tpl, exit, getContent(), and getHeading().

36  {
37  if($type == self::OUTPUT_MODAL) {
38  $tpl = new ilTemplate('tpl.modal_content.html', false, false, 'Modules/StudyProgramme');
39  $tpl->setVariable('HEADING', $this->getHeading());
40  $tpl->setVariable('BODY', $this->getContent());
41 
42  //TODO: implement window properties
43  /*foreach($this->window_properties as $key => $value) {
44  if($value) {
45  $tpl->activeBlock($key);
46  } else {
47  $tpl->removeBlockData($key);
48  }
49  }*/
50 
51  echo $tpl->get();
52  exit();
53 
54  } else if($type == self::OUTPUT_EMPTY) {
55 
56  echo $this->getContent();
57  exit();
58  }
59  }
getHeading()
Return the heading of a modal.
exit
Definition: login.php:54
global $tpl
Definition: ilias.php:8
getContent()
Returns the content of the modal output.
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

Field Documentation

◆ $content

ilAsyncOutputHandler::$content
protected

◆ $heading

ilAsyncOutputHandler::$heading
protected

Definition at line 17 of file class.ilAsyncOutputHandler.php.

Referenced by __construct(), getHeading(), and setHeading().

◆ $window_properties

ilAsyncOutputHandler::$window_properties
protected

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

Referenced by getWindowProperties(), and setWindowProperties().

◆ OUTPUT_EMPTY

const ilAsyncOutputHandler::OUTPUT_EMPTY = "output_empty"

Definition at line 13 of file class.ilAsyncOutputHandler.php.

◆ OUTPUT_MODAL

const ilAsyncOutputHandler::OUTPUT_MODAL = "output_modal"

Definition at line 12 of file class.ilAsyncOutputHandler.php.


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