/** * @param bool $leading_zero * @param array $input_settings */ function __construct($leading_zero = false, $input_settings = array()) { if ($leading_zero) { $select_options = array('01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05', '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10', '11' => '11', '12' => '12'); } else { $select_options = array(1 => '01', 2 => '02', 3 => '03', 4 => '04', 5 => '05', 6 => '06', 7 => '07', 8 => '08', 9 => '09', 10 => '10', 11 => '11', 12 => '12'); } parent::__construct($select_options, $input_settings); }
public function test_display_flat_multidimensional_array() { $input = new EE_Select_Input(array('code_var_names' => array('foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz'), 'primates' => array('chimp' => 'Chimp', 'orangutan' => 'Orangutan', 'baboon' => 'Baboon'))); $expected_output = ' <select id="" name="" class="" style=""> <optgroup label="code_var_names"> <option value="foo">Foo</option> <option value="bar">Bar</option> <option value="baz">Baz</option> </optgroup> <optgroup label="primates"> <option value="chimp">Chimp</option> <option value="orangutan">Orangutan</option> <option value="baboon">Baboon</option> </optgroup> </select>'; $this->assertEquals($expected_output, $input->get_html_for_input()); }
/** * @param bool $leading_zero * @param array $input_settings * @param bool $january_is_month_1 whether january should have value of 1; or it should be month 0 */ function __construct($leading_zero = false, $input_settings = array(), $january_is_month_1 = true) { $key_begin_range = $january_is_month_1 ? 1 : 0; $key_range = range($key_begin_range, $key_begin_range + 11); if ($leading_zero) { array_walk($key_range, array($this, '_zero_pad')); } $value_range = range(1, 12); array_walk($value_range, array($this, '_zero_pad')); parent::__construct(array_combine($key_range, $value_range), $input_settings); }
/** * Adds an entry of 'select_reveal_inputs' to the js data, which is an array * whose top-level keys are select reveal input html ids; values are arrays * whose keys are select option values and values are the sections they reveal * @param array $form_other_js_data * @return array */ public function get_other_js_data($form_other_js_data = array()) { $form_other_js_data = parent::get_other_js_data($form_other_js_data); if (!isset($form_other_js_data['select_reveal_inputs'])) { $form_other_js_data['select_reveal_inputs'] = array(); } $sibling_input_to_html_id_map = array(); foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) { $sibling_input_to_html_id_map[$sibling_section_path] = $sibling_section->html_id(); } $form_other_js_data['select_reveal_inputs'][$this->html_id()] = $sibling_input_to_html_id_map; return $form_other_js_data; }
function __construct($input_settings = array(), $four_digit_year = true, $years_behind = 1, $years_ahead = 15) { if ($four_digit_year) { $current_year_int = intval(date('Y')); } else { $current_year_int = intval(date('y')); } $answer_options = array(); for ($start = $current_year_int - $years_behind; $start <= $current_year_int + $years_ahead; $start++) { $answer_options[$start] = $start; } parent::__construct($answer_options, $input_settings); }
/** * * @param array $only_specific_currency_codes numerically-indexed array of allowed currency codes. By default, all are allowed * @param array $input_settings */ function __construct($only_specific_currency_codes = array(), $input_settings = array()) { $query_params = array('order_by' => array('CNT_name' => 'asc')); if ($only_specific_currency_codes) { $query_params[0]['CNT_cur_code'] = array('IN', $only_specific_currency_codes); } $all_countries = EEM_Country::instance()->get_all($query_params); $country_options = array(); foreach ($all_countries as $country) { /* @var $country EE_Country */ $country_options[$country->currency_code()] = $country->name() . ": " . $country->currency_name_single() . " (" . $country->currency_sign() . ")"; } parent::__construct($country_options, 'int', $input_settings); }
/** * @param array $options */ function __construct($options = array()) { $select_options = array(true => __("Yes", "event_espresso"), false => __("No", "event_espresso")); parent::__construct($select_options, $options); }
/** * @param array $state_options * @param array $input_settings */ function __construct($state_options, $input_settings = array()) { $state_options = apply_filters('FHEE__EE_State_Select_Input____construct__state_options', $this->get_state_answer_options($state_options), $this); parent::__construct($state_options, $input_settings); }
/** * @param array $country_options * @param array $input_settings * @return EE_Country_Select_Input */ public function __construct($country_options = NULL, $input_settings = array()) { $country_options = apply_filters('FHEE__EE_Country_Select_Input____construct__country_options', $this->get_country_answer_options($country_options), $this); parent::__construct($country_options, $input_settings); }