ILIAS  release_8 Revision v8.23
ilModalGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilModalGUI:

Public Member Functions

 setId (string $a_val)
 
 getId ()
 
 setHeading (string $a_val)
 
 getHeading ()
 
 setBody (string $a_val)
 
 getBody ()
 
 setType (string $a_val)
 Set type. More...
 
 getType ()
 
 addButton (ilButtonBase $but)
 
 getButtons ()
 Get buttons. More...
 
 getHTML ()
 

Static Public Member Functions

static getInstance ()
 
static initJS (ilGlobalTemplateInterface $a_main_tpl=null)
 

Data Fields

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

Protected Member Functions

 __construct ()
 

Protected Attributes

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

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Modal class

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilModalGUI::__construct ( )
protected

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

38  {
39  }

Member Function Documentation

◆ addButton()

ilModalGUI::addButton ( ilButtonBase  $but)

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

92  : void
93  {
94  $this->buttons[] = $but;
95  }

◆ getBody()

ilModalGUI::getBody ( )

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

References $body.

Referenced by getHTML().

72  : string
73  {
74  return $this->body;
75  }
+ Here is the caller graph for this function:

◆ getButtons()

ilModalGUI::getButtons ( )

Get buttons.

Returns
ilButtonBase[]

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

References $buttons.

Referenced by getHTML().

101  : array
102  {
103  return $this->buttons;
104  }
+ Here is the caller graph for this function:

◆ getHeading()

ilModalGUI::getHeading ( )

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

References $heading.

Referenced by getHTML().

62  : string
63  {
64  return $this->heading;
65  }
+ Here is the caller graph for this function:

◆ getHTML()

ilModalGUI::getHTML ( )

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

References Vendor\Package\$b, $tpl, getBody(), getButtons(), getHeading(), getId(), and getType().

106  : string
107  {
108  $tpl = new ilTemplate("tpl.modal.html", true, true, "Services/UIComponent/Modal");
109 
110  if (count($this->getButtons()) > 0) {
111  foreach ($this->getButtons() as $b) {
112  $tpl->setCurrentBlock("button");
113  $tpl->setVariable("BUTTON", $b->render());
114  $tpl->parseCurrentBlock();
115  }
116  $tpl->setCurrentBlock("footer");
117  $tpl->parseCurrentBlock();
118  }
119 
120  $tpl->setVariable("HEADING", $this->getHeading());
121 
122  $tpl->setVariable("MOD_ID", $this->getId());
123  $tpl->setVariable("BODY", $this->getBody());
124 
125  switch ($this->getType()) {
126  case self::TYPE_LARGE:
127  $tpl->setVariable("CLASS", "modal-lg");
128  break;
129 
130  case self::TYPE_SMALL:
131  $tpl->setVariable("CLASS", "modal-sm");
132  break;
133  }
134 
135  return $tpl->get();
136  }
getButtons()
Get buttons.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

◆ getId()

ilModalGUI::getId ( )

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

References $id.

Referenced by getHTML().

51  : string
52  {
53  return $this->id;
54  }
+ Here is the caller graph for this function:

◆ getInstance()

◆ getType()

ilModalGUI::getType ( )

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

References $type.

Referenced by getHTML().

87  : string
88  {
89  return $this->type;
90  }
+ Here is the caller graph for this function:

◆ initJS()

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

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

References $DIC, and $tpl.

Referenced by ilObjForumGUI\doHistoryCheck(), ilPageObjectGUI\initEditing(), ILIAS\Notes\InternalGUIService\initJavascript(), and ilChatroomViewGUI\showRoom().

138  : void
139  {
140  global $DIC;
141 
142  $tpl = $a_main_tpl ?? $DIC["tpl"];
143 
144  $tpl->addJavaScript("./Services/UIComponent/Modal/js/Modal.js");
145  }
global $DIC
Definition: feed.php:28
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the caller graph for this function:

◆ setBody()

ilModalGUI::setBody ( string  $a_val)

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

67  : void
68  {
69  $this->body = $a_val;
70  }

◆ setHeading()

ilModalGUI::setHeading ( string  $a_val)

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

56  : void
57  {
58  $this->heading = $a_val;
59  }

◆ setId()

ilModalGUI::setId ( string  $a_val)

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

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

◆ setType()

ilModalGUI::setType ( string  $a_val)

Set type.

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

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

82  : void
83  {
84  $this->type = $a_val;
85  }

Field Documentation

◆ $body

string ilModalGUI::$body = ""
protected

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

Referenced by getBody().

◆ $buttons

array ilModalGUI::$buttons = array()
protected

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

Referenced by getButtons().

◆ $heading

string ilModalGUI::$heading = ""
protected

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

Referenced by getHeading().

◆ $id

string ilModalGUI::$id = ""
protected

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

Referenced by getId().

◆ $type

string ilModalGUI::$type = self::TYPE_MEDIUM
protected

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

Referenced by getType().

◆ TYPE_LARGE

◆ TYPE_MEDIUM

const ilModalGUI::TYPE_MEDIUM = "medium"

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

◆ TYPE_SMALL

const ilModalGUI::TYPE_SMALL = "small"

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


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