当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form::addPrefixPath方法代码示例

本文整理汇总了PHP中Zend_Form::addPrefixPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::addPrefixPath方法的具体用法?PHP Zend_Form::addPrefixPath怎么用?PHP Zend_Form::addPrefixPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form的用法示例。


在下文中一共展示了Zend_Form::addPrefixPath方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCanAddElementPluginLoaderPrefixPath

 public function testCanAddElementPluginLoaderPrefixPath()
 {
     $loader = $this->form->getPluginLoader('element');
     $this->form->addPrefixPath('Zend\\Foo', 'Zend/Foo/', 'element');
     $paths = $loader->getPaths('Zend\\Foo');
     $this->assertInstanceOf('Zend\\Stdlib\\SplStack', $paths);
     $this->assertContains('Foo', $paths->top());
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:8,代码来源:FormTest.php

示例2: testCanAddElementPluginLoaderPrefixPath

 public function testCanAddElementPluginLoaderPrefixPath()
 {
     $loader = $this->form->getPluginLoader('element');
     $this->form->addPrefixPath('Zend_Foo', 'Zend/Foo/', 'element');
     $paths = $loader->getPaths('Zend_Foo');
     $this->assertTrue(is_array($paths));
     $this->assertContains('Foo', $paths[0]);
 }
开发者ID:vicfryzel,项目名称:zf,代码行数:8,代码来源:FormTest.php

示例3: enableForm

 /**
  * Dojo-enable a form instance
  *
  * @param  Zend_Form $form
  * @return void
  */
 public static function enableForm(Zend_Form $form)
 {
     $form->addPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator', 'decorator')->addPrefixPath('Zend_Dojo_Form_Element', 'Zend/Dojo/Form/Element', 'element')->addElementPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator', 'decorator')->addDisplayGroupPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator')->setDefaultDisplayGroupClass('Zend_Dojo_Form_DisplayGroup');
     foreach ($form->getSubForms() as $subForm) {
         self::enableForm($subForm);
     }
     if (null !== ($view = $form->getView())) {
         self::enableView($view);
     }
 }
开发者ID:georgepaul,项目名称:socialstrap,代码行数:16,代码来源:Dojo.php

