Rev 5384 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4667 | obado | 1 | # Utilise pour verifier l'existence d'un etudiant dans une classe |
2 | # Check.user verifie que l'element $quser est present dans $qclass |
||
23 | reyssat | 3 | |
5384 | obado | 4 | #On considere que la classe a ete verifie en amont (via check.class) |
23 | reyssat | 5 | |
5384 | obado | 6 | quser=!word 1 of $quser |
7 | quser=!translate internal . to @ in $quser |
||
8 | quser=!translate internal /;,?* to $ $ in $quser |
||
23 | reyssat | 9 | !if $ $ isin $quser |
10 | quser= |
||
11 | !endif |
||
12 | !if $quser=$empty |
||
13 | :baduser |
||
5384 | obado | 14 | error=bad user (empty quser or bad chars detected) |
23 | reyssat | 15 | !exit |
16 | !endif |
||
17 | |||
18 | !if $quser=supervisor |
||
19 | deffile=supervisor |
||
20 | !else |
||
21 | deffile=.users/$quser |
||
22 | !endif |
||
1373 | bpr | 23 | class_superclass=!defof class_superclass in $classdeffile |
23 | reyssat | 24 | |
1373 | bpr | 25 | !if $class_superclass= |
4176 | obado | 26 | userdeffile=wimshome/log/classes/$qclass/$deffile |
1373 | bpr | 27 | test=!defof user_exists in $userdeffile |
28 | !if $test!=yes |
||
29 | !goto baduser |
||
4667 | obado | 30 | !endif |
1373 | bpr | 31 | !else |
4176 | obado | 32 | # on regarde si user existe dans la superclasse |
1373 | bpr | 33 | userdeffile=wimshome/log/classes/$class_superclass/$deffile |
34 | test=!defof user_exists in $userdeffile |
||
4176 | obado | 35 | !if $test!=yes |
5601 | obado | 36 | error=user '$quser' not present in superclass $class_superclass. |
1373 | bpr | 37 | !exit |
38 | !endif |
||
4667 | obado | 39 | |
1373 | bpr | 40 | test=!defof user_participate in $userdeffile |
41 | ### contient les classes auxquelles est inscrit l'étudiant et les cours non obligatoires |
||
42 | test=!items2words $test |
||
4667 | obado | 43 | !if $qclass notwordof $test |
44 | class_typename=!defof class_typename in $classdeffile |
||
45 | |||
46 | !if $quser!=supervisor and $class_typename iswordof class and $qclass notwordof $test |
||
5273 | obado | 47 | error=Sorry, this user ($quser) does not participates to this subclass ($qclass). |
4667 | obado | 48 | !exit |
49 | !endif |
||
50 | |||
51 | !if $class_typename iswordof program and (mandatory notwordof $class_progstyles or $class_progstyles=$empty) |
||
52 | ###si le programme n'est pas obligatoire, user_participate contient ce qu'il faut |
||
53 | qlist=!record 0 of wimshome/log/classes/$qclass/courses |
||
54 | qcourses=!linecnt $qlist |
||
55 | !for q_c=1 to $qcourses |
||
56 | testc=!line $q_c of $qlist |
||
57 | test1=!replace internal / by , in $(testc[1]) |
||
58 | ###test1 doit avoir trois items dans le cas d'un établissement |
||
59 | !if $class_superclass/$(test1[1])/$(test1[2]) iswordof $test |
||
60 | qclass=$class_superclass/$(testc[1]) |
||
61 | #### il devrait n'y en avoir qu'un correspondant au programme ? |
||
62 | !exit |
||
63 | !endif |
||
64 | !next |
||
65 | !endif |
||
1373 | bpr | 66 | !endif |
4667 | obado | 67 | !endif |