Subversion Repositories wimsdev

Rev

Rev 4589 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4561 obado 1
# ModExam
2
# Modifie l'examen $qexam
3261 obado 3
 
4561 obado 4
#Pour commencer, on verifie la classe
5
!read scripts/check.class
6
!if $error!=$empty
7
 !exit
8
!endif
9
 
3261 obado 10
type=exams
11
!read scripts/check.proc
12
!if $error!=$empty
13
 !exit
14
!endif
15
 
4589 obado 16
#on recupere la duree et le nombre d'essais autorisés actuels de l'examen
17
line3 = !line 3 of $qproperties
18
exam_duration= !word 1 of $line3
19
exam_attempts = !word 2 of $line3
20
 
21
 
3261 obado 22
exocnt=!recordcnt $qfile
23
 
24
data1=!nonempty lines $data1
4589 obado 25
nbline=!linecnt $data1
3261 obado 26
nbdefs=0
27
 
4589 obado 28
!for i=1 to $nbline
3261 obado 29
  l=!line $i of $data1
30
  l=!translate = to $\
31
$ in $l
32
  !distribute lines $l into n_,v_
33
  n_=!word 1 of $n_
34
  v_=!trim $v_
35
  nbtot=!itemcnt $examdefs
36
  !for j=1 to $nbtot
37
    defcur=!item $j of $examdefs
38
    !if $n_ = $defcur
4589 obado 39
 
40
      !if $n_ = duration_and_attempts
41
        duration= !word 1 of $v_
4590 obado 42
        attempts= !word 2 of $v_
4589 obado 43
 
44
        !if NaN isin $attempts or $attempts<1
45
        	#le nombre d'essais autorises doit etre un nombre >0 sinon on laisse la valeur actuelle
46
			attempts=$exam_attempts
47
        !endif
48
        !if NaN isin $duration or $duration<1
49
        	#la duree doit etre un nombre >0 sinon on laisse la valeur actuelle
50
			duration=$exam_duration
51
        !endif
52
 
53
      !endif
54
 
55
      !if $n_ = status
3261 obado 56
        #attention : on ne modifie plus un examen qui a ete active
4589 obado 57
        #Ici il faudrait verifier qu'il n'y a aucun eleve dans la classe avant de repasser un examen en statut 0
3261 obado 58
        #le statut est forcement >0 et <4
59
   	    !ifval $v_<1 or $v_>4
60
   	      error=bad status. You can't deactive an exam.
61
   	      !exit
62
        !endif
4589 obado 63
        #On n'active pas un examen vide !
64
		!ifval $v_=1 and $exocnt<=0
65
		   error=Empty Exam. You can't active an exam with no exercice !
66
		   !exit
67
		!endif
3261 obado 68
      !endif
4589 obado 69
 
70
 
3261 obado 71
      !advance nbdefs
72
      update_field=$j
73
      update_content=$v_
74
 
75
      !read scripts/update.proc
76
    !endif
77
  !next j
78
!next i
79
 
80
!if $nbdefs<1
81
 error=nothing done
82
 !exit
83
!endif