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.

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

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

69 {
70 global $ilCtrl;
71
72 $data['cmd'] = $ilCtrl->getCmd();
73
74 return json_encode($data);
75 }
$data
global $ilCtrl
Definition: ilias.php:18

References $data, 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 108 of file class.ilAsyncOutputHandler.php.

108 {
109 return $this->content;
110 }

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

128 {
129 return $this->heading;
130 }

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 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.

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 }
global $tpl
Definition: ilias.php:8
exit
Definition: login.php:54

References $content, $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 118 of file class.ilAsyncOutputHandler.php.

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

References $content.

◆ setHeading()

ilAsyncOutputHandler::setHeading (   $heading)

Sets the heading of a modal-output.

Parameters
mixed$heading

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

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

References $heading.

◆ setWindowProperties()

ilAsyncOutputHandler::setWindowProperties (   $window_properties)

Set windows properties.

Parameters
mixed$window_properties

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

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

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

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.
getContent()
Returns the content of the modal output.
special template class to simplify handling of ITX/PEAR

References $tpl, 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 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: