
Public Member Functions | |
| getByName ($name) | |
| baseComponentMenu () | |
| createChild ($entry) | |
| makeMenu () | |
Static Public Member Functions | |
| static | getInstance () |
Protected Member Functions | |
| __construct () | |
Static Protected Attributes | |
| static | $instance = __CLASS__ |
Private Member Functions | |
| showLevel ($parent, $numbers, $liststart) | |
Private Attributes | |
| $all_entries = array() | |
| $visible = array() | |
| $byname = array() | |
| $basepath = '' | |
| $links = null | |
| $componentBase = 0 | |
Definition at line 59 of file aliroAdminMenu.php.
| aliroAdminMenuHandler::__construct | ( | ) | [protected] |
Definition at line 69 of file aliroAdminMenu.php.
References aliroCoreDatabase::getInstance(), aliroRequest::getInstance(), and published().
00069 { 00070 // Making private enforces singleton 00071 $this->basepath = aliroRequest::getInstance()->getCfg('admin_site').'/'; 00072 $database = aliroCoreDatabase::getInstance(); 00073 $this->all_entries = $database->doSQLget("SELECT * FROM #__admin_menu", 'aliroAdminMenu'); 00074 foreach ($this->all_entries as $key=>&$result) { 00075 $result->link = str_replace('&', '&', str_replace('&', '&', $result->link)); 00076 $this->byname[$result->component] = $key; 00077 if ('placeholder' == $result->type AND 'components' == $result->component) $this->componentBase = $result->id; 00078 if (!$result->published) continue; 00079 $mcount = 0; 00080 $this->visible[$result->id] = $result; 00081 } 00082 }
| static aliroAdminMenuHandler::getInstance | ( | ) | [static] |
Definition at line 84 of file aliroAdminMenu.php.
Referenced by aliroExtensionInstaller::install_component(), aliroAdminTemplateBase::preRender(), and aliroAdminMenu::store().
00084 { 00085 return is_object(self::$instance) ? self::$instance : (self::$instance = parent::getCachedSingleton(self::$instance)); 00086 }
| aliroAdminMenuHandler::getByName | ( | $ | name | ) |
Definition at line 88 of file aliroAdminMenu.php.
00088 { 00089 if (isset($this->byname[$name])) return $this->all_entries[$this->byname[$name]]; 00090 else return null; 00091 }
| aliroAdminMenuHandler::baseComponentMenu | ( | ) |
| aliroAdminMenuHandler::createChild | ( | $ | entry | ) |
Definition at line 97 of file aliroAdminMenu.php.
00097 { 00098 $item = new aliroAdminMenu(); 00099 $item->name = $entry->name; 00100 $item->link = $entry->link; 00101 $item->type = $entry->type; 00102 $item->parent = $entry->id; 00103 $item->component = $entry->component; 00104 $item->sublevel = $entry->sublevel + 1; 00105 $item->xmlfile = $entry->xmlfile; 00106 return $item; 00107 }
| aliroAdminMenuHandler::makeMenu | ( | ) |
Definition at line 109 of file aliroAdminMenu.php.
References $_REQUEST, and showLevel().
00109 { 00110 $max = $chosen = 0; 00111 foreach ($this->visible as $result) { 00112 $mcount = 0; 00113 $query = substr($result->link, 10); 00114 $elements = explode ('&', $query); 00115 foreach ($elements as $element) { 00116 $parts = explode ('=', $element); 00117 if (isset($_REQUEST[$parts[0]]) AND isset($parts[1]) AND $_REQUEST[$parts[0]] == $parts[1]) $mcount++; 00118 } 00119 if ($mcount > $max) { 00120 $max = $mcount; 00121 $chosen = $result->id; 00122 } 00123 } 00124 $numbers = array(); 00125 while ($chosen) { 00126 $numbers[] = $chosen; 00127 $chosen = $this->visible[$chosen]->parent; 00128 } 00129 $this->showLevel(0, $numbers, "\n<ul id='nav'>"); 00130 $html = ''; 00131 if ($this->links) { 00132 foreach ($this->links as $link) $html .= $link; 00133 } 00134 return $html; 00135 }
| aliroAdminMenuHandler::showLevel | ( | $ | parent, | |
| $ | numbers, | |||
| $ | liststart | |||
| ) | [private] |
Definition at line 137 of file aliroAdminMenu.php.
References aliroAuthoriser::getInstance().
Referenced by makeMenu().
00137 { 00138 $authoriser = aliroAuthoriser::getInstance(); 00139 $trigger = false; 00140 foreach ($this->visible as $entry) { 00141 if ($entry->parent != $parent) continue; 00142 if (!$authoriser->checkUserPermission('see', 'aliroMenu', $entry->id)) continue; 00143 if (!$trigger) { 00144 $this->links[] = $liststart; 00145 $trigger = true; 00146 } 00147 if ('placeholder' == $entry->type) $this->links[] = "\n\t<li>$entry->name"; 00148 elseif ('url' == $entry->type) $this->links[] = "\n\t<li><a href='{$entry->link}'>$entry->name</a>"; 00149 else $this->links[] = "\n\t<li><a href='{$this->basepath}{$entry->link}'>$entry->name</a>"; 00150 $this->showLevel($entry->id, $numbers, "\n<ul>"); 00151 $this->links[] = "</li>"; 00152 } 00153 if ($trigger) $this->links[] = "\n</ul>"; 00154 }
aliroAdminMenuHandler::$instance = __CLASS__ [static, protected] |
Definition at line 60 of file aliroAdminMenu.php.
aliroAdminMenuHandler::$all_entries = array() [private] |
Definition at line 62 of file aliroAdminMenu.php.
aliroAdminMenuHandler::$visible = array() [private] |
Definition at line 63 of file aliroAdminMenu.php.
aliroAdminMenuHandler::$byname = array() [private] |
Definition at line 64 of file aliroAdminMenu.php.
aliroAdminMenuHandler::$basepath = '' [private] |
Definition at line 65 of file aliroAdminMenu.php.
aliroAdminMenuHandler::$links = null [private] |
Definition at line 66 of file aliroAdminMenu.php.
aliroAdminMenuHandler::$componentBase = 0 [private] |
Definition at line 67 of file aliroAdminMenu.php.
1.5.5