ILIAS  release_8 Revision v8.24
class.ilTestPlayerNavButton.php
Go to the documentation of this file.
1<?php
2
26{
30 private $nextCommand = '';
31
32 // fau: testNav - add glyphicon support for navigation buttons
33 private $leftGlyph = '';
34 private $rightGlyph = '';
35
36 public function setLeftGlyph($glyph)
37 {
38 $this->leftGlyph = $glyph;
39 }
40
41 public function setRightGlyph($glyph)
42 {
43 $this->rightGlyph = $glyph;
44 }
45
46 protected function renderCaption(): string
47 {
48 $caption = '';
49
50 if ($this->leftGlyph) {
51 $caption .= '<span class="' . $this->leftGlyph . '"></span> ';
52 }
53
54 $caption .= parent::renderCaption();
55
56 if ($this->rightGlyph) {
57 $caption .= ' <span class="' . $this->rightGlyph . '"></span>';
58 }
59
60 return $caption;
61 }
62 // fau.
63
67 public function getNextCommand(): string
68 {
69 return $this->nextCommand;
70 }
71
76 {
77 $this->nextCommand = $nextCommand;
78 }
79
83 public function render(): string
84 {
85 $this->prepareRender();
86
87 $attr = array(
88 'href' => $this->getUrl() ? $this->getUrl() : "#",
89 'target' => $this->getTarget()
90 );
91
92 if (strlen($this->getNextCommand())) {
93 $attr['data-nextcmd'] = $this->getNextCommand();
94 }
95
96 return '<a' . $this->renderAttributes($attr) . '>' . $this->renderCaption() . '</a>';
97 }
98
99 public static function getInstance(): self
100 {
101 return new self(self::TYPE_LINK);
102 }
103}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
renderAttributes(array $a_additional_attr=null)
Render current HTML attributes.