• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List

E:/E/GEAMP/www/openbiz/openbiz/others/ZendX/JQuery/View/Helper/JQuery.php

00001 <?php
00026 require_once "ZendX/JQuery.php";
00027 
00031 require_once 'Zend/Registry.php';
00032 
00036 require_once 'Zend/View/Helper/Abstract.php';
00037 
00041 require_once "ZendX/JQuery/View/Helper/JQuery/Container.php";
00042 
00052 class ZendX_JQuery_View_Helper_JQuery extends Zend_View_Helper_Abstract
00053 {
00057     public $view;
00058 
00065     private static $noConflictMode = false;
00066 
00075     public function __construct()
00076     {
00077         $registry = Zend_Registry::getInstance();
00078         if (!isset($registry[__CLASS__])) {
00079             require_once 'ZendX/JQuery/View/Helper/JQuery/Container.php';
00080             $container = new ZendX_JQuery_View_Helper_JQuery_Container();
00081             $registry[__CLASS__] = $container;
00082         }
00083         $this->_container = $registry[__CLASS__];
00084     }
00085 
00091     public function jQuery()
00092     {
00093         return $this->_container;
00094     }
00095 
00102     public function setView(Zend_View_Interface $view)
00103     {
00104         $this->view = $view;
00105         $this->_container->setView($view);
00106     }
00107 
00116     public function __call($method, $args)
00117     {
00118         if (!method_exists($this->_container, $method)) {
00119             require_once 'Zend/View/Exception.php';
00120             throw new Zend_View_Exception(sprintf('Invalid method "%s" called on jQuery view helper', $method));
00121         }
00122 
00123         return call_user_func_array(array($this->_container, $method), $args);
00124     }
00125 
00133     public static function enableNoConflictMode()
00134     {
00135        self::$noConflictMode = true;
00136     }
00137 
00143     public static function disableNoConflictMode()
00144     {
00145        self::$noConflictMode = false;
00146     }
00147 
00153     public static function getNoConflictMode()
00154     {
00155        return self::$noConflictMode;
00156     }
00157 
00163     public static function getJQueryHandler()
00164     {
00165         return ((self::getNoConflictMode()==true)?'$j':'$');
00166     }
00167 }

Generated on Thu Apr 19 2012 17:01:18 for openbiz by  doxygen 1.7.2