/** * Handle paths from a XML file * @param $xml_file path for the file */ public function __construct($xml_file, $controller) { parent::__construct(); $path = array(); if (file_exists($xml_file)) { $menu_string = file_get_contents($xml_file); if (utf8_encode(utf8_decode($menu_string)) == $menu_string) { $xml = new SimpleXMLElement($menu_string); } else { $xml = new SimpleXMLElement(utf8_encode($menu_string)); } foreach ($xml as $xmlElement) { $atts = $xmlElement->attributes(); $label = (string) $atts['label']; $action = (string) $xmlElement->action; $icon = (string) $xmlElement->icon; $this->parse($xmlElement->menu->menuitem, array($label)); } if (isset($this->paths[$controller]) and $this->paths[$controller]) { $total = count($this->paths[$controller]); parent::addHome($path); $count = 1; foreach ($this->paths[$controller] as $path) { parent::addItem($path, $count == $total); $count++; } } else { throw new Exception(TAdiantiCoreTranslator::translate('Class ^1 not found in ^2', $controller, $xml_file)); } } else { throw new Exception(TAdiantiCoreTranslator::translate('File not found') . ': ' . $xml_file); } }