public function render() { $render = ''; if (!is_array($this->_config['options'])) { $this->_config['options'] = array_combine($this->_extra[$this->_config['options']], $this->_extra[$this->_config['options']]); } switch ($this->_config['format']) { case 'select': // Multiple if ($this->_config['multiple']) { $render = Form::select($this->_name . '[]', $this->_config['options'], (array) $this->_value, $this->_attributes + array('id' => $this->_id)); break; } // Multichoice if ($this->_config['multichoice']) { $render = ZForm::multichoice($this->_name, $this->_config['options'], $this->_value, $this->_attributes + array('id' => $this->_id)); break; } // Single $render = Form::select($this->_name, $this->_config['options'], $this->_value, $this->_attributes + array('id' => $this->_id)); break; default: $first = true; $i = 0; foreach ($this->_config['options'] as $option => $label) { $render .= '<span class="enum-item">'; $id = $first ? $this->_id : $this->_id . '_' . $i++; // Multiple (checkboxes) if ($this->_config['multiple']) { $render .= Form::checkbox($this->_name . '[' . $option . ']', $option, in_array($option, $this->_value), $this->_attributes + array('id' => $id)); } else { $render .= Form::radio($this->_name, $option, $this->_value == $option or $first and !$this->_value, $this->_attributes + array('id' => $id)); } $render .= Form::label($id, $label); $render .= '</span>'; $first = false; } $render = '<div class="enum">' . $render . '</div>'; } return $render; }
<?php defined('SYSPATH') or die('No direct script access.'); $config['date']['months'] = array_combine(range(1, 12), array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')); $config['date']['days'] = array_combine(range(1, 31), range(1, 31)); $config['date']['years'] = array_combine(range(date('Y') - 60, date('Y') + 5), range(date('Y') - 60, date('Y') + 5)); $config['date']['hours'] = array_combine(range(1, 12), ZForm::zerofill(range(1, 12))); $config['date']['minutes'] = array_combine(range(0, 59), ZForm::zerofill(range(0, 59))); $config['date']['seconds'] = array_combine(range(0, 59), ZForm::zerofill(range(0, 59))); $config['date']['meridiens'] = array('AM' => 'AM', 'PM' => 'PM'); return $config;