ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 Modify page content after xsl. More...
 
- 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 298 of file class.ilPCTabs.php.

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

◆ addBelow()

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

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

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

◆ 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 405 of file class.ilPCTabs.php.

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

◆ 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 270 of file class.ilPCTabs.php.

270 : array
271 {
273 }

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 }
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 415 of file class.ilPCTabs.php.

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

◆ 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:

◆ modifyPageContentPostXsl()

ilPCTabs::modifyPageContentPostXsl ( string  $a_output,
string  $a_mode,
bool  $a_abstract_only = false 
)

Modify page content after xsl.

Reimplemented from ilPageContent.

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

434 : string {
435 $debug = "";
436 //$debug = ".";
437 if ($a_mode !== "edit") {
438 $a_output .= '<script type="module" src="' . $debug . './components/ILIAS/COPage/PC/Tabs/js/presentation.js"></script>';
439 }
440 return $a_output;
441 }

◆ moveBottom()

ilPCTabs::moveBottom ( string  $pc_id)

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

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

◆ moveDown()

ilPCTabs::moveDown ( string  $pc_id)

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

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

◆ moveTop()

ilPCTabs::moveTop ( string  $pc_id)

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

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

◆ moveUp()

ilPCTabs::moveUp ( string  $pc_id)

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

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

◆ saveCaption()

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

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

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

◆ 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: