1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
16: class extends Horde_Menu
17: {
18: 19: 20: 21: 22:
23: protected $_renderCalled = false;
24:
25: 26:
27: public function render()
28: {
29: if (!$this->_renderCalled) {
30: parent::render();
31:
32: $msort = array();
33: foreach ($this->_menu as $k => $v) {
34: if ($v != 'separator') {
35: $msort[$k] = $v['text'];
36: }
37: }
38:
39: asort($msort, SORT_LOCALE_STRING);
40:
41: $tmp = array();
42: foreach (array_keys($msort) as $k) {
43: $tmp[$k] = $this->_menu[$k];
44: }
45: $this->_menu = $tmp;
46:
47: $this->_renderCalled = true;
48: }
49:
50: $out = '';
51:
52: foreach ($this->_menu as $k => $m) {
53:
54: if (empty($GLOBALS['conf']['menu']['apps_iframe']) ||
55: (($m['icon'] instanceof Horde_Themes_Image) &&
56: $GLOBALS['registry']->hasAjaxView($m['icon']->app))) {
57: $href = ' href="' . htmlspecialchars($m['url']) . '"';
58: } else {
59: $href = '';
60: }
61: $out .= '<li class="custom">' .
62: Horde::img($m['icon'], Horde::stripAccessKey($m['text']), '', $m['icon_path'])
63: . '<a id="sidebarapp_' . htmlspecialchars($k) . '"'
64: . $href . '>' . htmlspecialchars($m['text']) . '</a></li>';
65: }
66:
67: return $out;
68: }
69:
70: 71:
72: protected function _render()
73: {
74: }
75:
76: 77: 78: 79:
80: public function addJs()
81: {
82: $out = array();
83:
84: foreach ($this->_menu as $k => $v) {
85: $url = new Horde_Url($v['url']);
86: $out[$k] = strval($url->setRaw(true)->add('ajaxui', 1));
87: }
88:
89: if (!empty($out)) {
90: Horde::addInlineJsVars(array(
91: 'DIMP.conf.menu_urls' => $out
92: ));
93: }
94: }
95:
96: }
97: