Example #1
0
$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
    $new->addChild(new YMenuItem('new', $meta['name']));
}
if ($controller == 'manager' && $group) {
    // get application meta
    $app = new Application();
    $app->setGroup($group);
    $meta = $app->getMetaData();
    // add info item
    $info = new YMenuItem('manager-types', $meta['name'], 'index.php?option=com_zoo&controller=manager&task=types&group=' . $group);
    $info->addChild(new YMenuItem('manager-types', 'Types', 'index.php?option=com_zoo&controller=manager&task=types&group=' . $group));
    $info->addChild(new YMenuItem('manager-info', 'Info', 'index.php?option=com_zoo&controller=manager&task=info&group=' . $group));
    $manager->addChild($info);
}
try {
    if ($application) {
        // dispatch current application
        $application->dispatch();
    } else {
        // load controller
        require_once ZOO_ADMIN_PATH . "/controllers/{$controller}.php";
        // perform the request task