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

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

00001 <?php
00026 require_once "Zend/Json.php";
00027 
00036 class ZendX_JQuery
00037 {
00043     const DEFAULT_JQUERY_VERSION = "1.3.2";
00044 
00050     const DEFAULT_UI_VERSION = "1.7.1";
00051 
00056     const CDN_BASE_GOOGLE = 'http://ajax.googleapis.com/ajax/libs/';
00057 
00062     const CDN_BASE_GOOGLE_SSL = 'https://ajax.googleapis.com/ajax/libs/';
00063 
00067     const CDN_SUBFOLDER_JQUERY = 'jquery/';
00068 
00072     const CDN_SUBFOLDER_JQUERYUI = 'jqueryui/';
00073 
00081     const CDN_JQUERY_PATH_GOOGLE = '/jquery.min.js';
00082 
00091     const RENDER_LIBRARY         = 1;
00092     const RENDER_SOURCES         = 2;
00093     const RENDER_STYLESHEETS     = 4;
00094     const RENDER_JAVASCRIPT      = 8;
00095     const RENDER_JQUERY_ON_LOAD  = 16;
00096     const RENDER_ALL             = 255;
00097 
00104     public static function enableView(Zend_View_Interface $view)
00105     {
00106         if (false === $view->getPluginLoader('helper')->getPaths('ZendX_JQuery_View_Helper')) {
00107             $view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
00108         }
00109     }
00110 
00117     public static function enableForm(Zend_Form $form)
00118     {
00119         $form->addPrefixPath('ZendX_JQuery_Form_Decorator', 'ZendX/JQuery/Form/Decorator', 'decorator')
00120              ->addPrefixPath('ZendX_JQuery_Form_Element', 'ZendX/JQuery/Form/Element', 'element')
00121              ->addElementPrefixPath('ZendX_JQuery_Form_Decorator', 'ZendX/JQuery/Form/Decorator', 'decorator')
00122              ->addDisplayGroupPrefixPath('ZendX_JQuery_Form_Decorator', 'ZendX/JQuery/Form/Decorator');
00123 
00124         foreach ($form->getSubForms() as $subForm) {
00125             self::enableForm($subForm);
00126         }
00127 
00128         if (null !== ($view = $form->getView())) {
00129             self::enableView($view);
00130         }
00131     }
00132 
00143     public static function encodeJson($value)
00144     {
00145         if (is_array($value) && count($value) == 0) {
00146             return '{}';
00147         }
00148 
00149         if(!class_exists('Zend_Json')) {
00153             require_once "Zend/Json.php";
00154         }
00155         return Zend_Json::encode($value, false, array('enableJsonExprFinder' => true));
00156     }
00157 }

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