コード例 #1
0
ファイル: Bootstrap.php プロジェクト: GemsTracker/MUtil
 /**
 * jQuery-enable a form instance
 *
 * @param  \Zend_Form $form
 * @return void
 * /
     public static function enableForm(\Zend_Form $form)
     {
    $form->addPrefixPath('MUtil_Bootstrap_Form_Decorator', 'MUtil/Bootstrap/Form/Decorator', 'decorator')
         ->addPrefixPath('MUtil_Bootstrap_Form_Element', 'MUtil/Bootstrap/Form/Element', 'element')
         ->addElementPrefixPath('MUtil_Bootstrap_Form_Decorator', 'MUtil/Bootstrap/Form/Decorator', 'decorator')
         ->addDisplayGroupPrefixPath('MUtil_Bootstrap_Form_Decorator', 'MUtil/Bootstrap/Form/Decorator');
 
    foreach ($form->getSubForms() as $subForm) {
        self::enableForm($subForm);
    }
 
    if (null !== ($view = $form->getView())) {
        self::enableView($view);
    }
     }
 
     /**
 * Bootstrap-enable a view instance
 *
 * @param  \Zend_View_Interface $view
 * @return void
 */
 public static function enableView(\Zend_View_Interface $view)
 {
     if (!\MUtil_JQuery::usesJQuery($view)) {
         \MUtil_JQuery::enableView($view);
     }
     if (false === $view->getPluginLoader('helper')->getPaths('MUtil_Bootstrap_View_Helper')) {
         $view->addHelperPath('MUtil/Bootstrap/View/Helper', 'MUtil_Bootstrap_View_Helper');
     }
     self::$_bootstrap = $view->bootstrap();
 }
コード例 #2
0
 public function setView(\Zend_View_Abstract $view)
 {
     if (isset($view->request) && $view->request instanceof \Zend_Controller_Request_Http) {
         $this->setBasePath($view->request->getBasePath());
     }
     if (!\MUtil_JQuery::usesJQuery($view)) {
         \ZendX_JQuery::enableView($view);
     }
     $this->view = $view;
 }
コード例 #3
0
 /**
  * Function called if specified in the Project.ini layoutPrepare section before
  * the layout is drawn, but after the rest of the program has run it's course.
  *
  * @return mixed If null nothing is set, otherwise the name of
  * the function is used as \Zend_View variable name.
  */
 protected function _layoutJQuery()
 {
     // JQUERY
     if (\MUtil_JQuery::usesJQuery($this->view)) {
         $jquery = $this->view->jQuery();
         $jquery->uiEnable();
         // enable user interface
         if (isset($this->project->jquerycss)) {
             foreach ((array) $this->project->jquerycss as $css) {
                 $jquery->addStylesheet($this->basepath->getBasePath() . '/' . $css);
             }
         }
         return true;
     }
 }