Ejemplo n.º 1
0
 public static function menu()
 {
     \Menu::add(['index' => 0, 'icon-class' => 'fa fa-dashboard', 'name' => 'dashboard', 'label' => trans('backend/dashboard.dashboard'), 'url' => url('backend/c/dashboard')]);
     \Menu::add(['index' => 10, 'icon-class' => 'fa fa-cube', 'name' => 'article', 'label' => trans('backend/article.articles')]);
     \Menu::addChild(['index' => 10, 'group' => true, 'target' => 'article', 'name' => 'navigation', 'label' => trans('backend/general.navigation')]);
     \Menu::addChild(['index' => 10, 'target' => 'article', 'target_group' => 'navigation', 'label' => trans('backend/general.show_all'), 'url' => url('backend/c/article')]);
     \Menu::addChild(['index' => 20, 'target' => 'article', 'target_group' => 'navigation', 'label' => trans('backend/article.add'), 'url' => url('backend/c/article/a/add')]);
 }
Ejemplo n.º 2
0
 * @author Francisco Yure Pereira de Araujo <*****@*****.**>
 * @since 2014-04-21 
 * 
 */
require_once 'IComponentMenu.class.php';
require_once 'Menu.class.php';
require_once 'SubMenu.class.php';
require_once 'Item.class.php';
$menu = new Menu();
$subMenu = new SubMenu();
$subMenu2 = new SubMenu();
$item1 = new Item('#link-item1', 'Item 1');
$item2 = new Item('#link-item2', 'Item 2');
$item3 = new Item('#link-item3', 'Item 3');
$item4 = new Item('#link-item4', 'Item 4');
$menu->addChild($item1);
$menu->addChild($item2);
$menu->addChild($item3);
$menu->addChild($item4);
$subMenu2->addChild($item1);
$subMenu2->addChild($item2);
$subMenu2->addChild($item3);
$subMenu2->addChild($item4);
$subMenu->addChild($item1);
$subMenu->addChild($item2);
$subMenu->addChild($subMenu2);
$subMenu->addChild($item3);
$menu->addChild($subMenu);
?>
<!doctype html>
<html lang="en">
Ejemplo n.º 3
0
 public static function addChild($data, SimpleXMLElement $xml)
 {
     foreach ($data as $tagName => $tagValue) {
         if (is_numeric($tagName)) {
             Menu::addChild($tagValue, $xml);
             continue;
         }
         if (!is_array($tagValue)) {
             $child = $xml->addChild($tagName, (string) $tagValue);
             continue;
         }
         foreach ($tagValue as $key => $value) {
             $child = $xml->addChild($tagName);
             // Do we need this?
             if (!is_array($value)) {
                 $child->addAttribute($key, (string) $value);
                 continue;
             }
             foreach ($value as $k => $v) {
                 if (is_array($v)) {
                     Menu::addChild(array($k => $v), $child);
                 } else {
                     $child->addAttribute($k, (string) $v);
                 }
             }
         }
     }
     /* this is the recently working code
        if (isset($data[$this->_menuTag])) {
            foreach ($data[$this->_menuTag] as $key => $value) {
                $child = $xml->addChild($this->_menuTag);
                foreach ($value as $k => $v) {
                    if ($k == $this->_menuTag) {
                        Menu::addChild(array($k => $v), $child);
                    } else {
                        $child->addAttribute($k, (string)$v);
                    }
                }
            }
        }
        */
 }