ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 22 of file class.ilAsyncOutputHandler.php.

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

References $content, and $heading.

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 70 of file class.ilAsyncOutputHandler.php.

71 {
72 global $DIC;
73 $ilCtrl = $DIC['ilCtrl'];
74
75 $data['cmd'] = $ilCtrl->getCmd();
76
77 return json_encode($data);
78 }
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7

References $data, $DIC, and $ilCtrl.

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

+ Here is the caller graph for this function:

◆ getContent()

ilAsyncOutputHandler::getContent ( )

Returns the content of the modal output.

Returns
mixed

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

115 {
116 return $this->content;
117 }

References $content.

Referenced by terminate().

+ Here is the caller graph for this function:

◆ getHeading()

ilAsyncOutputHandler::getHeading ( )

Return the heading of a modal.

Returns
mixed

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

137 {
138 return $this->heading;
139 }

References $heading.

Referenced by terminate().

+ Here is the caller graph for this function:

◆ getWindowProperties()

ilAsyncOutputHandler::getWindowProperties ( )

Return all window properties.

Returns
mixed

Definition at line 158 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 89 of file class.ilAsyncOutputHandler.php.

90 {
91 global $DIC;
92 $ilCtrl = $DIC['ilCtrl'];
93 $tpl = $DIC['tpl'];
94
95 $content = ($ilCtrl->isAsynch() && $async_content != null)? $async_content : $normal_content;
96
97 if ($ilCtrl->isAsynch()) {
98 echo $content;
99 exit();
100 } else {
101 if ($apply_to_tpl) {
102 $tpl->setContent($content);
103 } else {
104 return $content;
105 }
106 }
107 }
$tpl
Definition: ilias.php:10

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

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

+ 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 125 of file class.ilAsyncOutputHandler.php.

126 {
127 $this->content = $content;
128 }

References $content.

◆ setHeading()

ilAsyncOutputHandler::setHeading (   $heading)

Sets the heading of a modal-output.

Parameters
mixed$heading

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

148 {
149 $this->heading = $heading;
150 }

References $heading.

◆ setWindowProperties()

ilAsyncOutputHandler::setWindowProperties (   $window_properties)

Set windows properties.

Parameters
mixed$window_properties

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

170 {
171 $this->window_properties = $window_properties;
172 }

References $window_properties.

◆ 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 38 of file class.ilAsyncOutputHandler.php.

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

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

+ Here is the call graph for this function:

Field Documentation

◆ $content

ilAsyncOutputHandler::$content
protected

◆ $heading

ilAsyncOutputHandler::$heading
protected

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

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

◆ $window_properties

ilAsyncOutputHandler::$window_properties
protected

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

Referenced by getWindowProperties(), and setWindowProperties().

◆ OUTPUT_EMPTY

const ilAsyncOutputHandler::OUTPUT_EMPTY = "output_empty"

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

◆ OUTPUT_MODAL

const ilAsyncOutputHandler::OUTPUT_MODAL = "output_modal"

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


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