/** * _responseHtml * * @return void */ private function _responseHtml() { $body = $this->_viewRenderer->getResponse()->getBody(); $respHeader = "{$this->_view->doctype()}\n <html>\n <head>\n {$this->_view->headMeta()}\n {$this->_view->headTitle()}\n {$this->_view->headStyle()}\n {$this->_view->headLink()}\n {$this->_view->headScript()}\n {$this->_view->dojo()}\n </head>"; $respBody = "<body>{$body}</body>"; $respFooter = "</html>"; $this->_viewRenderer->getResponse()->setBody($respHeader . $respBody . $respFooter); }
/** * postDispatch * * @param Zend_Controller_Request_Abstract $oRequest * @return void */ public function postDispatch(Zend_Controller_Request_Abstract $oRequest) { // Vars $options = $this->_getOptions()->getMergedRequestOptions($oRequest); $front = Zend_Controller_Front::getInstance(); // Dojo if (isset($options["dojo"])) { if (count($options["dojo"]) > 0) { $djOptions = $options["dojo"]; if (isset($djOptions["djConfig"])) { $array = array_merge($djOptions['djConfig'], $this->_view->dojo()->getDjConfig()); $this->_view->dojo()->setDjConfig($array); unset($djOptions["djConfig"]); } $this->_view->dojo()->setOptions($djOptions); } Zend_Dojo::enableView($this->_view); } }
public function testResetResponseShouldClearAllViewPlaceholders() { $this->testCase->getFrontController()->setControllerDirectory(dirname(__FILE__) . '/_files/application/controllers'); $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $viewRenderer->initView(); $view = $viewRenderer->view; $view->addHelperPath('Zend/Dojo/View/Helper', 'Zend_Dojo_View_Helper'); $view->dojo()->setCdnVersion('1.1.0')->requireModule('dojo.parser')->enable(); $view->headTitle('Foo'); $this->testCase->dispatch('/zend-test-php-unit-foo/baz'); $response = $this->testCase->getResponse(); $this->testCase->resetResponse(); $view = new Zend_View(); $view->addHelperPath('Zend/Dojo/View/Helper', 'Zend_Dojo_View_Helper'); $this->assertFalse($view->dojo()->isEnabled(), 'Dojo is enabled? ', $view->dojo()); $this->assertNotContains('Foo', $view->headTitle()->__toString(), 'Head title persisted?'); }
/** * * @param Zend_View $pView * @return void */ public static function prep_view(Zend_View $pView) { $pView->dojo()->addLayer(ZUPAL_BASEURL . DS . 'scripts/Dojo/dojo/grid_layer.js')->addStyleSheet(ZUPAL_BASEURL . DS . 'scripts/Dojo/dojox/grid/resources/Grid.css')->enable(); }
/** * Set Dojo * * @return void */ public function setDojo() { Zend_Dojo::enableView($this->_view); $options = array_change_key_case($this->getOptions(), CASE_LOWER); foreach ($options as $key => $value) { switch ($key) { case 'cdnbase': $this->_view->dojo()->setCdnBase($value); break; case 'cdndojopath': $this->_view->dojo()->setCdnDojoPath($value); break; case 'cdnversion': $this->_view->dojo()->setCdnVersion($value); break; case 'djconfig': $this->_view->dojo()->setDjConfig($value); break; case 'layers': foreach ($value as $path) { $this->_view->dojo()->addLayer($path); } break; case 'localpath': $this->_view->dojo()->setLocalPath($value); break; case 'modules': foreach ($value as $module) { $this->_view->dojo()->requireModule($module); } break; case 'stylesheets': foreach ($value as $path) { $this->_view->dojo()->addStylesheet($path); } break; case 'stylesheetmodules': foreach ($value as $module) { $this->_view->dojo()->addStylesheetModule($module); } break; default: break; } } if (array_key_exists('enable', $options) && $options['enable']) { $this->_view->dojo()->enable(); } else { $this->_view->dojo()->disable(); } }