X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Feducation.func.inc.php;h=9d2e2b732bbbd8dc13c0d46df7bbf625b3d37607;hb=fb5a54cbdf4317488bc46c804e0df964c007eb4e;hp=64da8f10e766384b46b21a405b26ebd686e28cb1;hpb=a5e30e55fc7fae12781c5e91320fadcaaa9cb11e;p=platal.git
diff --git a/include/education.func.inc.php b/include/education.func.inc.php
index 64da8f1..9d2e2b7 100644
--- a/include/education.func.inc.php
+++ b/include/education.func.inc.php
@@ -1,6 +1,6 @@
';
- $res = XDB::iterator("SELECT e.id AS id, e.name AS name, g.pays AS country
+ $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
- INNER JOIN geoloc_pays AS g ON (e.country = g.a2)
- ORDER BY g.pays, e.name");
+ 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");
$country = "";
while ($arr_edu = $res->next()) {
if ($arr_edu["country"] != $country) {
@@ -56,33 +60,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)
- INNER JOIN geoloc_pays AS g ON (e.country = g.a2)
- ORDER BY g.pays, 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;
}
@@ -92,7 +88,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");
@@ -104,11 +99,10 @@ 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');
@@ -142,19 +136,17 @@ function education_fmt($name, $url, $degree, $grad_year, $field, $program, $sexe
}
}
- if (($degree != "Licence") || ($long)) {
- if (($degree != "Ingénieur") && ($degree != "Diplôme")) {
+ if (($degree != "Lic.") || ($long)) {
+ if (($degree != "Ing.") && ($degree != "Dipl.")) {
$txt .= $degree;
}
- if ($name != "Université") {
- if ($name) {
- $txt .= ' ';
- }
- if ($url != ' ') {
- $txt .= "$name";
- } else {
- $txt .= $name;
- }
+ if ($name) {
+ $txt .= ' ';
+ }
+ if ($url != ' ') {
+ $txt .= "$name";
+ } else {
+ $txt .= $name;
}
}
$txt .= "";