Beispiel #1
0
 /**
  * Changes the current menu.
  * 
  * Changes the current menu.
  * 
  * @param string $newMenu The menu to change to. Can be specified with API
  *     or CLI syntax and can be either absolute or relative. If relative,
  *     it's relative to the current menu, which by default is the root.
  * 
  * @return string The old menu. If an empty string is given for a new menu,
  *     no change is performed, and this function returns the current menu.
  */
 public function changeMenu($newMenu = '')
 {
     $newMenu = (string) $newMenu;
     if ('' === $newMenu) {
         return $this->menu;
     }
     $oldMenu = $this->menu;
     $menuRequest = new Request('/menu');
     if ('/' === $newMenu[0]) {
         $this->menu = $menuRequest->setCommand($newMenu)->getCommand();
     } else {
         $this->menu = $menuRequest->setCommand('/' . str_replace('/', ' ', substr($this->menu, 1)) . ' ' . str_replace('/', ' ', $newMenu))->getCommand();
     }
     $this->clearIdCache();
     return $oldMenu;
 }