Example #1
0
 /**
  * @param	MvcContextInterface $context
  * @return	null
  */
 public function process(MvcContextInterface $context)
 {
     $input = $context->getInput();
     $view = $context->getView();
     if (!ResourceTreeManager::isTree()) {
         ResourceTreeManager::loadTree();
     }
     $finder = new FileFinder('resource');
     $writer = new FileWriter($finder);
     $reader = new FileReader($finder);
     if (!$writer->deleteTree('build', true)) {
         $err = "could not detete -({$finder->getPath('build')})";
         throw new RunTimeException($err);
     }
     $list = ResourceTreeManager::getAllPageNames();
     if (!is_array($list) || empty($list)) {
         return;
     }
     foreach ($list as $pageName) {
         $pkg = ResourceTreeManager::getPkg($pageName);
         $layers = $pkg->getLayers();
         $pageStack = new FileStack();
         foreach ($layers as $layerName) {
             $stack = new FileStack();
             $layer = ResourceTreeManager::loadLayer($layerName, $stack);
             $this->buildLayer($layer, $reader, $writer, $pageStack);
         }
         $this->buildLayer(ResourceTreeManager::createPageLayer($pageName), $reader, $writer, $pageStack);
         $themeName = $pkg->getThemeName();
         if ($themeName) {
             $this->buildTheme($themeName, $reader, $writer, $pageStack);
         }
     }
     $view->assign('result', 'build completed');
 }
Example #2
0
 /**
  * @param   AppContextInterface           $context
  * @param   ConsoleViewTemplateInterface  $view
  * @return  mixed   null | AppContextInterface 
  */
 public function process(MvcContextInterface $context)
 {
     $view = $context->getView();
     $input = $context->getInput();
     $valueA = $input->get('get', 'label-a');
     $valueB = $input->get('get', 'label-b');
     $result = "processed label-a={$valueA} label-b={$valueB}";
     $view->assign('action-b:', $result);
 }
Example #3
0
 /**
  * @param   AppContextInterface           $context
  * @param   ConsoleViewTemplateInterface  $view
  * @return  mixed   null | AppContextInterface 
  */
 public function process(MvcContextInterface $context)
 {
     $view = $context->getView();
     $input = $context->getInput();
     $valueC = $input->get('get', 'label-c');
     $valueD = $input->get('get', 'label-d');
     $result = "processed label-a={$valueC} label-b={$valueD}";
     $view->assign('action-c:', $result);
 }
Example #4
0
 /**
  * @param	string	$routeKey
  * @param	MvcContextInterface $context
  * @return	MvcContextInterface
  */
 public function callWithContext($routeKey, MvcContextInterface $context)
 {
     $dispatcher = $this->getDispatcher();
     $tmp = $this->getMvcFactory()->createContext($routeKey, $context->getInput());
     $tmp->load($context->getAll());
     $dispatcher->dispatch($tmp);
     /* transfer all assignments made by mvc action */
     $context->load($tmp->getAll());
     $view = $tmp->getView();
     if (!empty($view)) {
         $context->setView($view);
     }
     return $context;
 }
Example #5
0
 /**
  * @param	MvcContextInterface $context
  * @return	null
  */
 public function process(MvcContextInterface $context)
 {
     $input = $context->getInput();
     $view = $context->getView();
     $view->assign('foo', 'bar');
 }