Subversion Repositories c2i-annu

Rev

Rev 42 | Rev 44 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 swirly 1
<?php
2
/* -----------------
3
/ C2ildapadm Controller
4
/------------------*/
5
 
6
require_once('include/auth.inc.php');
7
require_once('include/c2ildapadm.inc.php');
8
require_once('include/admins.inc.php');
9
require_once('include/admin.inc.php');
10
require_once('include/sadmin.inc.php');
11
require_once('include/schools.inc.php');
43 swirly 12
require_once('include/pupil.inc.php');
1 swirly 13
 
14
global $c2i_ldap;
15
global $smarty;
31 swirly 16
global $current_year;
1 swirly 17
 
31 swirly 18
 
19
 
1 swirly 20
$ldap_res=ldap_connection();
21
 
22
$user=$_SESSION['user'];
23
 
24
 
25
switch ($user->type) {
25 mathieu 26
  case 'sadmin':  
1 swirly 27
    if ($user->rne=='-1') {
28
      sadmin_init_menu();
25 mathieu 29
    }
1 swirly 30
    else {
31
      admin_init_menu();
25 mathieu 32
    }
1 swirly 33
    break;
34
 case 'admin' :
39 swirly 35
     admin_init_menu();
36
     break;
37
 case 'pupil' :
43 swirly 38
     pupil_init_menu();
39 swirly 39
     break;
1 swirly 40
}
41
 
42
$smarty->assign('user_type',$user->type);
43
$smarty->assign('user_rne',$user->rne);
44
 
45
$action=$_POST['action'];
46
$page=$_POST['page'];
47
 
48
 
