1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
3 function country_dropdown ( $name="country", $top_countries=array(),
4 $selection=NULL, $show_all=TRUE )
7 $ci->config->load('localization');
8 $countries = $ci->config->item('country_list');
10 $html = "<select name='{$name}'>";
12 if(in_array($selection,$top_countries)) {
13 $top_selection = $selection;
14 $all_selection = NULL;
17 $top_selection = NULL;
18 $all_selection = $selection;
21 if(!empty($top_countries)) {
22 foreach($top_countries as $value) {
23 if(array_key_exists($value, $countries)) {
24 if($value === $top_selection) {
25 $selected = 'selected="selected"';
27 $html .= "<option value='{$value}' {$selected}>{$countries[$value]}</option>";
31 //$html .= "<option>----------</option>";
35 foreach($countries as $key => $country) {
36 if($key === $all_selection) {
37 $selected = 'selected="selected"';
39 $html .= "<option value='{$key}' {$selected}>{$country}</option>";
48 function available_languages_dropdown($name, $selection=NULL, $attributes='')
50 $ci =& get_instance();
51 // Use the config file name.
52 $ci->config->load('p2p-tube');
53 $langs = $ci->config->item('available_languages_list');
55 $html = "<select name='{$name}' {$attributes}>";
58 foreach($langs as $key=> $value)
60 if($key == $selection)
62 $selected = 'selected="selected"';
64 $value = ucwords($value);
65 $html .= "<option value='{$key}' {$selected}>{$value}</option>";
74 /* End of file localization_helper.php */
75 /* Location: ./application/helpers/localization_helper.php */