1<?php 2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */ 3 4require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php'; 5 6/** 7 * @author Björn Heyser <bheyser@databay.de> 8 * @version $Id$ 9 * 10 * @package Modules/Test 11 */ 12class ilTestPlayerNavButton extends ilLinkButton 13{ 14 /** 15 * @var string 16 */ 17 private $nextCommand = ''; 18 19 // fau: testNav - add glyphicon support for navigation buttons 20 private $leftGlyph = ''; 21 private $rightGlyph = ''; 22 23 public function setLeftGlyph($glyph) 24 { 25 $this->leftGlyph = $glyph; 26 } 27 28 public function setRightGlyph($glyph) 29 { 30 $this->rightGlyph = $glyph; 31 } 32 33 protected function renderCaption() 34 { 35 $caption = ''; 36 37 if ($this->leftGlyph) { 38 $caption .= '<span class="' . $this->leftGlyph . '"></span> '; 39 } 40 41 $caption .= parent::renderCaption(); 42 43 if ($this->rightGlyph) { 44 $caption .= ' <span class="' . $this->rightGlyph . '"></span>'; 45 } 46 47 return $caption; 48 } 49 // fau. 50 51 /** 52 * @return string 53 */ 54 public function getNextCommand() 55 { 56 return $this->nextCommand; 57 } 58 59 /** 60 * @param string $nextCommand 61 */ 62 public function setNextCommand($nextCommand) 63 { 64 $this->nextCommand = $nextCommand; 65 } 66 67 /** 68 * @return string 69 */ 70 public function render() 71 { 72 $this->prepareRender(); 73 74 $attr = array( 75 'href' => $this->getUrl() ? $this->getUrl() : "#", 76 'target' => $this->getTarget() 77 ); 78 79 if (strlen($this->getNextCommand())) { 80 $attr['data-nextcmd'] = $this->getNextCommand(); 81 } 82 83 return '<a' . $this->renderAttributes($attr) . '>' . $this->renderCaption() . '</a>'; 84 } 85 86 public static function getInstance() 87 { 88 return new self(self::TYPE_LINK); 89 } 90} 91