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


PHP HTML_QuickForm2::addSelect方法代码示例

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


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

示例1: read_preset_form

 /**
  * read_preset_form generates a quickform-object to choose the announcement-preset,
  * if validated redirect to announcement.php?id=new&cid=$id
  * 
  * @param object $calendar the actual calendarentry
  * @return object quickform-object to choose the preset, if validated redirect to new announcement
  */
 private function read_preset_form(&$calendar)
 {
     // check sort or from/to
     $sort = $from = $to = '';
     if ($this->get('sort') !== false) {
         $sort = "&sort=" . $this->get('sort');
     }
     if ($this->get('from') !== false) {
         $from = "&from=" . $this->get('from');
     }
     if ($this->get('to') !== false) {
         $to = "&to=" . $this->get('to');
     }
     // form-object
     $form = new HTML_QuickForm2('choose_preset_' . $calendar->get_id(), 'post', array('name' => 'choose_preset_' . $calendar->get_id(), 'action' => 'calendar.php?id=listall' . $sort . $from . $to));
     // add selectfield
     $select = $form->addSelect('preset', array());
     $options = array(0 => parent::lang('class.CalendarView#read_preset_form#select#choosePreset'));
     $options = $options + Preset::read_all_presets('calendar');
     $select->loadOptions($options);
     $select->addRule('callback', parent::lang('class.CalendarView#read_preset_form#rule#select'), array($this, 'callback_check_select'));
     // add submit
     $submit = $form->addSubmit('submit', array('value' => parent::lang('class.CalendarView#read_preset_form#select#submit')));
     // validate
     if ($form->validate()) {
         // get data
         $data = $form->getValue();
         // insert preset_id in calendar-entry
         $update = array('preset_id' => $data['preset']);
         $calendar->update($update);
         $calendar->write_db('update');
         // redirect to listall
         header('Location: calendar.php?id=listall' . $sort . $from . $to);
         exit;
     } else {
         return $form;
     }
 }
开发者ID:BackupTheBerlios,项目名称:judointranet,代码行数:45,代码来源:class.CalendarView.php

示例2: testBug20295

 /**
  * If data source contains explicitly provided null values, those should be used
  * @link http://pear.php.net/bugs/bug.php?id=20295
  */
 public function testBug20295()
 {
     $form = new HTML_QuickForm2('bug20295');
     $ms = $form->addSelect('multiselect', array('multiple'))->loadOptions(array('one' => 'First option', 'two' => 'Second option'))->setValue(array('two'));
     // data source searching should stop on finding this null
     $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('multiselect' => null)));
     $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('multiselect' => array('one'))));
     $this->assertNull($ms->getValue());
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:13,代码来源:SelectTest.php

示例3: testSelectMultipleRecursive

 public function testSelectMultipleRecursive()
 {
     $form = new HTML_QuickForm2('filters', 'post', null, false);
     $select = $form->addSelect('baz', array('multiple' => 'multiple'))->loadOptions(array('VALUE1' => 'VALUE1', 'VALUE2' => 'VALUE2', 'VALUE3' => 'VALUE3'));
     $select->addRecursiveFilter('strtolower');
     $this->assertEquals(array('value1', 'value2'), $select->getValue());
 }
开发者ID:andreaswarnaar,项目名称:HTML_QuickForm2.1,代码行数:7,代码来源:FilterTest.php


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