X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Feducation.func.inc.php;h=dbfba28d506e7bd2a5b2fc97ca178c54f79d2244;hb=c4b6b1f4989e57e80aa721028d8255a3800442f9;hp=8bc691c4c0e0311ce8d3fe18782c64093262113a;hpb=0abd0cea70b22676ae32ad04b7bd98e9f7ea4733;p=platal.git diff --git a/include/education.func.inc.php b/include/education.func.inc.php index 8bc691c..dbfba28 100644 --- a/include/education.func.inc.php +++ b/include/education.func.inc.php @@ -1,6 +1,6 @@ '; + $html = ''; $res = XDB::iterator("SELECT e.id AS id, gc.countryFR AS country, IF(CHAR_LENGTH(e.name) > 76, e.abbreviation, e.name) AS name FROM profile_education_enum AS e @@ -33,8 +33,11 @@ function education_options($current = 0) $country = ""; while ($arr_edu = $res->next()) { if ($arr_edu["country"] != $country) { + if ($country) { + $html .= ''; + } $country = $arr_edu["country"]; - $html .= ""; + $html .= ''; } $html .= ''; + } return $html; } @@ -60,33 +66,25 @@ Platal::page()->register_function('education_options', '_education_options_smart */ function education_degree() { - $html = ""; - $res = XDB::iterRow("SELECT d.eduid, d.degreeid - FROM profile_education_enum AS e - INNER JOIN profile_education_degree AS d ON (e.id = d.eduid) - INNER JOIN geoloc_countries AS gc ON (e.country = gc.iso_3166_1_a2) - ORDER BY gc.countryFR, 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']; + $html = ''; + $res = XDB::iterRow("SELECT eduid, degreeid + 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; } @@ -114,60 +112,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 .= ""; - } - } - - if (($degree != "Lic.") || ($long)) { - if (($degree != "Ing.") && ($degree != "Dipl.")) { - $txt .= $degree; - } - 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, $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: ?>