Synchronize fiche from AX
[platal.git] / htdocs / admin / synchro_ax.php
CommitLineData
0337d704 1<?php
2/***************************************************************************
dd502514 3 * Copyright (C) 2003-2006 Polytechnique.org *
0337d704 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_admin_page('admin/synchro_ax.tpl');
d9a33f98 25$page->assign('xorg_title','Polytechnique.org - Administration - Synchro AX');
0337d704 26
27require_once('user.func.inc.php');
28require_once('synchro_ax.inc.php');
29
30if (Env::has('user')) {
31 $login = get_user_forlife(Env::get('user'));
32 if ($login === false) {
33 $page->kill("");
34 }
35}
36
37if (Env::has('mat')) {
38 $res = $globals->xdb->query(
39 "SELECT alias
40 FROM aliases AS a
41 INNER JOIN auth_user_md5 AS u ON (a.id=u.user_id AND a.type='a_vie')
42 WHERE matricule={?}", Env::getInt('mat'));
43 $login = $res->fetchOneCell();
44}
45
46if ($login) {
0337d704 47
dd502514 48 if (Env::has('importe')) {
49 ax_synchronize($login, Session::getInt('uid'));
0337d704 50 }
dd502514 51 // get details from user, but looking only info that can be seen by ax
52 $user = get_user_details($login, Session::getInt('uid'), 'ax');
53 $userax= get_user_ax($user['matricule_ax']);
54 require_once 'profil.func.inc.php';
55 $diff = diff_user_details($userax, $user, 'ax');
0337d704 56
57 $page->assign('x', $user);
dd502514 58 $page->assign('diff', $diff);
0337d704 59}
60$page->run();
61
62// vim:set et sts=4 sws=4 sw=4:
63?>