Example #1
0
 /**
  * Dispatch request
  */
 public function index()
 {
     if (!access('admin')) {
         return _403();
     }
     new Admin_Menu();
     $args = $this->router->getArgs();
     $rev_args = array_reverse($args);
     $class = array();
     while ($piece = array_pop($rev_args)) {
         $class[] = $piece;
         $gear = implode('_', $class);
         if ($this->gears->{$gear}) {
             $callback = array($this->gears->{$gear}, 'admin');
             if (is_callable($callback)) {
                 event('admin.gear.request', $this->gears->{$gear});
                 Template::setGlobal('title', $gear);
                 $this->router->exec($callback, $rev_args);
                 break;
             }
         }
     }
 }