Moving to GitHub.
[platal.git] / include / education.func.inc.php
index 9d2e2b7..8ff9a5f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2009 Polytechnique.org                              *
+ *  Copyright (C) 2003-2014 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
 
 function education_options($current = 0)
 {
-    $html = '<option value="-1"></option>';
-    $res  = XDB::iterator("SELECT  e.id AS id, gc.countryFR AS country,
+    $html = '<option value="-1">&nbsp;</option>';
+    $res  = XDB::iterator("SELECT  e.id AS id, gc.country,
                                    IF(CHAR_LENGTH(e.name) > 76, e.abbreviation, e.name) AS name
                              FROM  profile_education_enum AS e
                         LEFT JOIN  geoloc_countries       AS gc ON (e.country = gc.iso_3166_1_a2)
                      WHERE EXISTS  (SELECT  *
                                       FROM  profile_education_degree AS d
-                                     WHERE  e.id = d.eduid)
-                         ORDER BY  gc.countryFR, e.name");
+                                     WHERE  e.id = d.eduid) AND e.name != {?}
+                         ORDER BY  gc.country, e.name",
+                          Profile::EDU_X);
     $country = "";
     while ($arr_edu = $res->next()) {
         if ($arr_edu["country"] != $country) {
+            if ($country) {
+                $html .= '</optgroup>';
+            }
             $country = $arr_edu["country"];
-            $html .= "<optgroup label=" . $country . ">";
+            $html .= '<optgroup label="' . $country . '">';
         }
         $html .= '<option value="' . $arr_edu["id"] . '"';
         if ($arr_edu["id"] == $current) {
@@ -42,6 +46,9 @@ function education_options($current = 0)
         }
         $html .= '>' . htmlspecialchars($arr_edu["name"]) . "</option>\n";
     }
+    if ($country) {
+        $html .= '</optgroup>';
+    }
     return $html;
 }
 
@@ -106,60 +113,5 @@ function education_degree_name()
 }
 Platal::page()->register_function('education_degree_name', 'education_degree_name');
 
-/** formatte une formation pour l'affichage
- */
-function education_fmt($name, $url, $degree, $grad_year, $field, $program, $sexe, $long)
-{
-    $field = strtolower($field);
-    $txt = "";
-
-    if ($grad_year || $field || $program) {
-        $txt .= "<span title=\"(";
-        if ($program) {
-            $txt .= $program;
-            if ($grad_year || $field) {
-                $txt .= ", ";
-            }
-        }
-        if ($grad_year) {
-            if ($sexe) {
-                $txt .= "diplômée en $grad_year";
-            } else {
-                $txt .= "diplômé en $grad_year";
-            }
-            if ($field) {
-                $txt .= ", ";
-            }
-        }
-        if ($field) {
-            $txt .= "domaine : $field)\">";
-        }
-    }
-
-    if (($degree != "Lic.") || ($long)) {
-        if (($degree != "Ing.") && ($degree != "Dipl.")) {
-            $txt .= $degree;
-        }
-        if ($name) {
-            $txt .= ' ';
-        }
-        if ($url != ' ') {
-            $txt .= "<a href=\"$url\" onclick=\"return popup(this)\">$name</a>";
-        } else {
-            $txt .= $name;
-        }
-    }
-    $txt .= "</span>";
-
-    return $txt;
-}
-
-function _education_fmt($params, &$smarty)
-{
-    extract($params);
-    return education_fmt($name, $url, $degree, $grad_year, $field, $program, $sexe, $long);
-}
-Platal::page()->register_function('education_fmt', '_education_fmt');
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
 ?>