예제 #1
0
파일: Exception.php 프로젝트: im286er/Ding
 public function _ExceptionException($exception)
 {
     $modelAndView = new ModelAndView('layout');
     $modelAndView->add(array('viewName' => 'exception'));
     $modelAndView->add(array('exception' => $exception));
     return $modelAndView;
 }
예제 #2
0
파일: example.php 프로젝트: im286er/Ding
 public function someAction($optional = 'yeah')
 {
     $session = HttpSession::getSession();
     $session->setAttribute('aSessionVariable', array('user' => 'aUser'));
     $modelAndView = new ModelAndView('some');
     $modelAndView->add(array('somestring' => 'Hello World', 'arguments' => func_get_args(), 'optional' => $optional));
     $modelAndView->add(array('headers' => array('Cache-Control: no-cache', 'Pragma: no-cache')));
     return $modelAndView;
 }
예제 #3
0
 /**
  * @test
  */
 public function can_get_set_model()
 {
     $mav = new ModelAndView('name');
     $mav->add(array('key1' => 'value1'));
     $model = $mav->getModel();
     $this->assertEquals($model['key1'], 'value1');
 }
예제 #4
0
 /**
  * @test
  */
 public function can_render_and_translate()
 {
     // For language stuff
     ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . RESOURCES_DIR);
     $this->expectOutputString('hi there');
     $mav = new ModelAndView('some');
     $mav->add(array('headers' => array('HTTP/1.0 404 Not Found')));
     $container = ContainerImpl::getInstance($this->_properties);
     $resolver = $container->getBean('HttpViewResolver3');
     $view = $resolver->resolve($mav);
     $render = $container->getBean('HttpViewRender');
     $render->render($view);
     $this->assertEquals($render->translate('abundle', 'message.some', array('arg1' => '1', 'arg2' => '2', 'arg3' => '3')), 'This is a test message, arg1=1 arg2=2 arg3=3');
     $session = HttpSession::getSession();
     $session->setAttribute('LANGUAGE', 'es_AR');
     $this->assertEquals($render->translate('abundle', 'message.some', array('arg1' => '1', 'arg2' => '2', 'arg3' => '3')), 'Este es un mensaje de prueba, arg1=1 arg2=2 arg3=3');
 }
예제 #5
0
파일: Main.php 프로젝트: im286er/Ding
 public function mainAction()
 {
     $modelAndView = new ModelAndView('layout');
     $modelAndView->add(array('viewName' => 'home'));
     return $modelAndView;
 }
예제 #6
0
 public function somethingSmartyAction()
 {
     $model = new ModelAndView('someSmarty');
     $model->add(array('a' => 'b'));
     return $model;
 }