1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: 19: 20: 21: 22: 23:
24: class {
25:
26: 27: 28: 29:
30: public $link;
31:
32: 33: 34: 35:
36: public $title;
37:
38: 39: 40: 41:
42: public $tooltips;
43:
44: 45: 46: 47:
48: public $image;
49:
50: 51: 52: 53:
54: public $alt;
55:
56: 57: 58: 59:
60: public $actions;
61:
62: 63: 64: 65:
66: public $imagewidth;
67:
68: 69: 70: 71: 72:
73: public $caption;
74:
75: 76: 77: 78: 79:
80: public $type;
81:
82: 83: 84: 85: 86:
87: public $show;
88:
89: 90: 91: 92: 93:
94: protected $_marked = false;
95:
96: 97: 98:
99: public function __construct() {
100: $this->rowmark = true;
101: }
102:
103: 104: 105: 106: 107:
108: public function setTitle($item, $title) {
109: $this->title[$item] = $title;
110: }
111:
112: 113: 114: 115: 116:
117: public function setTooltip($item, $tooltip) {
118: $this->tooltips[$item] = $tooltip;
119: }
120:
121: 122: 123: 124:
125: public function setRowmark($rowmark = true) {
126: $this->rowmark = $rowmark;
127: }
128:
129: 130: 131: 132: 133: 134:
135: public function setImage($item, $image, $maxwidth = 0) {
136: $this->image[$item] = $image;
137: $this->imagewidth[$item] = $maxwidth;
138: $this->show[$item] = '';
139: }
140:
141: 142: 143: 144: 145:
146: public function setLink($item, $link) {
147: $this->link[$item] = $link;
148: }
149:
150: 151: 152: 153: 154: 155:
156: public function setActions($item, $key, $action) {
157: $this->actions[$item][$key] = $action;
158: }
159:
160: 161: 162: 163:
164: public function setMarked($item) {
165: $this->_marked = $item;
166: }
167:
168: 169: 170: 171: 172: 173: 174:
175: public function render($print = true) {
176: global $cfg;
177:
178: $tpl = new cTemplate;
179:
180: $tpl->reset();
181:
182: if (is_array($this->link)) {
183: foreach ($this->link as $key => $value) {
184: if ($value != NULL) {
185: if ($this->imagewidth[$key] != 0) {
186: $value->setContent('<img border="0" alt="" src="' . $this->image[$key] . '" width="' . $this->imagewidth[$key] . '">');
187: $img = $value->render();
188: } else {
189: $value->setContent('<img border="0" alt="" src="' . $this->image[$key] . '">');
190: $img = $value->render();
191: }
192: $value->setContent($this->title[$key]);
193: $link = $value->render();
194: } else {
195: $link = $this->title[$key];
196:
197: if ($this->image[$key] != "") {
198: if ($this->imagewidth[$key] != 0) {
199: $img = '<img border="0" alt="" src="' . $this->image[$key] . '" width="' . $this->imagewidth[$key] . '">';
200: } else {
201: $img = '<img border="0" alt="" src="' . $this->image[$key] . '">';
202: }
203: } else {
204: $img = " ";
205: }
206: }
207:
208: $tpl->set('d', 'NAME', $link);
209:
210: if ($this->image[$key] == "") {
211: $tpl->set('d', 'ICON', '');
212: } else {
213: $tpl->set('d', 'ICON', $img);
214: }
215:
216: $extra = "";
217: if ($this->rowmark == true) {
218: $extra .= 'onmouseover="row.over(this)" onmouseout="row.out(this)" onclick="row.click(this)" ';
219: }
220: if ($this->_marked === $key) {
221: $extra .= "id='marked' ";
222: }
223: if ($this->tooltips[$key] != "") {
224: $extra .= "class='tooltip-north' original-title='" . $this->tooltips[$key] . "' ";
225: }
226: $tpl->set('d', 'EXTRA', $extra);
227:
228: $fullactions = "";
229: if (is_array($this->actions[$key])) {
230:
231: $fullactions = '<table border="0"><tr>';
232:
233: foreach ($this->actions[$key] as $key => $singleaction) {
234: $fullactions .= '<td nowrap="nowrap">' . $singleaction . '</td>';
235: }
236:
237: $fullactions .= '</tr></table>';
238: }
239:
240: $tpl->set('d', 'ACTIONS', $fullactions);
241: $tpl->next();
242: }
243: }
244: $rendered = $tpl->generate(cRegistry::getBackendPath() . $cfg['path']['templates'] . $cfg['templates']['generic_menu'], true);
245:
246: if ($print == true) {
247: echo $rendered;
248: } else {
249: return $rendered;
250: }
251: }
252:
253: }
254: