Ejemplo n.º 1
0
 function Application()
 {
     parent::DecoratingController();
     $responder = new PathInfoDispatchController();
     //the search command will handle the search logic
     $searchCommand = new CommandController(new CallBack($this, 'search'));
     $searchCommand->addParameter(new PostParameter('name'));
     $responder->addPublicChild('search', $searchCommand);
     $this->addPublicChild('responder', $responder);
     $this->setDefaultChildName('responder');
     $responder->addChild('searchResponse', new ViewController(new View('/results.html')));
     $this->setView(new AppView('/application.html'));
 }
Ejemplo n.º 2
0
 /**
  *
  */
 public static function commandAction()
 {
     if ($bundles = self::getBundles()) {
         foreach ($bundles as $name => $path) {
             $command_path = $path . '/command';
             if (is_dir($command_path)) {
                 if ($dh = opendir($command_path)) {
                     while (($file = readdir($dh)) !== false) {
                         if ($file != "." && $file != ".." && preg_match("/\\.php\$/", $file)) {
                             require_once $command_path . '/' . $file;
                             $command_name = pathinfo($file, PATHINFO_FILENAME);
                             CommandController::add($command_name);
                         }
                     }
                     closedir($dh);
                 }
             }
         }
     }
     Command::execute();
 }