X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Feducation.func.inc.php;h=51437db1e5ddfd6d93d913ac2ecd4c9b918e1875;hb=16d2c88314364b5e79936f4262d453dff03abdad;hp=48f4a430808c48ae781d981c27e179e75c3f1254;hpb=f711b03f11899af380d98e31e01e7f76fe7c7f88;p=platal.git
diff --git a/include/education.func.inc.php b/include/education.func.inc.php
index 48f4a43..51437db 100644
--- a/include/education.func.inc.php
+++ b/include/education.func.inc.php
@@ -1,6 +1,6 @@
';
- $res = XDB::iterator("SELECT *
- FROM profile_education_enum
- ORDER BY name");
+ $html = '';
+ $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.country, e.name");
+ $country = "";
while ($arr_edu = $res->next()) {
+ if ($arr_edu["country"] != $country) {
+ if ($country) {
+ $html .= '';
+ }
+ $country = $arr_edu["country"];
+ $html .= '';
+ }
return $html;
}
@@ -50,32 +66,25 @@ Platal::page()->register_function('education_options', '_education_options_smart
*/
function education_degree()
{
- $html = "";
+ $html = '';
$res = XDB::iterRow("SELECT eduid, degreeid
- FROM profile_education_degree AS d
- INNER JOIN profile_education_enum AS e ON (e.id = d.eduid)
- ORDER BY e.name");
- if ($edu_degree = $res->next()) {
- $eduid = $edu_degree['0'];
- $html .= "[";
- $html .= $edu_degree['1'];
- $edu_degree = $res->next();
- while ($edu_degree['0'] == $eduid) {
- $html .= "," . $edu_degree['1'];
+ FROM profile_education_degree
+ ORDER BY eduid");
+ $edu_degree = $res->next();
+ for ($eduid = 1; $edu_degree; ++$eduid) {
+ $html .= '[';
+ if ($edu_degree['0'] == $eduid) {
+ $html .= $edu_degree['1'];
$edu_degree = $res->next();
+ while ($edu_degree['0'] == $eduid) {
+ $html .= ',' . $edu_degree['1'];
+ $edu_degree = $res->next();
+ }
}
- $html .= "]";
- }
- while ($edu_degree) {
- $eduid = $edu_degree['0'];
- $html .= ",\n[";
- $html .= $edu_degree['1'];
- $edu_degree = $res->next();
- while ($edu_degree['0'] == $eduid) {
- $html .= "," . $edu_degree['1'];
- $edu_degree = $res->next();
+ $html .= ']';
+ if ($edu_degree) {
+ $html .= ",\n";
}
- $html .= "]";
}
return $html;
}
@@ -85,7 +94,6 @@ Platal::page()->register_function('education_degree', 'education_degree');
*/
function education_degree_all()
{
- $html = "";
$res = XDB::query("SELECT id
FROM profile_education_degree_enum
ORDER BY id");
@@ -97,64 +105,12 @@ Platal::page()->register_function('education_degree_all', 'education_degree_all'
*/
function education_degree_name()
{
- $html = "";
$res = XDB::query("SELECT degree
- FROM profile_education_degree_enum
- ORDER BY id");
- return '\'' . implode('\',\'', $res->fetchColumn()) . '\'';
+ FROM profile_education_degree_enum
+ ORDER BY id");
+ return '"' . implode('","', $res->fetchColumn()) . '"';
}
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, $sexe, $long)
-{
- $field = strtolower($field);
- $txt = "";
-
- if ($grad_year || $field) {
- $txt .= "";
- }
- }
-
- if (($degree != "Licence") || ($long)) {
- if (($degree != "Ingénieur") && ($degree != "Diplôme")) {
- $txt .= $degree;
- }
- if ($name != "Université") {
- if ($name) {
- $txt .= ' ';
- }
- if ($url != ' ') {
- $txt .= "$name";
- } else {
- $txt .= $name;
- }
- }
- }
- $txt .= "";
-
- return $txt;
-}
-
-function _education_fmt($params, &$smarty)
-{
- extract($params);
- return education_fmt($name, $url, $degree, $grad_year, $field, $sexe, $long);
-}
-Platal::page()->register_function('education_fmt', '_education_fmt');
-
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>