diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Dojo/View/Helper/Dojo.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Dojo/View/Helper/Dojo.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,176 @@ +_container = $registry[__CLASS__]; + } + + /** + * 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); + } + + /** + * Return dojo container + * + * @return Zend_Dojo_View_Helper_Dojo_Container + */ + public function dojo() + { + return $this->_container; + } + + /** + * Proxy to container methods + * + * @param string $method + * @param array $args + * @return mixed + * @throws Zend_Dojo_View_Exception For invalid method calls + */ + public function __call($method, $args) + { + if (!method_exists($this->_container, $method)) { + require_once 'Zend/Dojo/View/Exception.php'; + throw new Zend_Dojo_View_Exception(sprintf('Invalid method "%s" called on dojo view helper', $method)); + } + + return call_user_func_array(array($this->_container, $method), $args); + } + + /** + * Set whether or not dijits should be created declaratively + * + * @return void + */ + public static function setUseDeclarative() + { + self::$_useProgrammatic = false; + } + + /** + * Set whether or not dijits should be created programmatically + * + * Optionally, specifiy whether or not dijit helpers should generate the + * programmatic dojo. + * + * @param int $style + * @return void + */ + public static function setUseProgrammatic($style = self::PROGRAMMATIC_SCRIPT) + { + if (!in_array($style, array(self::PROGRAMMATIC_SCRIPT, self::PROGRAMMATIC_NOSCRIPT))) { + $style = self::PROGRAMMATIC_SCRIPT; + } + self::$_useProgrammatic = $style; + } + + /** + * Should dijits be created declaratively? + * + * @return bool + */ + public static function useDeclarative() + { + return (false === self::$_useProgrammatic); + } + + /** + * Should dijits be created programmatically? + * + * @return bool + */ + public static function useProgrammatic() + { + return (false !== self::$_useProgrammatic); + } + + /** + * Should dijits be created programmatically but without scripts? + * + * @return bool + */ + public static function useProgrammaticNoScript() + { + return (self::PROGRAMMATIC_NOSCRIPT === self::$_useProgrammatic); + } +}