fix #346
[platal.git] / htdocs / fiche_referent.php
CommitLineData
0337d704 1<?php
2/***************************************************************************
3 * Copyright (C) 2003-2004 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
5 * *
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. *
10 * *
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. *
15 * *
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 *
18 * Foundation, Inc., *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
21
22
23require_once("xorg.inc.php");
24new_simple_page('fiche_referent.tpl',AUTH_COOKIE);
9039c94d 25require_once('user.func.inc.php');
0337d704 26
27if (!Env::has('user')) {
28 exit;
29}
30
31$res = $globals->xdb->query(
32 "SELECT prenom, nom, user_id, promo, cv, a.alias AS bestalias
33 FROM auth_user_md5 AS u
34 INNER JOIN aliases AS a ON (u.user_id=a.id AND FIND_IN_SET('bestalias',a.flags))
35 INNER JOIN aliases AS a1 ON (u.user_id=a1.id AND a1.alias = {?} AND a1.type!='homonyme')",
36 Env::get('user'));
37if ($res->numRows() != 1) {
38 exit;
39}
40
41list($prenom, $nom, $user_id, $promo, $cv, $bestalias) = $res->fetchOneRow();
42
43$page->assign('prenom', $prenom);
44$page->assign('nom', $nom);
45$page->assign('promo', $promo);
46$page->assign('cv', $cv);
47$page->assign('bestalias', $bestalias);
9039c94d 48$page->assign('adr_pro', get_user_details_pro($user_id));
0337d704 49
50///// recuperations infos referent
51
52//expertise
53$res = $globals->xdb->query("SELECT expertise FROM mentor WHERE uid = {?}", $user_id);
54$page->assign('expertise', $res->fetchOneCell());
55
56//secteurs
57$secteurs = $ss_secteurs = Array();
58$res = $globals->xdb->iterRow(
59 "SELECT s.label, ss.label
60 FROM mentor_secteurs AS m
61 LEFT JOIN emploi_secteur AS s ON(m.secteur = s.id)
62 LEFT JOIN emploi_ss_secteur AS ss ON(m.secteur = ss.secteur AND m.ss_secteur = ss.id)
63 WHERE uid = {?}", $user_id);
64while (list($sec, $ssec) = $res->next()) {
65 $secteurs[] = $sec;
66 $ss_secteurs[] = $ssec;
67}
68$page->assign_by_ref('secteurs', $secteurs);
69$page->assign_by_ref('ss_secteurs', $ss_secteurs);
70
71//pays
72$res = $globals->xdb->query(
73 "SELECT gp.pays
74 FROM mentor_pays AS m
75 LEFT JOIN geoloc_pays AS gp ON(m.pid = gp.a2)
76 WHERE uid = {?}", $user_id);
77$page->assign('pays', $res->fetchColumn());
78
79$page->addJsLink('javascript/close_on_esc.js');
80$page->run();
81?>