예제 #1
0
파일: _menu.php 프로젝트: bizanto/Hooked
<?php

/**
* @package   ZOO Component
* @file      _menu.php
* @version   2.3.0 December 2010
* @author    YOOtheme http://www.yootheme.com
* @copyright Copyright (C) 2007 - 2011 YOOtheme GmbH
* @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// render menu
$menu = YMenu::getInstance('nav')->addFilter(array('ZooMenuFilter', 'activeFilter'))->addFilter(array('ZooMenuFilter', 'nameFilter'))->applyFilter();
echo '<div id="nav"><div class="bar"></div>' . $menu->render(array('YMenuDecorator', 'index')) . '</div>';
/*
	Class: ZooMenuFilter
		Filter for menu class.
*/
class ZooMenuFilter
{
    public static function activeFilter(YMenuItem $item)
    {
        // init vars
        $id = '';
        $app = Zoo::getApplication();
        $controller = YRequest::getWord('controller');
        $task = YRequest::getWord('task');
        $classes = array();
        // application context
        if (!empty($app)) {
예제 #2
0
파일: zoo.php 프로젝트: bizanto/Hooked
// change application
if ($id = YRequest::getInt('changeapp')) {
    JFactory::getApplication()->setUserState('com_zooapplication', $id);
}
// load application
$application = Zoo::getApplication();
// set default controller
if (!$controller) {
    $controller = $application ? 'item' : 'new';
    YRequest::setVar('controller', $controller);
}
// set toolbar button include path
$toolbar = JToolBar::getInstance('toolbar');
$toolbar->addButtonPath(ZOO_ADMIN_PATH . '/joomla/button');
// build menu
$menu = YMenu::getInstance('nav');
// add "app" menu items
foreach (YTable::getInstance('application')->all(array('order' => 'name')) as $app) {
    $app->addMenuItems($menu);
}
// add "new" and "manager" menu item
$new = new YMenuItem('new', '<span class="icon"> </span>', 'index.php?option=com_zoo&controller=new', array('class' => 'new'));
$manager = new YMenuItem('manager', '<span class="icon"> </span>', 'index.php?option=com_zoo&controller=manager', array('class' => 'config'));
$menu->addChild($new);
$menu->addChild($manager);
if ($controller == 'new' && $task == 'add' && $group) {
    // get application meta
    $app = new Application();
    $app->setGroup($group);
    $meta = $app->getMetaData();
    // add info item