Rev 5601 | 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 |
||
6026 | obado | 9 | |
23 | reyssat | 10 | !if $ $ isin $quser |
11 | quser= |
||
12 | !endif |
||
13 | !if $quser=$empty |
||
14 | :baduser |
||
5384 | obado | 15 | error=bad user (empty quser or bad chars detected) |
23 | reyssat | 16 | !exit |
17 | !endif |
||
18 | |||
19 | !if $quser=supervisor |
||
20 | deffile=supervisor |
||
21 | !else |
||
22 | deffile=.users/$quser |
||
23 | !endif |
||
1373 | bpr | 24 | class_superclass=!defof class_superclass in $classdeffile |
23 | reyssat | 25 | |
1373 | bpr | 26 | !if $class_superclass= |
4176 | obado | 27 | userdeffile=wimshome/log/classes/$qclass/$deffile |
1373 | bpr | 28 | test=!defof user_exists in $userdeffile |
29 | !if $test!=yes |
||
6026 | obado | 30 | error=user $quser not in this class ($qclass) |
31 | !exit |
||
4667 | obado | 32 | !endif |
1373 | bpr | 33 | !else |
4176 | obado | 34 | # on regarde si user existe dans la superclasse |
1373 | bpr | 35 | userdeffile=wimshome/log/classes/$class_superclass/$deffile |
36 | test=!defof user_exists in $userdeffile |
||
4176 | obado | 37 | !if $test!=yes |
5601 | obado | 38 | error=user '$quser' not present in superclass $class_superclass. |
1373 | bpr | 39 | !exit |
40 | !endif |
||
4667 | obado | 41 | |
1373 | bpr | 42 | test=!defof user_participate in $userdeffile |
43 | ### contient les classes auxquelles est inscrit l'étudiant et les cours non obligatoires |
||
44 | test=!items2words $test |
||
4667 | obado | 45 | !if $qclass notwordof $test |
46 | class_typename=!defof class_typename in $classdeffile |
||
47 | |||
48 | !if $quser!=supervisor and $class_typename iswordof class and $qclass notwordof $test |
||
5273 | obado | 49 | error=Sorry, this user ($quser) does not participates to this subclass ($qclass). |
4667 | obado | 50 | !exit |
51 | !endif |
||
52 | |||
53 | !if $class_typename iswordof program and (mandatory notwordof $class_progstyles or $class_progstyles=$empty) |
||
54 | ###si le programme n'est pas obligatoire, user_participate contient ce qu'il faut |
||
55 | qlist=!record 0 of wimshome/log/classes/$qclass/courses |
||
56 | qcourses=!linecnt $qlist |
||
57 | !for q_c=1 to $qcourses |
||
58 | testc=!line $q_c of $qlist |
||
59 | test1=!replace internal / by , in $(testc[1]) |
||
60 | ###test1 doit avoir trois items dans le cas d'un établissement |
||
61 | !if $class_superclass/$(test1[1])/$(test1[2]) iswordof $test |
||
62 | qclass=$class_superclass/$(testc[1]) |
||
63 | #### il devrait n'y en avoir qu'un correspondant au programme ? |
||
64 | !exit |
||
65 | !endif |
||
66 | !next |
||
67 | !endif |
||
1373 | bpr | 68 | !endif |
4667 | obado | 69 | !endif |