/** * Create a dijit programmatically * * @param string $dijit * @param string $id * @param array $params * @return void */ protected function _createDijit($dijit, $id, array $params) { $params['dojoType'] = $dijit; array_walk_recursive($params, array($this, '_castBoolToString')); $this->dojo->setDijit($id, $params); }
/** * Create JS function for retrieving parent form * * @return void */ protected function _createGetParentFormFunction() { $function = <<<EOJ if (zend == undefined) { var zend = {}; } zend.findParentForm = function(elementNode) { while (elementNode.nodeName.toLowerCase() != 'form') { elementNode = elementNode.parentNode; } return elementNode; }; EOJ; $this->dojo->addJavascript($function); }
/** * Create a dijit programmatically * * @param string $dijit * @param string $id * @param array $params * @return void */ protected function _createDijit($dijit, $id, array $params) { if (empty($params)) { $params = '{}'; } else { require_once 'Zend/Json.php'; $params = Zend_Json::encode($params); } $lambda = <<<EOJ function() { var zfDijit = new {$dijit}({$params}, dojo.byId('{$id}')); zfDijit.startup(); } EOJ; $this->dojo->addOnLoad($lambda); }
/** * Set view object * * @param Zend_Dojo_View_Interface $view * @return void */ public function setView(Zend_View_Interface $view) { $this->view = $view; $this->_container->setView($view); }
public function setupDojo() { $this->helper->requireModule('dijit.layout.ContentPane')->registerModulePath('custom', '../custom')->requireModule('custom.foo')->setCdnVersion('1.1')->setDjConfig(array('parseOnLoad' => 'true'))->addStylesheetModule('dijit.themes.tundra')->addStylesheet('/css/custom.css')->addOnLoad('foo'); }