Example #1
0
 protected function onPrepare($argv = null)
 {
     $this->web = Web::getWeb();
     $this->app = $this->web->app;
     $this->router = $this->web->getRouter();
     $this->parse = $this->router->parseStr($this->name);
     if (empty($this->parse['controller'])) {
         throw new \Exception('Please specify controller, the right format should "controller#action"!');
     }
     if (empty($this->parse['action'])) {
         throw new \Exception('Please specify action, the right format should "controller#action"!');
     }
     $this->controller = $this->web->filterController($this->parse['controller']);
     $this->class = $this->web->makeControllerClass($this->controller);
     $this->view = $this->web->filterAction($this->parse['action']);
     $dirs = $this->web->component->getScopeDirs('view');
     if (!isset($dirs['appView'])) {
         throw new \Exception("Unknown view folder!");
     }
     $this->dir = $dirs['appView'];
     if (is_file($this->getPath())) {
         throw new \Exception("The file '{$this->getPath()}' is existing!");
     }
 }
Example #2
0
 protected function onPrepare($argv = null)
 {
     $this->web = Web::getWeb();
     $this->name = $this->web->filterController($this->name);
     $this->class = $this->web->makeControllerClass($this->name);
 }