ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 (ilTemplate $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.

References $body.

Referenced by getHTML().

97  {
98  return $this->body;
99  }
+ Here is the caller graph for this function:

◆ getButtons()

ilModalGUI::getButtons ( )

Get buttons.

Returns
ilButtonBase[]

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

References $buttons.

Referenced by getHTML().

137  {
138  return $this->buttons;
139  }
+ 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.

References $heading.

Referenced by getHTML().

77  {
78  return $this->heading;
79  }
+ 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.

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

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  }
getType()
Get type.
getHeading()
Get heading.
getBody()
Get body.
$tpl
Definition: ilias.php:10
getButtons()
Get buttons.
special template class to simplify handling of ITX/PEAR
getId()
Get id.
+ 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.

References $id.

Referenced by getHTML().

57  {
58  return $this->id;
59  }
+ 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.

References $type.

Referenced by getHTML().

117  {
118  return $this->type;
119  }
+ Here is the caller graph for this function:

◆ initJS()

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

Init javascript.

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

References $DIC, and $tpl.

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

183  {
184  global $DIC;
185 
186  if ($a_main_tpl != null) {
187  $tpl = $a_main_tpl;
188  } else {
189  $tpl = $DIC["tpl"];
190  }
191 
192  $tpl->addJavascript("./Services/UIComponent/Modal/js/Modal.js");
193  }
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
+ 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 ilBadgeRenderer\renderModal().


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