@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | session_cache_limiter("none"); |
12 | 12 | |
13 | 13 | require '../inc/global.inc.php'; |
14 | -require api_get_path(LIBRARY_PATH) . 'geometry.lib.php'; |
|
14 | +require api_get_path(LIBRARY_PATH).'geometry.lib.php'; |
|
15 | 15 | |
16 | 16 | // set vars |
17 | 17 | $questionId = intval($_GET['modifyAnswers']); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $course_id = api_get_course_int_id(); |
30 | 30 | |
31 | 31 | // Query db for answers |
32 | -if ($answer_type==HOT_SPOT_DELINEATION) { |
|
32 | +if ($answer_type == HOT_SPOT_DELINEATION) { |
|
33 | 33 | $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
34 | 34 | WHERE c_id = $course_id AND question_id = ".intval($questionId)." AND hotspot_type = 'delineation' ORDER BY id"; |
35 | 35 | } else { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $hotSpot['answer'] = $hotspot['answer']; |
76 | 76 | |
77 | 77 | // Square or rectancle |
78 | - if ($hotspot['hotspot_type'] == 'square' ) |
|
78 | + if ($hotspot['hotspot_type'] == 'square') |
|
79 | 79 | { |
80 | 80 | $hotSpot['type'] = 'square'; |
81 | 81 | } |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | session_cache_limiter('public'); |
13 | 13 | |
14 | 14 | require_once '../inc/global.inc.php'; |
15 | -$this_section=SECTION_COURSES; |
|
15 | +$this_section = SECTION_COURSES; |
|
16 | 16 | |
17 | 17 | $tbl_document = Database::get_course_table(TABLE_DOCUMENT); |
18 | 18 | |
19 | -$doc_url=str_replace(array('../','\\..','\\0','..\\'),array('','','',''),urldecode($_GET['doc_url'])); |
|
20 | -$filename=basename($doc_url); |
|
19 | +$doc_url = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), urldecode($_GET['doc_url'])); |
|
20 | +$filename = basename($doc_url); |
|
21 | 21 | |
22 | 22 | // launch event |
23 | 23 | //Event::event_download($doc_url); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $full_file_name = $course_path.Security::remove_XSS($doc_url); |
30 | 30 | } |
31 | 31 | |
32 | -if(!is_file($full_file_name)) { |
|
32 | +if (!is_file($full_file_name)) { |
|
33 | 33 | exit; |
34 | 34 | } |
35 | 35 | |
@@ -37,26 +37,26 @@ discard block |
||
37 | 37 | exit; |
38 | 38 | } |
39 | 39 | |
40 | -$extension=explode('.',$filename); |
|
41 | -$extension=strtolower($extension[sizeof($extension)-1]); |
|
42 | - |
|
43 | -switch($extension) { |
|
44 | - case 'gz': $content_type='application/x-gzip'; break; |
|
45 | - case 'zip': $content_type='application/zip'; break; |
|
46 | - case 'pdf': $content_type='application/pdf'; break; |
|
47 | - case 'png': $content_type='image/png'; break; |
|
48 | - case 'gif': $content_type='image/gif'; break; |
|
49 | - case 'jpg': $content_type='image/jpeg'; break; |
|
50 | - case 'txt': $content_type='text/plain'; break; |
|
51 | - case 'htm': $content_type='text/html'; break; |
|
52 | - case 'html': $content_type='text/html'; break; |
|
53 | - default: $content_type='application/octet-stream'; break; |
|
40 | +$extension = explode('.', $filename); |
|
41 | +$extension = strtolower($extension[sizeof($extension) - 1]); |
|
42 | + |
|
43 | +switch ($extension) { |
|
44 | + case 'gz': $content_type = 'application/x-gzip'; break; |
|
45 | + case 'zip': $content_type = 'application/zip'; break; |
|
46 | + case 'pdf': $content_type = 'application/pdf'; break; |
|
47 | + case 'png': $content_type = 'image/png'; break; |
|
48 | + case 'gif': $content_type = 'image/gif'; break; |
|
49 | + case 'jpg': $content_type = 'image/jpeg'; break; |
|
50 | + case 'txt': $content_type = 'text/plain'; break; |
|
51 | + case 'htm': $content_type = 'text/html'; break; |
|
52 | + case 'html': $content_type = 'text/html'; break; |
|
53 | + default: $content_type = 'application/octet-stream'; break; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | header('Content-disposition: filename='.$filename); |
57 | 57 | header('Content-Type: '.$content_type); |
58 | -header('Expires: '.gmdate('D, d M Y H:i:s',time()+10).' GMT'); |
|
59 | -header('Last-Modified: '.gmdate('D, d M Y H:i:s',time()+10).' GMT'); |
|
58 | +header('Expires: '.gmdate('D, d M Y H:i:s', time() + 10).' GMT'); |
|
59 | +header('Last-Modified: '.gmdate('D, d M Y H:i:s', time() + 10).' GMT'); |
|
60 | 60 | |
61 | 61 | /* |
62 | 62 | Dynamic parsing section |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | if ($content_type == 'text/html') { |
71 | 71 | $directory_name = dirname($full_file_name); |
72 | 72 | |
73 | - $dir=str_replace(array('\\',$_configuration['root_sys']."courses/".$_course['path'].'/document'),array('/',''),$directory_name); |
|
73 | + $dir = str_replace(array('\\', $_configuration['root_sys']."courses/".$_course['path'].'/document'), array('/', ''), $directory_name); |
|
74 | 74 | |
75 | - if($dir[strlen($dir)-1] != '/') { |
|
76 | - $dir.='/'; |
|
75 | + if ($dir[strlen($dir) - 1] != '/') { |
|
76 | + $dir .= '/'; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
80 | 80 | //Parse whole file at one |
81 | 81 | $fp = fopen($full_file_name, "r"); |
82 | - $file_content = fread ($fp, filesize ($full_file_name)); |
|
82 | + $file_content = fread($fp, filesize($full_file_name)); |
|
83 | 83 | fclose($fp); |
84 | 84 | //$file_content = api_replace_parameter($dir, $file_content, "src"); |
85 | 85 | //$file_content = api_replace_parameter($dir, $file_content, "href"); |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | |
99 | 99 | |
100 | 100 | $exercisePath = api_get_self(); |
101 | - $exfile = explode('/',$exercisePath); |
|
102 | - $exfile = $exfile[sizeof($exfile)-1]; |
|
103 | - $exercisePath = substr($exercisePath,0,strpos($exercisePath,$exfile)); |
|
101 | + $exfile = explode('/', $exercisePath); |
|
102 | + $exfile = $exfile[sizeof($exfile) - 1]; |
|
103 | + $exercisePath = substr($exercisePath, 0, strpos($exercisePath, $exfile)); |
|
104 | 104 | $exercisePath = $exercisePath; |
105 | 105 | |
106 | 106 | $content = $file_content; |
@@ -125,16 +125,16 @@ discard block |
||
125 | 125 | "// Must be included \n". |
126 | 126 | "function Finish(){\n". |
127 | 127 | " mySaveScore();"; |
128 | - $newcontent = str_replace($mit,$js_content,$content); |
|
128 | + $newcontent = str_replace($mit, $js_content, $content); |
|
129 | 129 | |
130 | - $prehref="javascript:void(0);"; |
|
131 | - $posthref=$_configuration['root_web']."main/exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid; |
|
132 | - $newcontent = str_replace($prehref,$posthref,$newcontent); |
|
130 | + $prehref = "javascript:void(0);"; |
|
131 | + $posthref = $_configuration['root_web']."main/exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid; |
|
132 | + $newcontent = str_replace($prehref, $posthref, $newcontent); |
|
133 | 133 | |
134 | 134 | |
135 | - $prehref="class=\"GridNum\" onclick="; |
|
136 | - $posthref="class=\"GridNum\" onMouseover="; |
|
137 | - $newcontent = str_replace($prehref,$posthref,$newcontent); |
|
135 | + $prehref = "class=\"GridNum\" onclick="; |
|
136 | + $posthref = "class=\"GridNum\" onMouseover="; |
|
137 | + $newcontent = str_replace($prehref, $posthref, $newcontent); |
|
138 | 138 | |
139 | 139 | |
140 | 140 | header('Content-length: '.strlen($newcontent)); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | //normal case, all non-html files |
148 | 148 | //header('Content-length: '.filesize($full_file_name)); |
149 | -$fp=fopen($full_file_name,'rb'); |
|
149 | +$fp = fopen($full_file_name, 'rb'); |
|
150 | 150 | fpassthru($fp); |
151 | 151 | fclose($fp); |
152 | 152 | ?> |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | { |
24 | 24 | $return = array(); |
25 | 25 | $TBL_USER = Database::get_main_table(TABLE_MAIN_USER); |
26 | - $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
|
26 | + $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
|
27 | 27 | |
28 | 28 | $cid = api_get_course_id(); |
29 | 29 | $course_id = api_get_course_int_id(); |
30 | 30 | //$user_id = intval($user_id); |
31 | 31 | $user_id = null; |
32 | - $session_id_and = ' AND te.session_id = ' . api_get_session_id() . ' '; |
|
32 | + $session_id_and = ' AND te.session_id = '.api_get_session_id().' '; |
|
33 | 33 | $hotpotato_name = Database::escape_string($hotpotato_name); |
34 | 34 | |
35 | 35 | if (!empty($exercise_id)) { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | if (empty($user_id)) { |
40 | - $sql="SELECT firstname as userpart1, lastname as userpart2 , |
|
40 | + $sql = "SELECT firstname as userpart1, lastname as userpart2 , |
|
41 | 41 | email, |
42 | 42 | tth.exe_name, |
43 | 43 | tth.exe_result, |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | tth.exe_name = '$hotpotato_name' |
50 | 50 | ORDER BY tth.c_id ASC, tth.exe_date ASC"; |
51 | 51 | } else { |
52 | - $user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' '; |
|
52 | + $user_id_and = ' AND te.exe_user_id = '.api_get_user_id().' '; |
|
53 | 53 | // get only this user's results |
54 | 54 | |
55 | 55 | $sql = "SELECT '', exe_name, exe_result , exe_weighting, exe_date |
56 | 56 | FROM $TBL_TRACK_HOTPOTATOES |
57 | 57 | WHERE |
58 | - exe_user_id = '" . $user_id . "' AND |
|
58 | + exe_user_id = '".$user_id."' AND |
|
59 | 59 | c_id = $course_id AND |
60 | 60 | tth.exe_name = '$hotpotato_name' |
61 | 61 | ORDER BY c_id ASC, exe_date ASC"; |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | $results = array(); |
65 | 65 | |
66 | 66 | $resx = Database::query($sql); |
67 | - while ($rowx = Database::fetch_array($resx,'ASSOC')) { |
|
67 | + while ($rowx = Database::fetch_array($resx, 'ASSOC')) { |
|
68 | 68 | $results[] = $rowx; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $hpresults = array(); |
72 | 72 | $resx = Database::query($sql); |
73 | - while ($rowx = Database::fetch_array($resx,'ASSOC')) { |
|
73 | + while ($rowx = Database::fetch_array($resx, 'ASSOC')) { |
|
74 | 74 | $hpresults[] = $rowx; |
75 | 75 | } |
76 | 76 | |
@@ -89,19 +89,19 @@ discard block |
||
89 | 89 | |
90 | 90 | // Print the Result of Hotpotatoes Tests |
91 | 91 | if (is_array($hpresults)) { |
92 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
92 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
93 | 93 | $return[$i] = array(); |
94 | 94 | $title = GetQuizName($hpresults[$i]['exe_name'], $document_path); |
95 | - if ($title =='') { |
|
95 | + if ($title == '') { |
|
96 | 96 | $title = basename($hpresults[$i]['exe_name']); |
97 | 97 | } |
98 | - if(empty($user_id)) { |
|
98 | + if (empty($user_id)) { |
|
99 | 99 | $return[$i]['email'] = $hpresults[$i]['email']; |
100 | 100 | $return[$i]['first_name'] = $hpresults[$i]['userpart1']; |
101 | 101 | $return[$i]['last_name'] = $hpresults[$i]['userpart2']; |
102 | 102 | } |
103 | 103 | $return[$i]['title'] = $title; |
104 | - $return[$i]['exe_date'] = $hpresults[$i]['exe_date']; |
|
104 | + $return[$i]['exe_date'] = $hpresults[$i]['exe_date']; |
|
105 | 105 | |
106 | 106 | $return[$i]['result'] = $hpresults[$i]['exe_result']; |
107 | 107 | $return[$i]['max'] = $hpresults[$i]['exe_weighting']; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param boolean Whether to include user fields or not |
121 | 121 | * @return boolean False on error |
122 | 122 | */ |
123 | - public function exportCompleteReportCSV($document_path='', $hotpotato_name) |
|
123 | + public function exportCompleteReportCSV($document_path = '', $hotpotato_name) |
|
124 | 124 | { |
125 | 125 | global $charset; |
126 | 126 | $this->getExercisesReporting($document_path, $hotpotato_name); |
@@ -131,17 +131,17 @@ discard block |
||
131 | 131 | $data = ''; |
132 | 132 | |
133 | 133 | if (api_is_western_name_order()) { |
134 | - if(!empty($this->results[0]['first_name'])) { |
|
134 | + if (!empty($this->results[0]['first_name'])) { |
|
135 | 135 | $data .= get_lang('FirstName').';'; |
136 | 136 | } |
137 | - if(!empty($this->results[0]['last_name'])) { |
|
137 | + if (!empty($this->results[0]['last_name'])) { |
|
138 | 138 | $data .= get_lang('LastName').';'; |
139 | 139 | } |
140 | 140 | } else { |
141 | - if(!empty($this->results[0]['last_name'])) { |
|
141 | + if (!empty($this->results[0]['last_name'])) { |
|
142 | 142 | $data .= get_lang('LastName').';'; |
143 | 143 | } |
144 | - if(!empty($this->results[0]['first_name'])) { |
|
144 | + if (!empty($this->results[0]['first_name'])) { |
|
145 | 145 | $data .= get_lang('FirstName').';'; |
146 | 146 | } |
147 | 147 | } |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | $data .= "\n"; |
164 | 164 | |
165 | 165 | //results |
166 | - foreach($this->results as $row) { |
|
166 | + foreach ($this->results as $row) { |
|
167 | 167 | if (api_is_western_name_order()) { |
168 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
169 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
168 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
169 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
170 | 170 | } else { |
171 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
172 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
171 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
172 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
173 | 173 | } |
174 | 174 | |
175 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
|
175 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
|
176 | 176 | |
177 | 177 | /*if ($export_user_fields) { |
178 | 178 | //show user fields data, if any, for this user |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | } |
183 | 183 | }*/ |
184 | 184 | |
185 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
186 | - $data .= str_replace("\r\n",' ',$row['exe_date']).';'; |
|
187 | - $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
188 | - $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
185 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
186 | + $data .= str_replace("\r\n", ' ', $row['exe_date']).';'; |
|
187 | + $data .= str_replace("\r\n", ' ', $row['result']).';'; |
|
188 | + $data .= str_replace("\r\n", ' ', $row['max']).';'; |
|
189 | 189 | $data .= "\n"; |
190 | 190 | } |
191 | 191 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | header('Content-Description: '.$filename); |
208 | 208 | header('Content-transfer-encoding: binary'); |
209 | 209 | // @todo add this utf-8 header for all csv files |
210 | - echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
210 | + echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
211 | 211 | echo $data; |
212 | 212 | return true; |
213 | 213 | } |
@@ -249,25 +249,25 @@ discard block |
||
249 | 249 | } |
250 | 250 | |
251 | 251 | if ($with_column_user) { |
252 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
252 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Email')); |
|
253 | 253 | $column++; |
254 | 254 | |
255 | 255 | if (api_is_western_name_order()) { |
256 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
256 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName')); |
|
257 | 257 | $column++; |
258 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName')); |
|
258 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName')); |
|
259 | 259 | $column++; |
260 | 260 | } else { |
261 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName')); |
|
261 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName')); |
|
262 | 262 | $column++; |
263 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
263 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName')); |
|
264 | 264 | $column++; |
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | 268 | if ($export_user_fields) { |
269 | 269 | //show user fields section with a big th colspan that spans over all fields |
270 | - $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
270 | + $extra_user_fields = UserManager::get_extra_fields(0, 1000, 5, 'ASC', false, 1); |
|
271 | 271 | |
272 | 272 | //show the fields names for user fields |
273 | 273 | foreach ($extra_user_fields as $field) { |
@@ -276,63 +276,63 @@ discard block |
||
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
279 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
279 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Title')); |
|
280 | 280 | $column++; |
281 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
281 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('StartDate')); |
|
282 | 282 | $column++; |
283 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('EndDate')); |
|
283 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('EndDate')); |
|
284 | 284 | $column++; |
285 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
|
285 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
|
286 | 286 | $column++; |
287 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
287 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Score')); |
|
288 | 288 | $column++; |
289 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
289 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Total')); |
|
290 | 290 | $column++; |
291 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Status')); |
|
291 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Status')); |
|
292 | 292 | $line++; |
293 | 293 | |
294 | 294 | foreach ($this->results as $row) { |
295 | 295 | $column = 0; |
296 | 296 | |
297 | 297 | if ($with_column_user) { |
298 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
|
298 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
|
299 | 299 | $column++; |
300 | 300 | |
301 | 301 | if (api_is_western_name_order()) { |
302 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
302 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
303 | 303 | $column++; |
304 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
304 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
305 | 305 | $column++; |
306 | 306 | } else { |
307 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
307 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
308 | 308 | $column++; |
309 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
309 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
310 | 310 | $column++; |
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
314 | 314 | if ($export_user_fields) { |
315 | 315 | //show user fields data, if any, for this user |
316 | - $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
317 | - foreach($user_fields_values as $value) { |
|
318 | - $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
316 | + $user_fields_values = UserManager::get_extra_user_data($row['user_id'], false, false, false, true); |
|
317 | + foreach ($user_fields_values as $value) { |
|
318 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
319 | 319 | $column++; |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
323 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
324 | 324 | $column++; |
325 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']); |
|
325 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['start_date']); |
|
326 | 326 | $column++; |
327 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']); |
|
327 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['end_date']); |
|
328 | 328 | $column++; |
329 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
329 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['duration']); |
|
330 | 330 | $column++; |
331 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
331 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['result']); |
|
332 | 332 | $column++; |
333 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
333 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['max']); |
|
334 | 334 | $column++; |
335 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['status']); |
|
335 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['status']); |
|
336 | 336 | $line++; |
337 | 337 | } |
338 | 338 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public $type; |
23 | 23 | public $level; |
24 | 24 | public $picture; |
25 | - public $exerciseList; // array with the list of exercises which this question is in |
|
25 | + public $exerciseList; // array with the list of exercises which this question is in |
|
26 | 26 | public $category_list; |
27 | 27 | public $parent_id; |
28 | 28 | public $category; |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | 'multiple_answer_combination_true_false.class.php', |
48 | 48 | 'MultipleAnswerCombinationTrueFalse' |
49 | 49 | ), |
50 | - GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php' , 'GlobalMultipleAnswer'), |
|
51 | - CALCULATED_ANSWER => array('calculated_answer.class.php' , 'CalculatedAnswer'), |
|
50 | + GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php', 'GlobalMultipleAnswer'), |
|
51 | + CALCULATED_ANSWER => array('calculated_answer.class.php', 'CalculatedAnswer'), |
|
52 | 52 | UNIQUE_ANSWER_IMAGE => ['UniqueAnswerImage.php', 'UniqueAnswerImage'], |
53 | 53 | DRAGGABLE => ['Draggable.php', 'Draggable'], |
54 | 54 | MATCHING_DRAGGABLE => ['MatchingDraggable.php', 'MatchingDraggable'] |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | $id = intval($id); |
108 | 108 | |
109 | 109 | if (!empty($course_id)) { |
110 | - $course_info = api_get_course_info_by_id($course_id); |
|
110 | + $course_info = api_get_course_info_by_id($course_id); |
|
111 | 111 | } else { |
112 | 112 | $course_info = api_get_course_info(); |
113 | 113 | } |
114 | 114 | |
115 | 115 | $course_id = $course_info['real_id']; |
116 | 116 | |
117 | - if (empty($course_id) || $course_id == -1 ) { |
|
117 | + if (empty($course_id) || $course_id == -1) { |
|
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | public function selectPicturePath() |
271 | 271 | { |
272 | 272 | if (!empty($this->picture)) { |
273 | - return api_get_path(WEB_COURSE_PATH) . $this->course['path'] . '/document/images/' . $this->picture; |
|
273 | + return api_get_path(WEB_COURSE_PATH).$this->course['path'].'/document/images/'.$this->picture; |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | return false; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public function updateTitle($title) |
309 | 309 | { |
310 | - $this->question=$title; |
|
310 | + $this->question = $title; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | // DO nothing |
407 | 407 | } else { |
408 | 408 | $sql = "INSERT INTO $TBL_QUESTION_REL_CATEGORY (c_id, question_id, category_id) |
409 | - VALUES (" . api_get_course_int_id() . ", $question_id, $category_id)"; |
|
409 | + VALUES (".api_get_course_int_id().", $question_id, $category_id)"; |
|
410 | 410 | Database::query($sql); |
411 | 411 | } |
412 | 412 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $sql = "SELECT count(*) AS nb FROM $table |
434 | 434 | WHERE |
435 | 435 | question_id = $question_id AND |
436 | - c_id=" . api_get_course_int_id(); |
|
436 | + c_id=".api_get_course_int_id(); |
|
437 | 437 | $res = Database::query($sql); |
438 | 438 | $row = Database::fetch_array($res); |
439 | 439 | if ($row['nb'] > 0) { |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | SET category_id = $category_id |
442 | 442 | WHERE |
443 | 443 | question_id = $question_id AND |
444 | - c_id = " . api_get_course_int_id(); |
|
444 | + c_id = ".api_get_course_int_id(); |
|
445 | 445 | Database::query($sql); |
446 | 446 | } else { |
447 | 447 | $sql = "INSERT INTO $table (c_id, question_id, category_id) |
448 | - VALUES (" . api_get_course_int_id().", $question_id, $category_id)"; |
|
448 | + VALUES (".api_get_course_int_id().", $question_id, $category_id)"; |
|
449 | 449 | Database::query($sql); |
450 | 450 | } |
451 | 451 | } |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | $sql = "DELETE FROM $table |
464 | 464 | WHERE |
465 | 465 | question_id = $question_id AND |
466 | - c_id = " . api_get_course_int_id(); |
|
466 | + c_id = ".api_get_course_int_id(); |
|
467 | 467 | Database::query($sql); |
468 | 468 | } |
469 | 469 | |
@@ -516,11 +516,11 @@ discard block |
||
516 | 516 | ) { |
517 | 517 | // removes old answers |
518 | 518 | $sql = "DELETE FROM $TBL_REPONSES |
519 | - WHERE c_id = $course_id AND question_id = " . intval($this->id); |
|
519 | + WHERE c_id = $course_id AND question_id = ".intval($this->id); |
|
520 | 520 | Database::query($sql); |
521 | 521 | } |
522 | 522 | |
523 | - $this->type=$type; |
|
523 | + $this->type = $type; |
|
524 | 524 | } |
525 | 525 | } |
526 | 526 | |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | if (!file_exists($picturePath)) { |
545 | 545 | if (mkdir($picturePath, api_get_permissions_for_new_directories())) { |
546 | 546 | // document path |
547 | - $documentPath = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . "/document"; |
|
547 | + $documentPath = api_get_path(SYS_COURSE_PATH).$this->course['path']."/document"; |
|
548 | 548 | $path = str_replace($documentPath, '', $picturePath); |
549 | 549 | $title_path = basename($picturePath); |
550 | 550 | $doc_id = add_document($this->course, $path, 'folder', 0, $title_path); |
@@ -560,14 +560,14 @@ discard block |
||
560 | 560 | |
561 | 561 | // if the question has got an ID |
562 | 562 | if ($this->id) { |
563 | - $this->picture = 'quiz-' . $this->id . '.jpg'; |
|
563 | + $this->picture = 'quiz-'.$this->id.'.jpg'; |
|
564 | 564 | $o_img = new Image($Picture); |
565 | - $o_img->send_image($picturePath . '/' . $this->picture, -1, 'jpg'); |
|
565 | + $o_img->send_image($picturePath.'/'.$this->picture, -1, 'jpg'); |
|
566 | 566 | $document_id = add_document( |
567 | 567 | $this->course, |
568 | - '/images/' . $this->picture, |
|
568 | + '/images/'.$this->picture, |
|
569 | 569 | 'file', |
570 | - filesize($picturePath . '/' . $this->picture), |
|
570 | + filesize($picturePath.'/'.$this->picture), |
|
571 | 571 | $this->picture |
572 | 572 | ); |
573 | 573 | if ($document_id) { |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | // if the question has an ID |
602 | 602 | if ($this->id) { |
603 | 603 | // Get dimensions from current image. |
604 | - $my_image = new Image($picturePath . '/' . $this->picture); |
|
604 | + $my_image = new Image($picturePath.'/'.$this->picture); |
|
605 | 605 | |
606 | 606 | $current_image_size = $my_image->get_image_size(); |
607 | 607 | $current_width = $current_image_size['width']; |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | } |
642 | 642 | |
643 | 643 | $my_image->resize($new_width, $new_height); |
644 | - $result = $my_image->send_image($picturePath . '/' . $this->picture); |
|
644 | + $result = $my_image->send_image($picturePath.'/'.$this->picture); |
|
645 | 645 | |
646 | 646 | if ($result) { |
647 | 647 | return true; |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | $picture = $this->picture; |
667 | 667 | $this->picture = ''; |
668 | 668 | |
669 | - return @unlink($picturePath . '/' . $picture) ? true : false; |
|
669 | + return @unlink($picturePath.'/'.$picture) ? true : false; |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | return false; |
@@ -683,27 +683,27 @@ discard block |
||
683 | 683 | { |
684 | 684 | $course_id = $course_info['real_id']; |
685 | 685 | $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
686 | - $destination_path = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document/images'; |
|
687 | - $source_path = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . '/document/images'; |
|
686 | + $destination_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images'; |
|
687 | + $source_path = api_get_path(SYS_COURSE_PATH).$this->course['path'].'/document/images'; |
|
688 | 688 | |
689 | 689 | // if the question has got an ID and if the picture exists |
690 | 690 | if ($this->id && !empty($this->picture)) { |
691 | 691 | $picture = explode('.', $this->picture); |
692 | 692 | $extension = $picture[sizeof($picture) - 1]; |
693 | - $picture = 'quiz-' . $questionId . '.' . $extension; |
|
694 | - $result = @copy($source_path . '/' . $this->picture, $destination_path . '/' . $picture) ? true : false; |
|
693 | + $picture = 'quiz-'.$questionId.'.'.$extension; |
|
694 | + $result = @copy($source_path.'/'.$this->picture, $destination_path.'/'.$picture) ? true : false; |
|
695 | 695 | // If copy was correct then add to the database |
696 | 696 | if ($result) { |
697 | 697 | $sql = "UPDATE $TBL_QUESTIONS SET |
698 | - picture = '" . Database::escape_string($picture) . "' |
|
699 | - WHERE c_id = $course_id AND id='" . intval($questionId) . "'"; |
|
698 | + picture = '".Database::escape_string($picture)."' |
|
699 | + WHERE c_id = $course_id AND id='".intval($questionId)."'"; |
|
700 | 700 | Database::query($sql); |
701 | 701 | |
702 | 702 | $document_id = add_document( |
703 | 703 | $course_info, |
704 | - '/images/' . $picture, |
|
704 | + '/images/'.$picture, |
|
705 | 705 | 'file', |
706 | - filesize($destination_path . '/' . $picture), |
|
706 | + filesize($destination_path.'/'.$picture), |
|
707 | 707 | $picture |
708 | 708 | ); |
709 | 709 | if ($document_id) { |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | $Extension = $PictureName[sizeof($PictureName) - 1]; |
739 | 739 | |
740 | 740 | // saves the picture into a temporary file |
741 | - @move_uploaded_file($Picture, $picturePath . '/tmp.' . $Extension); |
|
741 | + @move_uploaded_file($Picture, $picturePath.'/tmp.'.$Extension); |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | /** |
@@ -771,15 +771,15 @@ discard block |
||
771 | 771 | |
772 | 772 | // if the question has got an ID and if the picture exists |
773 | 773 | if ($this->id) { |
774 | - if (file_exists($picturePath . '/tmp.jpg')) { |
|
774 | + if (file_exists($picturePath.'/tmp.jpg')) { |
|
775 | 775 | $Extension = 'jpg'; |
776 | - } elseif (file_exists($picturePath . '/tmp.gif')) { |
|
776 | + } elseif (file_exists($picturePath.'/tmp.gif')) { |
|
777 | 777 | $Extension = 'gif'; |
778 | - } elseif (file_exists($picturePath . '/tmp.png')) { |
|
778 | + } elseif (file_exists($picturePath.'/tmp.png')) { |
|
779 | 779 | $Extension = 'png'; |
780 | 780 | } |
781 | - $this->picture = 'quiz-' . $this->id . '.' . $Extension; |
|
782 | - return @rename($picturePath . '/tmp.' . $Extension, $picturePath . '/' . $this->picture) ? true : false; |
|
781 | + $this->picture = 'quiz-'.$this->id.'.'.$Extension; |
|
782 | + return @rename($picturePath.'/tmp.'.$Extension, $picturePath.'/'.$this->picture) ? true : false; |
|
783 | 783 | } |
784 | 784 | return false; |
785 | 785 | } |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | $category = $this->category; |
810 | 810 | |
811 | 811 | // question already exists |
812 | - if(!empty($id)) { |
|
812 | + if (!empty($id)) { |
|
813 | 813 | |
814 | 814 | $params = [ |
815 | 815 | 'question' => $question, |
@@ -855,12 +855,12 @@ discard block |
||
855 | 855 | $TBL_EXERCISE_QUESTION as test_question |
856 | 856 | WHERE |
857 | 857 | question.id = test_question.question_id AND |
858 | - test_question.exercice_id = " . intval($exerciseId) . " AND |
|
858 | + test_question.exercice_id = ".intval($exerciseId)." AND |
|
859 | 859 | question.c_id = $c_id AND |
860 | 860 | test_question.c_id = $c_id "; |
861 | - $result = Database::query($sql); |
|
862 | - $current_position = Database::result($result,0,0); |
|
863 | - $this->updatePosition($current_position+1); |
|
861 | + $result = Database::query($sql); |
|
862 | + $current_position = Database::result($result, 0, 0); |
|
863 | + $this->updatePosition($current_position + 1); |
|
864 | 864 | $position = $this->position; |
865 | 865 | |
866 | 866 | $params = [ |
@@ -956,10 +956,10 @@ discard block |
||
956 | 956 | } |
957 | 957 | } |
958 | 958 | |
959 | - public function search_engine_edit($exerciseId, $addQs=false, $rmQs=false) |
|
959 | + public function search_engine_edit($exerciseId, $addQs = false, $rmQs = false) |
|
960 | 960 | { |
961 | 961 | // update search engine and its values table if enabled |
962 | - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { |
|
962 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
963 | 963 | $course_id = api_get_course_id(); |
964 | 964 | // get search_did |
965 | 965 | $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); |
@@ -977,8 +977,8 @@ discard block |
||
977 | 977 | $res = Database::query($sql); |
978 | 978 | |
979 | 979 | if (Database::num_rows($res) > 0 || $addQs) { |
980 | - require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'); |
|
981 | - require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'); |
|
980 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
981 | + require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'); |
|
982 | 982 | |
983 | 983 | $di = new ChamiloIndexer(); |
984 | 984 | if ($addQs) { |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | |
992 | 992 | // retrieve others exercise ids |
993 | 993 | $se_ref = Database::fetch_array($res); |
994 | - $se_doc = $di->get_document((int)$se_ref['search_did']); |
|
994 | + $se_doc = $di->get_document((int) $se_ref['search_did']); |
|
995 | 995 | if ($se_doc !== FALSE) { |
996 | 996 | if (($se_doc_data = $di->get_document_data($se_doc)) !== FALSE) { |
997 | 997 | $se_doc_data = unserialize($se_doc_data); |
@@ -1029,16 +1029,16 @@ discard block |
||
1029 | 1029 | SE_DATA => array( |
1030 | 1030 | 'type' => SE_DOCTYPE_EXERCISE_QUESTION, |
1031 | 1031 | 'exercise_ids' => $question_exercises, |
1032 | - 'question_id' => (int)$this->id |
|
1032 | + 'question_id' => (int) $this->id |
|
1033 | 1033 | ), |
1034 | - SE_USER => (int)api_get_user_id(), |
|
1034 | + SE_USER => (int) api_get_user_id(), |
|
1035 | 1035 | ); |
1036 | 1036 | $ic_slide->xapian_data = serialize($xapian_data); |
1037 | 1037 | $ic_slide->addValue("content", $this->description); |
1038 | 1038 | |
1039 | 1039 | //TODO: index answers, see also form validation on question_admin.inc.php |
1040 | 1040 | |
1041 | - $di->remove_document((int)$se_ref['search_did']); |
|
1041 | + $di->remove_document((int) $se_ref['search_did']); |
|
1042 | 1042 | $di->addChunk($ic_slide); |
1043 | 1043 | |
1044 | 1044 | //index and return search engine document id |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | $count = $new_exercise->selectNbrQuestions(); |
1118 | 1118 | $count++; |
1119 | 1119 | $sql = "INSERT INTO $exerciseRelQuestionTable (c_id, question_id, exercice_id, question_order) |
1120 | - VALUES ({$this->course['real_id']}, " . intval($id) . ", " . intval($exerciseId) . ", '$count')"; |
|
1120 | + VALUES ({$this->course['real_id']}, ".intval($id).", ".intval($exerciseId).", '$count')"; |
|
1121 | 1121 | Database::query($sql); |
1122 | 1122 | |
1123 | 1123 | // we do not want to reindex if we had just saved adnd indexed the question |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | $course_id = api_get_course_int_id(); |
1147 | 1147 | |
1148 | 1148 | // exercise not found |
1149 | - if($pos === false) { |
|
1149 | + if ($pos === false) { |
|
1150 | 1150 | return false; |
1151 | 1151 | } else { |
1152 | 1152 | // deletes the position in the array containing the wanted exercise ID |
@@ -1156,17 +1156,17 @@ discard block |
||
1156 | 1156 | FROM $TBL_EXERCISE_QUESTION |
1157 | 1157 | WHERE |
1158 | 1158 | c_id = $course_id |
1159 | - AND question_id = " . intval($id) . " |
|
1159 | + AND question_id = ".intval($id)." |
|
1160 | 1160 | AND exercice_id = " . intval($exerciseId); |
1161 | 1161 | $res = Database::query($sql); |
1162 | - if (Database::num_rows($res)>0) { |
|
1162 | + if (Database::num_rows($res) > 0) { |
|
1163 | 1163 | $row = Database::fetch_array($res); |
1164 | 1164 | if (!empty($row['question_order'])) { |
1165 | 1165 | $sql = "UPDATE $TBL_EXERCISE_QUESTION |
1166 | 1166 | SET question_order = question_order-1 |
1167 | 1167 | WHERE |
1168 | 1168 | c_id = $course_id |
1169 | - AND exercice_id = " . intval($exerciseId) . " |
|
1169 | + AND exercice_id = ".intval($exerciseId)." |
|
1170 | 1170 | AND question_order > " . $row['question_order']; |
1171 | 1171 | Database::query($sql); |
1172 | 1172 | } |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | $sql = "DELETE FROM $TBL_EXERCISE_QUESTION |
1176 | 1176 | WHERE |
1177 | 1177 | c_id = $course_id |
1178 | - AND question_id = " . intval($id) . " |
|
1178 | + AND question_id = ".intval($id)." |
|
1179 | 1179 | AND exercice_id = " . intval($exerciseId); |
1180 | 1180 | Database::query($sql); |
1181 | 1181 | |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | SET question_order = question_order-1 |
1217 | 1217 | WHERE |
1218 | 1218 | c_id= $course_id |
1219 | - AND exercice_id = " . intval($row['exercice_id']) . " |
|
1219 | + AND exercice_id = ".intval($row['exercice_id'])." |
|
1220 | 1220 | AND question_order > " . $row['question_order']; |
1221 | 1221 | Database::query($sql); |
1222 | 1222 | } |
@@ -1224,20 +1224,20 @@ discard block |
||
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | $sql = "DELETE FROM $TBL_EXERCISE_QUESTION |
1227 | - WHERE c_id = $course_id AND question_id = " . intval($id) . ""; |
|
1227 | + WHERE c_id = $course_id AND question_id = ".intval($id).""; |
|
1228 | 1228 | Database::query($sql); |
1229 | 1229 | |
1230 | 1230 | $sql = "DELETE FROM $TBL_QUESTIONS |
1231 | - WHERE c_id = $course_id AND id = " . intval($id) . ""; |
|
1231 | + WHERE c_id = $course_id AND id = ".intval($id).""; |
|
1232 | 1232 | Database::query($sql); |
1233 | 1233 | |
1234 | 1234 | $sql = "DELETE FROM $TBL_REPONSES |
1235 | - WHERE c_id = $course_id AND question_id = " . intval($id) . ""; |
|
1235 | + WHERE c_id = $course_id AND question_id = ".intval($id).""; |
|
1236 | 1236 | Database::query($sql); |
1237 | 1237 | |
1238 | 1238 | // remove the category of this question in the question_rel_category table |
1239 | 1239 | $sql = "DELETE FROM $TBL_QUIZ_QUESTION_REL_CATEGORY |
1240 | - WHERE c_id = $course_id AND question_id = " . intval($id) . " AND c_id=" . api_get_course_int_id(); |
|
1240 | + WHERE c_id = $course_id AND question_id = ".intval($id)." AND c_id=".api_get_course_int_id(); |
|
1241 | 1241 | Database::query($sql); |
1242 | 1242 | |
1243 | 1243 | api_item_property_update($this->course, TOOL_QUIZ, $id, 'QuizQuestionDeleted', api_get_user_id()); |
@@ -1394,7 +1394,7 @@ discard block |
||
1394 | 1394 | if (class_exists($class_name)) { |
1395 | 1395 | return new $class_name(); |
1396 | 1396 | } else { |
1397 | - echo 'Can\'t instanciate class ' . $class_name . ' of type ' . $type; |
|
1397 | + echo 'Can\'t instanciate class '.$class_name.' of type '.$type; |
|
1398 | 1398 | } |
1399 | 1399 | } |
1400 | 1400 | } |
@@ -1436,7 +1436,7 @@ discard block |
||
1436 | 1436 | |
1437 | 1437 | // Question type |
1438 | 1438 | $answerType = isset($_REQUEST['answerType']) ? intval($_REQUEST['answerType']) : null; |
1439 | - $form->addElement('hidden','answerType', $answerType); |
|
1439 | + $form->addElement('hidden', 'answerType', $answerType); |
|
1440 | 1440 | |
1441 | 1441 | // html editor |
1442 | 1442 | $editorConfig = array( |
@@ -1444,7 +1444,7 @@ discard block |
||
1444 | 1444 | 'Height' => '150' |
1445 | 1445 | ); |
1446 | 1446 | |
1447 | - if (!api_is_allowed_to_edit(null,true)) { |
|
1447 | + if (!api_is_allowed_to_edit(null, true)) { |
|
1448 | 1448 | $editorConfig['UserStatus'] = 'student'; |
1449 | 1449 | } |
1450 | 1450 | |
@@ -1581,7 +1581,7 @@ discard block |
||
1581 | 1581 | |
1582 | 1582 | if ($feedback_type == 1) { |
1583 | 1583 | //2. but if it is a feedback DIRECT we only show the UNIQUE_ANSWER type that is currently available |
1584 | - $question_type_custom_list = array ( |
|
1584 | + $question_type_custom_list = array( |
|
1585 | 1585 | UNIQUE_ANSWER => self::$questionTypes[UNIQUE_ANSWER], |
1586 | 1586 | HOT_SPOT_DELINEATION => self::$questionTypes[HOT_SPOT_DELINEATION] |
1587 | 1587 | ); |
@@ -1597,17 +1597,17 @@ discard block |
||
1597 | 1597 | require_once $a_type[0]; |
1598 | 1598 | // get the picture of the type and the langvar which describes it |
1599 | 1599 | $img = $explanation = ''; |
1600 | - eval('$img = ' . $a_type[1] . '::$typePicture;'); |
|
1601 | - eval('$explanation = get_lang(' . $a_type[1] . '::$explanationLangVar);'); |
|
1600 | + eval('$img = '.$a_type[1].'::$typePicture;'); |
|
1601 | + eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);'); |
|
1602 | 1602 | echo '<li>'; |
1603 | 1603 | echo '<div class="icon-image">'; |
1604 | 1604 | if ($objExercise->exercise_was_added_in_lp == true) { |
1605 | 1605 | $img = pathinfo($img); |
1606 | - $img = $img['filename'] . '_na.' . $img['extension']; |
|
1606 | + $img = $img['filename'].'_na.'.$img['extension']; |
|
1607 | 1607 | echo Display::return_icon($img, $explanation, null, ICON_SIZE_BIG); |
1608 | 1608 | } else { |
1609 | - echo '<a href="admin.php?' . api_get_cidreq() . '&newQuestion=yes&answerType=' . $i . '">' . |
|
1610 | - Display::return_icon($img, $explanation, null, ICON_SIZE_BIG) . '</a>'; |
|
1609 | + echo '<a href="admin.php?'.api_get_cidreq().'&newQuestion=yes&answerType='.$i.'">'. |
|
1610 | + Display::return_icon($img, $explanation, null, ICON_SIZE_BIG).'</a>'; |
|
1611 | 1611 | } |
1612 | 1612 | echo '</div>'; |
1613 | 1613 | echo '</li>'; |
@@ -1619,9 +1619,9 @@ discard block |
||
1619 | 1619 | echo Display::return_icon('database_na.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG); |
1620 | 1620 | } else { |
1621 | 1621 | if ($feedback_type == 1) { |
1622 | - echo $url = "<a href=\"question_pool.php?" . api_get_cidreq() . "&type=1&fromExercise=$exerciseId\">"; |
|
1622 | + echo $url = "<a href=\"question_pool.php?".api_get_cidreq()."&type=1&fromExercise=$exerciseId\">"; |
|
1623 | 1623 | } else { |
1624 | - echo $url = '<a href="question_pool.php?' . api_get_cidreq() . '&fromExercise=' . $exerciseId . '">'; |
|
1624 | + echo $url = '<a href="question_pool.php?'.api_get_cidreq().'&fromExercise='.$exerciseId.'">'; |
|
1625 | 1625 | } |
1626 | 1626 | echo Display::return_icon('database.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG); |
1627 | 1627 | } |
@@ -1758,7 +1758,7 @@ discard block |
||
1758 | 1758 | $header .= $this->show_media_content(); |
1759 | 1759 | } |
1760 | 1760 | |
1761 | - $header .= Display::page_subheader2($counter_label . ". " . $question_title); |
|
1761 | + $header .= Display::page_subheader2($counter_label.". ".$question_title); |
|
1762 | 1762 | $header .= Display::div( |
1763 | 1763 | "<div class=\"rib rib-$class\"><h3>$score_label</h3></div> <h4>{$score['result']}</h4>", |
1764 | 1764 | array('class' => 'ribbon') |
@@ -1779,7 +1779,7 @@ discard block |
||
1779 | 1779 | public function create_question( |
1780 | 1780 | $quiz_id, |
1781 | 1781 | $question_name, |
1782 | - $question_description = "" , |
|
1782 | + $question_description = "", |
|
1783 | 1783 | $max_score = 0, |
1784 | 1784 | $type = 1, |
1785 | 1785 | $level = 1 |
@@ -1849,8 +1849,8 @@ discard block |
||
1849 | 1849 | require_once $tabQuestionList[$type][0]; |
1850 | 1850 | |
1851 | 1851 | $img = $explanation = null; |
1852 | - eval('$img = ' . $tabQuestionList[$type][1] . '::$typePicture;'); |
|
1853 | - eval('$explanation = get_lang(' . $tabQuestionList[$type][1] . '::$explanationLangVar);'); |
|
1852 | + eval('$img = '.$tabQuestionList[$type][1].'::$typePicture;'); |
|
1853 | + eval('$explanation = get_lang('.$tabQuestionList[$type][1].'::$explanationLangVar);'); |
|
1854 | 1854 | return array($img, $explanation); |
1855 | 1855 | } |
1856 | 1856 | |
@@ -1914,7 +1914,7 @@ discard block |
||
1914 | 1914 | $media_list[0] = get_lang('NoMedia'); |
1915 | 1915 | |
1916 | 1916 | if (!empty($medias)) { |
1917 | - foreach($medias as $media) { |
|
1917 | + foreach ($medias as $media) { |
|
1918 | 1918 | $media_list[$media['id']] = empty($media['question']) ? get_lang('Untitled') : $media['question']; |
1919 | 1919 | } |
1920 | 1920 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | api_protect_course_script(false); |
12 | 12 | |
13 | -$isAllowedToEdit = api_is_allowed_to_edit(null,true); |
|
13 | +$isAllowedToEdit = api_is_allowed_to_edit(null, true); |
|
14 | 14 | |
15 | 15 | if (!$isAllowedToEdit) { |
16 | 16 | api_not_allowed(true); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $objQuestion = Question::read($questionId); |
23 | 23 | $_course = api_get_course_info(); |
24 | 24 | |
25 | -$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
25 | +$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
26 | 26 | |
27 | 27 | $picturePath = $documentPath.'/images'; |
28 | 28 | $pictureName = $objQuestion->selectPicture(); |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | $answers = $_SESSION['tmp_answers']; |
66 | 66 | $nbrAnswers = count($answers['answer']); |
67 | 67 | |
68 | -for ($i=1;$i <= $nbrAnswers; $i++) { |
|
68 | +for ($i = 1; $i <= $nbrAnswers; $i++) { |
|
69 | 69 | $hotSpot = []; |
70 | 70 | $hotSpot['id'] = null; |
71 | - $hotSpot['answer']= $answers['answer'][$i]; |
|
71 | + $hotSpot['answer'] = $answers['answer'][$i]; |
|
72 | 72 | |
73 | 73 | if ($answer_type == HOT_SPOT_DELINEATION) { |
74 | - if ($i==1) { |
|
74 | + if ($i == 1) { |
|
75 | 75 | $hotSpot['type'] = 'delineation'; |
76 | 76 | } else { |
77 | 77 | $hotSpot['type'] = 'oar'; |
@@ -7,4 +7,4 @@ |
||
7 | 7 | // directly to exercise.php. This redirection is enabled for 1.10.x (2015-04-21) |
8 | 8 | // The final goal of this file is to be removed in a few years time, if |
9 | 9 | // considered realistically not harmful |
10 | -require __DIR__ . '/exercise.php'; |
|
10 | +require __DIR__.'/exercise.php'; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | api_not_allowed($show_headers); |
27 | 27 | } |
28 | 28 | |
29 | -$is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor; |
|
29 | +$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $is_courseTutor; |
|
30 | 30 | |
31 | 31 | //Getting results from the exe_id. This variable also contain all the information about the exercise |
32 | 32 | $track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($id); |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | -$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
|
57 | -$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
|
56 | +$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">'; |
|
57 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; |
|
58 | 58 | |
59 | 59 | if ($show_headers) { |
60 | 60 | $interbreadcrumb[] = array( |
@@ -7,7 +7,7 @@ |
||
7 | 7 | get_lang('MultiplicationStar')."\n". |
8 | 8 | get_lang('DivisionSlash')."\n". |
9 | 9 | get_lang('ExponentiationCircumflex')."\n". |
10 | -get_lang('ModuloPercentage') . "\n" . |
|
10 | +get_lang('ModuloPercentage')."\n". |
|
11 | 11 | "\n". |
12 | 12 | get_lang('SquareRootSqrt')."\n". |
13 | 13 | get_lang('AbsoluteValueAbs')."\n". |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | 'Height' => '125' |
39 | 39 | ); |
40 | 40 | |
41 | - $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; // The previous default value was 2. See task #1759. |
|
41 | + $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; // The previous default value was 2. See task #1759. |
|
42 | 42 | $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); |
43 | 43 | |
44 | 44 | $obj_ex = $_SESSION['objExercise']; |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | $html = '<table class="table table-striped table-hover"> |
49 | 49 | <thead> |
50 | 50 | <tr> |
51 | - <th width="10">' . get_lang('Number') . '</th> |
|
52 | - <th width="10">' . get_lang('True') . '</th> |
|
53 | - <th width="50%">' . get_lang('Answer') . '</th> |
|
54 | - <th width="50%">' . get_lang('Comment') . '</th> |
|
55 | - <th width="10">' . get_lang('Weighting') . '</th> |
|
51 | + <th width="10">' . get_lang('Number').'</th> |
|
52 | + <th width="10">' . get_lang('True').'</th> |
|
53 | + <th width="50%">' . get_lang('Answer').'</th> |
|
54 | + <th width="50%">' . get_lang('Comment').'</th> |
|
55 | + <th width="10">' . get_lang('Weighting').'</th> |
|
56 | 56 | </tr> |
57 | 57 | </thead> |
58 | 58 | <tbody>'; |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | $form->addHtml('<tr>'); |
83 | 83 | |
84 | 84 | if (is_object($answer)) { |
85 | - $defaults['answer[' . $i . ']'] = $answer->answer[$i]; |
|
86 | - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; |
|
87 | - $defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1); |
|
88 | - $defaults['correct[' . $i . ']'] = $answer->correct[$i]; |
|
85 | + $defaults['answer['.$i.']'] = $answer->answer[$i]; |
|
86 | + $defaults['comment['.$i.']'] = $answer->comment[$i]; |
|
87 | + $defaults['weighting['.$i.']'] = float_format($answer->weighting[$i], 1); |
|
88 | + $defaults['correct['.$i.']'] = $answer->correct[$i]; |
|
89 | 89 | } else { |
90 | 90 | $defaults['answer[1]'] = get_lang('DefaultMultipleAnswer2'); |
91 | 91 | $defaults['comment[1]'] = get_lang('DefaultMultipleComment2'); |
@@ -101,38 +101,38 @@ discard block |
||
101 | 101 | |
102 | 102 | $renderer->setElementTemplate( |
103 | 103 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
104 | - 'correct[' . $i . ']' |
|
104 | + 'correct['.$i.']' |
|
105 | 105 | ); |
106 | 106 | $renderer->setElementTemplate( |
107 | 107 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
108 | - 'counter[' . $i . ']' |
|
108 | + 'counter['.$i.']' |
|
109 | 109 | ); |
110 | 110 | $renderer->setElementTemplate( |
111 | 111 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
112 | - 'answer[' . $i . ']' |
|
112 | + 'answer['.$i.']' |
|
113 | 113 | ); |
114 | 114 | $renderer->setElementTemplate( |
115 | 115 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
116 | - 'comment[' . $i . ']' |
|
116 | + 'comment['.$i.']' |
|
117 | 117 | ); |
118 | 118 | $renderer->setElementTemplate( |
119 | 119 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
120 | - 'weighting[' . $i . ']' |
|
120 | + 'weighting['.$i.']' |
|
121 | 121 | ); |
122 | 122 | |
123 | - $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); |
|
123 | + $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"'); |
|
124 | 124 | $answer_number->freeze(); |
125 | 125 | |
126 | - $form->addElement('checkbox', 'correct[' . $i . ']', null, null, |
|
126 | + $form->addElement('checkbox', 'correct['.$i.']', null, null, |
|
127 | 127 | 'class="checkbox" style="margin-left: 0em;"'); |
128 | - $boxes_names[] = 'correct[' . $i . ']'; |
|
128 | + $boxes_names[] = 'correct['.$i.']'; |
|
129 | 129 | |
130 | 130 | $form->addHtmlEditor("answer[$i]", null, null, true, $editorConfig); |
131 | - $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); |
|
131 | + $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'); |
|
132 | 132 | |
133 | 133 | $form->addHtmlEditor("comment[$i]", null, null, true, $editorConfig); |
134 | 134 | |
135 | - $form->addElement('text', 'weighting[' . $i . ']', null, array('style' => "width: 60px;", 'value' => '0')); |
|
135 | + $form->addElement('text', 'weighting['.$i.']', null, array('style' => "width: 60px;", 'value' => '0')); |
|
136 | 136 | $form->addHtml('</tr>'); |
137 | 137 | } |
138 | 138 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $objAnswer = new Answer($this->id); |
178 | 178 | $nb_answers = $form->getSubmitValue('nb_answers'); |
179 | 179 | |
180 | - for($i=1 ; $i <= $nb_answers ; $i++) { |
|
180 | + for ($i = 1; $i <= $nb_answers; $i++) { |
|
181 | 181 | $answer = trim(str_replace(['<p>', '</p>'], '', $form -> getSubmitValue('answer['.$i.']'))); |
182 | 182 | $comment = trim(str_replace(['<p>', '</p>'], '', $form -> getSubmitValue('comment['.$i.']'))); |
183 | 183 | $weighting = trim($form -> getSubmitValue('weighting['.$i.']')); |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | $weighting = abs($weighting); |
190 | 190 | $weighting = -$weighting; |
191 | 191 | } |
192 | - if($weighting > 0) { |
|
192 | + if ($weighting > 0) { |
|
193 | 193 | $questionWeighting += $weighting; |
194 | 194 | } |
195 | - $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i); |
|
195 | + $objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | // saves the answers into the data base |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | function return_header($feedback_type = null, $counter = null, $score = null) |
207 | 207 | { |
208 | 208 | $header = parent::return_header($feedback_type, $counter, $score); |
209 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
209 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
210 | 210 | <tr> |
211 | 211 | <th>'.get_lang("Choice").'</th> |
212 | 212 | <th>'. get_lang("ExpectedChoice").'</th> |