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


PHP Zend_Form::addDisplayGroup方法代码示例

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


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

示例1: nodeForm

 /**
  * Hook for node form - if type is Filemanager Node, add extra fields
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeForm(Zend_Form &$form, &$arguments)
 {
     $item =& array_shift($arguments);
     if (!Zend_Controller_Front::getInstance()->getRequest()->isXmlHttpRequest() && $item->type == "filemanager_file") {
         // Add Filemanager fields
         $form->setAttrib('enctype', 'multipart/form-data');
         $file = new Zend_Form_Element_File('filemanager_file');
         $file->setLabel("Select file")->setDestination(ZfApplication::$_data_path . DIRECTORY_SEPARATOR . "files")->setRequired(false);
         $form->addElement($file);
         $fields[] = 'filemanager_file';
         if ($item->id > 0) {
             // Fetch Filemanager object
             $factory = new Filemanager_File_Factory();
             $file_item = $factory->find($item->id)->current();
             if ($file_item) {
                 $existing = new Zend_Form_Element_Image('filemanager_image');
                 if (substr($file_item->mimetype, 0, 5) == "image") {
                     $imageid = $file_item->nid;
                 } else {
                     $imageid = 0;
                 }
                 $urlOptions = array('module' => 'filemanager', 'controller' => 'file', 'action' => 'show', 'id' => $imageid);
                 $existing->setImage(Zend_Controller_Front::getInstance()->getRouter()->assemble($urlOptions, 'default'));
                 $fields[] = 'filemanager_image';
             }
         }
         $options = array('legend' => Zoo::_("File upload"));
         $form->addDisplayGroup($fields, 'filemanager_fileupload', $options);
     } else {
         // Add content node image selector
     }
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:38,代码来源:Node.php

示例2: nodeForm

 /**
  * Hook for node form - if type is Guestbook Node, add extra fields
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeForm(Zend_Form &$form, &$arguments)
 {
     $item =& array_shift($arguments);
     if ($item->type == "guestbook_entry") {
         // Add guestbook fields
         $name = new Zend_Form_Element_Text('guestbook_name', array('size' => 35));
         $name->setLabel('Name');
         $name->setRequired(true);
         $email = new Zend_Form_Element_Text('guestbook_email', array('size' => 35));
         $email->setLabel('Email');
         $email->setRequired(true)->addValidator(new Zend_Validate_StringLength(6))->addValidator(new Zend_Validate_EmailAddress());
         $url = new Zend_Form_Element_Text('guestbook_homepage', array('size' => 35));
         $url->setLabel('Homepage');
         $url->setRequired(false)->addValidator(new Zend_Validate_StringLength(4))->addValidator(new Zend_Validate_Hostname());
         $form->addElements(array($name, $email, $url));
         $options = array('legend' => Zoo::_("Guest information"));
         $form->addDisplayGroup(array('guestbook_name', 'guestbook_email', 'guestbook_homepage'), 'guestbook_add', $options);
         if ($item->id > 0) {
             // Fetch guestbook object
             $factory = new Guestbook_Node_Factory();
             $guestbook = $factory->find($item->id)->current();
             if (!$guestbook) {
                 $guestbook = $factory->createRow();
             }
             $values = $guestbook->toArray();
             $populate = array();
             foreach ($values as $key => $value) {
                 $populate['guestbook_' . $key] = $value;
             }
             $form->populate($populate);
         }
     }
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:39,代码来源:Node.php

示例3: testAddElementToDisplayGroupByElementInstance

 public function testAddElementToDisplayGroupByElementInstance()
 {
     $element = new Zend_Form_Element_Text('foo');
     $this->form->addElement($element);
     $this->form->addDisplayGroup(array($element), 'bar');
     $this->assertNotNull($this->form->getDisplayGroup('bar')->getElement('foo'));
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:7,代码来源:FormTest.php

示例4: nodeForm

 /**
  * Hook for node form, add extra fields
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeForm(Zend_Form &$form, &$arguments)
 {
     $item =& array_shift($arguments);
     $content_type = Zoo::getService('content')->getType($item->type);
     if ($content_type->has_parent_url == 0) {
         $path = new Zend_Form_Element_Text('rewrite_path', array('size' => 65));
         $path->setLabel('URL');
         $form->addElement($path);
         $options = array('legend' => Zoo::_("URL Rewriting"));
         $form->addDisplayGroup(array('rewrite_path'), 'rewrite_path_options', $options);
         if ($item->id > 0) {
             $factory = new Rewrite_Path_Factory();
             $path = $factory->find($item->id)->current();
             if ($path) {
                 $form->populate(array('rewrite_path' => $path->path));
             } else {
                 // Find parent's path
                 if ($item->pid && ($path = $factory->find($item->pid)->current())) {
                     $form->populate(array('rewrite_path' => $path->path . "/" . $item->id));
                 } else {
                     $form->populate(array('rewrite_path' => $item->url()));
                 }
             }
         }
     }
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:32,代码来源:Node.php

示例5: getForm

 public function getForm()
 {
     $form = new Zend_Form();
     $form->addElement('text', 'foo')->addElement('text', 'bar')->addElement('text', 'baz')->addElement('text', 'bat');
     $subForm = new Zend_Form_SubForm();
     $subForm->addElement('text', 'foo')->addElement('text', 'bar')->addElement('text', 'baz')->addElement('text', 'bat');
     $form->addDisplayGroup(array('foo', 'bar'), 'foobar')->addSubForm($subForm, 'sub')->setView(new Zend_View());
     return $form;
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:9,代码来源:DojoTest.php

示例6: makeOptionCheckbox

 public function makeOptionCheckbox(Zend_Form $form, $elements, $label = 'Options', $displayGroupName = 'options')
 {
     foreach ($elements as $element) {
         $form->getElement($element)->setAttrib('noFormItem', true);
     }
     $form->addDisplayGroup($elements, $displayGroupName);
     $form->getDisplayGroup($displayGroupName)->setAttrib('class', 'form-checkbox')->setAttrib('formItem', 'true')->setLegend($label);
     return $form;
 }
开发者ID:netconstructor,项目名称:Centurion,代码行数:9,代码来源:GridForm.php

示例7: nodeForm

 /**
  * Hook for node form - if type is Estate Node, add extra fields
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeForm(Zend_Form &$form, &$arguments)
 {
     $item =& array_shift($arguments);
     $title = new Zend_Form_Element_Text('title', array('class' => 'content_title'));
     $title->setLabel('Title');
     $title->setRequired(true)->addValidator(new Zend_Validate_StringLength(2, 255));
     $content = new Zoo_Form_Element_Wysiwyg('content');
     $content->setRequired(false)->setLabel('Content')->setAttrib('cols', 50);
     $form->addElements(array($title, $content));
     $form->addDisplayGroup(array('title', 'content'), 'content_add', array('legend' => Zoo::_('Content')));
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $identity = Zend_Auth::getInstance()->getIdentity();
         $uid = $identity->id;
     } else {
         $uid = 0;
     }
     $filters = Zoo::getService('filter')->getFiltersByUser($uid);
     if ($filters && $filters->count() > 0) {
         foreach ($filters as $filter) {
             $options = array();
             if (!$filter->optional) {
                 $options = array('disabled' => 'disabled', 'value' => 1);
             } elseif ($item->id == 0) {
                 $options['value'] = $filter->default;
             }
             $ele = new Zend_Form_Element_Checkbox("filter_" . $filter->name, $options);
             $ele->setLabel($filter->name);
             $form->addElement($ele);
             $elements[] = "filter_" . $filter->name;
             $userfilters[$filter->id] = $filter;
         }
         $options = array('legend' => Zoo::_("Filters"));
         $form->addDisplayGroup($elements, 'filter_set', $options);
         if ($item->id > 0) {
             // Fetch set filters
             $filters = Zoo::getService('content')->getFilters($item);
             $populate = array();
             foreach ($filters as $filter) {
                 $populate['filter_' . $userfilters[$filter->filter_id]->name] = 1;
             }
             $form->populate($populate);
         }
     }
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:50,代码来源:Node.php

示例8: addDisplayGroup

 /**
  * @see Zend_Form::addDisplayGroup
  * 
  * @param array $elements
  * @param string $name
  * @param array|Zend_Config $options
  */
 public function addDisplayGroup(array $elements, $name = null, $options = null)
 {
     parent::addDisplayGroup($elements, $name, $options);
     if ($name != null && $name !== 'form-group-actions') {
         $displayGroup = $this->getDisplayGroup($name);
         if ($displayGroup instanceof Zend_Form_DisplayGroup) {
             $displayGroup->removeDecorator('DtDdWrapper');
             $displayGroup->removeDecorator('HtmlTag');
         }
     }
     return $this;
 }
