.

Countries Class Reference
[Countries]

Facade class for countries. More...

List of all members.

Static Public Member Functions

static  create_adapter ()
  Create adapter.
static  create_continent_adapter ($id_continent)
  Create adapter for countries in continent.
static  create_localized_sort_adapter ($lang=false)
  Create an adapter that loads translated names.
static  get ($country_code)
  Returns country for given code (de, fr etc.
static  get_all ()
  Returns array of all countries with code as key and name as value.
static  get_continent ($id)
  Returns continent with given ID.
static  get_continents ()
  Returns continents as associative array with id as key and translated name as value.
static  get_group_types ()
  Return possible types for country groups.
static  localize_adapter (DAOCountries $adapter, $lang=false)
  Join given adapter with translations.

Public Attributes

const  GROUP_ID_EU = 1
const  GROUP_TYPE_CULTURAL = 'CULTURAL'
const  GROUP_TYPE_GEOGRAPHICAL = 'GEOGRAPHICAL'
const  GROUP_TYPE_NONE = 'NONE'
const  GROUP_TYPE_POLITICAL = 'POLITICAL'

Detailed Description

Facade class for countries.

Author:
Gerd Riesselmann

Definition at line 9 of file countries.facade.php.


Member Function Documentation

static Countries::create_adapter (  )  [static]

Create adapter.

Returns:
DAOCountries

Definition at line 45 of file countries.facade.php.

00045                                             {
00046                 return new DAOCountries();
00047     } 
static Countries::create_continent_adapter ( id_continent  )  [static]

Create adapter for countries in continent.

Returns:
DAOCountries

Definition at line 55 of file countries.facade.php.

00055                                                                    {
00056                 $dao = self::create_adapter();
00057                 $dao->id_continent = $id_continent;
00058                 return $dao;            
00059     } 
static Countries::create_localized_sort_adapter ( lang = false  )  [static]

Create an adapter that loads translated names.

Returns:
DAOCountries

Definition at line 66 of file countries.facade.php.

00066                                                                         {
00067         $dao = new DAOCountries();
00068         self::localize_adapter($dao, $lang);
00069         return $dao;
00070     }
static Countries::get ( country_code  )  [static]

Returns country for given code (de, fr etc.

Parameters:
DAOCountries  $country_code

Definition at line 36 of file countries.facade.php.

00036                                               {
00037         return DB::get_item('countries', 'id', $country_code);
00038     }
static Countries::get_all (  )  [static]

Returns array of all countries with code as key and name as value.

Returns:
array

Definition at line 99 of file countries.facade.php.

00099                                      {
00100         $ret = array();
00101         $dao = self::create_localized_sort_adapter(GyroLocale::get_language());
00102         $dao->sort('name');
00103         $dao->find();
00104         while($dao->fetch()) {
00105             $ret[$dao->id] = $dao->get_title();
00106         }
00107         return $ret;
00108     }
static Countries::get_continent ( id  )  [static]

Returns continent with given ID.

Returns:
DAOContinents

Definition at line 130 of file countries.facade.php.

00130                                               {
00131         return DB::get_item('continents', 'id', $id); 
00132     }
static Countries::get_continents (  )  [static]

Returns continents as associative array with id as key and translated name as value.

Returns:
array

Definition at line 115 of file countries.facade.php.

00115                                             {
00116         $ret = array();
00117         $dao = new DAOContinents();
00118         $dao->find();
00119         while($dao->fetch()) {
00120                 $ret[$dao->id] = $dao->get_title();
00121         }
00122         return $ret;
00123     }
static Countries::get_group_types (  )  [static]

Return possible types for country groups.

Returns:
array

Definition at line 22 of file countries.facade.php.

00022                                                  {
00023                 return array(
00024                         self::GROUP_TYPE_NONE => tr(self::GROUP_TYPE_NONE, 'countries'),
00025                         self::GROUP_TYPE_POLITICAL => tr(self::GROUP_TYPE_POLITICAL, 'countries'),
00026                         self::GROUP_TYPE_GEOGRAPHICAL => tr(self::GROUP_TYPE_GEOGRAPHICAL, 'countries'),
00027                         self::GROUP_TYPE_CULTURAL => tr(self::GROUP_TYPE_CULTURAL, 'countries')
00028                 );
00029         }
static Countries::localize_adapter ( DAOCountries adapter,
lang = false  
) [static]

Join given adapter with translations.

Parameters:
$adapter  DAOCountries
Returns:
void

Definition at line 78 of file countries.facade.php.

00078                                                                                   {
00079         if (empty($lang)) {
00080                 $lang = GyroLocale::get_language();
00081         }
00082         $trans = new DAOCountriestranslations();
00083         $adapter->join(
00084                 $trans, 
00085                 array(
00086                         new DBJoinCondition($trans, 'id_country', $adapter, 'id'),
00087                         new DBWhere($trans, 'lang', '=', $lang)
00088                 ), 
00089                 DBQueryJoined::LEFT
00090         );
00091         $adapter->sort('countriestranslations.name');
00092     }

Member Data Documentation

Definition at line 15 of file countries.facade.php.

const Countries::GROUP_TYPE_CULTURAL = 'CULTURAL'

Definition at line 13 of file countries.facade.php.

const Countries::GROUP_TYPE_GEOGRAPHICAL = 'GEOGRAPHICAL'

Definition at line 12 of file countries.facade.php.

Definition at line 10 of file countries.facade.php.

const Countries::GROUP_TYPE_POLITICAL = 'POLITICAL'

Definition at line 11 of file countries.facade.php.


The documentation for this class was generated from the following file: