當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。