开发者ID:cliftonscott,项目名称:zend-twitter-bootstrap,代码行数:19,代码来源:Form.php

示例9: testCanSetDisplayGroupPrefixPath

 public function testCanSetDisplayGroupPrefixPath()
 {
     $this->setupDisplayGroups();
     $this->form->addDisplayGroupPrefixPath('Zend_Foo', 'Zend/Foo/');
     $this->form->addDisplayGroup(array('test1', 'test2'), 'testgroup');
     foreach ($this->form->getDisplayGroups() as $group) {
         $loader = $group->getPluginLoader();
         $paths = $loader->getPaths('Zend_Foo');
         $this->assertFalse(empty($paths));
         $this->assertContains('Foo', $paths[0]);
     }
 }
开发者ID:vicfryzel,项目名称:zf,代码行数:12,代码来源:FormTest.php

示例10: 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

示例11: indexAction

 function indexAction()
 {
     $form = new Zend_Form();
     $form->setAction($_SERVER['REQUEST_URI'])->setMethod('post')->setAttrib("id", "formPublish");
     $jobs_per_categ = $form->createElement('text', 'jobs_per_categ')->setLabel('Job title:')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->addValidator('notEmpty')->setDescription('Ex: "Flash Designer" or "ASP.NET Programmer"')->setRequired(true);
     $submit = $form->createElement('submit', 'submit')->setLabel("Set");
     $config = Zend_Registry::get("conf");
     foreach ($this->textItems as $category => $items) {
         foreach ($items as $key => $label) {
             $item = $form->createElement('text', $key)->setLabel($label)->addValidator('notEmpty')->setRequired(true)->setValue($config->{$category}->{$key});
             $form->addElement($item);
         }
         $form->addDisplayGroup(array_keys($items), $category, array('legend' => ucfirst($category)));
     }
     foreach ($this->checkItems as $category => $items) {
         foreach ($items as $key => $label) {
             $item = $form->createElement('checkbox', $key)->setLabel($label)->setChecked($config->{$category}->{$key});
         }
         $form->getDisplayGroup($category)->addElement($item);
     }
     // Locale select
     $locales = Zend_Registry::get("Zend_Locale")->getTranslationList('language', 'en');
     foreach ($locales as $key => $value) {
         if (!file_exists("Joobsbox/Languages/{$key}")) {
             unset($locales[$key]);
         }
     }
     $locale = $form->createElement('select', 'locale')->setMultiOptions($locales)->setLabel($this->view->translate("Language"))->setValue($config->general->locale);
     $form->getDisplayGroup('general')->addElement($locale);
     // Timezone select
     $tzfile = file("config/timezones.ini.php");
     $timezones = array();
     foreach ($tzfile as $value) {
         $value = trim($value);
         $value = str_replace('"', '', $value);
         $timezones[$value] = $value;
     }
     $timezone = $form->createElement('select', 'site_timezone')->setMultiOptions($timezones)->setLabel($this->view->translate("Timezone"))->setValue($config->general->timezone);
     $form->getDisplayGroup('general')->addElement($timezone);
     $form->addElement($submit);
     $this->form = $form;
     $this->view->form = $form->render();
     if ($this->getRequest()->isPost()) {
         $this->validateForm();
         return;
     }
     $this->view->form = $this->form->render();
 }
