ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilModalGUI Class Reference

Modal class. More...

+ Collaboration diagram for ilModalGUI:

Public Member Functions

 setId ($a_val)
 Set id. More...
 
 getId ()
 Get id. More...
 
 setHeading ($a_val)
 Set heading. More...
 
 getHeading ()
 Get heading. More...
 
 setBody ($a_val)
 Set body. More...
 
 getBody ()
 Get body. More...
 
 setType ($a_val)
 Set type. More...
 
 getType ()
 Get type. More...
 
 addButton (ilButtonBase $but)
 Add button. More...
 
 getButtons ()
 Get buttons. More...
 
 getHTML ()
 Get HTML. More...
 

Static Public Member Functions

static getInstance ()
 Get instance. More...
 
static initJS ()
 Init javascript. More...
 

Data Fields

const TYPE_LARGE = "large"
 
const TYPE_MEDIUM = "medium"
 
const TYPE_SMALL = "small"
 

Protected Member Functions

 __construct ()
 Constructor. More...
 

Protected Attributes

 $heading = ""
 
 $body = ""
 
 $id = ""
 
 $type = self::TYPE_MEDIUM
 
 $buttons = array()
 

Detailed Description

Modal class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilModalGUI::__construct ( )
protected

Constructor.

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

28 {
29
30 }

Member Function Documentation

◆ addButton()

ilModalGUI::addButton ( ilButtonBase  $but)

Add button.

Parameters
ilButtonBase$butbutton

Definition at line 127 of file class.ilModalGUI.php.

128 {
129 $this->buttons[] = $but;
130 }

◆ getBody()

ilModalGUI::getBody ( )

Get body.

Returns
string body

Definition at line 97 of file class.ilModalGUI.php.

98 {
99 return $this->body;
100 }

References $body.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getButtons()

ilModalGUI::getButtons ( )

Get buttons.

Returns
ilButtonBase[]

Definition at line 137 of file class.ilModalGUI.php.

138 {
139 return $this->buttons;
140 }

References $buttons.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getHeading()

ilModalGUI::getHeading ( )

Get heading.

Returns
string heading

Definition at line 77 of file class.ilModalGUI.php.

78 {
79 return $this->heading;
80 }

References $heading.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getHTML()

ilModalGUI::getHTML ( )

Get HTML.

Returns
string html

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

149 {
150 $tpl = new ilTemplate("tpl.modal.html", true, true, "Services/UIComponent/Modal");
151
152 if (count($this->getButtons()) > 0)
153 {
154 foreach ($this->getButtons() as $b)
155 {
156 $tpl->setCurrentBlock("button");
157 $tpl->setVariable("BUTTON", $b->render());
158 $tpl->parseCurrentBlock();
159 }
160 $tpl->setCurrentBlock("footer");
161 $tpl->parseCurrentBlock();
162 }
163
164 $tpl->setVariable("HEADING", $this->getHeading());
165
166 $tpl->setVariable("MOD_ID", $this->getId());
167 $tpl->setVariable("BODY", $this->getBody());
168
169 switch ($this->getType())
170 {
171 case self::TYPE_LARGE:
172 $tpl->setVariable("CLASS", "modal-lg");
173 break;
174
175 case self::TYPE_SMALL:
176 $tpl->setVariable("CLASS", "modal-sm");
177 break;
178 }
179
180 return $tpl->get();
181 }
global $tpl
Definition: ilias.php:8
getBody()
Get body.
getHeading()
Get heading.
getButtons()
Get buttons.
getId()
Get id.
getType()
Get type.
special template class to simplify handling of ITX/PEAR

References $tpl, getBody(), getButtons(), getHeading(), getId(), getType(), TYPE_LARGE, and TYPE_SMALL.

+ Here is the call graph for this function:

◆ getId()

ilModalGUI::getId ( )

Get id.

Returns
string id

Definition at line 57 of file class.ilModalGUI.php.

58 {
59 return $this->id;
60 }

References $id.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getInstance()

◆ getType()

ilModalGUI::getType ( )

Get type.

Returns
string type

Definition at line 117 of file class.ilModalGUI.php.

118 {
119 return $this->type;
120 }

References $type.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ initJS()

static ilModalGUI::initJS ( )
static

Init javascript.

Definition at line 186 of file class.ilModalGUI.php.

187 {
188 global $tpl;
189
190 $tpl->addJavascript("./Services/UIComponent/Modal/js/Modal.js");
191 }

References $tpl.

Referenced by ilNoteGUI\initJavascript(), ilFolderDownloadBackgroundTaskHandler\initObjectListAction(), and ilPageObjectGUI\showPage().

+ Here is the caller graph for this function:

◆ setBody()

ilModalGUI::setBody (   $a_val)

Set body.

Parameters
string$a_valbody

Definition at line 87 of file class.ilModalGUI.php.

88 {
89 $this->body = $a_val;
90 }

◆ setHeading()

ilModalGUI::setHeading (   $a_val)

Set heading.

Parameters
string$a_valheading

Definition at line 67 of file class.ilModalGUI.php.

68 {
69 $this->heading = $a_val;
70 }

◆ setId()

ilModalGUI::setId (   $a_val)

Set id.

Parameters
string$a_valid

Definition at line 47 of file class.ilModalGUI.php.

48 {
49 $this->id = $a_val;
50 }

◆ setType()

ilModalGUI::setType (   $a_val)

Set type.

Parameters
string$a_valtype const ilModalGUI::TYPE_SMALL|ilModalGUI::TYPE_MEDIUM|ilModalGUI::TYPE_LARGE

Definition at line 107 of file class.ilModalGUI.php.

108 {
109 $this->type = $a_val;
110 }

Field Documentation

◆ $body

ilModalGUI::$body = ""
protected

Definition at line 15 of file class.ilModalGUI.php.

Referenced by getBody().

◆ $buttons

ilModalGUI::$buttons = array()
protected

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

Referenced by getButtons().

◆ $heading

ilModalGUI::$heading = ""
protected

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

Referenced by getHeading().

◆ $id

ilModalGUI::$id = ""
protected

Definition at line 16 of file class.ilModalGUI.php.

Referenced by getId().

◆ $type

ilModalGUI::$type = self::TYPE_MEDIUM
protected

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

Referenced by getType().

◆ TYPE_LARGE

◆ TYPE_MEDIUM

const ilModalGUI::TYPE_MEDIUM = "medium"

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

◆ TYPE_SMALL

const ilModalGUI::TYPE_SMALL = "small"

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

Referenced by getHTML(), and ilBadgeRenderer\renderModal().


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