/** * Renders the contents of the the select tag, option tags being built by * the option handler. Called from with a compiled template render function. * * @return void * @access protected */ function render_contents() { $value = $this->get_value(); if ($ini_file = $this->get_attribute('options_ini_file')) { $this->set_choices(strings::get('options', $ini_file)); if ($value === null) { $value = strings::get('default_option', $ini_file); } } elseif ($this->get_attribute('options_datasource')) { $data_source =& data_source_factory::create($this->get_attribute('options_datasource')); $this->set_choices($data_source->get_options_array()); if ($value === null) { $value = $data_source->get_default_option(); } } if (empty($value) || !array_key_exists($value, $this->choice_list)) { $value = reset($this->choice_list); } if (empty($this->option_renderer)) { $this->option_renderer = new option_renderer(); } foreach ($this->choice_list as $key => $contents) { $this->option_renderer->render_attribute($key, $contents, $key == $value); } }
function &_get_data_source() { if ($this->data_source) { return $this->data_source; } $this->data_source =& data_source_factory::create($this->parameters['data_source_path']); return $this->data_source; }
function &_get_data_source() { $data_source_path = $this->get_attribute('options_datasource'); return data_source_factory::create($data_source_path); }