bb64663cdddde8ca6dfb90829cb25ac7728ded50
2 /***************************************************************************
3 * Copyright (C) 2003-2004 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 ***************************************************************************/
23 require_once("xorg.inc.php");
24 new_admin_page('admin/synchro_ax.tpl');
25 $page->assign('xorg_title','Polytechnique.org - Administration - Synchro AX');
27 require_once('user.func.inc.php');
28 require_once('synchro_ax.inc.php');
30 if (Env
::has('user')) {
31 $login = get_user_forlife(Env
::get('user'));
32 if ($login === false
) {
37 if (Env
::has('mat')) {
38 $res = $globals->xdb
->query(
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();
47 $new = Env
::get('modif') == 'new';
48 $user = get_user_details($login, Session
::getInt('uid'));
49 $userax= get_user_ax($user['user_id']);
51 if (Env
::has('importe')) {
54 foreach ($user['adr'] as $adr) {
55 if (Env
::has('del_address'.$adr['adrid'])) {
56 $adr_dels[] = $adr['adrid'];
61 foreach ($userax['adr'] as $i => $adr) {
62 if (Env
::has('add_address'.$i)) {
68 foreach ($user['adr_pro'] as $pro) {
69 if (Env
::has('del_pro'.$pro['entrid'])) {
70 $pro_dels[] = $pro['entrid'];
75 foreach ($userax['adr_pro'] as $i => $pro) {
76 if (Env
::has('add_pro'.$i)) {
81 import_from_ax($userax, Env
::has('nom_usage'), Env
::has('mobile'), $adr_dels, $adr_adds, $pro_dels, $pro_adds, Env
::has('nationalite'));
85 $user = get_user_details($login, Session
::getInt('uid'));
88 $user['matricule_ax'] = $userax['matricule_ax'];
89 unset($userax['matricule_ax']);
90 $user['nom'] = ucwords(strtolower($user['nom']));
91 $user['nom_usage'] = ucwords(strtolower($user['nom_usage']));
94 $page->assign('watch_champs',array('nom', 'nom_usage', 'prenom', 'nationalite', 'mobile'));
95 $page->assign('modifiables', array(0,1,0,1,1));
97 $page->assign('x', $user);
98 $page->assign('ax', $userax);
102 // vim:set et sts=4 sws=4 sw=4: