@@ -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 |
@@ -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> |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | $time = time(); |
15 | 15 | $doc_url = str_replace(array('../', '\\', '\\0', '..'), array('', '', '', ''), urldecode($_GET['file'])); |
16 | 16 | $cid = api_get_course_id(); |
17 | -$document_path = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document'; |
|
18 | -$document_web_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document'; |
|
17 | +$document_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
18 | +$document_web_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'; |
|
19 | 19 | $origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : null; |
20 | 20 | $learnpath_id = isset($_REQUEST['learnpath_id']) ? $_REQUEST['learnpath_id'] : null; |
21 | 21 | $learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? $_REQUEST['learnpath_item_id'] : null; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $my_file = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), urldecode($my_file)); |
70 | 70 | |
71 | 71 | $title = GetQuizName($my_file, $documentPath); |
72 | -if ($title =='') { |
|
72 | +if ($title == '') { |
|
73 | 73 | $title = basename($my_file); |
74 | 74 | } |
75 | 75 | $nameTools = $title; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | }); |
87 | 87 | </script>'; |
88 | 88 | |
89 | -$interbreadcrumb[]= array ("url"=>"./exercise.php", "name"=> get_lang('Exercises')); |
|
89 | +$interbreadcrumb[] = array("url"=>"./exercise.php", "name"=> get_lang('Exercises')); |
|
90 | 90 | if ($origin == 'learnpath') { |
91 | 91 | Display::display_reduced_header($nameTools, "Exercise"); |
92 | 92 | } else { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | if ($title == '') { |
67 | 67 | $title = basename($fname); |
68 | 68 | } |
69 | - return (string)$title; |
|
69 | + return (string) $title; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | if ($src == '') { |
177 | 177 | return ''; |
178 | 178 | } else { |
179 | - $tmp_src = basename($src) ; |
|
179 | + $tmp_src = basename($src); |
|
180 | 180 | if ($tmp_src == '') { |
181 | 181 | return $src; |
182 | 182 | } else { |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | { |
199 | 199 | // Select src tag from img tag. |
200 | 200 | $match = array(); |
201 | - preg_match("|(src=\".*\" )|U", $imgtag, $match); //src |
|
201 | + preg_match("|(src=\".*\" )|U", $imgtag, $match); //src |
|
202 | 202 | list($key, $srctag) = each($match); |
203 | 203 | $src = substr($srctag, 5, (strlen($srctag) - 7)); |
204 | 204 | if (stristr($src, 'http') === false) { |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | while (list($key, $imgtag) = each($match)) { |
231 | 231 | $imgname = GetImgName($imgtag); |
232 | 232 | if ($imgname != '' && !in_array($imgname, $imgparams)) { |
233 | - array_push($imgparams, $imgname); // name (+ type) of the images in the html test |
|
234 | - $imgcount = $imgcount + 1; // number of images in the html test |
|
233 | + array_push($imgparams, $imgname); // name (+ type) of the images in the html test |
|
234 | + $imgcount = $imgcount + 1; // number of images in the html test |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | if ($file != '..') { |
405 | 405 | $full_name = $folder.'/'.$file; |
406 | 406 | if (is_dir($full_name)) { |
407 | - $dflag = 1; // first directory |
|
407 | + $dflag = 1; // first directory |
|
408 | 408 | } |
409 | 409 | } |
410 | 410 | } |