paper: Mention grant agreement number in Acknowledgement
[living-lab-site.git] / application / helpers / localization_helper.php
1 <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
3 function  country_dropdown ( $name="country", $top_countries=array(), 
4                 $selection=NULL, $show_all=TRUE )  
5 {
6         $ci =& get_instance();
7         $ci->config->load('localization');
8         $countries = $ci->config->item('country_list');
9
10         $html = "<select name='{$name}'>";
11         $selected = NULL;
12         if(in_array($selection,$top_countries))  {
13                 $top_selection = $selection;
14                 $all_selection = NULL;
15         }
16         else  {
17                 $top_selection = NULL;
18                 $all_selection = $selection;
19         }
20
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"';
26                                 }
27                                 $html .= "<option value='{$value}' {$selected}>{$countries[$value]}</option>";
28                                 $selected = NULL;
29                         }
30                 }
31                 //$html .= "<option>----------</option>";
32         }
33
34         if($show_all)  {
35                 foreach($countries as $key => $country)  {
36                         if($key === $all_selection)  {
37                                 $selected = 'selected="selected"';
38                         }
39                         $html .= "<option value='{$key}' {$selected}>{$country}</option>";
40                         $selected = NULL;
41                 }
42         }
43
44         $html .= "</select>";
45         return $html;
46 }
47
48 function available_languages_dropdown($name, $selection=NULL, $attributes='')
49 {
50         $ci =& get_instance();
51         // Use the config file name.
52         $ci->config->load('p2p-tube');
53         $langs = $ci->config->item('available_languages_list');
54         
55         $html = "<select name='{$name}' {$attributes}>";
56         $selected = NULL;
57         
58         foreach($langs as $key=> $value)  
59         {
60                 if($key == $selection)  
61                 {
62                         $selected = 'selected="selected"';
63                 }
64                 $value = ucwords($value);
65                 $html .= "<option value='{$key}' {$selected}>{$value}</option>";
66                 $selected = NULL;
67         }
68         
69         $html .= '</select>';
70         
71         return $html;
72 }
73
74 /* End of file localization_helper.php */
75 /* Location: ./application/helpers/localization_helper.php */