From: Stéphane Jacob Date: Sat, 4 Sep 2010 07:50:31 +0000 (+0200) Subject: Display more info about education on profile pages (Closes #1186). X-Git-Tag: xorg/1.0.1~229 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=8f3d549b10d58ae5a64296f9cf0de278c7b17543;p=platal.git Display more info about education on profile pages (Closes #1186). Signed-off-by: Stéphane Jacob --- diff --git a/plugins/function.display_education.php b/plugins/function.display_education.php index 160f99c..4e7db2a 100644 --- a/plugins/function.display_education.php +++ b/plugins/function.display_education.php @@ -20,68 +20,58 @@ ***************************************************************************/ -function display_education($name, $url, $degree, $grad_year, $field, $program, $sexe, $long) +function display_education($name, $url, $degree, $gradYear, $field, $program, $full) { $field = strtolower($field); - $txt = ""; + $txt = ''; - if ($grad_year || $field || $program) { - $txt .= "' . $name . ''; + } else { + $txt .= $name; + } + + if ($gradYear || $field || $program) { + $details = ''; if ($program) { - $txt .= $program; - if ($grad_year || $field) { - $txt .= ", "; + $details .= $program; + if ($gradYear || $field) { + $details .= ', '; } } - if ($grad_year) { - if ($sexe) { - $txt .= "diplômée en $grad_year"; - } else { - $txt .= "diplômé en $grad_year"; - } + if ($gradYear) { + $details .= $gradYear; if ($field) { - $txt .= ", "; + $details .= ', '; } } if ($field) { - $txt .= "domaine : $field"; + $details .= $field; } - $txt .= ")\">"; - } - if (($degree != "Lic.") || ($long)) { - if (($degree != "Ing.") && ($degree != "Dipl.")) { - $txt .= $degree; - } - if ($name) { - $txt .= ' '; - } - if ($url != '') { - $txt .= "$name"; + if ($full) { + $txt .= ' (' . $details . ')'; } else { - $txt .= $name; + $txt = '' . $txt . ''; } } - if ($grad_year || $field || $program) { - $txt .= ""; - } return $txt; } function smarty_function_display_education($params, &$smarty) { - $params = new PlDict($params); - $edu = $params->v('edu'); - if (!$params->has('sex')) { - $profile = $params->v('profile'); - $sex = $profile->isFemale(); - } else { - $sex = $params->b('sex'); - } + $params = new PlDict($params); + $edu = $params->v('edu'); return display_education(($edu->school_short == '') ? $edu->school : $edu->school_short, $edu->school_url, $edu->degree_short, $edu->grad_year, - $edu->field, $edu->program, $sex, $params->b('long')); + $edu->field, $edu->program, $params->b('full')); } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: diff --git a/templates/include/minifiche.tpl b/templates/include/minifiche.tpl index e018b4b..0daa537 100644 --- a/templates/include/minifiche.tpl +++ b/templates/include/minifiche.tpl @@ -64,7 +64,7 @@ {$code}  {/foreach} {$profile->promo()}{* - *}{foreach from=$profile->getExtraEducations(4) item=edu}, {display_education edu=$edu profile=$profile}{/foreach}{* + *}{foreach from=$profile->getExtraEducations(4) item=edu}, {display_education edu=$edu profile=$profile full=false}{/foreach}{* *}{if $dead}, {"décédé"|sex:"décédée":$profile} le {$profile->deathdate|date_format}{/if} diff --git a/templates/profile/profile.tpl b/templates/profile/profile.tpl index ed73b0b..926f807 100644 --- a/templates/profile/profile.tpl +++ b/templates/profile/profile.tpl @@ -172,7 +172,7 @@ function chgMainWinLoc(strPage)  - Formation : {/if}