Changeset 1465
- Timestamp:
- 12/08/2007 01:25:35 AM (13 months ago)
- Location:
- trunk/modules/forge
- Files:
-
- 2 modified
-
controllers/forge_demo.php (modified) (1 diff)
-
libraries/Form_Dateselect.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/forge/controllers/forge_demo.php
r1464 r1465 27 27 $form->checklist('foods')->label('Favorite Foods')->options($foods)->rules('required'); 28 28 $form->dropdown('state')->label('Home State')->options(locale_US::states())->rules('required'); 29 $form->dateselect('birthday')->label(TRUE)->minutes( 5);29 $form->dateselect('birthday')->label(TRUE)->minutes(15)->years(1950, date('Y')); 30 30 $form->submit('Save'); 31 31 -
trunk/modules/forge/libraries/Form_Dateselect.php
r1464 r1465 14 14 protected $parts = array 15 15 ( 16 'month' => NULL,17 'day' => 1,18 'year' => NULL,16 'month' => array(), 17 'day' => array(1), 18 'year' => array(), 19 19 ' @ ', 20 'hour' => NULL,20 'hour' => array(), 21 21 ':', 22 'minute' => 5,23 'am_pm' => NULL,22 'minute' => array(5), 23 'am_pm' => array(), 24 24 ); 25 25 … … 38 38 { 39 39 // Set options for date generation 40 $this->parts[substr($method, 0, -1)] = $args [0];40 $this->parts[substr($method, 0, -1)] = $args; 41 41 return $this; 42 42 } … … 57 57 58 58 $input = ''; 59 foreach($this->parts as $type => $ option)59 foreach($this->parts as $type => $val) 60 60 { 61 61 if (is_int($type)) 62 62 { 63 63 // Just add the separators 64 $input .= $ option;64 $input .= $val; 65 65 continue; 66 66 } … … 83 83 84 84 // Use the date helper to generate the options 85 $options = ($option === NULL) ? date::$type() : date::$type($option);85 $options = empty($val) ? date::$type() : call_user_func_array(array('date', $type), $val); 86 86 } 87 87 … … 101 101 102 102 // Minutes should always be in 5 minute increments 103 $time['minute'] = num::round($time['minute'], $this->parts['minute']);103 $time['minute'] = num::round($time['minute'], current($this->parts['minute'])); 104 104 105 105 return $time;
