XOOPS  2.6.0
Buttonbox.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  */
11 
12 namespace Xmf\Template;
13 
28 {
32  private $_items = array();
33 
37  private $_delimiter = "&nbsp;";
38 
42  private $_position = "right";
43 
47  private $_path = '';
48 
54  protected function init()
55  {
56  }
57 
65  public function setPosition($position)
66  {
67  $this->_position = $position;
68  }
69 
78  public function setImagePath($path)
79  {
80  $this->_path = $path;
81  }
82 
90  public function setDelimiter($delimiter)
91  {
92  $this->_delimiter = $delimiter;
93  }
94 
105  public function addItem($title, $link, $icon, $extra = '')
106  {
107  $item['title'] = $title;
108  $item['link'] = $link;
109  $item['icon'] = $icon;
110  $item['extra'] = $extra;
111  $this->_items[] = $item;
112  }
113 
119  protected function render()
120  {
121  $ret = '';
123  switch ($this->_position) {
124  default:
125  case "right":
126  $ret = "<div class=\"floatright\">\n";
127  break;
128 
129  case "left":
130  $ret = "<div class=\"floatleft\">\n";
131  break;
132 
133  case "center":
134  $ret = "<div class=\"aligncenter\">\n";
135  }
136  $ret .= "<div class=\"xo-buttons\">\n";
137  foreach ($this->_items as $item) {
138  $ret .= "<a class='ui-corner-all tooltip' href='" . $item['link'] . "' title='" . $item['title'] . "'>";
139  $ret .= "<img src='" . $path . $item['icon'] . "' title='" . $item['title'] . "' />" . $item['title'] . ' ' . $item['extra'];
140  $ret .= "</a>\n";
141  $ret .= $this->_delimiter;
142  }
143  $ret .= "</div>\n</div>\n";
144  $this->tpl->assign('dummy_content', $ret);
145  }
146 }
$path
Definition: execute.php:31
$link
Definition: userinfo.php:84
setDelimiter($delimiter)
Definition: Buttonbox.php:90
setPosition($position)
Definition: Buttonbox.php:65
addItem($title, $link, $icon, $extra= '')
Definition: Buttonbox.php:105