ILIAS  release_7 Revision v7.30-3-g800a261c036
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 (ilGlobalTemplateInterface $a_main_tpl=null)
 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 }

Member Function Documentation

◆ addButton()

ilModalGUI::addButton ( ilButtonBase  $but)

Add button.

Parameters
ilButtonBase$butbutton

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

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

◆ getBody()

ilModalGUI::getBody ( )

Get body.

Returns
string body

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

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

References $body.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getButtons()

ilModalGUI::getButtons ( )

Get buttons.

Returns
ilButtonBase[]

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

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

References $buttons.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getHeading()

ilModalGUI::getHeading ( )

Get heading.

Returns
string heading

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

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

References $heading.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getHTML()

ilModalGUI::getHTML ( )

Get HTML.

Returns
string html

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

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

References Vendor\Package\$b, $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 56 of file class.ilModalGUI.php.

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

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 116 of file class.ilModalGUI.php.

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

References $type.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ initJS()

static ilModalGUI::initJS ( ilGlobalTemplateInterface  $a_main_tpl = null)
static

Init javascript.

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

183 {
184 global $DIC;
185
186 if ($a_main_tpl != null) {
187 $tpl = $a_main_tpl;
188 } else {
189 $tpl = $DIC["tpl"];
190 }
191 $tpl->addJavascript("./Services/UIComponent/Modal/js/Modal.js");
192 }
global $DIC
Definition: goto.php:24

References $DIC, and $tpl.

Referenced by ilPageObjectGUI\initEditing(), and ilNoteGUI\initJavascript().

+ Here is the caller graph for this function:

◆ setBody()

ilModalGUI::setBody (   $a_val)

Set body.

Parameters
string$a_valbody

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

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

◆ setHeading()

ilModalGUI::setHeading (   $a_val)

Set heading.

Parameters
string$a_valheading

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

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

◆ setId()

ilModalGUI::setId (   $a_val)

Set id.

Parameters
string$a_valid

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

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

◆ setType()

ilModalGUI::setType (   $a_val)

Set type.

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

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

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

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


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