Exemplo n.º 1
0
 public function init()
 {
     $this->getBootstrap()->bootstrap('Frontcontroller');
     $this->_view = parent::init();
     $this->_saveInRegistry()->_setLayoutPath()->_setHeadFilesFramework()->_setPaginationStyle();
     return $this->_view;
 }
Exemplo n.º 2
0
 public function init()
 {
     $bootstrap = $this->getBootstrap();
     $bootstrap->bootstrap('zf2');
     $serviceManager = $bootstrap->getResource('zf2')->getServiceManager();
     //register zf1 helper to grant access to zf2 view helpers
     $zf2Helper = new Zf2Helper($serviceManager->get('ViewHelperManager'));
     $view = $this->getView();
     $view->registerHelper($zf2Helper, 'zf2Helper');
     return parent::init();
 }
Exemplo n.º 3
0
Arquivo: View.php Projeto: epixa/Epixa
 /**
  * {@inheritdoc}
  *
  * In addition, register the default view helper path for the epixa library.
  * 
  * @return BaseView
  */
 public function init()
 {
     $options = $this->getOptions();
     $this->_view = new BaseView($options);
     if (isset($options['doctype'])) {
         $this->_view->doctype()->setDoctype(strtoupper($options['doctype']));
     }
     $this->_view->addHelperPath('Epixa/View/Helper', 'Epixa\\View\\Helper\\');
     $view = parent::init();
     HelperBroker::getExistingHelper('ViewRenderer')->setViewBasePathSpec(':moduleDir/..');
     return $view;
 }
Exemplo n.º 4
0
 /**
  * @author slovacus
  * @return type
  */
 public function getView()
 {
     $this->_view = parent::getView();
     if (null === $this->_view) {
         $options = $this->getOptions();
         $view = new Zend_View();
         $view->headTitle($options['title']);
         $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
         $viewRenderer->setView($view);
         $this->_view = $view;
     }
     return $this->_view;
 }
Exemplo n.º 5
0
 public function init()
 {
     $view = parent::init();
     $options = $this->getOptions();
     if (array_key_exists('variables', $options)) {
         if (is_array($options['variables'])) {
             foreach ($options['variables'] as $key => $value) {
                 $view->assign($key, $value);
             }
         } else {
             $view->assign($options['variables']);
         }
     }
     $viewRenderer = new HausDesign_Controller_Action_Helper_ViewRenderer();
     $viewRenderer->setView($view);
     Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
     return $view;
 }
Exemplo n.º 6
0
 /**
  * @group ZF-11579
  */
 public function testViewResourceDoesNotReinjectViewRenderer()
 {
     require_once dirname(__FILE__) . '/TestAsset/ViewRenderer.php';
     $viewRenderer = new Zend_Application_Resource_TestAsset_ViewRenderer();
     Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
     $resource = new Zend_Application_Resource_View(array('encoding' => 'UTF-8'));
     $view = $resource->init();
     $this->assertSame($view, $viewRenderer->view);
 }
Exemplo n.º 7
0
 /**
  * @group ZF-10042
  */
 public function testAssignmentsAreSet()
 {
     $options = array('assign' => array('foo' => 'barbapapa', 'bar' => 'barbazoo'));
     $resource = new Zend_Application_Resource_View($options);
     $view = $resource->init();
     $this->assertEquals('barbapapa', $view->foo);
     $this->assertEquals('barbazoo', $view->bar);
 }
Exemplo n.º 8
0
 public function testDoctypeIsSet()
 {
     $options = array('doctype' => 'XHTML1_FRAMESET');
     $resource = new Zend_Application_Resource_View($options);
     $resource->init();
     $view = $resource->getView();
     $this->assertEquals('XHTML1_FRAMESET', $view->doctype()->getDoctype());
 }
 /**
  * @group ZF-10343
  */
 public function testSetMetaCharsetShouldOnlyAvailableForHtml5()
 {
     $charset = 'UTF-8';
     $options = array('doctype' => 'XHTML1_STRICT', 'charset' => $charset);
     $resource = new Zend_Application_Resource_View($options);
     $view = $resource->init();
     $headMetaHelper = $view->headMeta();
     $actual = null;
     $container = $headMetaHelper->getContainer();
     foreach ($container as $item) {
         if ('charset' == $item->type) {
             $actual = $item->charset;
             break;
         }
     }
     $this->assertFalse($view->doctype()->isHtml5());
     $this->assertNull($actual);
     $registry = Zend_View_Helper_Placeholder_Registry::getRegistry();
     $registry->deleteContainer('Zend_View_Helper_HeadMeta');
     $registry->deleteContainer('Zend_View_Helper_Doctype');
 }