Subversion Repositories wimsdev

Rev

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

Rev Author Line No. Line
9750 obado 1
# AddExam
4561 obado 2
# permet d'ajouter un examen dans la classe qclass
3
 
3261 obado 4
!read scripts/check.class
5
!if $error!=$empty
13228 obado 6
  !exit
3261 obado 7
!endif
8
 
9
#################################
9750 obado 10
FORMAT OF THE /exams/.exams INDEX FILE :
3261 obado 11
#:EXAM STATUS
12
#EXPIRATION DATE
13
#DURATION & ALLOWED_ATTEMPTS
14
#EXAM TITLE
15
#EXAM DESCRIPTION
16
#CUT Hours
17
 
18
##################################
19
#FORMAT of an /exams/.examN File :
20
#:WEIGHT
21
#IDSCHEET.IDEXO
22
#TITLE_EXO
23
#DEPENDENCES
24
#autogen
25
#################################
26
# Format of an /.E(n) FILE (Opening restrictions for exam n )
27
# #     - open for simulation
28
# empty - open for all
29
# none  - closed for all
30
# IP/Hours/Both - open for IP and/or hours defined
31
######################################################
32
 
9963 obado 33
examcnt=!recordcnt wimshome/log/classes/$qclass/exams/.exams
34
!if $examcnt >= $MAX_EXAMS
13228 obado 35
  error= error : The number of exams is limited to $MAX_EXAMS. You may not create exam #$[$examcnt+1].
36
  !exit
9963 obado 37
!endif
3261 obado 38
 
39
data1=!nonempty lines $data1
40
n1=!linecnt $data1
41
!for i=1 to $n1
13228 obado 42
  l=!line $i of $data1
43
  l=!translate = to $\
3261 obado 44
$ in $l
13228 obado 45
  !distribute lines $l into n_,v_
46
  exam_$n_=$v_
3261 obado 47
!next i
48
 
49
exam_creation=!char 1 to 8 of $wims_now
50
exam_creation=!eval $exam_creation
51
!default exam_expiration=$[$exam_creation+10000]
4589 obado 52
 
53
!if NaN isin $exam_duration or $exam_duration<1
54
	#le nombre d'essais autorises doit etre un nombre >0 sinon on laisse la valeur actuelle
55
	exam_duration=$empty
56
!endif
8235 obado 57
!default exam_duration=60
4589 obado 58
 
59
!if NaN isin $exam_attempts or $exam_attempts<1
60
	#le nombre d'essais autorises doit etre un nombre >0 sinon on laisse la valeur actuelle
61
	exam_attempts=$empty
62
!endif
3261 obado 63
!default exam_attempts=1
4589 obado 64
 
9750 obado 65
list1=.,..,.exams,.require,.weight,.eseverity
66
list2=!listfile -a $wims_home/log/classes/$qclass/exams
67
list2=!lines2items  $list2
68
list2=!listcomplement $list1 in $list2
69
nb=!itemcnt $list2
70
!increase nb
71
 
72
!default exam_title=Examen #$nb
73
!default exam_description= Vous &ecirc;tes dans l'examen $nb.
3261 obado 74
!default exam_cut_hours=$empty
75
!default exam_opening=$empty
76
 
77
#Si le fichier .exams n'existe pas, appendfile le cree.
78
!appendfile wimshome/log/classes/$qclass/exams/.exams \
79
:0\
80
$exam_expiration\
81
$exam_duration $exam_attempts\
82
$exam_title\
83
$exam_description\
84
$exam_cut_hours
85
 
86
examcnt=!recordcnt wimshome/log/classes/$qclass/exams/.exams
87
 
4561 obado 88
!if $examcnt!=$nb
13228 obado 89
  error= error in exam count ($examcnt records / $nb files)
90
  !exit
4561 obado 91
!endif
3261 obado 92
 
93
!writefile wimshome/log/classes/$qclass/exams/.exam$examcnt
94
!writefile wimshome/log/classes/$qclass/.E$examcnt $exam_opening
95
 
13228 obado 96
exam_id=$examcnt