2 /***************************************************************************
3 * Copyright (C) 2003-2008 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 function education_options($current = 0)
24 $html = '<option value="-1"></option>';
25 $res = XDB
::iterator("SELECT *
26 FROM profile_education_enum
28 while ($arr_edu = $res->next()) {
29 $html .= '<option value="' . $arr_edu["id"] . '"';
30 if ($arr_edu["id"] == $current) {
31 $html .= " selected='selected'";
33 $html .= '>' . htmlspecialchars($arr_edu["name"]) . "</option>\n";
38 /** pour appeller education_options depuis smarty
40 function _education_options_smarty($params)
42 if(!isset($params['selected'])) {
43 $params['selected'] = 0;
45 return education_options($params['selected']);
47 Platal
::page()->register_function('education_options', '_education_options_smarty');
49 /** affiche un Array javascript contenant les diplômes de chaque formation
51 function education_degree()
54 $res = XDB
::iterRow("SELECT eduid, degreeid
55 FROM profile_education_degree AS d
56 INNER JOIN profile_education_enum AS e ON (e.id = d.eduid)
58 if ($edu_degree = $res->next()) {
59 $eduid = $edu_degree['0'];
61 $html .= $edu_degree['1'];
62 $edu_degree = $res->next();
63 while ($edu_degree['0'] == $eduid) {
64 $html .= "," . $edu_degree['1'];
65 $edu_degree = $res->next();
70 $eduid = $edu_degree['0'];
72 $html .= $edu_degree['1'];
73 $edu_degree = $res->next();
74 while ($edu_degree['0'] == $eduid) {
75 $html .= "," . $edu_degree['1'];
76 $edu_degree = $res->next();
82 Platal
::page()->register_function('education_degree', 'education_degree');
84 /** affiche tous les types possibles de diplômes
86 function education_degree_all()
89 $res = XDB
::query("SELECT id
90 FROM profile_education_degree_enum
92 return implode(',', $res->fetchColumn());
94 Platal
::page()->register_function('education_degree_all', 'education_degree_all');
96 /** affiche les noms de tous les diplômes possibles
98 function education_degree_name()
101 $res = XDB
::query("SELECT degree
102 FROM profile_education_degree_enum
104 return '\'' . implode('\',\'', $res->fetchColumn()) . '\'';
106 Platal
::page()->register_function('education_degree_name', 'education_degree_name');
108 /** formatte une formation pour l'affichage
110 function education_fmt($name, $url, $degree, $grad_year, $field, $program, $sexe, $long)
112 $field = strtolower($field);
115 if ($grad_year ||
$field ||
$program) {
116 $txt .= "<span title=\"(";
119 if ($grad_year ||
$field) {
125 $txt .= "diplômée en $grad_year";
127 $txt .= "diplômé en $grad_year";
134 $txt .= "domaine : $field)\">";
138 if (($degree != "Licence") ||
($long)) {
139 if (($degree != "Ingénieur") && ($degree != "Diplôme")) {
142 if ($name != "Université") {
147 $txt .= "<a href=\"$url\" onclick=\"return popup(this)\">$name</a>";
158 function _education_fmt($params, &$smarty)
161 return education_fmt($name, $url, $degree, $grad_year, $field, $program, $sexe, $long);
163 Platal
::page()->register_function('education_fmt', '_education_fmt');
165 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: