ILIAS  trunk Revision v12.0_alpha-1338-g8f7e531aa3c
ilPCTabs Class Reference

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

+ Inheritance diagram for ilPCTabs:
+ Collaboration diagram for ilPCTabs:

Public Member Functions

 init ()
 Init object. More...
 
 create (ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
 
 setTabType (string $a_type="HorizontalTabs")
 
 getTabType ()
 
 setContentWidth (string $a_val)
 
 getContentWidth ()
 
 setContentHeight (string $a_val)
 
 getContentHeight ()
 
 setHorizontalAlign (string $a_val)
 
 getHorizontalAlign ()
 
 setBehavior (string $a_val)
 
 getBehavior ()
 
 getCaptions ()
 
 getCaption (string $a_hier_id, string $a_pc_id)
 
 savePositions (array $a_pos)
 Save positions of tabs. More...
 
 saveCaptions (array $a_captions)
 
 deleteTab (string $a_hier_id, string $a_pc_id)
 
 addTab (string $a_caption)
 
 setTemplate (string $a_template)
 
 getTemplate ()
 
 setAutoTime (?int $a_val)
 
 getAutoTime ()
 
 setRandomStart (bool $a_val)
 
 getRandomStart ()
 
 getJavascriptFiles (string $a_mode)
 
 getCssFiles (string $a_mode)
 
 saveCaption (string $pc_id, string $caption)
 
 addAbove (string $pc_id, string $caption="")
 
 addBelow (string $pc_id, string $caption="")
 
 moveUp (string $pc_id)
 
 moveDown (string $pc_id)
 
 moveTop (string $pc_id)
 
 moveBottom (string $pc_id)
 
 deletePanel (string $pc_id)
 
 getNodeXml (string $pc_id)
 
- Public Member Functions inherited from ilPageContent
 __construct (ilPageObject $a_pg_obj, ?PageManagerInterface $page_manager=null, ?ObjectAdapterInterface $object_adapter=null)
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 init ()
 Init object. More...
 
 getType ()
 
 getDomNode ()
 
 getDomDoc ()
 
 setDomNode (DOMNode $node)
 
 getChildNode ()
 
 getJavascriptFiles (string $a_mode)
 
 getCssFiles (string $a_mode)
 
 getOnloadCode (string $a_mode)
 
 setHierId (string $a_hier_id)
 
 getHierId ()
 
 lookupHierId ()
 
 readHierId ()
 
 setPcId (string $a_pcid)
 
 getPCId ()
 
 setFileDownloadLink (string $a_download_link)
 
 getFileDownloadLink ()
 
 setProfileBackUrl (string $url)
 
 getProfileBackUrl ()
 
 setFullscreenLink (string $a_fullscreen_link)
 
 getFullscreenLink ()
 
 setSourcecodeDownloadScript (string $script_name)
 
 getSourcecodeDownloadScript ()
 
 readPCId ()
 
 writePCId (string $a_pc_id)
 
 setEnabled (string $value)
 Set Enabled value for page content component. More...
 
 enable ()
 
 disable ()
 
 isEnabled ()
 
 createPageContentNode (bool $a_set_this_node=true)
 Create page content node (always use this method first when adding a new element) More...
 
 getNewPageContentNode ()
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 Modify page content after xsl. More...
 
 getModel ()
 Get model as needed for the front-end editor. More...
 

Static Public Member Functions

static getLangVars ()
 Get lang vars needed for editing. More...
 
- Static Public Member Functions inherited from ilPageContent
static sortHierIds (array $a_array)
 Sort an array of Hier IDS in ascending order. More...
 
static isGreaterHierId (string $a, string $b)
 Check whether Hier ID $a is greater than Hier ID $b. More...
 
static getLangVars ()
 Get lang vars needed for editing. More...
 
static handleCopiedContent (DOMDocument $a_domdoc, bool $a_self_ass=true, bool $a_clone_mobs=false, int $new_parent_id=0, int $obj_copy_id=0)
 Handle copied content. More...
 
static afterPageUpdate (ilPageObject $a_page, DOMDocument $a_domdoc, string $a_xml, bool $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete (ilPageObject $a_page)
 Before page is being deleted. More...
 
static afterRepositoryCopy (ilPageObject $page, array $mapping, int $source_ref_id)
 After repository (container) copy action. More...
 
static afterPageHistoryEntry (ilPageObject $a_page, DOMDocument $a_old_domdoc, string $a_old_xml, int $a_old_nr)
 After page history entry has been created. More...
 
static deleteHistoryLowerEqualThan (string $parent_type, int $page_id, string $lang, int $delete_lower_than_nr)
 Overwrite in derived classes, if old history entries are being deleted. More...
 

Data Fields

const ACCORDION_HOR = "HorizontalAccordion"
 
const ACCORDION_VER = "VerticalAccordion"
 
const CAROUSEL = "Carousel"
 
- Data Fields inherited from ilPageContent
string $hier_id = ""
 
DOMNode $dom_node = null
 
string $page_lang = ""
 

Protected Member Functions

 setTabsAttribute (string $a_attr, string $a_value)
 
- Protected Member Functions inherited from ilPageContent
 getPageManager ()
 
 setType (string $a_type)
 Set Type. More...
 
 hasNode ()
 
 createInitialChildNode (string $hier_id, string $pc_id, string $child, array $child_attributes=[])
 

Additional Inherited Members

- Protected Attributes inherited from ilPageContent
DOMDocument $dom_doc
 
ILIAS COPage InternalDomainService $domain
 
string $pcid
 
string $type = ""
 
ilPageObject $pg_obj
 
string $file_download_link = ''
 
string $fullscreen_link = ''
 
string $sourcecode_download_script = ''
 
ilLogger $log
 
string $profile_back_url = ""
 
ILIAS COPage Dom DomUtil $dom_util
 
PageManagerInterface $page_manager = null
 
ObjectAdapterInterface $object = null
 

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 Tabbed contents (see ILIAS DTD)

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

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

Member Function Documentation

◆ addAbove()

ilPCTabs::addAbove ( string  $pc_id,
string  $caption = "" 
)

Definition at line 302 of file class.ilPCTabs.php.

302 : void
303 {
304 $dom = $this->getPage()->getDomDoc();
305 $new_tab = $dom->createElement("Tab");
306 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
307 if (!is_null($tab)) {
308 $new_tab = $tab->parentNode->insertBefore($new_tab, $tab);
309 if ($caption !== "") {
310 $dom_util = $this->domain->domUtil();
311 $dom_util->setFirstOptionalElement(
312 $new_tab,
313 "TabCaption",
314 array(),
315 $caption,
316 array()
317 );
318 }
319 }
320 }
ILIAS COPage Dom DomUtil $dom_util

◆ addBelow()

ilPCTabs::addBelow ( string  $pc_id,
string  $caption = "" 
)

Definition at line 322 of file class.ilPCTabs.php.

322 : void
323 {
324 $dom = $this->getPage()->getDomDoc();
325 $new_tab = $dom->createElement("Tab");
326 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
327 if (!is_null($tab)) {
328 if ($next = $tab->nextSibling) {
329 $new_tab = $next->parentNode->insertBefore($new_tab, $next);
330 } else {
331 $new_tab = $tab->parentNode->appendChild($new_tab);
332 }
333
334 if ($caption !== "") {
335 $dom_util = $this->domain->domUtil();
336 $dom_util->setFirstOptionalElement(
337 $new_tab,
338 "TabCaption",
339 array(),
340 $caption,
341 array()
342 );
343 }
344 }
345 }

◆ addTab()

ilPCTabs::addTab ( string  $a_caption)

Definition at line 213 of file class.ilPCTabs.php.

213 : void
214 {
215 $new_item = $this->dom_doc->createElement("Tab");
216 $new_item = $this->getChildNode()->appendChild($new_item);
217 $this->dom_util->setFirstOptionalElement(
218 $new_item,
219 "TabCaption",
220 array(),
221 $a_caption,
222 array()
223 );
224 }

◆ create()

ilPCTabs::create ( ilPageObject  $a_pg_obj,
string  $a_hier_id,
string  $a_pc_id = "" 
)

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

39 : void {
40 $this->createInitialChildNode($a_hier_id, $a_pc_id, "Tabs");
41 }
createInitialChildNode(string $hier_id, string $pc_id, string $child, array $child_attributes=[])

◆ deletePanel()

ilPCTabs::deletePanel ( string  $pc_id)

Definition at line 409 of file class.ilPCTabs.php.

409 : void
410 {
411 $dom = $this->getPage()->getDomDoc();
412 $new_tab = $dom->createElement("Tab");
413 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
414 if (!is_null($tab)) {
415 $tab->parentNode->removeChild($tab);
416 }
417 }

◆ deleteTab()

ilPCTabs::deleteTab ( string  $a_hier_id,
string  $a_pc_id 
)

Definition at line 198 of file class.ilPCTabs.php.

201 : void {
202 // File Item
203 foreach ($this->getChildNode()->childNodes as $child) {
204 if ($child->nodeName == "Tab") {
205 if ($a_pc_id == $child->getAttribute("PCID") &&
206 $a_hier_id == $child->getAttribute("HierId")) {
207 $child->parentNode->removeChild($child);
208 }
209 }
210 }
211 }

◆ getAutoTime()

ilPCTabs::getAutoTime ( )

Definition at line 246 of file class.ilPCTabs.php.

246 : ?int
247 {
248 $val = $this->getChildNode()->getAttribute("AutoAnimWait");
249 if ($val) {
250 return (int) $val;
251 }
252 return null;
253 }

◆ getBehavior()

ilPCTabs::getBehavior ( )

Definition at line 105 of file class.ilPCTabs.php.

105 : string
106 {
107 return $this->getChildNode()->getAttribute("Behavior");
108 }

◆ getCaption()

ilPCTabs::getCaption ( string  $a_hier_id,
string  $a_pc_id 
)

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

139 : string {
140 foreach ($this->getCaptions() as $cap) {
141 if ($cap["pc_id"] === $a_pc_id && $cap["hier_id"] === $a_hier_id) {
142 return $cap["caption"];
143 }
144 }
145 return "";
146 }

◆ getCaptions()

ilPCTabs::getCaptions ( )

Definition at line 110 of file class.ilPCTabs.php.

110 : array
111 {
112 $captions = array();
113 $k = 0;
114 foreach ($this->getChildNode()->childNodes as $child) {
115 if ($child->nodeName == "Tab") {
116 $pc_id = $child->getAttribute("PCID");
117 $hier_id = $child->getAttribute("HierId");
118 $current_caption = "";
119 foreach ($child->childNodes as $tab_child) {
120 if ($tab_child->nodeName == "TabCaption") {
121 $current_caption = $this->dom_util->getContent($tab_child);
122 }
123 }
124 $captions[] = array("pos" => $k,
125 "caption" => $current_caption,
126 "pc_id" => $pc_id,
127 "hier_id" => $hier_id
128 );
129 $k++;
130 }
131 }
132
133 return $captions;
134 }

◆ getContentHeight()

ilPCTabs::getContentHeight ( )

Definition at line 85 of file class.ilPCTabs.php.

85 : string
86 {
87 return $this->getChildNode()->getAttribute("ContentHeight");
88 }

◆ getContentWidth()

ilPCTabs::getContentWidth ( )

Definition at line 75 of file class.ilPCTabs.php.

75 : string
76 {
77 return $this->getChildNode()->getAttribute("ContentWidth");
78 }

◆ getCssFiles()

ilPCTabs::getCssFiles ( string  $a_mode)

Reimplemented from ilPageContent.

Definition at line 274 of file class.ilPCTabs.php.

274 : array
275 {
277 }

References ilAccordionGUI\getLocalCssFiles().

+ Here is the call graph for this function:

◆ getHorizontalAlign()

ilPCTabs::getHorizontalAlign ( )

Definition at line 95 of file class.ilPCTabs.php.

95 : string
96 {
97 return $this->getChildNode()->getAttribute("HorizontalAlign");
98 }

◆ getJavascriptFiles()

ilPCTabs::getJavascriptFiles ( string  $a_mode)

Reimplemented from ilPageContent.

Definition at line 265 of file class.ilPCTabs.php.

265 : array
266 {
268 if ($a_mode !== "edit") {
269 $files[] = "./components/ILIAS/COPage/PC/Tabs/js/presentation.js";
270 }
271 return $files;
272 }
static getLocalJavascriptFiles()

References ilAccordionGUI\getLocalJavascriptFiles().

+ Here is the call graph for this function:

◆ getLangVars()

static ilPCTabs::getLangVars ( )
static

Get lang vars needed for editing.

Returns
string[] array of lang var keys

Reimplemented from ilPageContent.

Definition at line 236 of file class.ilPCTabs.php.

236 : array
237 {
238 return array("pc_vacc", "pc_hacc", "pc_carousel");
239 }

◆ getNodeXml()

ilPCTabs::getNodeXml ( string  $pc_id)

Definition at line 419 of file class.ilPCTabs.php.

419 : string
420 {
421 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
422 if (!is_null($tab)) {
423 $xml = "";
424 foreach ($tab->childNodes as $node) {
425 if ($node->nodeName === "PageContent") {
426 $xml .= $node->ownerDocument->saveXml($node);
427 }
428 }
429 return $xml;
430 }
431 return "";
432 }

◆ getRandomStart()

ilPCTabs::getRandomStart ( )

Definition at line 260 of file class.ilPCTabs.php.

260 : bool
261 {
262 return (bool) $this->getChildNode()->getAttribute("RandomStart");
263 }

◆ getTabType()

ilPCTabs::getTabType ( )

Definition at line 65 of file class.ilPCTabs.php.

65 : string
66 {
67 return $this->getChildNode()->getAttribute("Type");
68 }

◆ getTemplate()

ilPCTabs::getTemplate ( )

Definition at line 231 of file class.ilPCTabs.php.

231 : string
232 {
233 return $this->getChildNode()->getAttribute("Template");
234 }

◆ init()

ilPCTabs::init ( )

Init object.

This function must be overwritten and at least set the content type.

Reimplemented from ilPageContent.

Definition at line 30 of file class.ilPCTabs.php.

30 : void
31 {
32 $this->setType("tabs");
33 }
setType(string $a_type)
Set Type.

References ilPageContent\setType().

+ Here is the call graph for this function:

◆ moveBottom()

ilPCTabs::moveBottom ( string  $pc_id)

Definition at line 395 of file class.ilPCTabs.php.

395 : void
396 {
397 $dom = $this->getPage()->getDomDoc();
398 $new_tab = $dom->createElement("Tab");
399 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
400 if (!is_null($tab)) {
401 $next = $tab->nextSibling;
402 if ($next) {
403 $tab->parentNode->removeChild($tab);
404 $tab = $next->parentNode->appendChild($tab);
405 }
406 }
407 }

◆ moveDown()

ilPCTabs::moveDown ( string  $pc_id)

Definition at line 361 of file class.ilPCTabs.php.

361 : void
362 {
363 $dom = $this->getPage()->getDomDoc();
364 $new_tab = $dom->createElement("Tab");
365 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
366 if (!is_null($tab)) {
367 $next = $tab->nextSibling;
368 if ($next) {
369 $next2 = $next->nextSibling;
370 $tab->parentNode->removeChild($tab);
371 if ($next2) {
372 $tab = $next2->parentNode->insertBefore($tab, $next2);
373 } else {
374 $tab = $next->parentNode->appendChild($tab);
375 }
376 }
377 }
378 }

◆ moveTop()

ilPCTabs::moveTop ( string  $pc_id)

Definition at line 380 of file class.ilPCTabs.php.

380 : void
381 {
382 $dom = $this->getPage()->getDomDoc();
383 $new_tab = $dom->createElement("Tab");
384 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
385 if (!is_null($tab)) {
386 $prev = $tab->previousSibling;
387 if ($prev) {
388 $tab->parentNode->removeChild($tab);
389 $first = $prev->parentNode->childNodes->item(0);
390 $tab = $prev->parentNode->insertBefore($tab, $first);
391 }
392 }
393 }

◆ moveUp()

ilPCTabs::moveUp ( string  $pc_id)

Definition at line 347 of file class.ilPCTabs.php.

347 : void
348 {
349 $dom = $this->getPage()->getDomDoc();
350 $new_tab = $dom->createElement("Tab");
351 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
352 if (!is_null($tab)) {
353 $prev = $tab->previousSibling;
354 if ($prev) {
355 $tab->parentNode->removeChild($tab);
356 $tab = $prev->parentNode->insertBefore($tab, $prev);
357 }
358 }
359 }

◆ saveCaption()

ilPCTabs::saveCaption ( string  $pc_id,
string  $caption 
)

Definition at line 279 of file class.ilPCTabs.php.

279 : void
280 {
281 $tab_nodes = $this->getChildNode()->childNodes;
282 foreach ($tab_nodes as $tab_node) {
283 if ($tab_node->nodeName === "Tab") {
284 $current_pc_id = $tab_node->getAttribute("PCID");
285 if ($current_pc_id === $pc_id) {
286 if ($caption !== "") {
287 $this->dom_util->setFirstOptionalElement(
288 $tab_node,
289 "TabCaption",
290 [],
291 $caption,
292 []
293 );
294 } else {
295 $this->dom_util->deleteAllChildsByName($tab_node, ["TabCaption"]);
296 }
297 }
298 }
299 }
300 }

◆ saveCaptions()

ilPCTabs::saveCaptions ( array  $a_captions)

Definition at line 174 of file class.ilPCTabs.php.

174 : void
175 {
176 // iterate all tab nodes
177 foreach ($this->getChildNode()->childNodes as $child) {
178 if ($child->nodeName == "Tab") {
179 $pc_id = $child->getAttribute("PCID");
180 $hier_id = $child->getAttribute("HierId");
181 $k = $hier_id . ":" . $pc_id;
182 // if caption given, set it, otherwise delete caption subitem
183 if ($a_captions[$k] != "") {
184 $this->dom_util->setFirstOptionalElement(
185 $child,
186 "TabCaption",
187 array(),
188 $a_captions[$k],
189 array()
190 );
191 } else {
192 $this->dom_util->deleteAllChildsByName($child, array("TabCaption"));
193 }
194 }
195 }
196 }

◆ savePositions()

ilPCTabs::savePositions ( array  $a_pos)

Save positions of tabs.

Definition at line 151 of file class.ilPCTabs.php.

153 : void {
154 asort($a_pos);
155
156 // File Item
157 $nodes = array();
158 foreach ($this->getChildNode()->childNodes as $child) {
159 if ($child->nodeName == "Tab") {
160 $pc_id = $child->getAttribute("PCID");
161 $hier_id = $child->getAttribute("HierId");
162 $nodes[$hier_id . ":" . $pc_id] = $child;
163 }
164 }
165 $this->dom_util->deleteAllChildsByName($this->getChildNode(), ["Tab"]);
166
167 foreach ($a_pos as $k => $v) {
168 if (is_object($nodes[$k])) {
169 $nodes[$k] = $this->getChildNode()->appendChild($nodes[$k]);
170 }
171 }
172 }

◆ setAutoTime()

ilPCTabs::setAutoTime ( ?int  $a_val)

Definition at line 241 of file class.ilPCTabs.php.

241 : void
242 {
243 $this->setTabsAttribute("AutoAnimWait", (string) $a_val);
244 }
setTabsAttribute(string $a_attr, string $a_value)

◆ setBehavior()

ilPCTabs::setBehavior ( string  $a_val)

Definition at line 100 of file class.ilPCTabs.php.

100 : void
101 {
102 $this->setTabsAttribute("Behavior", $a_val);
103 }

◆ setContentHeight()

ilPCTabs::setContentHeight ( string  $a_val)

Definition at line 80 of file class.ilPCTabs.php.

80 : void
81 {
82 $this->setTabsAttribute("ContentHeight", $a_val);
83 }

◆ setContentWidth()

ilPCTabs::setContentWidth ( string  $a_val)

Definition at line 70 of file class.ilPCTabs.php.

70 : void
71 {
72 $this->setTabsAttribute("ContentWidth", $a_val);
73 }

◆ setHorizontalAlign()

ilPCTabs::setHorizontalAlign ( string  $a_val)

Definition at line 90 of file class.ilPCTabs.php.

90 : void
91 {
92 $this->setTabsAttribute("HorizontalAlign", $a_val);
93 }

◆ setRandomStart()

ilPCTabs::setRandomStart ( bool  $a_val)

Definition at line 255 of file class.ilPCTabs.php.

255 : void
256 {
257 $this->setTabsAttribute("RandomStart", $a_val);
258 }

◆ setTabsAttribute()

ilPCTabs::setTabsAttribute ( string  $a_attr,
string  $a_value 
)
protected

Definition at line 43 of file class.ilPCTabs.php.

46 : void {
47 $this->dom_util->setAttribute($this->getChildNode(), $a_attr, $a_value);
48 }

◆ setTabType()

ilPCTabs::setTabType ( string  $a_type = "HorizontalTabs")
Parameters
string$a_type("HorizontalTabs" | "Accordion")

Definition at line 53 of file class.ilPCTabs.php.

55 : void {
56 switch ($a_type) {
60 $this->setTabsAttribute("Type", $a_type);
61 break;
62 }
63 }
const CAROUSEL
const ACCORDION_HOR
const ACCORDION_VER

References ACCORDION_HOR, ACCORDION_VER, and CAROUSEL.

◆ setTemplate()

ilPCTabs::setTemplate ( string  $a_template)

Definition at line 226 of file class.ilPCTabs.php.

226 : void
227 {
228 $this->setTabsAttribute("Template", $a_template);
229 }

Field Documentation

◆ ACCORDION_HOR

const ilPCTabs::ACCORDION_HOR = "HorizontalAccordion"

◆ ACCORDION_VER

const ilPCTabs::ACCORDION_VER = "VerticalAccordion"

◆ CAROUSEL

const ilPCTabs::CAROUSEL = "Carousel"

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