示例4: enableForm

 /**
  * jQuery-enable a form instance
  *
  * @param  \Zend_Form $form
  * @return void
  */
 public static function enableForm(\Zend_Form $form)
 {
     $form->addPrefixPath('ZendX_JQuery_Form_Decorator', 'ZendX/JQuery/Form/Decorator', 'decorator')->addPrefixPath('ZendX_JQuery_Form_Element', 'ZendX/JQuery/Form/Element', 'element')->addElementPrefixPath('ZendX_JQuery_Form_Decorator', 'ZendX/JQuery/Form/Decorator', 'decorator')->addDisplayGroupPrefixPath('ZendX_JQuery_Form_Decorator', 'ZendX/JQuery/Form/Decorator');
     foreach ($form->getSubForms() as $subForm) {
         self::enableForm($subForm);
     }
     if (null !== ($view = $form->getView())) {
         self::enableView($view);
     }
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:16,代码来源:JQuery.php

示例5: setFormDefaults

 /**
  * Set Form defaults
  * - disable default decorators
  * - set form & displaygroup decorators
  * - set needed prefix path for bootstrap decorators
  * - set form element decorators
  *
  * @param Zend_Form $form The form instance.
  * @param string $format Standard, minimal, table.
  *
  * @return void
  */
 protected static function setFormDefaults(Zend_Form $form, $format)
 {
     $form->setDisableLoadDefaultDecorators(true);
     $form->setDisplayGroupDecorators(self::$_DisplayGroupDecorator[$format]);
     $form->setDecorators(self::$_FormDecorator[$format]);
     if (self::BOOTSTRAP == $format || self::BOOTSTRAP_MINIMAL == $format) {
         $form->addElementPrefixPath('Dfi_Form_Decorator', 'Dfi/Form/Decorator', Zend_Form::DECORATOR);
         $form->addPrefixPath('Dfi_Form_Decorator', 'Dfi/Form/Decorator', Zend_Form::DECORATOR);
     }
     $form->setElementDecorators(self::$_ElementDecorator[$format]);
     return;
 }
开发者ID:dafik,项目名称:dfi,代码行数:24,代码来源:Decorator.php

示例6: initForm

 /**
  * initForm
  * @author Thomas Schedler <tsh@massiveart.com>
  * @version 1.0
  */
 protected function initForm()
 {
     $this->objForm = new Zend_Form();
     /**
      * Use our own PluginLoader
      */
     $objLoader = new PluginLoader();
     $objLoader->setPluginLoader($this->objForm->getPluginLoader(PluginLoader::TYPE_FORM_ELEMENT));
     $objLoader->setPluginType(PluginLoader::TYPE_FORM_ELEMENT);
     $this->objForm->setPluginLoader($objLoader, PluginLoader::TYPE_FORM_ELEMENT);
     /**
      * clear all decorators
      */
     $this->objForm->clearDecorators();
     /**
      * add standard decorators
      */
     $this->objForm->addDecorator('TabContainer');
     $this->objForm->addDecorator('FormElements');
     $this->objForm->addDecorator('Form');
     /**
      * add form prefix path
      */
     $this->objForm->addPrefixPath('Form_Decorator', GLOBAL_ROOT_PATH . 'library/massiveart/generic/forms/decorators/', 'decorator');
     /**
      * elements prefixes
      */
     $this->objForm->addElementPrefixPath('Form_Decorator', GLOBAL_ROOT_PATH . 'library/massiveart/generic/forms/decorators/', 'decorator');
     /**
      * regions prefixes
      */
     $this->objForm->addDisplayGroupPrefixPath('Form_Decorator', GLOBAL_ROOT_PATH . 'library/massiveart/generic/forms/decorators/');
     $this->objForm->setAttrib('id', 'genForm');
     $this->objForm->setAttrib('onsubmit', 'return false;');
     $this->objForm->addElement('hidden', 'id', array('decorators' => array('Hidden')));
     $this->objForm->addElement('text', 'title', array('label' => $this->core->translate->_('title', false), 'decorators' => array('Input'), 'columns' => 12, 'class' => 'text keyfield', 'required' => true));
     $this->objForm->addElement('text', 'key', array('label' => $this->core->translate->_('key', false), 'decorators' => array('Input'), 'columns' => 12, 'class' => 'text', 'required' => true));
     $this->objForm->addDisplayGroup(array('title', 'key'), 'main-resource');
     $this->objForm->getDisplayGroup('main-resource')->setLegend($this->core->translate->_('General_information', false));
     $this->objForm->getDisplayGroup('main-resource')->setDecorators(array('FormElements', 'Region'));
     $arrGroups = array();
     $sqlStmt = $this->core->dbh->query("SELECT `id`, `title` FROM `groups` ORDER BY `title`")->fetchAll();
     foreach ($sqlStmt as $arrSql) {
         $arrGroups[$arrSql['id']] = $arrSql['title'];
     }
     $this->objForm->addElement('multiCheckbox', 'groups', array('label' => $this->core->translate->_('groups', false), 'value' => $this->arrGroups, 'decorators' => array('Input'), 'columns' => 6, 'class' => 'multiCheckbox', 'MultiOptions' => $arrGroups));
     $this->objForm->addDisplayGroup(array('groups'), 'groups-group');
     $this->objForm->getDisplayGroup('groups-group')->setLegend($this->core->translate->_('Resource_groups', false));
     $this->objForm->getDisplayGroup('groups-group')->setDecorators(array('FormElements', 'Region'));
 }
开发者ID:BGCX261,项目名称:zoolu-svn-to-git,代码行数:55,代码来源:ResourceController.php

示例7: addSubForm

 /**
  * Add a form group/subform
  *
  * @param  Zend_Form $form
  * @param  string $name
  * @param  int $order
  * @return Zend_Form
  */
 public function addSubForm(Zend_Form $form, $name, $order = null)
 {
     $name = (string) $name;
     foreach ($this->_loaders as $type => $loader) {
         $loaderPaths = $loader->getPaths();
         foreach ($loaderPaths as $prefix => $paths) {
             foreach ($paths as $path) {
                 $form->addPrefixPath($prefix, $path, $type);
             }
         }
     }
     if (!empty($this->_elementPrefixPaths)) {
         foreach ($this->_elementPrefixPaths as $spec) {
             list($prefix, $path, $type) = array_values($spec);
             $form->addElementPrefixPath($prefix, $path, $type);
         }
     }
     if (!empty($this->_displayGroupPrefixPaths)) {
         foreach ($this->_displayGroupPrefixPaths as $spec) {
             list($prefix, $path) = array_values($spec);
             $form->addDisplayGroupPrefixPath($prefix, $path);
         }
     }
     if (null !== $order) {
         $form->setOrder($order);
     }
     if (($oldName = $form->getName()) && $oldName !== $name && $oldName === $form->getElementsBelongTo()) {
         $form->setElementsBelongTo($name);
     }
     $form->setName($name);
     $form->setParent($name, $this->getParent());
     $this->_subForms[$name] = $form;
     $this->_order[$name] = $order;
     $this->_orderUpdated = true;
     return $this;
 }
开发者ID:Tony133,项目名称:zf-web,代码行数:44,代码来源:Form.php

示例8: addSubForm

 /**
  * Add a form group/subform
  * 
  * @param  Zend_Form $form 
  * @param  string $name 
  * @param  int $order 
  * @return Zend_Form
  */
 public function addSubForm(Zend_Form $form, $name, $order = null)
 {
     $name = (string) $name;
     foreach ($this->_loaders as $type => $loader) {
         $loaderPaths = $loader->getPaths();
         foreach ($loaderPaths as $prefix => $paths) {
             foreach ($paths as $path) {
                 $form->addPrefixPath($prefix, $path, $type);
             }
         }
     }
     if (!empty($this->_elementPrefixPaths)) {
         foreach ($this->_elementPrefixPaths as $spec) {
             list($prefix, $path, $type) = $spec;
             $form->addElementPrefixPath($prefix, $path, $spec);
         }
     }
     if (!empty($this->_displayGroupPrefixPaths)) {
         foreach ($this->_displayGroupPrefixPaths as $spec) {
             list($prefix, $path) = $spec;
             $form->addDisplayGroupPrefixPath($prefix, $path);
         }
     }
     $this->_subForms[$name] = $form;
     $this->_order[$name] = $order;
     $this->_orderUpdated = true;
     return $this;
 }
开发者ID:dalinhuang,项目名称:popo,代码行数:36,代码来源:Form.php

示例9: enableForm

 public static function enableForm(Zend_Form $form)
 {
     $form->addPrefixPath('Fields_Form_Element', APPLICATION_PATH . '/application/modules/Fields/Form/Element', 'element');
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:4,代码来源:Standard.php

示例10: enableForm

 /**
  * Adds paths to an existing form
  * 
  * @param Zend_Form $form
  */
 public static function enableForm(Zend_Form $form)
 {
     $form->addPrefixPath('Khcn_Form_Decorator', 'Khcn/Form/Decorator', 'decorator')->addPrefixPath('Khcn_Form_Element', 'Khcn/Form/Element', 'element')->addElementPrefixPath('Khcn_Form_Decorator', 'Khcn/Form/Decorator', 'decorator')->addDisplayGroupPrefixPath('Khcn_Form_Decorator', 'Khcn/Form/Decorator')->setDefaultDisplayGroupClass('Khcn_Form_DisplayGroup');
 }
开发者ID:nhochong,项目名称:qlkh-sgu,代码行数:9,代码来源:Form.php

示例11: init

 public static function init(Zend_Form $form)
 {
     $form->addPrefixPath('Zmz_Form_', 'Zmz/Form/');
     //        $form->addElementPrefixPath('Zmz_Form_Decorator_', 'ZMZ/Form/Decorator/', 'decorator');
 }
开发者ID:massimozappino,项目名称:zmz,代码行数:5,代码来源:Initialize.php

示例12: testAddingPrefixPathsWithBackslashWillLoadNamespacedPlugins

 /**
  * @group ZF-12173
  */
 public function testAddingPrefixPathsWithBackslashWillLoadNamespacedPlugins()
 {
     if (version_compare(PHP_VERSION, '5.3.0', '<')) {
         $this->markTestSkipped(__CLASS__ . '::' . __METHOD__ . ' requires PHP 5.3.0 or greater');
         return;
     }
     $form = new Zend_Form();
     $form->addPrefixPath('Zf\\Foo', 'Zf/Foo');
     foreach (array('element', 'decorator') as $type) {
         $loader = $form->getPluginLoader($type);
         $paths = $loader->getPaths('Zf\\Foo\\' . ucfirst($type));
         $this->assertTrue(is_array($paths), "Failed for type {$type}: " . var_export($paths, 1));
         $this->assertFalse(empty($paths));
         $this->assertContains('Foo', $paths[0]);
     }
 }
开发者ID:baofeng-beijing,项目名称:zf1.11.x,代码行数:19,代码来源:FormTest.php

示例13: initForm

 /**
  * initForm
  * @author Thomas Schedler <tsh@massiveart.com>
  * @version 1.0
  */
 protected function initForm()
 {
     $this->objForm = new Zend_Form();
     /**
      * Use our own PluginLoader
      */
     $objLoader = new PluginLoader();
     $objLoader->setPluginLoader($this->objForm->getPluginLoader(PluginLoader::TYPE_FORM_ELEMENT));
     $objLoader->setPluginType(PluginLoader::TYPE_FORM_ELEMENT);
     $this->objForm->setPluginLoader($objLoader, PluginLoader::TYPE_FORM_ELEMENT);
     /**
      * clear all decorators
      */
     $this->objForm->clearDecorators();
     /**
      * add standard decorators
      */
     $this->objForm->addDecorator('TabContainer');
     $this->objForm->addDecorator('FormElements');
     $this->objForm->addDecorator('Form');
     /**
      * add form prefix path
      */
     $this->objForm->addPrefixPath('Form_Decorator', GLOBAL_ROOT_PATH . 'library/massiveart/generic/forms/decorators/', 'decorator');
     /**
      * elements prefixes
      */
     $this->objForm->addElementPrefixPath('Form_Decorator', GLOBAL_ROOT_PATH . 'library/massiveart/generic/forms/decorators/', 'decorator');
     /**
      * regions prefixes
      */
     $this->objForm->addDisplayGroupPrefixPath('Form_Decorator', GLOBAL_ROOT_PATH . 'library/massiveart/generic/forms/decorators/');
     $arrGroupTypeOptions = array();
     $sqlStmt = $this->core->dbh->query("SELECT `id`, `title` FROM `groupTypes`")->fetchAll();
     foreach ($sqlStmt as $arrSql) {
         $arrGroupTypeOptions[$arrSql['id']] = ucfirst($arrSql['title']);
     }
     $this->objForm->setAttrib('id', 'genForm');
     $this->objForm->setAttrib('onsubmit', 'return false;');
     $this->objForm->addElement('hidden', 'id', array('decorators' => array('Hidden')));
     $this->objForm->addElement('text', 'title', array('label' => $this->core->translate->_('title', false), 'decorators' => array('Input'), 'columns' => 12, 'class' => 'text keyfield', 'required' => true));
     $this->objForm->addElement('text', 'key', array('label' => $this->core->translate->_('key', false), 'decorators' => array('Input'), 'columns' => 12, 'class' => 'text', 'required' => true));
     $this->objForm->addElement('textarea', 'description', array('label' => $this->core->translate->_('description', false), 'decorators' => array('Input'), 'columns' => 12, 'class' => 'text'));
     $this->objForm->addElement('multiCheckbox', 'groupTypes', array('label' => $this->core->translate->_('groupTypes', false), 'value' => $this->arrGroupTypes, 'decorators' => array('Input'), 'columns' => 6, 'class' => 'multiCheckbox', 'MultiOptions' => $arrGroupTypeOptions));
     $this->objForm->addDisplayGroup(array('title', 'key', 'description', 'groupTypes'), 'main-group', array('columns' => 9));
     $this->objForm->getDisplayGroup('main-group')->setLegend($this->core->translate->_('General_information', false));
     $this->objForm->getDisplayGroup('main-group')->setDecorators(array('FormElements', 'Region'));
     $arrPermissionOptions = array();
     $sqlStmt = $this->core->dbh->query("SELECT `id`, UCASE(`title`) AS title FROM `permissions`")->fetchAll();
     foreach ($sqlStmt as $arrSql) {
         $arrPermissionOptions[$arrSql['id']] = $arrSql['title'];
     }
     $arrLanguageOptions = array();
     $arrLanguageOptions['0'] = $this->core->translate->_('All_languages', false);
     $sqlStmt = $this->core->dbh->query("SELECT `id`, `title` FROM `languages`")->fetchAll();
     foreach ($sqlStmt as $arrSql) {
         $arrLanguageOptions[$arrSql['id']] = $arrSql['title'];
     }
     $strRegionInstances = '';
     $intRegionCounter = 0;
     /**
      * create group permisson regions
      */
     foreach ($this->arrPermissions as $arrPermission) {
         $intRegionCounter++;
         $this->objForm->addElement('radio', 'language_' . $intRegionCounter, array('label' => $this->core->translate->_('language', false), 'value' => $arrPermission['language'], 'decorators' => array('Input'), 'columns' => 6, 'class' => 'radio', 'MultiOptions' => $arrLanguageOptions));
         $this->objForm->addElement('multiCheckbox', 'permissions_' . $intRegionCounter, array('label' => $this->core->translate->_('permissions', false), 'value' => $arrPermission['permissions'], 'decorators' => array('Input'), 'columns' => 6, 'class' => 'multiCheckbox', 'MultiOptions' => $arrPermissionOptions));
         $this->objForm->addDisplayGroup(array('language_' . $intRegionCounter, 'permissions_' . $intRegionCounter), 'Permission_' . $intRegionCounter, array('columns' => 9, 'regionTypeId' => 1, 'collapsable' => 0, 'regionCounter' => $intRegionCounter, 'regionId' => 'Permission', 'regionExt' => $intRegionCounter, 'isMultiply' => true, 'regionTitle' => $this->core->translate->_('Language_specific', false)));
         $this->objForm->getDisplayGroup('Permission_' . $intRegionCounter)->setLegend($this->core->translate->_('Permissions', false));
         $this->objForm->getDisplayGroup('Permission_' . $intRegionCounter)->setDecorators(array('FormElements', 'Region'));
         $strRegionInstances .= '[' . $intRegionCounter . ']';
     }
     $this->objForm->addElement('radio', 'language_REPLACE_n', array('label' => $this->core->translate->_('language', false), 'decorators' => array('Input'), 'columns' => 6, 'class' => 'radio', 'MultiOptions' => $arrLanguageOptions));
     $this->objForm->addElement('multiCheckbox', 'permissions_REPLACE_n', array('label' => $this->core->translate->_('permissions', false), 'decorators' => array('Input'), 'columns' => 6, 'class' => 'multiCheckbox', 'MultiOptions' => $arrPermissionOptions));
     $this->objForm->addDisplayGroup(array('language_REPLACE_n', 'permissions_REPLACE_n'), 'Permission_REPLACE_n', array('columns' => 9, 'regionTypeId' => 1, 'collapsable' => 0, 'regionId' => 'Permission', 'regionExt' => 'REPLACE_n', 'isMultiply' => true, 'isEmptyWidget' => true, 'regionTitle' => $this->core->translate->_('Language_specific', false)));
     $this->objForm->getDisplayGroup('Permission_REPLACE_n')->setLegend('Rechte');
     $this->objForm->getDisplayGroup('Permission_REPLACE_n')->setDecorators(array('FormElements', 'Region'));
     $this->objForm->addElement('hidden', 'Region_Permission_Instances', array('value' => $strRegionInstances, 'decorators' => array('Hidden')));
     $this->objForm->addElement('hidden', 'Region_Permission_Order', array('value' => '', 'decorators' => array('Hidden')));
 }
开发者ID:BGCX261,项目名称:zoolu-svn-to-git,代码行数:85,代码来源:GroupController.php


注:本文中的Zend_Form::addPrefixPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。