开发者ID:joobsbox,项目名称:joobsbox,代码行数:48,代码来源:Settings.php

示例12: testAddElementToDisplayGroupByElementInstance

 /**
  * @group ZF-10491
  * @group ZF-10734
  * @group ZF-10731
  */
 public function testAddElementToDisplayGroupByElementInstance()
 {
     $element = new Zend_Form_Element_Text('foo');
     $elementTwo = new Zend_Form_Element_Text('baz-----');
     $this->form->addElements(array($element, $elementTwo));
     $this->form->addDisplayGroup(array($element, $elementTwo), 'bar');
     $displayGroup = $this->form->getDisplayGroup('bar');
     $this->assertNotNull($displayGroup->getElement('foo'));
     $this->assertNotNull($displayGroup->getElement('baz'));
     // clear display groups and elements
     $this->form->clearDisplayGroups()->clearElements();
     $this->form->addDisplayGroup(array($element, $elementTwo), 'bar');
     $displayGroup = $this->form->getDisplayGroup('bar');
     $this->assertNotNull($displayGroup->getElement('foo'));
     $this->assertNotNull($displayGroup->getElement('baz'));
 }
开发者ID:nbcutech,项目名称:o3drupal,代码行数:21,代码来源:FormTest.php

示例13: indexAction

 /**
  * The default action - show the home page
  */
 public function indexAction()
 {
     $this->view->messages = $this->_flashMessenger->getMessages();
     $loginForm = new Zend_Form();
     $unField = new Zend_Form_Element_Text('un');
     $unField->setLabel('User Name');
     $pwField = new Zend_Form_Element_Password('pw');
     $pwField->setLabel('Password');
     $loginForm->addElement($unField);
     $loginForm->addElement($pwField);
     $loginForm->addDisplayGroup(array('un', 'pw'), 'authGroup')->getDisplayGroup('authGroup')->setLegend('Authentication');
     //view specific form additions
     //TODO: not sure if $_SERVER['HTTP_HOST'] is dependable enough to use in this case .. XSS vulnerability
     //TODO: programmatically determine http/https
     $loginForm->setAction('http://' . $_SERVER['HTTP_HOST'] . $this->getFrontController()->getBaseUrl() . $this->_helper->url('authenticate'));
     $loginForm->addElement('submit', 'login');
     $this->view->loginForm = $loginForm;
 }