49
switch ($page) {
50
 case 'accueil' :
51
   break;
25 mathieu 52
 
53
   /*
1 swirly 54
      Gestion des administrateurs locaux
55
   */
56
 
41 swirly 57
 case 'logout' :
43 swirly 58
     session_unset();
59
     session_destroy();
42 swirly 60
     header("Location: https://disconnect:true@c2i1.ac-grenoble.fr/c2i-annu/logout/logout.html");
41 swirly 61
     break;
62
 
1 swirly 63
 case 'admins' :
64
   if ($user->type !='sadmin') {
65
     $action='unauthorized';
66
   }
67
   switch ($action) {
68
   case 'list_admins' :
31 swirly 69
       sadmin_list_admins();
70
       break;
1 swirly 71
   case 'create_admin':
31 swirly 72
       sadmin_create_admin();
73
       break;
1 swirly 74
   case 'edit' :
31 swirly 75
       sadmin_modify_admin($_POST['uid']);
76
       break;
9 swirly 77
   case 'reset_admin_pwd':
31 swirly 78
       sadmin_reset_admin_pwd($_POST['uid']);
79
       break;
9 swirly 80
   case 'reset_all_admins_pwd':
31 swirly 81
       sadmin_reset_all_admins_pwd();
82
       break;
25 mathieu 83
   case 'process' :
31 swirly 84
       sadmin_admin_process();
85
       break;
1 swirly 86
   case 'delete' :
31 swirly 87
       sadmin_delete_admin($_POST['uid']);    
88
       break;
1 swirly 89
   case 'confirm_delete' :
31 swirly 90
       sadmin_confirm_delete_admin($_POST['uid']);
91
       break;
3 swirly 92
   case 'import_admins' :
31 swirly 93
       sadmin_admins_import();
94
       break;
95
   case 'export_final_note':
28 mathieu 96
       sadmin_export_naissance();
25 mathieu 97
       break;
3 swirly 98
   case 'process_import' :
31 swirly 99
       sadmin_admins_process_import();
100
       break;
3 swirly 101
   case 'process_import_create' :
31 swirly 102
       sadmin_admins_process_import_create();
1 swirly 103
   case 'unauthorized' :
31 swirly 104
       c2ildapadm_unauthorized();
105
       break;
1 swirly 106
   default :
31 swirly 107
       c2ildapadm_unauthorized();
108
       break;
1 swirly 109
   }
110
   break;
111
 
112
   /*
33 swirly 113
    Gestion  des élèves.
114
   */
115
 
116
 case 'pupils' :
117
     if ($user->type !='sadmin') {
118
         $action='unauthorized';
119
     }
120
     switch ($action)  {
121
     case 'recover_pupil_from_ine' :
122
         $smarty->assign('header_title',"R&eacute;cup&eacute;rer depuis l'INE");
123
         sadmin_recover_pupil_from_ine();
124
         break;
125
     case 'recover_pupil_from_ine_confirm':
126
         $smarty->assign('header_title',"Confirmation du choix.");
127
         sadmin_recover_pupil_from_ine_confirm($_POST);
128
         break;
129
     case 'recover_pupil_from_ine_process':
130
         sadmin_recover_pupil_from_ine_process($_POST);
131
         $smarty->assign('header_title',"R&eacute;cup&eacute;rer depuis l'INE");
132
         sadmin_recover_pupil_from_ine();
133
         break;
134
     case 'unauthorized' :
135
         c2ildapadm_unauthorized();
136
         break;
137
     default:
138
         sadmin_welcome();
139
         break;
140
     }
141
     break;
142
 
143
  /*
1 swirly 144
      Gestion des établissements
145
   */
146
 
147
 case 'schools' :
148
   if ($user->type !='sadmin') {
149
     $action='unauthorized';
150
   }
151
   switch ($action) {
152
   case 'welcome_schools' :
153
     sadmin_welcome_schools();
154
     break;
155
   case 'list_schools' :
156
     sadmin_list_schools();
157
     break;
158
   case 'create_school':
159
     sadmin_create_school();
160
     break;
25 mathieu 161
   case 'edit' :    
1 swirly 162
     sadmin_modify_school($_POST['rne']);
163
     break;
164
   case 'confirm_delete' :
165
     sadmin_confirm_delete_school($_POST['rne']);
166
     break;
167
   case 'delete' :
25 mathieu 168
     sadmin_delete_school($_POST['rne']);    
1 swirly 169
     break;
170
   case 'process' :
171
     $school=new school($_POST);
172
     $school->insert_into_ldap();
173
     sadmin_list_schools();
174
     break;
175
   case 'import_schools' :
176
     sadmin_import_schools();
177
     break;
28 mathieu 178
 
1 swirly 179
   case 'process_import' :
180
     sadmin_schools_process_import();
181
     break;
182
   case 'control_school' :
31 swirly 183
       $_SESSION['user']->rne=$_POST['rne'];
184
       $smarty->assign('user_rne',$user->rne);
185
       admin_init_menu();
186
       admin_view_school();
187
       break;
1 swirly 188
   case 'unauthorized' :
31 swirly 189
       c2ildapadm_unauthorized();
190
       break;
1 swirly 191
   default :
31 swirly 192
       sadmin_welcome_schools();
193
       break;
1 swirly 194
   }
195
   break;
196
 
38 swirly 197
   /*
198
    *
199
    *  Gestion de la configuration
200
    *
201
    */
6 swirly 202
 
203
 case 'config' :
204
   if ($user->type !='sadmin' ) {
205
     $action='unauthorized';
206
   }
207
   switch ($action) {
208
   case 'parameters':
31 swirly 209
       sadmin_config_parameters();
210
       break;
211
   case 'config_modify' :
212
       sadmin_config_modify($_POST);
213
       break;
214
   case 'ldap_clean' :
215
       ldap_clean();
216
       sadmin_welcome();
217
       break;
32 swirly 218
   case 'ldap_synchronize' :
219
       sadmin_ldap_synchronize();
220
       break;
221
   case 'process_ldap_synchronize' :
222
       sadmin_process_ldap_synchronize();
223
       break;
35 swirly 224
   case 'ldap_recover_lost_ine' :
225
       sadmin_ldap_recover_lost_ine();
226
       break;
227
   case 'confirm_ldap_recover_lost_ine' :
228
       sadmin_confirm_ldap_recover_lost_ine();
229
       break;
230
   case 'process_ldap_recover_lost_ine' :
231
       sadmin_process_ldap_recover_lost_ine();
232
       break;
6 swirly 233
   default :
234
     c2ildapadm_unauthorized();
235
     break;
236
   }
237
   break;
38 swirly 238
 
1 swirly 239
   /*
38 swirly 240
    *  Gestion de l'annuaire
241
    */
242
 
243
 case 'ldap' :
244
     if ($user->type !='sadmin') {
245
         $action='unauthorized';
246
     }
247
 
248
     switch ($action) {
249
     case 'ldap_export_csv' :
250
         sadmin_ldap_export_csv();
251
         break;
252
     default :
253
         c2ildapadm_unauthorized();
254
         break;
255
     }
256
     break;
257
 
258
   /*
25 mathieu 259
      Pages des admins locaux
1 swirly 260
   */
261
 
262
 case 'admin':
3 swirly 263
   if ($user->type !='sadmin' && $user->type!='admin') {
264
     $action='unauthorized';
265
   }
1 swirly 266
   switch ($action) {
267
   case 'view_profile' :
268
     admin_view_profile();
269
     break;
270
   case 'view_school' :
271
     admin_view_school();
272
     break;
273
   case 'list_sections' :
274
     admin_list_sections();
275
     break;
276
   case 'create_section' :
277
     admin_create_section($_POST['section']);
278
     admin_list_sections();
279
     break;
280
   case 'confirm_delete_section' :
281
     admin_confirm_delete_section($_POST['section']);
282
     break;
283
   case 'delete_section' :
284
     admin_delete_section($_POST['section']);
285
     admin_list_sections();
286
     break;
287
   case 'list_pupils' :
5 swirly 288
     admin_list_pupils($_POST['section']);
1 swirly 289
     break;
5 swirly 290
   case 'reset_pupil_pwd' :
291
     admin_reset_pupil_password($_POST['uid']);
292
     break;
6 swirly 293
   case 'reset_all_pupils_pwd' :
294
     admin_reset_all_pupils_password($_POST['section']);
295
     break;
33 swirly 296
   case 'export_pwd_CSV' :
297
       admin_export_password_CSV();
298
       break;
1 swirly 299
   case 'confirm_delete_pupil' :
300
     admin_confirm_delete_pupil($_POST['uid']);
301
     break;
302
   case 'delete_pupil' :
303
     admin_delete_pupil($_POST['uid']);
304
     break;
305
   case 'import_pupils':
306
     admin_import_pupils();
307
     break;
14 swirly 308
   case 'import_sconet_pupils':
309
     admin_import_sconet_pupils();
310
     break;
3 swirly 311
   case 'edit_pupil' :
312
     admin_edit_pupil($_POST['uid']);
313
     break;
1 swirly 314
   case 'process_import' :
315
     admin_process_pupils_import();
316
     break;
14 swirly 317
   case 'process_sconet_import':
318
     admin_process_sconet_import();
319
     break;
320
   case 'process_sconet_import_create' :
321
     admin_process_sconet_import_create();
322
     break;
21 mathieu 323
   case 'note_pupils' :
324
     admin_list_pupils_note($_POST['section']);
325
     break;
326
   case 'process_note_pupils' :
327
     admin_process_pupils_note($_POST['note'],$_POST['section']);
328
    break;
329
   case 'export_pupils_note' :
330
     admin_export_pupils_note($_POST['section']);
31 swirly 331
    break;    
332
   case 'import_pupils_note' :      
333
       admin_import_pupils_note($_FILES,$_POST['section'],$_SESSION['user']->rne);
334
       break;
335
   case 'exportCSV' :
336
       admin_exportCSV($_SESSION['user']->rne);
337
       break;
1 swirly 338
   case 'process_import_create' :
31 swirly 339
       admin_process_pupils_import_create();
340
       break;
1 swirly 341
   case 'sadmin_return' :
31 swirly 342
       if ($user->type == 'sadmin') {
343
           sadmin_return();
344
           $smarty->assign('user_rne','-1');
345
           sadmin_init_menu();
346
           sadmin_list_schools();
347
       } else {
348
           c2ildapadm_unauthorized();
349
       }
350
       break;
1 swirly 351
   default :
31 swirly 352
       admin_view_profile();
353
       break;
1 swirly 354
   }
355
   break;
25 mathieu 356
 
43 swirly 357
 
358
 case 'pupil' :
359
     switch ($action) {
360
     case 'infos':
361
         pupil_infos();
362
         break;
363
     case 'validation':
364
         pupil_validation();
365
         break;
366
     case 'process_validation':
367
         pupil_process_validation();
368
         break;
369
     }
370
     break;
371
 
372
 
1 swirly 373
 default :
31 swirly 374
     sadmin_welcome();
375
     break;
376
 }
1 swirly 377
?>