ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilFormSectionHeaderGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
28 {
29  protected string $type = "";
30  protected string $title = "";
31  protected string $info = "";
32  protected array $section_icon = [];
33  protected string $section_anchor = "";
35 
36  public function __construct()
37  {
38  $this->setType("section_header");
39  }
40 
41  public function checkInput(): bool
42  {
43  return true;
44  }
45 
46  public function setType(string $a_type): void
47  {
48  $this->type = $a_type;
49  }
50 
51  public function getType(): string
52  {
53  return $this->type;
54  }
55 
56  public function setSectionIcon(
57  string $a_file,
58  string $a_alt
59  ): void {
60  $this->section_icon['file'] = $a_file;
61  $this->section_icon['alt'] = $a_alt;
62  }
63 
64  public function getSectionIcon(): array
65  {
66  return $this->section_icon ?: array();
67  }
68 
69  public function setTitle(string $a_title): void
70  {
71  $this->title = $a_title;
72  }
73 
74  public function getTitle(): string
75  {
76  return $this->title;
77  }
78 
79  public function setInfo(string $a_info): void
80  {
81  $this->info = $a_info;
82  }
83 
84  public function getInfo(): string
85  {
86  return $this->info;
87  }
88 
89  public function setParentForm(ilPropertyFormGUI $a_parentform): void
90  {
91  $this->parentform = $a_parentform;
92  }
93 
94  public function getParentForm(): ilPropertyFormGUI
95  {
96  return $this->parentform;
97  }
98 
99  public function setSectionAnchor(string $value): void
100  {
101  $this->section_anchor = $value;
102  }
103 
104  public function insert(ilTemplate $a_tpl): void
105  {
106  $section_icon = $this->getSectionIcon();
107 
108  if (isset($section_icon['file']) && is_file($section_icon['file'])) {
109  $a_tpl->setCurrentBlock("title_icon");
110  $a_tpl->setVariable("IMG_ICON", $section_icon['file']);
111  $a_tpl->setVariable('IMG_ALT', $section_icon['alt']);
112  $a_tpl->parseCurrentBlock();
113  }
114 
115  $a_tpl->setCurrentBlock("header");
116  $a_tpl->setVariable("TXT_TITLE", $this->getTitle());
117  $a_tpl->setVariable("TXT_DESCRIPTION", $this->getInfo());
118  $a_tpl->setVariable('HEAD_COLSPAN', 2);
119  if (isset($this->section_anchor)) {
120  $a_tpl->setVariable('LABEL', $this->section_anchor);
121  }
122  $a_tpl->parseCurrentBlock();
123  }
124 
125  public function setValueByArray(array $a_values): void
126  {
127  }
128 
129  public function getPostVar(): string
130  {
131  return "";
132  }
133 }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
info()
description: > Example for rendering a info message box.
Definition: info.php:34
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
setSectionIcon(string $a_file, string $a_alt)
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setParentForm(ilPropertyFormGUI $a_parentform)