-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathagenda.php
More file actions
1731 lines (1689 loc) · 113 KB
/
Copy pathagenda.php
File metadata and controls
1731 lines (1689 loc) · 113 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
if (!isset($_SESSION)) session_start();
// pour avoir acces à l'envoi de message decommenter les ligne if(.....) et envoi = mail_attachement
include ("include/UrlParam2PhpVar.inc.php");
if (!isset($_SESSION['id_user']) || $_SESSION['id_user'] == "")
{
exit();
}
require "admin.inc.php";
require 'agenda.inc.php';
require 'fonction.inc.php';
require 'fonction_html.inc.php';
require 'langues/agenda.inc.php';
require "lang$lg.inc.php";
if ($lg == "ru"){
$code_langage = "ru";
$charset = "Windows-1251";
}elseif ($lg == "fr"){
$code_langage = "fr";
$charset = "iso-8859-1";
}elseif ($lg == "en"){
$code_langage = "en";
$charset = "iso-8859-1";
}
//include "click_droit.txt";
dbConnect();
include ('include/varGlobals.inc.php');
$nom_user = $_SESSION['name_user'] ;
$prenom_user = $_SESSION['prename_user'];
$person = $nom_user;
$bkg = GetDataField($connect,"select param_etat_lb from param_foad where param_typ_lb = 'bkg'","param_etat_lb");
if (isset($tuteur) && $tuteur == 1 && $typ_user == "APPRENANT")
{
?>
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" content="text/html; charset=<?php echo $charset;?>">
<META http-equiv="Content-Language" content="<?php echo $code_langage ;?>">
<META HTTP-EQUIV="Expires" CONTENT="Fri, Jan 01 1900 00:00:00 GMT">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<link rel="stylesheet" type="text/css" href="<?php echo $monURI;?>/admin/style_admin.css" />
<STYLE>
//BODY { font-family: arial; font-size: 11px; color: #333333 }
TD { font-family: arial; font-size: 11px; color: #333333 }
TH { font-family: arial; font-size: 11px; color: #333333 }
A {font-family:arial;font-size:11px;color:#24677A;text-decoration:none}
A:link {font-family:arial;font-size:11px;color:#24677A;font-weight:bold}
A:visited {font-family:arial;font-size:11px;color:#24677A;font-weight:bold}
A:hover {font-family:arial;font-size:11px;color:#D45211;font-weight:bold}
A.off {font-family:arial;font-size:11px;color:#24677A;font-weight:bold}
#titre A:link{background-repeat:no-repeat;background-position:1% 50%;color:#3BACC4;}
#titre A:visited{background-repeat:no-repeat;background-position:1% 50%;color:#3BACC4;}
#titre A:hover {background-repeat:no-repeat;background-position:1% 50%;color:#D45211;}
#menu A:link{background-repeat:no-repeat;background-position:1% 50%;color:#002D44;}
#menu A:visited{background-repeat:no-repeat;background-position:1% 50%;color:#002D44;}
#menu A:hover {background-repeat:no-repeat;background-position:1% 50%;color:#D45211;}
#sequence A:link{background-repeat:no-repeat;background-position:1% 50%;color:#24677A;}
#sequence A:visited{background-repeat:no-repeat;background-position:1% 50%;color:#24677A;}
#sequence A:hover {background-repeat:no-repeat;background-position:1% 50%;color:#D45211;}
#seqinv A:link{background-repeat:no-repeat;background-position:1% 50%;color:#D45211;}
#seqinv A:visited{background-repeat:no-repeat;background-position:1% 50%;color:#D45211;}
#seqinv A:hover {background-repeat:no-repeat;background-position:1% 50%;color:#24677A;}
#parcours A:link{background-repeat:no-repeat;background-position:1% 50%;color:#002D44;}
#parcours A:visited{background-repeat:no-repeat;background-position:1% 50%;color:#002D44;}
#parcours A:hover {background-repeat:no-repeat;background-position:1% 50%;color:#FFFFFF;}
#parcseqtype A:link{background-repeat:no-repeat;background-position:1% 50%;color:red;}
#parcseqtype A:visited{background-repeat:no-repeat;background-position:1% 50%;color:red;}
#parcseqtype A:hover {background-repeat:no-repeat;background-position:1% 50%;color:#D45211;}
.clq {LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px}
.mar { font-family: arial;font-size:9px;;color:'#800000' }
.small {font-family:arial;color:navy;font-size:11px;}
.admin {font-family:arial;color:#9999FF;font-size:11px}
.texte {font-family:arial;color:navy;font-size:11px}
.Softricks_Calendar {
position: absolute;
visibility: visible;
top: 200;
left: 10;
height: 250;
width: 260;
}
<?php if ($typ_user == 'APPRENANT' && $nombre_groupes > 1)
{?>
<!--
#slidemenubar, #slidemenubar2{
position:absolute;
border:1.5px solid black;
line-height:20px;
}
-->
<?php
}
?>
</STYLE>
<script type="text/javascript" src="OutilsJs/Alert2/alert2.js"></script>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="calendrier_<?php echo $lg;?>.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function popupload(cible,nom,lg,ht) {
//Javascript:popupload('telecharger.pgi?cmd=frame','telecharger','470','280');
var win = window.open(cible, nom, 'width='+lg+',height='+ht+',resizable=yes,scrollbars=yes,status=yes,menubar=no,toolbar=no,location=no,directories=no,closed=no,opener=no');
}
function appel_w(sel_val) {
var fset=sel_val.substring(0,2);
var f2=sel_val;
var url1 = ""+f2+"";
if ( fset == "tr" )
parent.main.location=url1
}
function appel_wpop(sel_val) {
var fset=sel_val.substring(0,2);
var f2=sel_val;
var url1 = ""+f2+"";
if ( fset == "tr" )
window.open('','','width=680,height=380,resizable=yes,status=no').location=url1
}
</script>
<script language="javascript" src="functions.js"></script>
<script language="javascript">
function TryCallFunction() {
var sd = document.MForm.mydate1.value.split("\/");
document.MForm.iday.value = sd[1];
document.MForm.imonth.value = sd[0];
document.MForm.iyear.value = sd[2];
}
function TryCallFunction1() {
var sd = document.MForm.ma_date.value.split("\/");
document.MForm.iday1.value = sd[1];
document.MForm.imonth1.value = sd[0];
document.MForm.iyear1.value = sd[2];
}
function Today() {
var dd = new Date();
return((dd.getMonth()+1) + "/" + dd.getDate() + "/" + dd.getFullYear());
}
function popup(f,nom, w, h) {
window.open(f, nom, 'resizable,screenX=0,screenY=0,scrollbars=yes,menubar=yes,width=' + w + ',height=' + h);
}
function tinypopup(f,nom, w, h) {
window.open(f, nom, 'resizable,screenX=0,screenY=0,scrollbars=no,menubar=no,width=' + w + ',height=' + h);
}
msgconfm="<?php echo $mess_admin_valid_modif;?>"
function confm() {
if ( confirm(msgconfm) )
return(true);
return(false);
}
msgconf="<?php echo $mess_admin_valid_supp;?>"
function confm(url) {
ShowAlert2('JavaScript:document.location.replace("'+url+'")',
'Confirmation',
'<?php echo "$mess_admin_valid_supp <br />$mess_op_irrev";?>',
'<?php echo $adresse_http;?>/images/Exclamation.gif',
['Confirmer', 'Annuler'],
['JavaScript:HideAlert2(1,"'+url+'")','JavaScript:HideAlert2(2,"'+url+'")'],
400,
'<?php echo $adresse_http;?>/images/close.gif',
url
);
}
function conf() {
if ( confirm(msgconf) )
return(true);
return(false);
}
msgconfv="<?php echo $mess_gen_val_sais;?>"
function confv() {
if ( confirm(msgconfv) )
return(true);
return(false);
}
msgconfseq="<?php echo $mess_seq_presc;?>"
function confseq() {
if ( confirm(msgconfseq) )
return(true);
return(false);
}
function makevisible(cur,which){
if(document.getElementById){
if (which==0){
if(document.all)
cur.filters.alpha.opacity=100
else
cur.style.setProperty("-moz-opacity", 1, "");
}else{
if(document.all)
cur.filters.alpha.opacity=1
else
cur.style.setProperty("-moz-opacity", .01, "");
}
}
}
//--></SCRIPT>
<div id="overDiv" style="position:absolute; visibility:hidden;z-index:1000;"></div>
<SCRIPT LANGUAGE="JavaScript" SRC="overlib.js"><!-- overLIB (c) Erik Bosrup --></SCRIPT>
<TITLE>Formagri</TITLE>
</HEAD>
<?php
echo "<BODY bgcolor=\"$bkg\" marginwidth='0' marginheight='0' leftmargin='0'>";
$bouton_gauche = "<TABLE cellpadding='0' cellspacing='0' border=0><TR><TD><IMG SRC='images/complement/cg.gif' border='0'></TD>".
"<TD background='images/complement/milieu.gif' nowrap align='center'><DIV id='sequence'> ";
$bouton_droite = " </DIV></TD><TD><IMG SRC='images/complement/cd.gif' border='0'></TD><TR></TABLE>";
}
else
{
$_SESSION['acces'] = $acces;
if ($typ_user== "APPRENANT" && $acces == "annonce_grp" && $menu_prov != 1)
{
$_SESSION['acces'] = $acces;
$_SESSION['menu_prov'] = $menu_prov;
$_SESSION['agenda'] = $agenda;
$complement = 1;
$_SESSION['complement'] = $complement;
include "style.inc.php";
echo "<TABLE background=\"images/menu/fond_logo_formagri.jpg\" border='0' cellspacing='0' cellpadding='0' width='100%'>";
echo "<TR width='100%'><TD align='left' width='800'><IMG SRC=\"images/logo_formagri.jpg\" border='0'></TD>";
$lien="delog.php";
$lien = urlencode($lien);
echo "<TD align='right' valign='bottom'><A href=\"trace.php?link=$lien\" title=\"$mess_dcnx\"".
" onmouseover=\"img_dec.src='images/complement/boutdeconecb.gif';return true;\" onmouseout=\"img_dec.src='images/complement/boutdeconec.gif'\">";
echo "<IMG NAME=\"img_dec\" SRC=\"images/complement/boutdeconec.gif\" BORDER='0'".
" onLoad=\"tempImg=new Image(0,0); tempImg.src='images/complement/boutdeconecb.gif'\"></A></TD></TR></TABLE>";
echo "<TABLE background=\"images/ecran-annonce/bando.gif\" cellspacing='0' cellpadding='0' width='100%' border='0'>".
"<TR width='100%'><TD align='left' width='100%' valign='top'><IMG SRC=\"images/complement/soustitre.gif\" border='0'>".
"</TD></TR></TABLE> <P>";
}
else
include "style.inc.php";
}
$date_op = date("Y-m-d H:i:s" ,time());
$heure_fiche = substr($date_op,11);
$date_fiche = substr($date_op,0,10);
// traite les dates insérées via un formulaire
if ($iday && $imonth && $iyear)
$date_prise="$imonth/$iday/$iyear";
elseif (isset($day) && isset($month) && isset($year))
$date_prise = "$day/$month/$year";
if ($insere_reserve == 1)
$date_reserve = $date_prise;
if ($rdv == 1 || $insere_occupation == 1)
$date_rdv = $date_prise;
$date_cour = date ("Y/n/d");
$effacer = mysql_query("delete from rendez_vous where
rdv_date_dt < '$date_cour' AND
((rdv_commentaire_cmt = '$mess_ag_libre' OR
rdv_commentaire_cmt = 'free') OR
(rdv_modecontact_lb='AGENDA' AND
rdv_util_no > 0 AND rdv_grp_no = 0))");
$date_en_cours = date("Y-n-d");
$nb_jours_cour = nb_jours($date_en_cours);
if ($date_rdv || $date_reserve){
if ($date_rdv)
{
$ch_date = ( strstr($date_rdv,'/')) ? explode ("/",$date_rdv) : explode ("-",$date_rdv);
$date_rdv_1 = "$ch_date[2]-$ch_date[1]-$ch_date[0]";
$nb_jours = nb_jours($date_rdv_1);
}else{
$ch_date = ( strstr($date_reserve,'/')) ? explode ("/",$date_reserve) : explode ("-",$date_reserve);
$date_reserve_1 = "$ch_date[2]-$ch_date[1]-$ch_date[0]";
$nb_jours = nb_jours($date_reserve_1);
}
if ($nb_jours <= $nb_jours_cour)
$non_supp = 1;
}
//$rdv_query = mysql_query ("delete from rendez_vous where rdv_date_dt < '$date_cour' and rdv_apprenant_no = 0");
$date_messagerie = date("d/m/Y H:i:s" ,time());
//si c'est un apprenant, il doit d'abord choisir le tuteur
//Pas de rendez-vous le week-end
$jour_query = mysql_query ("select dayname('$date_reserve_1')");
$jour = mysql_result ($jour_query,0);
//if (($jour == 'Saturday' || $jour == 'Sunday') && $insere_reserve == 1)
// $messg = "<center><font size='2' color='white'><b>$mess_ag_no__regr_weend</b></font><P>";
//elseif ($insere_reserve == 1 && $jour != 'Saturday' && $jour != 'Sunday'){
if ($insere_reserve == 1)
{
if ($non_supp == 1)
{
$messg = "<center><font size='2' color='white'><b>$mess_ag_date_ant</b></font><P>";
$non_supp = 1;
}
else
{
if ($type_reserve == "Présentiel")
{
if ($id_grp == -1)
$mesg = $ag_noselect_grp;
if ($cren2 < $cren1)
$mesg = $hf_sup_hd;
if ($salle == "")
$mesg = $ag_num_salle;
if ($typ_mat == "")
$mesg = $ag_mat_act;
if ($mesg != "")
{
echo "<CENTER><TABLE bgColor='#298CA0' cellspacing='2'><TR><TD>";
echo "<TABLE bgColor='#FFFFFF' cellspacing='2' width='100%'>";
echo "<TR><TD background=\"images/fond_titre_table.jpg\" colspan='2' height='34' align='center' valign='center'><Font size='3' color='#FFFFFF'><B>$mess_menu_agenda</B></FONT>";
echo "<CENTER> <P><FONT SIZE='2'>$mesg</FONT></CENTER><P> ";
echo "</TD></TR></TABLE></TD></TR></TABLE>";
exit();
}
}
$adr_mail = GetDataField ($connect, "select util_email_lb from utilisateur where util_cdn=$id_user","util_email_lb");
$date_mess = $date_reserve;
$ch_date = explode("/",$date_reserve);
$date_reserve = "$ch_date[2]-$ch_date[1]-$ch_date[0]";
$id_rdv = Donne_ID ($connect,"select max(rdv_cdn) from rendez_vous");
if ($type_reserve != "Présentiel")
{
$id_rdv = Donne_ID ($connect,"select max(rdv_cdn) from rendez_vous");
$query = mysql_query ("insert into rendez_vous (rdv_cdn,rdv_util_no,rdv_tuteur_no,rdv_apprenant_no,rdv_grp_no,rdv_creneau_nb,rdv_commentaire_cmt,rdv_date_dt,rdv_modecontact_lb) values ('$id_rdv','$id_user','0','0','$id_grp','0','$type_reserve','$date_reserve','AGENDA')");
}
else
{
// $id_cren=0;
// echo "<FONT color='white'>for ($id_cren=$cren1;$id_cren<$cren2;$id_cren++){"; exit;
for ($id_cren=$cren1;$id_cren<$cren2+1;$id_cren++)
{
$id_rdv = Donne_ID ($connect,"select max(rdv_cdn) from rendez_vous");
$query = mysql_query ("insert into rendez_vous (rdv_cdn,rdv_util_no,rdv_tuteur_no,rdv_apprenant_no,rdv_grp_no,rdv_creneau_nb,rdv_titre_lb,rdv_commentaire_cmt,rdv_date_dt,rdv_modecontact_lb) values ('$id_rdv','$id_user','0','0','$id_grp','$id_cren','$type_reserve','$salle-$typ_mat','$date_reserve','AGENDA')");
}
}
$nom_grp = GetDataField ($connect,"select grp_nom_lb from groupe where grp_cdn = $id_grp","grp_nom_lb");
$message.= "$convoc_regroup : $nom_user $prenom_user\n";
$message.= "$mess_ag_blo_jour\n";
$message.= "$mess_ag_date $date_mess $pour $mpr_grpmin $nom_grp $endroit-$salle\n";
$message.= "$mess_ag_mat: $typ_mat\n";
$message.= "$mess_ag_mail1_4\n\n";
$message_base = "$convoc_regroup : $nom_user $prenom_user<BR>$mess_ag_blo_jour <BR>
$mess_ag_date $date_mess $mpr_grpmin $nom_grp $endroit-$salle<BR>
$mess_ag_mat: $typ_mat<BR>
$mess_ag_mail1_4";
$msg = StripSlashes($message);
$origine=$nom_user." ".$typ_user;
$nom ='';
$userfile = "none";
// envoi d'Emails à chaque apprenant du groupe en question
$liste = mysql_query("select * from utilisateur,utilisateur_groupe where utilisateur.util_cdn = utilisateur_groupe.utilgr_utilisateur_no AND utilisateur_groupe.utilgr_groupe_no=$id_grp");
$nbr = mysql_num_rows($liste);
if ($nbr>0){
$i = 0;
while ($i < $nbr){
$num = mysql_result($liste,$i,"util_cdn");
$email = mysql_result($liste,$i,"util_email_lb");
$reply = $adr_mail;
$from = $adr_mail;
$sendto = $email;
$subject = StripSlashes($mess_ag_ag);
if (isset($_SESSION['IsOff']) && $_SESSION['IsOff'] == 0)
{
if ($sendto != "")
$envoi=mail_attachement($sendto , $subject , $msg , $userfile ,$reply, $nom, $from );
}
$max_numero = Donne_ID ($connect,"select max(mess_cdn) from messagerie");
$requete = mysql_query("INSERT INTO messagerie (mess_cdn,envoyeur,origine,contenu,date,sujet,id_user) VALUES ($max_numero,'$id_user',\"$mess_ag_rsv\",\"$message_base\",'$date_messagerie','$subject',$num)");
$i++;
}
}
$from = $adr_mail;
$reply = $adr_mail;
$sendto = $adr_mail;
$subject = StripSlashes($mess_ag_ag);
$msg = StripSlashes($message);
$origine=$nom_user." ".$typ_user;
$nom ='';
$userfile = "none";
if (isset($_SESSION['IsOff']) && $_SESSION['IsOff'] == 0)
{
if ($sendto != "")
$envoi=mail_attachement($sendto , $subject , $msg , $userfile ,$reply, $nom, $from );
}
$max_numero = Donne_ID ($connect,"select max(mess_cdn) from messagerie");
$requete = mysql_query("INSERT INTO messagerie (mess_cdn,envoyeur,origine,contenu,date,sujet,id_user) VALUES ($max_numero,'$id_user',\"$mess_ag_rsv\",\"$message_base\",'$date_messagerie','$subject',$id_user)");
}
} //fin if insere_reserve...
if (($apprenant == 1 || $apprenant == $id_user) && $typ_user == "APPRENANT")
{
$tuteur_query = mysql_query ("select distinct utilisateur.util_cdn,utilisateur.util_nom_lb,utilisateur.util_prenom_lb from
utilisateur,tuteur where utilisateur.util_typutil_lb !='apprenant' and tuteur.tut_apprenant_no = $id_user and
tuteur.tut_tuteur_no=utilisateur.util_cdn");
$Nb_Tut = mysql_num_rows ($tuteur_query);
$date_cour = date ("Y/n/d");
//on recupere ds un champ l'annee pour pouvoir comparer avec l'annee cherchee ($ch_date_cour[0])
$ch_date= explode ("/",$date_cour);
//On echange les champs car l'annee est conservee ds $ch_date[2] ds tout le script
$ch_date[2]=$ch_date[0];
$i = 0;
$possibilites = array();
while ($i != $Nb_Tut)
{
$id = mysql_result ($tuteur_query,$i,"util_cdn");
$nom = mysql_result ($tuteur_query,$i,"util_nom_lb");
$prenom = mysql_result ($tuteur_query,$i,"util_prenom_lb");
$req_lib = mysql_query("SELECT rdv_cdn from rendez_vous where rdv_tuteur_no = $id and rdv_util_no=0 and rdv_apprenant_no=0 and rdv_grp_no=0 and rdv_date_dt > '$date_en_cours' order by rdv_date_dt asc");
$nomb_lib = mysql_num_rows($req_lib);
$req_occupe = mysql_query("SELECT rdv_cdn from rendez_vous where rdv_tuteur_no = $id and rdv_util_no=0 and rdv_apprenant_no=$id_user and rdv_grp_no=0 and rdv_date_dt > '$date_en_cours' order by rdv_date_dt asc");
$nomb_ocp = mysql_num_rows($req_occupe);
if ($nomb_lib > 0)
{
$possibilites[$i] = $nomb_lib;
$possible ++;
}
if ($nomb_lib > $nomb_ocp || $nomb_lib == $nomb_ocp)
$nombre_items += $nomb_lib;
elseif($nomb_lib < $nomb_ocp)
$nombre_items += $nomb_ocp;
$i++;
}
if ($possible > 0)
{
$lien = "tutorat.php";
$lien= urlencode($lien);
$hauteur = 30*$nombre_items+100;
$mon_lien= "<div id='rdv' style=\"float:left;padding-left:4px;padding-right:8px;\">".
"<A HREF=\"javascript:void(0);\" class='bouton_new' ".
"onclick=\"javascript:window.open('trace.php?link=$lien','','left=100,top=300,width=750,height=$hauteur,resizable=yes,status=no')\">".
"<img src='images/clignotant.gif' border=0> $mess_prise_rdv</A></div>";
}
} //fin if ($apprenant)
if ($reserve == 1 && !$matiere)
{
echo "<TABLE bgColor='#298CA0' cellspacing='2'><TR><TD>";
echo "<TABLE bgColor='#FFFFFF' cellspacing='2' width='100%'>";
echo "<form name='form' action=\"agenda.php?reserve=$reserve&tuteur=$tuteur&Prem=0&rech=$rech&tut=$tut&date=$date_reserve\" method='post'>";
echo "<TR><TD background=\"images/fond_titre_table.jpg\" colspan='3' height='34' align='center' valign='center'><Font size='3' color='#FFFFFF'><B>$mess_ag_choix_reserve</B></FONT>";
echo "</TD></TR><TR><TD><TABLE><TR><TD nowrap> </TD><TD nowrap>OUI</TD>";
echo "<TD nowrap>NON</TD></TR><TR><TD nowrap>$mess_ag_ch_mat</TD>";
echo "<TD><input type='checkbox' name='matiere' value = 'oui'></TD>";
echo "<TD><input type='checkbox' name='matiere' value = 'non'></TD></TR><TR>";
echo "</TD></TR><TR><TD align=left><A HREF=\"javascript:history.back();\" onmouseover=\"img_annonce.src='images/fiche_identite/boutretourb.gif';return true;\" onmouseout=\"img_annonce.src='images/fiche_identite/boutretour.gif'\">";
echo "<IMG NAME=\"img_annonce\" SRC=\"images/fiche_identite/boutretour.gif\" BORDER='0' onLoad=\"tempImg=new Image(0,0); tempImg.src='images/fiche_identite/boutretourb.gif'\"></A>";
echo "</TD><TD align='center' colspan='2'><A HREF=\"javascript:document.form.submit();\" onmouseover=\"img1.src='images/fiche_identite/boutvalidb.gif';return true;\" onmouseout=\"img1.src='images/fiche_identite/boutvalid.gif'\">".
"<IMG NAME=\"img1\" SRC=\"images/fiche_identite/boutvalid.gif\" BORDER='0' onLoad=\"tempImg=new Image(0,0); tempImg.src='images/fiche_identite/boutvalidb.gif'\"></A>";
echo "</TD></TR></TABLE></TD></TR></TABLE></form></BODY></HTML>";
exit();
}
if ($reserve == 1 && $matiere == "non")
{
echo "<form name=\"MForm\" action=\"agenda.php?insere_reserve=$reserve&tuteur=$tuteur&Prem=0&rech=$rech&tut=$tut&date=$date_reserve\" method='post'>";
entete_simple($mess_ag_choix_reserve);
echo "<TR><TD colspan=4>";
echo "<TABLE bgColor='#FFFFFF' width=100% cellpadding='4'>";
echo "<tr><td colspan=4>$nordvdtjour</td></tr>";
echo "<TR><TD nowrap>";
echo $mess_ag_date_reserve;
echo "</TD>";
$ch_date_cour= explode ("/",$date_cour);
$day=$ch_date_cour[2];
$month=$ch_date_cour[1];
$year=$ch_date_cour[0];?>
<input type="hidden" name=txt_custom value="AppendOrReplace=Replace;AppendChar=';';CloseOnSelect=Yes;ReturnData=Date;Title=<?php echo $calendrier?>;InlineX=550;InlineY=250;CurrentDate=Today;SelectAfter=Today-30;SelectBefore=Today+30;AllowWeekends=No;Resizable=Yes;CallFunction=TryCallFunction;PopupX=300;PopupY=300;Nav=Yes;SmartNav=Yes;Fix=No;WeekStart=1;Weekends=06">
<TD><INPUT TYPE="TEXT" class="INPUT" name="imonth" value="<?php echo $day;?>" MAXLENGTH="2" size="2"></TD>
<TD><INPUT TYPE="TEXT" class="INPUT" name="iday" value="<?php echo $month;?>" MAXLENGTH="2" size="2"></TD>
<TD><INPUT TYPE="TEXT" class="INPUT" name="iyear" value="<?php echo $year;?>" MAXLENGTH="4" size="4"></TD>
<TD><input type="hidden" value="" name="mydate1">
<a href="javascript:show_calendar('MForm.mydate1','09', '2002', 'DD/MM/YYYY', 'INLINE', MForm.txt_custom.value);"
onmouseover="img_cal1.src='images/agenda/icocalendb.gif';return true;"
onmouseout="img_cal1.src='images/agenda/icocalend.gif'">
<IMG NAME="img_cal1" SRC="images/agenda/icocalend.gif" BORDER='0' valign='top' alt="<?php echo $cal_click ;?>"
onLoad="tempImg=new Image(0,0); tempImg.src='images/agenda/icocalendb.gif'"></A>
</TD><TR>
<TD nowrap>
<?php echo $mess_ag_choix ;?>
</TD>
<TD colspan=4>
<SELECT name="<?php echo $mess_ag_typ_res;?>" class='SELECT'>
<OPTION VALUE="Stage"><?php echo $mess_ag_stage ;?></OPTION>
<OPTION VALUE="Visite"><?php echo $mess_ag_visite ;?></OPTION>
</SELECT>
</TD>
</TR>
<TR>
<TD nowrap>
<?php echo $mess_gp_nom_grp ;?>
</TD>
<TD colspan=3>
<?php
if ($typ_user == "ADMINISTRATEUR")
Ascenseur ("id_grp","select distinct grp_cdn,grp_nom_lb from groupe where grp_flag_on = 1",$connect,$param);
elseif ($typ_user == "RESPONSABLE_FORMATION")
Ascenseur ("id_grp","select distinct grp_cdn,grp_nom_lb from groupe where grp_resp_no = $id_user AND grp_flag_on = 1",$connect,$param);
?>
</TD>
</TR>
<?php
echo boutret(1,0);
echo "</TD><TD align='center' colspan='3'><A HREF=\"javascript:document.MForm.submit();\" onmouseover=\"img1.src='images/fiche_identite/boutvalidb.gif';return true;\" onmouseout=\"img1.src='images/fiche_identite/boutvalid.gif'\">".
"<IMG NAME=\"img1\" SRC=\"images/fiche_identite/boutvalid.gif\" BORDER='0' onLoad=\"tempImg=new Image(0,0); tempImg.src='images/fiche_identite/boutvalidb.gif'\"></A>";
?>
</TD></TR></TABLE></td></tr></TD></TR></TABLE></TD></TR></TABLE>
</form>
<DIV ID="TOP">
<SCRIPT Language="Javascript" TYPE="text/javascript">
Calendar.CreateCalendarLayer(10, 275, "");
</SCRIPT>
</DIV>
</BODY></HTML>
<?php exit;
}
if ($reserve == 1 && $matiere == "oui")
{
echo "<form name=\"MForm\" action=\"agenda.php?insere_reserve=$reserve&tuteur=$tuteur&Prem=0&rech=$rech&tut=$tut&date=$date_reserve\" target='main' method='post'>";
entete_simple($mess_ag_choix_reserve);
echo "<TR><TD colspan='2' width='100%'>";
?>
<TABLE bgcolor='#FFFFFF' width=100% cellpadding="4" border=0 >
<?php echo "<tr><td align=center></td><td style=\"font-weight:bold;\">$nordvdtjour</td></tr>";?>
<TR>
<TD nowrap align='right'>
<?php echo $mess_ag_date_reserve ;?>
</TD>
<?php
$ch_date_cour= explode ("/",$date_cour);
$day=$ch_date_cour[2];
$month=$ch_date_cour[1];
$year=$ch_date_cour[0];
?>
<input type="hidden" name=txt_custom value="AppendOrReplace=Replace;AppendChar=';';CloseOnSelect=Yes;ReturnData=Date;Title=<?php echo $calendrier;?>;InlineX=550;InlineY=250;CurrentDate=Today;SelectAfter=Today-30;SelectBefore=Today+30;AllowWeekends=No;Resizable=Yes;CallFunction=TryCallFunction;PopupX=300;PopupY=300;Nav=Yes;SmartNav=Yes;Fix=No;WeekStart=1;Weekends=06">
<TD align='left'><INPUT TYPE="TEXT" class="INPUT" name="imonth" value="<?php echo $day;?>" MAXLENGTH="2" size="2">
<INPUT TYPE="TEXT" class="INPUT" name="iday" value="<?php echo $month;?>" MAXLENGTH="2" size="2">
<INPUT TYPE="TEXT" class="INPUT" name="iyear" value="<?php echo $year;?>" MAXLENGTH="4" size="4">
<input type="hidden" value="" name="mydate1">
<a href="javascript:show_calendar('MForm.mydate1','09', '2002', 'DD/MM/YYYY', 'INLINE', MForm.txt_custom.value);"
onmouseover="img_cal1.src='images/agenda/icocalendb.gif';return true;"
onmouseout="img_cal1.src='images/agenda/icocalend.gif'">
<IMG NAME="img_cal1" SRC="images/agenda/icocalend.gif" BORDER='0' valign='bottom' alt="<?php echo $cal_click ;?>"
onLoad="tempImg=new Image(0,0); tempImg.src='images/agenda/icocalendb.gif'"></A>
</TD><TR>
<TD nowrap align='right'>
<?php echo $mess_mail_de ;?>
</TD>
<TD><?php
echo "
<SELECT name='cren1' class='SELECT' size='1'>
<OPTION VALUE='1'>8$h</OPTION>
<OPTION VALUE='2'>9$h</OPTION>
<OPTION VALUE='3'>10$h</OPTION>
<OPTION VALUE='4'>11$h</OPTION>
<OPTION VALUE='5'>12$h</OPTION>
<OPTION VALUE='6'>13$h </OPTION>
<OPTION VALUE='7'>14$h</OPTION>
<OPTION VALUE='8'>15$h</OPTION>
<OPTION VALUE='9'>16$h</OPTION>
<OPTION VALUE='10'>17$h</OPTION>
<OPTION VALUE='11'>18$h</OPTION>
<OPTION VALUE='12'>19$h</OPTION>
<OPTION VALUE='13'>20$h</OPTION>
<OPTION VALUE='14'>21$h</OPTION>
<OPTION VALUE='15'>22$h</OPTION>
</SELECT>"
?>
</TD>
</TR>
<TR>
<TD nowrap align='right'>
<?php echo $mess_mail_a ;?>
</TD>
<TD><?php
echo "
<SELECT name='cren2' class='SELECT' size='1' >
<OPTION VALUE='1'>9$h</OPTION>
<OPTION VALUE='2'>10$h</OPTION>
<OPTION VALUE='3'>11$h</OPTION>
<OPTION VALUE='4'>12$h</OPTION>
<OPTION VALUE='5'>13$h</OPTION>
<OPTION VALUE='6'>14$h</OPTION>
<OPTION VALUE='7'>15$h</OPTION>
<OPTION VALUE='8'>16$h</OPTION>
<OPTION VALUE='9'>17$h</OPTION>
<OPTION VALUE='10'>18$h</OPTION>
<OPTION VALUE='11'>19$h</OPTION>
<OPTION VALUE='12'>20$h </OPTION>
<OPTION VALUE='13'>21$h</OPTION>
<OPTION VALUE='14'>22$h</OPTION>
<OPTION VALUE='15'>23$h</OPTION>
</SELECT>"
?>
</TD>
</TR>
<input type="hidden" name="type_reserve" value="Présentiel">
<TR>
<TD nowrap align='right'>
<?php echo $objet_ag ;?>
</TD>
<TD>
<INPUT TYPE="TEXT" class="INPUT" name="typ_mat" size="60">
</TD>
</TR>
<TR>
<TD nowrap align='right'>
<?php echo $m_ref_lieu ;?>
</TD>
<TD>
<INPUT TYPE="TEXT" class="INPUT" name="salle" size="60">
</TD>
</TR>
<TR>
<TD nowrap align='right'>
<?php echo $mess_gp_nom_grp ;?>
</TD>
<TD>
<?php
if ($typ_user == "ADMINISTRATEUR")
Ascenseur ("id_grp","select distinct grp_cdn,grp_nom_lb from groupe where grp_flag_on = 1",$connect,$param);
else
Ascenseur ("id_grp","select distinct grp_cdn,grp_nom_lb from groupe where grp_resp_no = $id_user and grp_flag_on = 1",$connect,$param);
?>
</TD>
</TR>
<?php
echo boutret(1,0);
echo "</TD><TD align='left'><A HREF=\"javascript:document.MForm.submit();\" onmouseover=\"img1.src='images/fiche_identite/boutvalidb.gif';return true;\" onmouseout=\"img1.src='images/fiche_identite/boutvalid.gif'\">".
"<IMG NAME=\"img1\" SRC=\"images/fiche_identite/boutvalid.gif\" BORDER='0' onLoad=\"tempImg=new Image(0,0); tempImg.src='images/fiche_identite/boutvalidb.gif'\"></A>";
?>
</TD></TR></TABLE></TD></TR></TABLE></TD></TR></TABLE>
</form>
<DIV ID="TOP">
<SCRIPT Language="Javascript" TYPE="text/javascript">
Calendar.CreateCalendarLayer(10, 275, "");
</SCRIPT>
</DIV>
</BODY></HTML>
<?php exit;
}
else if ($prop_rdv == 1 || $occupation == 1) { //Ds URL,on est oblige de passer 2 fois $date_rdv pour la mettre ds le mail de confirmation
if ($prop_rdv == 1)
$rdv = 1;
echo "<form name=\"MForm\" action=\"agenda.php?rdv=$rdv&insere_occupation=$occupation&tuteur=$tuteur&Prem=0&rech=$rech&num_sem=$num_sem&apprenant=$apprenant&tut=$tut\" method='post'>";
if($prop_rdv == 1)
$tit_mess = $mess_ag_prop_rdv_app;
else
$tit_mess = $mess_ag_ins_act;
entete_simple($tit_mess);
if ($prop_rdv == 1)
echo "<TR><TD colspan='2' class='sous_titre'>$mess_ag_envoi_delai</TD></TR>";
echo "<TR><TD colspan='2'>";
?>
<TABLE bgcolor="#FFFFFF" width=100% cellpadding="4" border=0>
<?php echo "<tr><td align=center></td><td style=\"font-weight:bold;\">$nordvdtjour</td></tr>";?>
<TR><TD align='right'><?php echo $mess_ag_date_rdv ;?></TD><TD>
<input type="hidden" name="txt_custom" value="AppendOrReplace=Replace;AppendChar=';';CloseOnSelect=Yes;ReturnData=Date;Title=<?php echo $calendrier;?>;InlineX=600;InlineY=150;CurrentDate=Today;SelectAfter=Today-30;SelectBefore=Today+30;AllowWeekends=No;Resizable=Yes;CallFunction=TryCallFunction;PopupX=500;PopupY=400;Nav=Yes;SmartNav=Yes;Fix=No;WeekStart=1;Weekends=06">
<INPUT TYPE="TEXT" class="INPUT" name="imonth" value="<?php echo $day;?>" MAXLENGTH="2" size="2">
<INPUT TYPE="TEXT" class="INPUT" name="iday" value="<?php echo $month;?>" MAXLENGTH="2" size="2">
<INPUT TYPE="TEXT" class="INPUT" name="iyear" value="<?php echo $year;?>" MAXLENGTH="4" size="4">
<input type="hidden" value="" name="mydate1">
<a href="javascript:show_calendar('MForm.mydate1','09', '2002', 'DD/MM/YYYY', 'INLINE', MForm.txt_custom.value);"
onmouseover="img_cal1.src='images/agenda/icocalendb.gif';return true;"
onmouseout="img_cal1.src='images/agenda/icocalend.gif'">
<IMG NAME="img_cal1" SRC="images/agenda/icocalend.gif" BORDER='0' valign='top' alt="<?php echo $cal_click ;?>"
onLoad="tempImg=new Image(0,0); tempImg.src='images/agenda/icocalendb.gif'"></A>
</TD>
</TR>
<?php
echo "</TD></TR><TR><TD align='right'>$mess_ag_cren</TD>";
echo "<TD>";
echo "
<SELECT name='cren' class='SELECT' size='1' >
<OPTION VALUE='1'>8$h-9$h</OPTION>
<OPTION VALUE='2'>9$h-10$h</OPTION>
<OPTION VALUE='3'>10$h-11$h</OPTION>
<OPTION VALUE='4'>11$h-12$h</OPTION>
<OPTION VALUE='5'>12$h-13$h</OPTION>
<OPTION VALUE='6'>13$h-14$h </OPTION>
<OPTION VALUE='7'>14$h -15$h</OPTION>
<OPTION VALUE='8'>15$h-16$h </OPTION>
<OPTION VALUE='9'>16$h -17$h</OPTION>
<OPTION VALUE='10'>17$h-18$h </OPTION>
<OPTION VALUE='11'>18$h -19$h</OPTION>
<OPTION VALUE='12'>19$h-20$h </OPTION>
<OPTION VALUE='13'>20$h -21$h</OPTION>
<OPTION VALUE='14'>21$h-22$h </OPTION>
<OPTION VALUE='15'>22$h-23$h</OPTION>
</SELECT>"
?>
</TD>
</TR>
<?php
if ($occupation == 0)
echo "<input type=hidden name= 'commentaire' value='libre'>";
else {
?>
<TR>
<TD align='right' nowrap>
<?php echo $objet_ag ;?>
</TD>
<TD>
<INPUT TYPE="TEXT" class="INPUT" name="titre_rdv" align="middle" size=60 MAXLENGTH=60>
</TD>
</TR>
<TR>
<TD align='right' nowrap>
<?php echo $mess_admin_comment ;?>
</TD>
<TD>
<INPUT TYPE="TEXT" class="INPUT" name="commentaire" size=60 MAXLENGTH=60 value="" align="middle">
</TD>
</TR>
<?php }?>
<?php if ($prop_rdv == 1){?>
<TR>
<TD align='right' nowrap>
<?php echo $mess_ag_mode_cont ;?>
</TD>
<TD>
<SELECT name="mod_contact" class='SELECT' size="1" >
<OPTION VALUE="CHAT"><?php echo $mess_gen_chat ;?></OPTION>
<OPTION VALUE="TELEPHONE"><?php echo $mess_gen_tel ;?></OPTION>
<OPTION VALUE="RENCONTRE"><?php echo $mess_gen_renc ;?></OPTION>
<OPTION VALUE="VISIO-CONF"><?php echo $mess_gen_visio ;?></OPTION>
</SELECT>
</TD>
</TR>
<?php }
else
echo "<INPUT TYPE=HIDDEN name='mod_contact' value='AGENDA'>";
echo boutret(1,0);
echo "</TD><TD align='left' colspan='2' valign='top'><A HREF=\"javascript:document.MForm.submit();\" ".
"onmouseover=\"img1.src='images/fiche_identite/boutvalidb.gif';return true;\" ".
"onmouseout=\"img1.src='images/fiche_identite/boutvalid.gif'\">".
"<IMG NAME=\"img1\" SRC=\"images/fiche_identite/boutvalid.gif\" BORDER='0' ".
"onLoad=\"tempImg=new Image(0,0); tempImg.src='images/fiche_identite/boutvalidb.gif'\"></A>";
?>
</TD></TR></TABLE></TD></TR></FORM></TABLE></TD></TR></TABLE>
<DIV ID="TOP">
<SCRIPT Language="Javascript" TYPE="text/javascript">
Calendar.CreateCalendarLayer(10, 275, "");
</SCRIPT>
</DIV>
</BODY></HTML>
<?php
exit; //fin if ($prop_rdv == 1)
}
elseif ($libre == 1 && $tut == 1)
{
//On a juste a proposer un formulaire pour rdv si c un tuteur, formateur,etc...
echo "<center><FORM name='form1' action=\"agenda.php?rdv_pris=1&Prem=0&rech=0&tut=1&date_rdv=$date&cren=$cren&tuteur=$tuteur&app=$app\" method='POST'>";
echo "<CENTER><TABLE bgColor='#298CA0' cellspacing='2'><TR><TD>";
echo "<TABLE bgColor='#FFFFFF' cellspacing='1' width='100%'>";
echo "<TR><TD nowrap>$mess_ag_chx_app</TD><TD nowrap>";
//Un tuteur ne peut prendre rendez-vous qu'avec les apprenants dont il a la charge
//Par contre, responsable, formateur et administrateur peuvent prendre rdv avec n'importe lequel
if (($typ_user == "FORMATEUR_REFERENT") || ($typ_user == "RESPONSABLE_FORMATION") || ($typ_user == "ADMINISTRATEUR"))
Ascenseur_mult("apprenant","select util_cdn, util_nom_lb, util_prenom_lb from utilisateur where
util_typutil_lb='APPRENANT' order by UTIL_NOM_LB ASC",$connect,$param);
else
Ascenseur_mult("apprenant","select util_cdn, util_nom_lb, util_prenom_lb from utilisateur,tuteur where
tuteur.tut_tuteur_no=$tuteur and util_cdn = tut_apprenant_no order by UTIL_NOM_LB ASC",$connect,$param);
echo "<TR><TD><A HREF=\"javascript:history.back();\" ".
"onmouseover=\"img_annonce.src='images/fiche_identite/boutretourb.gif';return true;\" ".
"onmouseout=\"img_annonce.src='images/fiche_identite/boutretour.gif'\">".
"<IMG NAME=\"img_annonce\" SRC=\"images/fiche_identite/boutretour.gif\" BORDER='0' ".
"onLoad=\"tempImg=new Image(0,0); tempImg.src='images/fiche_identite/boutretourb.gif'\"></A>";
echo "</TD><TD align='center'><A HREF=\"javascript:document.form1.submit();\" ".
"onmouseover=\"img1.src='images/fiche_identite/boutvalidb.gif';return true;\" ".
"onmouseout=\"img1.src='images/fiche_identite/boutvalid.gif'\">".
"<IMG NAME=\"img1\" SRC=\"images/fiche_identite/boutvalid.gif\" BORDER='0' ".
"onLoad=\"tempImg=new Image(0,0); tempImg.src='images/fiche_identite/boutvalidb.gif'\"></A>";
echo "</TD></TR></TABLE></TD></TR></TABLE></FORM></center><P>";
}// fin else if ($libre == 1 && $tut == 1)
$laide = ($typ_user == 'APPRENANT') ? aide_div("rendez_vous_apprenant",0,0,0,0) : aide_div("rendez-vous_formateur",0,0,0,0);
//On a besoin de la date courante slt la premiere fois ou l'on arrive sur la page
if ($Prem == 0)
$date = date("Y/n/d");
//on insere ds la table le plage horaire proposee par le tuteur, formateur,....
if ($rdv == 1 || $insere_occupation == 1)
{
if ($cren == '' || $date_rdv == '' || $mod_contact == '')
$form_vide=1;
elseif ($non_supp == 1)
echo "<center><TABLE cellspacing=10><TR><TD align=left valign=top width='36'>".
"<IMG SRC=\"images/ecran-annonce/icoalert.gif\" border = '0' title ='$mess_avertis'></TD>".
"<TD align=left valign=top><font size='2'><b>$mess_ag_date_ant</b></font></TD></TR></TABLE>";
else
{
//Il faut inverser la date
$ch_date = explode("/",$date_rdv);
$date_rdv = "$ch_date[2]/$ch_date[1]/$ch_date[0]";
//Verifier qu'il n'y a pas deja un rendez-vous de pris ou propose a la meme date et au meme horaire
if ($typ_user == "APPRENANT" && $numero_groupe > 1)
{
$group = mysql_query("select utilgr_groupe_no from utilisateur_groupe where utilgr_utilisateur_no = $id_user");
$nbr_grp = mysql_num_rows($group);
if ($nbr_grp > 0)
$grp = $numero_groupe;
$verif_rdv_query = mysql_query ("select rdv_cdn from rendez_vous where
(rdv_util_no = $id_user or rdv_apprenant_no = $id_user) and
(rdv_creneau_nb = $cren or (rdv_creneau_nb = 0 and rdv_grp_no = $grp)) and
rdv_date_dt = '$date_rdv'");
}
else
{
$grp = 0;
$verif_rdv_query = mysql_query ("select rdv_cdn from rendez_vous where (((rdv_util_no = $id_user and
rdv_titre_lb != 'Présentiel') or rdv_tuteur_no = $id_user) and
(rdv_creneau_nb = $cren)) and rdv_date_dt = '$date_rdv'");
}
$verif_rdv = mysql_num_rows($verif_rdv_query);
if ($verif_rdv == 0)
{
//Pas de rendez-vous le week-end
$jour_query = mysql_query ("select dayname('$date_rdv')");
$jour = mysql_result ($jour_query,0);
if (($jour == 'Saturday' || $jour == 'Sunday') && ($rdv == 1 && $mod_contact == 'RENCONTRE'))
{
echo "<center><TABLE cellspacing=10><TR><TD align=left valign=top width='36'>".
"<IMG SRC=\"images/ecran-annonce/icoalert.gif\" border = '0' title ='$mess_avertis'></TD>".
"<TD align=left valign=top><font size='2' color='white'><b>$mess_ag_no_weend</b></font></TD></TR></TABLE>";
}
else
{
$averti = 0;
$_SESSION['averti'] = $averti;
$id_rdv = Donne_ID ($connect,"select max(rdv_cdn) from rendez_vous");
if ($insere_occupation == 1)
{
// $titre_rdv = str_replace("'","\'",$titre_rdv);
// $commentaire = str_replace("'","\'",$commentaire);
$query = mysql_query ("insert into rendez_vous (rdv_cdn,rdv_util_no,rdv_titre_lb,rdv_apprenant_no,rdv_creneau_nb,rdv_commentaire_cmt,rdv_date_dt,rdv_modecontact_lb) values (\"$id_rdv\", \"$id_user\",\"$titre_rdv\",\"0\",\"$cren\",\"$commentaire\",\"$date_rdv\",\"$mod_contact\")");
}
else
{
$query = mysql_query ("insert into rendez_vous (rdv_cdn,rdv_tuteur_no,rdv_apprenant_no,rdv_creneau_nb,rdv_commentaire_cmt,rdv_date_dt,rdv_modecontact_lb) values (\"$id_rdv\", \"$tuteur\",\"0\",\"$cren\",\"$commentaire\",\"$date_rdv\",\"$mod_contact\")");
}
$date = "$ch_date[0]/$ch_date[1]/$ch_date[2]";
//On envoie un email pour lui rappeler quelle plage horaire il a propose
$adr_mail = GetDataField ($connect, "select util_email_lb from utilisateur where util_cdn=$id_user","util_email_lb");
$horaire = Horaire ($cren);
if ($mod_contact == "AGENDA")
{
$message = "$mess_ag_agenda\n$mess_ag_date $date\n$mess_ag_heure $horaire\n";
if ($insere_occupation == 1)
{
$message_into .= $msq_titre." ".Stripslashes($titre_rdv)."\n";
$message_into .= $mess_mail_mess." ".Stripslashes($commentaire)."\n";
}
$message .= $message_into;
$message .= "\n$mess_ag_cordial";
$reply = $adr_mail;
$from = $adr_mail;
$sendto = $adr_mail;
$subject = StripSlashes($mess_ag_ag);
$msg = StripSlashes($message);
$origine=$nom_user." ".$typ_user;
$nom ='';
$userfile = "none";
if (isset($_SESSION['IsOff']) && $_SESSION['IsOff'] == 0)
{
if ($sendto != "")
$envoi=mail_attachement($sendto , $subject , $msg , $userfile ,$reply, $nom, $from );
}
$message_base = "$mess_ag_agenda <BR>$mess_ag_date $date<BR>$mess_ag_heure $horaire<BR>".Stripslashes($titre_rdv)."<BR>".Stripslashes($commentaire)."<BR>$mess_ag_cordial";
$max_numero = Donne_ID ($connect,"select max(mess_cdn) from messagerie");
$requete = mysql_query("INSERT INTO messagerie (mess_cdn,envoyeur,origine,contenu,date,sujet,id_user) VALUES ($max_numero,'$id_user','$mess_ag_rdv_tut',\"$message_base\",'$date_messagerie','$subject',$id_user)");
$date = "$ch_date[2]/$ch_date[1]/$ch_date[0]";
}
else
{
$message= "$mess_ag_mail1_1 $date\n$mess_ag_mail1_2 $horaire\n$mess_ag_mail1_3 $mod_contact\n$mess_ag_mail1_4";
$reply = $adr_mail;
$from = $adr_mail;
$sendto = $adr_mail;
$subject = StripSlashes($mess_ag_rdv_foad);
$msg = StripSlashes($message);
$origine=$nom_user." ".$typ_user;
$nom ='';
$userfile = "none";
if (isset($_SESSION['IsOff']) && $_SESSION['IsOff'] == 0)
{
if ($sendto != "")
$envoi=mail_attachement($sendto , $subject , $msg , $userfile ,$reply, $nom, $from );
}
$message_base = $message;
$max_numero = Donne_ID ($connect,"select max(mess_cdn) from messagerie");
$requete = mysql_query("INSERT INTO messagerie (mess_cdn,envoyeur,origine,contenu,date,sujet,id_user) VALUES ($max_numero,'$id_user','$mess_ag_rdv_tut',\"$message_base\",'$date_messagerie','$subject',$id_user)");
$date = "$ch_date[2]/$ch_date[1]/$ch_date[0]";
} //fin else
}//fin if (!$verif_rdv)
}else
echo "<center><TABLE cellspacing=10><TR><TD align=left valign=top width='36'><IMG SRC=\"images/ecran-annonce/icoalert.gif\" border = '0' title ='$mess_avertis'></TD><TD align=left valign=top><font size='2' color='white'><b>$mess_ag_cren_occupe</b></font></TD></TR></TABLE>";
} //fin else ($cren='' ....)
$rdv = 1;
} //fin if ($rdv == 1)
//Les rdv sont pris
if ($rdv_pris == 1 || $app == 1)
{
//if ($app == 1) $apprenant=$id_user;
$verif_rdv_query = mysql_query ("select rdv_cdn from rendez_vous where rdv_apprenant_no = $id_user and rdv_creneau_nb = $cren and rdv_date_dt = '$date_rdv'");
$verif_rdv = mysql_num_rows($verif_rdv_query);
if ($verif_rdv > 0)
{
echo "<center><TABLE cellspacing=10><TR><TD align=left valign=top width='36'>".
"<IMG SRC=\"images/ecran-annonce/icoalert.gif\" border = '0' title ='$mess_avertis'></TD>".
"<TD align=left valign=top><font size='2' color='white'><b>$ag_rdv_also_pris</b></font></TD></TR></TABLE>";
$lien = "agenda.php?apprenant=1";
$lien = urlencode($lien);
echo "<script language=\"JavaScript\">";
echo "setTimeout(\"aller()\",2500);";
echo "function aller() {";
echo "document.location.replace(\"trace.php?link=$lien\");";
echo "}";
echo "</script>";
exit();
}
$averti = 0;
$_SESSION['averti'] = $averti;
$id_rdv = GetDataField ($connect,"select rdv_cdn from rendez_vous where rdv_date_dt='$date_rdv' and rdv_creneau_nb ='$cren' and rdv_tuteur_no='$tuteur'","rdv_cdn");
$upd_rdv = mysql_query ("UPDATE rendez_vous SET rdv_apprenant_no='$apprenant',rdv_commentaire_cmt='Occupe' where rdv_cdn=$id_rdv");
$mod_contact = GetDataField ($connect,"select rdv_modecontact_lb from rendez_vous where rdv_cdn=$id_rdv","rdv_modecontact_lb");
$letuteur = GetDataField ($connect,"select rdv_tuteur_no from rendez_vous where rdv_cdn=$id_rdv","rdv_tuteur_no");
$tuteur_query = GetDataField ($connect,"select util_typutil_lb from utilisateur where util_cdn=$letuteur","util_typutil_lb");
$inscripteur = GetDataField ($connect,"select util_auteur_no from utilisateur where util_cdn='$apprenant'","util_auteur_no");
if ($typ_user == "APPRENANT")
$qualite = "Apprenant";
elseif ($inscripteur == $id_user)
$qualite = "Inscripteur";
elseif ($letuteur == $id_user && $tuteur_query == $letuteur)
$qualite = "Tuteur";
elseif ($letuteur == $id_user && $tuteur_query != $letuteur)
$qualite = "Formateur";
elseif ($letuteur == $id_user && $inscripteur != $id_user && $typ_user == "ADMINISTRATEUR" && $tuteur_query != $letuteur)
$qualite = "Administrateur";
$nom_fiche=GetDataField ($connect,"select util_nom_lb from utilisateur where util_cdn='$letuteur'","util_nom_lb");
$prenom_fiche=GetDataField ($connect,"select util_prenom_lb from utilisateur where util_cdn='$letuteur'","util_prenom_lb");
//On envoie un email pour lui rappeler quelle plage horaire il a propose
//On pourrait faire dans une boucle mais cela complique pour la personnalisation du message
//Mail a l'utilisateur
$horaire = Horaire ($cren);
$adr_mail = GetDataField ($connect, "select util_email_lb from utilisateur where util_cdn=$id_user","util_email_lb");
$reply = $adr_mail;
$from = $adr_mail;
$sendto = $adr_mail;
$subject = StripSlashes($mess_ag_rdv_foad);
$ch_date_rdv = explode ("-",$date_rdv);
$date_rdv_pris = "$ch_date_rdv[2]/$ch_date_rdv[1]/$ch_date_rdv[0]";
if ($app == 1) {
$nom_user=GetDataField ($connect,"select util_nom_lb from utilisateur where util_cdn='$tuteur'","util_nom_lb");
$prenom_user=GetDataField ($connect,"select util_prenom_lb from utilisateur where util_cdn='$tuteur'","util_prenom_lb");
}else {
$nom_user=GetDataField ($connect,"select util_nom_lb from utilisateur where util_cdn='$apprenant'","util_nom_lb");
$prenom_user=GetDataField ($connect,"select util_prenom_lb from utilisateur where util_cdn='$apprenant'","util_prenom_lb");
}
$lecreneau = affiche_creneau($cren,$lg);
if ($mod_contact =="TELEPHONE")
$modee = $mess_gen_tel;
if ($mod_contact =="CHAT")
$modee = $mess_gen_chat;
if ($mod_contact =="RENCONTRE")
$modee = $mess_gen_renc;
if ($mod_contact =="VISIO-CONF")
$modee = $mess_gen_visio;
$date_fichee = str_replace("/","-",$date_rdv_pris);
$action_fiche = "Tutorat";
$commentaire = $mess_ag_rdv_tut." $par $modee : $date_fichee $lecreneau $mess_ag_avec $prenom_fiche $nom_fiche";
$new_fiche = Donne_ID ($connect,"select max(fiche_cdn) from fiche_suivi");
if ($qualite == "Apprenant")
$req_fiche = mysql_query("INSERT INTO fiche_suivi (fiche_cdn,fiche_utilisateur_no,fiche_auteur_no,fiche_qualite_lb,fiche_date_dt,fiche_heure_dt,fiche_commentaire_cmt,fiche_grp_no,fiche_parc_no,fiche_seq_no,fiche_act_no,fiche_typaction_lb) VALUES($new_fiche,$id_user,$id_user,'$qualite','$date_fiche','$heure_fiche',\"$commentaire\",0,0,0,0,\"$action_fiche\")");
else
$req_fiche = mysql_query("INSERT INTO fiche_suivi (fiche_cdn,fiche_utilisateur_no,fiche_auteur_no,fiche_qualite_lb,fiche_date_dt,fiche_heure_dt,fiche_commentaire_cmt,fiche_grp_no,fiche_parc_no,fiche_seq_no,fiche_act_no,fiche_typaction_lb) VALUES($new_fiche,$apprenant,$id_user,'$qualite','$date_fiche','$heure_fiche',\"$commentaire\",0,0,0,0,\"$action_fiche\")");
$id_mess = $id_user;
$message = "$mess_ag_rdv_app $prenom_user $nom_user:\n$mess_ag_date $date_rdv_pris\n$mess_ag_heure $horaire\n$mess_ag_mode_cont $mod_contact\n$mess_ag_cordial\n\n";
$msg = StripSlashes($message);
$origine=$nom_user." ".$typ_user;
$nom ='';
$userfile = "none";
if (isset($_SESSION['IsOff']) && $_SESSION['IsOff'] == 0)
{
if ($sendto != "")
$envoi=mail_attachement($sendto , $subject , $msg , $userfile ,$reply, $nom, $from );
}
$message_base = "$mess_ag_rdv_app $prenom_user $nom_user:<BR>$mess_ag_date $date_rdv_pris<BR>$mess_ag_heure $horaire<BR>$mess_ag_mode_cont $mod_contact<BR>$mess_ag_cordial";
$max_numero = Donne_ID ($connect,"select max(mess_cdn) from messagerie");
$requete = mysql_query("INSERT INTO messagerie (mess_cdn,envoyeur,origine,contenu,date,sujet,id_user) VALUES ($max_numero,'$id_user','$mess_ag_rdv_tut',\"$message_base\",'$date_messagerie','$subject',$id_mess)");
//Mail a l'autre personne concernée
if ($app == 1) {
$email_util = GetDataField ($connect, "select util_email_lb from utilisateur where util_cdn='$tuteur'","util_email_lb");