开发者ID:stm555,项目名称:proof-of-concepts,代码行数:21,代码来源:LoginController.php

示例14: nodeForm

 /**
  * Hook for node form - if type is Estate Node, add extra fields
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeForm(Zend_Form &$form, &$arguments)
 {
     $item =& array_shift($arguments);
     if ($item->type == "estate_node") {
         // Add estate fields
         $price = new Zend_Form_Element_Text('estate_price', array('size' => 10));
         $price->setLabel('Price');
         $price->setRequired(true)->addValidator(new Zend_Validate_Int());
         $area = new Zend_Form_Element_Text('estate_area', array('size' => 5));
         $area->setLabel('Area');
         $area->setRequired(true)->addValidator(new Zend_Validate_StringLength(1, 5))->addValidator(new Zend_Validate_Int());
         $rooms = new Zend_Form_Element_Text('estate_rooms', array('size' => 5));
         $rooms->setLabel('Rooms');
         $rooms->setRequired(true)->addValidator(new Zend_Validate_StringLength(1, 5))->addValidator(new Zend_Validate_Int());
         $floors = new Zend_Form_Element_Select('estate_floors');
         $floors->setLabel('Floors');
         $floors->addMultiOptions(array(1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '>5'));
         $year = new Zend_Form_Element_Text('estate_year');
         $year->setLabel('Built Year');
         $year->setRequired(true)->addValidator(new Zend_Validate_GreaterThan(1500))->addValidator(new Zend_Validate_Int());
         $ground = new Zend_Form_Element_Text('estate_ground');
         $ground->setLabel('Ground area');
         $ground->setRequired(true)->addValidator(new Zend_Validate_Int());
         $form->addElements(array($price, $area, $rooms, $floors, $year, $ground));
         $options = array('legend' => Zoo::_("Real estate information"));
         $form->addDisplayGroup(array('estate_price', 'estate_area', 'estate_rooms', 'estate_floors', 'estate_year', 'estate_ground'), 'estate_add', $options);
         if ($item->id > 0) {
             // Fetch estate object
             $factory = new Estate_Node_Factory();
             $estate = $factory->find($item->id)->current();
             if (!$estate) {
                 $estate = $factory->createRow();
             }
             $values = $estate->toArray();
             $populate = array();
             foreach ($values as $key => $value) {
                 $populate['estate_' . $key] = $value;
             }
             $form->populate($populate);
         }
     }
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:48,代码来源:Node.php

示例15: getRegistrationForm

 /**
  * Get registration form for a new user
  *
  * @return Zend_Form
  */
 function getRegistrationForm()
 {
     $form = new Zend_Form();
     $form->setAction("/register")->setMethod('post');
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('Username');
     $username->setRequired(true)->addValidator(new Zend_Validate_StringLength(2, 255));
     $password = new Zend_Form_Element_Password('password');
     $password->setRequired(true)->setLabel('Password');
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setLabel('Register');
     $form->addElements(array($username, $password));
     $form->addDisplayGroup(array('username', 'password'), 'user_register', array('legend' => Zoo::_('Register user')));
     try {
         Zoo::getService("hook")->trigger("User", "Registerform", $form);
     } catch (Zoo_Exception_Service $e) {
         // Hook service not available - log? Better not, some people may live happily without a hook service
     }
     $form->addElement($submit);
     return $form;
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:26,代码来源:User.php


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