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