Merge branch 'xorg/maint' into xorg/master
[platal.git] / classes / direnum.php
index 0268ca9..e45164c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -40,12 +40,14 @@ class DirEnum
     const EDUDEGREES     = 'educationdegrees';
     const EDUFIELDS      = 'educationfields';
 
-    const CORPS          = 'corps';
+    const CURRENTCORPS   = 'currentcorps';
+    const ORIGINCORPS    = 'origincorps';
     const CORPSRANKS     = 'corpsranks';
 
     const NATIONALITIES  = 'nationalities';
     const COUNTRIES      = 'countries';
     const ADMINAREAS     = 'adminareas';
+    const SUBADMINAREAS  = 'subadminareas';
     const LOCALITIES     = 'localities';
 
     const COMPANIES      = 'companies';
@@ -532,18 +534,32 @@ class DE_EducationFields extends DirEnumeration
 }
 // }}}
 
-// {{{ class DE_Corps
-class DE_Corps extends DirEnumeration
+// {{{ class DE_CurrentCorps
+class DE_CurrentCorps extends DirEnumeration
 {
     protected $idfield   = 'profile_corps_enum.id';
     protected $valfield  = 'profile_corps_enum.name';
     protected $valfield2 = 'profile_corps_enum.abbrev';
     protected $from      = 'profile_corps_enum';
+    protected $where     = 'WHERE profile_corps_enum.still_exists = 1';
 
     protected $ac_unique = 'profile_corps.pid';
     protected $ac_join   = 'INNER JOIN profile_corps ON (profile_corps.current_corpsid = profile_corps_enum.id)';
 }
 // }}}
+//
+// {{{ class DE_OriginCorps
+class DE_OriginCorps extends DirEnumeration
+{
+    protected $idfield   = 'profile_corps_enum.id';
+    protected $valfield  = 'profile_corps_enum.name';
+    protected $valfield2 = 'profile_corps_enum.abbrev';
+    protected $from      = 'profile_corps_enum';
+
+    protected $ac_unique = 'profile_corps.pid';
+    protected $ac_join   = 'INNER JOIN profile_corps ON (profile_corps.original_corpsid = profile_corps_enum.id)';
+}
+// }}}
 
 // {{{ class DE_CorpsRanks
 class DE_CorpsRanks extends DirEnumeration
@@ -564,8 +580,8 @@ class DE_CorpsRanks extends DirEnumeration
 class DE_Nationalities extends DirEnumeration
 {
     protected $idfield   = 'geoloc_countries.iso_3166_1_a2';
-    protected $valfield  = 'geoloc_countries.nationalityFR';
-    protected $valfield2 = 'geoloc_countries.nationality';
+    protected $valfield  = 'geoloc_countries.nationality';
+    protected $valfield2 = 'geoloc_countries.nationalityEn';
     protected $from      = 'geoloc_countries';
     protected $join      = 'INNER JOIN profiles ON (geoloc_countries.iso_3166_1_a2 IN (profiles.nationality1, profiles.nationality2, profiles.nationality3))';
 
@@ -600,6 +616,19 @@ class DE_AdminAreas extends DE_WithSuboption
 }
 // }}}
 
+// {{{ class DE_SubAdminAreas
+class DE_SubAdminAreas extends DE_WithSuboption
+{
+    protected $idfield   = 'geoloc_subadministrativeareas.id';
+    protected $optfield  = 'geoloc_subadministrativeareas.administrativearea';
+    protected $valfield  = 'geoloc_subadministrativeareas.name';
+    protected $from      = 'geoloc_subadministrativeareas';
+
+    protected $ac_join   = 'INNER JOIN profile_addresses ON (profile_addresses.subadministrativeAreaId = geoloc_subadministrativeareas.id)';
+    protected $ac_unique = 'profile_addresses.pid';
+}
+// }}}
+
 // {{{ class DE_Localities
 class DE_Localities extends DirEnumeration
 {