@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | |
31 | 31 | // Query db for answers |
32 | 32 | if ($answer_type==HOT_SPOT_DELINEATION) { |
33 | - $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
|
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 { |
36 | - $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
|
36 | + $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
|
37 | 37 | WHERE c_id = $course_id AND question_id = ".intval($questionId)." ORDER BY id"; |
38 | 38 | } |
39 | 39 | $result = Database::query($sql); |
@@ -74,37 +74,37 @@ discard block |
||
74 | 74 | $hotSpot['id'] = $hotspot['id']; |
75 | 75 | $hotSpot['answer'] = $hotspot['answer']; |
76 | 76 | |
77 | - // Square or rectancle |
|
78 | - if ($hotspot['hotspot_type'] == 'square' ) |
|
79 | - { |
|
77 | + // Square or rectancle |
|
78 | + if ($hotspot['hotspot_type'] == 'square' ) |
|
79 | + { |
|
80 | 80 | $hotSpot['type'] = 'square'; |
81 | - } |
|
82 | - // Circle or ovale |
|
83 | - if ($hotspot['hotspot_type'] == 'circle') |
|
84 | - { |
|
81 | + } |
|
82 | + // Circle or ovale |
|
83 | + if ($hotspot['hotspot_type'] == 'circle') |
|
84 | + { |
|
85 | 85 | $hotSpot['type'] = 'circle'; |
86 | - } |
|
87 | - // Polygon |
|
88 | - if ($hotspot['hotspot_type'] == 'poly') |
|
89 | - { |
|
86 | + } |
|
87 | + // Polygon |
|
88 | + if ($hotspot['hotspot_type'] == 'poly') |
|
89 | + { |
|
90 | 90 | $hotSpot['type'] = 'poly'; |
91 | - } |
|
92 | - // Delineation |
|
93 | - if ($hotspot['hotspot_type'] == 'delineation') |
|
94 | - { |
|
91 | + } |
|
92 | + // Delineation |
|
93 | + if ($hotspot['hotspot_type'] == 'delineation') |
|
94 | + { |
|
95 | 95 | $hotSpot['type'] = 'delineation'; |
96 | - } |
|
97 | - // No error |
|
98 | - if ($hotspot['hotspot_type'] == 'noerror') |
|
99 | - { |
|
96 | + } |
|
97 | + // No error |
|
98 | + if ($hotspot['hotspot_type'] == 'noerror') |
|
99 | + { |
|
100 | 100 | $hotSpot['type'] = 'noerror'; |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | - // This is a good answer, count + 1 for nmbr of clicks |
|
104 | - if ($hotspot['hotspot_type'] > 0) |
|
105 | - { |
|
106 | - $nmbrTries++; |
|
107 | - } |
|
103 | + // This is a good answer, count + 1 for nmbr of clicks |
|
104 | + if ($hotspot['hotspot_type'] > 0) |
|
105 | + { |
|
106 | + $nmbrTries++; |
|
107 | + } |
|
108 | 108 | |
109 | 109 | $hotSpot['coord'] = $hotspot['hotspot_coordinates']; |
110 | 110 |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | //Event::event_download($doc_url); |
24 | 24 | if (isset($_course['path'])) { |
25 | 25 | $course_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
26 | - $full_file_name = $course_path.Security::remove_XSS($doc_url); |
|
26 | + $full_file_name = $course_path.Security::remove_XSS($doc_url); |
|
27 | 27 | } else { |
28 | 28 | $course_path = api_get_path(SYS_COURSE_PATH).$cid.'/document'; |
29 | - $full_file_name = $course_path.Security::remove_XSS($doc_url); |
|
29 | + $full_file_name = $course_path.Security::remove_XSS($doc_url); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | if(!is_file($full_file_name)) { |
33 | - exit; |
|
33 | + exit; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | if (!Security::check_abs_path($full_file_name, $course_path.'/')) { |
@@ -41,16 +41,16 @@ discard block |
||
41 | 41 | $extension=strtolower($extension[sizeof($extension)-1]); |
42 | 42 | |
43 | 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; |
|
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); |
@@ -68,23 +68,23 @@ discard block |
||
68 | 68 | */ |
69 | 69 | |
70 | 70 | if ($content_type == 'text/html') { |
71 | - $directory_name = dirname($full_file_name); |
|
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.='/'; |
|
77 | - } |
|
75 | + if($dir[strlen($dir)-1] != '/') { |
|
76 | + $dir.='/'; |
|
77 | + } |
|
78 | 78 | |
79 | 79 | |
80 | - //Parse whole file at one |
|
81 | - $fp = fopen($full_file_name, "r"); |
|
82 | - $file_content = fread ($fp, filesize ($full_file_name)); |
|
83 | - fclose($fp); |
|
84 | - //$file_content = api_replace_parameter($dir, $file_content, "src"); |
|
85 | - //$file_content = api_replace_parameter($dir, $file_content, "href"); |
|
80 | + //Parse whole file at one |
|
81 | + $fp = fopen($full_file_name, "r"); |
|
82 | + $file_content = fread ($fp, filesize ($full_file_name)); |
|
83 | + fclose($fp); |
|
84 | + //$file_content = api_replace_parameter($dir, $file_content, "src"); |
|
85 | + //$file_content = api_replace_parameter($dir, $file_content, "href"); |
|
86 | 86 | |
87 | - /* |
|
87 | + /* |
|
88 | 88 | //parse line per line |
89 | 89 | $file_content_array = file($full_file_name); |
90 | 90 | |
@@ -98,16 +98,16 @@ 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)); |
|
104 | - $exercisePath = $exercisePath; |
|
101 | + $exfile = explode('/',$exercisePath); |
|
102 | + $exfile = $exfile[sizeof($exfile)-1]; |
|
103 | + $exercisePath = substr($exercisePath,0,strpos($exercisePath,$exfile)); |
|
104 | + $exercisePath = $exercisePath; |
|
105 | 105 | |
106 | - $content = $file_content; |
|
107 | - $mit = "function Finish(){"; |
|
106 | + $content = $file_content; |
|
107 | + $mit = "function Finish(){"; |
|
108 | 108 | |
109 | - $js_content = "var SaveScoreVariable = 0; // This variable included by Dokeos System\n". |
|
110 | - "function mySaveScore() // This function included by Dokeos System\n". |
|
109 | + $js_content = "var SaveScoreVariable = 0; // This variable included by Dokeos System\n". |
|
110 | + "function mySaveScore() // This function included by Dokeos System\n". |
|
111 | 111 | "{\n". |
112 | 112 | " if (SaveScoreVariable==0)\n". |
113 | 113 | " {\n". |
@@ -125,23 +125,23 @@ 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 | - header('Content-length: '.strlen($newcontent)); |
|
141 | - // Dipsp. |
|
142 | - echo $newcontent; |
|
140 | + header('Content-length: '.strlen($newcontent)); |
|
141 | + // Dipsp. |
|
142 | + echo $newcontent; |
|
143 | 143 | |
144 | - exit(); |
|
144 | + exit(); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | //normal case, all non-html files |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | //stores the results |
15 | 15 | private $results = array(); |
16 | 16 | |
17 | - /** |
|
18 | - * Gets the results of all students (or just one student if access is limited) |
|
19 | - * @param string The document path (for HotPotatoes retrieval) |
|
20 | - * @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null |
|
21 | - */ |
|
22 | - public function getExercisesReporting($document_path, $hotpotato_name) |
|
17 | + /** |
|
18 | + * Gets the results of all students (or just one student if access is limited) |
|
19 | + * @param string The document path (for HotPotatoes retrieval) |
|
20 | + * @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null |
|
21 | + */ |
|
22 | + public function getExercisesReporting($document_path, $hotpotato_name) |
|
23 | 23 | { |
24 | - $return = array(); |
|
24 | + $return = array(); |
|
25 | 25 | $TBL_USER = Database::get_main_table(TABLE_MAIN_USER); |
26 | 26 | $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
27 | 27 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $hotpotato_name = Database::escape_string($hotpotato_name); |
34 | 34 | |
35 | 35 | if (!empty($exercise_id)) { |
36 | - $session_id_and .= " AND exe_exo_id = $exercise_id "; |
|
36 | + $session_id_and .= " AND exe_exo_id = $exercise_id "; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | if (empty($user_id)) { |
@@ -110,25 +110,25 @@ discard block |
||
110 | 110 | $this->results = $return; |
111 | 111 | |
112 | 112 | return true; |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | 115 | |
116 | - /** |
|
117 | - * Exports the complete report as a CSV file |
|
118 | - * @param string Document path inside the document tool |
|
119 | - * @param integer Optional user ID |
|
120 | - * @param boolean Whether to include user fields or not |
|
121 | - * @return boolean False on error |
|
122 | - */ |
|
123 | - public function exportCompleteReportCSV($document_path='', $hotpotato_name) |
|
116 | + /** |
|
117 | + * Exports the complete report as a CSV file |
|
118 | + * @param string Document path inside the document tool |
|
119 | + * @param integer Optional user ID |
|
120 | + * @param boolean Whether to include user fields or not |
|
121 | + * @return boolean False on error |
|
122 | + */ |
|
123 | + public function exportCompleteReportCSV($document_path='', $hotpotato_name) |
|
124 | 124 | { |
125 | - global $charset; |
|
126 | - $this->getExercisesReporting($document_path, $hotpotato_name); |
|
127 | - $filename = 'exercise_results_'.date('YmdGis').'.csv'; |
|
128 | - if (!empty($user_id)) { |
|
129 | - $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv'; |
|
130 | - } |
|
131 | - $data = ''; |
|
125 | + global $charset; |
|
126 | + $this->getExercisesReporting($document_path, $hotpotato_name); |
|
127 | + $filename = 'exercise_results_'.date('YmdGis').'.csv'; |
|
128 | + if (!empty($user_id)) { |
|
129 | + $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv'; |
|
130 | + } |
|
131 | + $data = ''; |
|
132 | 132 | |
133 | 133 | if (api_is_western_name_order()) { |
134 | 134 | if(!empty($this->results[0]['first_name'])) { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | $data .= get_lang('Email').';'; |
149 | 149 | |
150 | - /*if ($export_user_fields) { |
|
150 | + /*if ($export_user_fields) { |
|
151 | 151 | //show user fields section with a big th colspan that spans over all fields |
152 | 152 | $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
153 | 153 | $num = count($extra_user_fields); |
@@ -156,25 +156,25 @@ discard block |
||
156 | 156 | } |
157 | 157 | }*/ |
158 | 158 | |
159 | - $data .= get_lang('Title').';'; |
|
160 | - $data .= get_lang('StartDate').';'; |
|
161 | - $data .= get_lang('Score').';'; |
|
162 | - $data .= get_lang('Total').';'; |
|
163 | - $data .= "\n"; |
|
159 | + $data .= get_lang('Title').';'; |
|
160 | + $data .= get_lang('StartDate').';'; |
|
161 | + $data .= get_lang('Score').';'; |
|
162 | + $data .= get_lang('Total').';'; |
|
163 | + $data .= "\n"; |
|
164 | 164 | |
165 | - //results |
|
166 | - foreach($this->results as $row) { |
|
165 | + //results |
|
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 | 175 | $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
176 | 176 | |
177 | - /*if ($export_user_fields) { |
|
177 | + /*if ($export_user_fields) { |
|
178 | 178 | //show user fields data, if any, for this user |
179 | 179 | $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
180 | 180 | foreach($user_fields_values as $value) { |
@@ -182,40 +182,40 @@ 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']).';'; |
|
189 | - $data .= "\n"; |
|
190 | - } |
|
191 | - |
|
192 | - //output the results |
|
193 | - $len = strlen($data); |
|
194 | - header('Content-type: application/octet-stream'); |
|
195 | - header('Content-Type: application/force-download'); |
|
196 | - header('Content-length: '.$len); |
|
197 | - if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
|
198 | - header('Content-Disposition: filename= '.$filename); |
|
199 | - } else { |
|
200 | - header('Content-Disposition: attachment; filename= '.$filename); |
|
201 | - } |
|
202 | - if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
|
203 | - header('Pragma: '); |
|
204 | - header('Cache-Control: '); |
|
205 | - header('Cache-Control: public'); // IE cannot download from sessions without a cache |
|
206 | - } |
|
207 | - header('Content-Description: '.$filename); |
|
208 | - header('Content-transfer-encoding: binary'); |
|
209 | - // @todo add this utf-8 header for all csv files |
|
210 | - echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
211 | - echo $data; |
|
212 | - return true; |
|
213 | - } |
|
214 | - |
|
215 | - /** |
|
216 | - * Exports the complete report as an XLS file |
|
217 | - * @return boolean False on error |
|
218 | - */ |
|
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 | + $data .= "\n"; |
|
190 | + } |
|
191 | + |
|
192 | + //output the results |
|
193 | + $len = strlen($data); |
|
194 | + header('Content-type: application/octet-stream'); |
|
195 | + header('Content-Type: application/force-download'); |
|
196 | + header('Content-length: '.$len); |
|
197 | + if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
|
198 | + header('Content-Disposition: filename= '.$filename); |
|
199 | + } else { |
|
200 | + header('Content-Disposition: attachment; filename= '.$filename); |
|
201 | + } |
|
202 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
|
203 | + header('Pragma: '); |
|
204 | + header('Cache-Control: '); |
|
205 | + header('Cache-Control: public'); // IE cannot download from sessions without a cache |
|
206 | + } |
|
207 | + header('Content-Description: '.$filename); |
|
208 | + header('Content-transfer-encoding: binary'); |
|
209 | + // @todo add this utf-8 header for all csv files |
|
210 | + echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
211 | + echo $data; |
|
212 | + return true; |
|
213 | + } |
|
214 | + |
|
215 | + /** |
|
216 | + * Exports the complete report as an XLS file |
|
217 | + * @return boolean False on error |
|
218 | + */ |
|
219 | 219 | public function exportCompleteReportXLS( |
220 | 220 | $document_path = '', |
221 | 221 | $user_id = null, |
@@ -224,37 +224,37 @@ discard block |
||
224 | 224 | $exercise_id = 0, |
225 | 225 | $hotpotato_name = null |
226 | 226 | ) { |
227 | - global $charset; |
|
228 | - $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
229 | - $filename = 'exercise_results_'.api_get_local_time().'.xls'; |
|
230 | - if (!empty($user_id)) { |
|
231 | - $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls'; |
|
232 | - } |
|
227 | + global $charset; |
|
228 | + $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
229 | + $filename = 'exercise_results_'.api_get_local_time().'.xls'; |
|
230 | + if (!empty($user_id)) { |
|
231 | + $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls'; |
|
232 | + } |
|
233 | 233 | |
234 | 234 | $spreadsheet = new PHPExcel(); |
235 | 235 | $spreadsheet->setActiveSheetIndex(0); |
236 | 236 | $worksheet = $spreadsheet->getActiveSheet(); |
237 | 237 | |
238 | 238 | |
239 | - $line = 0; |
|
240 | - $column = 0; //skip the first column (row titles) |
|
239 | + $line = 0; |
|
240 | + $column = 0; //skip the first column (row titles) |
|
241 | 241 | |
242 | - // check if exists column 'user' |
|
243 | - $with_column_user = false; |
|
244 | - foreach ($this->results as $result) { |
|
245 | - if (!empty($result['last_name']) && !empty($result['first_name'])) { |
|
246 | - $with_column_user = true; |
|
247 | - break; |
|
248 | - } |
|
249 | - } |
|
242 | + // check if exists column 'user' |
|
243 | + $with_column_user = false; |
|
244 | + foreach ($this->results as $result) { |
|
245 | + if (!empty($result['last_name']) && !empty($result['first_name'])) { |
|
246 | + $with_column_user = true; |
|
247 | + break; |
|
248 | + } |
|
249 | + } |
|
250 | 250 | |
251 | - if ($with_column_user) { |
|
252 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
253 | - $column++; |
|
251 | + if ($with_column_user) { |
|
252 | + $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
253 | + $column++; |
|
254 | 254 | |
255 | 255 | if (api_is_western_name_order()) { |
256 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
257 | - $column++; |
|
256 | + $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
257 | + $column++; |
|
258 | 258 | $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName')); |
259 | 259 | $column++; |
260 | 260 | } else { |
@@ -263,36 +263,36 @@ discard block |
||
263 | 263 | $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
264 | 264 | $column++; |
265 | 265 | } |
266 | - } |
|
266 | + } |
|
267 | 267 | |
268 | - if ($export_user_fields) { |
|
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); |
|
268 | + if ($export_user_fields) { |
|
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); |
|
271 | 271 | |
272 | - //show the fields names for user fields |
|
273 | - foreach ($extra_user_fields as $field) { |
|
274 | - $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
275 | - $column++; |
|
276 | - } |
|
277 | - } |
|
272 | + //show the fields names for user fields |
|
273 | + foreach ($extra_user_fields as $field) { |
|
274 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
275 | + $column++; |
|
276 | + } |
|
277 | + } |
|
278 | 278 | |
279 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
280 | - $column++; |
|
281 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
279 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
280 | + $column++; |
|
281 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
282 | 282 | $column++; |
283 | 283 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('EndDate')); |
284 | 284 | $column++; |
285 | 285 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
286 | - $column++; |
|
287 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
288 | - $column++; |
|
289 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
290 | - $column++; |
|
286 | + $column++; |
|
287 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
288 | + $column++; |
|
289 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
290 | + $column++; |
|
291 | 291 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Status')); |
292 | - $line++; |
|
292 | + $line++; |
|
293 | 293 | |
294 | - foreach ($this->results as $row) { |
|
295 | - $column = 0; |
|
294 | + foreach ($this->results as $row) { |
|
295 | + $column = 0; |
|
296 | 296 | |
297 | 297 | if ($with_column_user) { |
298 | 298 | $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
@@ -309,38 +309,38 @@ discard block |
||
309 | 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 | - if ($export_user_fields) { |
|
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)); |
|
319 | - $column++; |
|
320 | - } |
|
321 | - } |
|
314 | + if ($export_user_fields) { |
|
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)); |
|
319 | + $column++; |
|
320 | + } |
|
321 | + } |
|
322 | 322 | |
323 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
324 | - $column++; |
|
325 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']); |
|
323 | + $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
324 | + $column++; |
|
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 | + $column++; |
|
329 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
330 | + $column++; |
|
331 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
332 | + $column++; |
|
333 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
328 | 334 | $column++; |
329 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
330 | - $column++; |
|
331 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
332 | - $column++; |
|
333 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
334 | - $column++; |
|
335 | 335 | $worksheet->SetCellValueByColumnAndRow($line,$column,$row['status']); |
336 | - $line++; |
|
337 | - } |
|
336 | + $line++; |
|
337 | + } |
|
338 | 338 | |
339 | 339 | $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename); |
340 | 340 | $writer = new PHPExcel_Writer_Excel2007($spreadsheet); |
341 | 341 | $writer->save($file); |
342 | 342 | DocumentManager::file_send_for_download($file, true, $filename); |
343 | 343 | |
344 | - return true; |
|
345 | - } |
|
344 | + return true; |
|
345 | + } |
|
346 | 346 | } |
@@ -98,10 +98,10 @@ |
||
98 | 98 | }*/ |
99 | 99 | } |
100 | 100 | |
101 | - // This is a good answer, count + 1 for nmbr of clicks |
|
102 | - if ($answers['weighting'][$i] > 0) { |
|
103 | - $nmbrTries++; |
|
104 | - } |
|
101 | + // This is a good answer, count + 1 for nmbr of clicks |
|
102 | + if ($answers['weighting'][$i] > 0) { |
|
103 | + $nmbrTries++; |
|
104 | + } |
|
105 | 105 | |
106 | 106 | $hotSpot['coord'] = $answers['hotspot_coordinates'][$i]; |
107 | 107 | $data['hotspots'][] = $hotSpot; |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | $show_headers = isset($_REQUEST['show_headers']) ? intval($_REQUEST['show_headers']) : null; //exe id |
18 | 18 | |
19 | 19 | if ($origin == 'learnpath') { |
20 | - $show_headers = false; |
|
20 | + $show_headers = false; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | api_protect_course_script($show_headers); |
24 | 24 | |
25 | 25 | if (empty($id)) { |
26 | - api_not_allowed($show_headers); |
|
26 | + api_not_allowed($show_headers); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | $is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | // Only users can see their own results |
50 | 50 | if (!$is_allowedToEdit) { |
51 | 51 | if ($student_id != $current_user_id) { |
52 | - api_not_allowed($show_headers); |
|
52 | + api_not_allowed($show_headers); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | "name" => get_lang('Exercises'), |
63 | 63 | ); |
64 | 64 | $interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result')); |
65 | - $this_section = SECTION_COURSES; |
|
66 | - Display::display_header(); |
|
65 | + $this_section = SECTION_COURSES; |
|
66 | + Display::display_header(); |
|
67 | 67 | } else { |
68 | 68 | $htmlHeadXtra[] = " |
69 | 69 | <style> |
70 | 70 | body { background: none;} |
71 | 71 | </style> |
72 | 72 | "; |
73 | - Display::display_reduced_header(); |
|
73 | + Display::display_reduced_header(); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | ExerciseLib::display_question_list_by_attempt($objExercise, $id, false); |
77 | 77 | |
78 | 78 | if ($show_headers) { |
79 | - Display::display_footer(); |
|
79 | + Display::display_footer(); |
|
80 | 80 | } |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | |
169 | - /** |
|
170 | - * abstract function which creates the form to create / edit the answers of the question |
|
171 | - * @param the formvalidator instance |
|
172 | - * @param the answers number to display |
|
173 | - */ |
|
174 | - function processAnswersCreation($form) |
|
169 | + /** |
|
170 | + * abstract function which creates the form to create / edit the answers of the question |
|
171 | + * @param the formvalidator instance |
|
172 | + * @param the answers number to display |
|
173 | + */ |
|
174 | + function processAnswersCreation($form) |
|
175 | 175 | { |
176 | 176 | $questionWeighting = $nbrGoodAnswers = 0; |
177 | 177 | $objAnswer = new Answer($this->id); |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | // sets the total weighting of the question |
202 | 202 | $this->updateWeighting($questionWeighting); |
203 | 203 | $this->save(); |
204 | - } |
|
204 | + } |
|
205 | 205 | |
206 | - function return_header($feedback_type = null, $counter = null, $score = null) |
|
206 | + function return_header($feedback_type = null, $counter = null, $score = null) |
|
207 | 207 | { |
208 | - $header = parent::return_header($feedback_type, $counter, $score); |
|
209 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
208 | + $header = parent::return_header($feedback_type, $counter, $score); |
|
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> |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $header .= '<th>'.get_lang("Comment").'</th>'; |
215 | 215 | $header .= '</tr>'; |
216 | 216 | return $header; |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | |
220 | 220 | } |
@@ -28,10 +28,10 @@ |
||
28 | 28 | $content = ReadFileCont($full_file_path.$user_id.'.t.html'); |
29 | 29 | |
30 | 30 | if ($content == '') { |
31 | - $content = ReadFileCont($full_file_path); |
|
31 | + $content = ReadFileCont($full_file_path); |
|
32 | 32 | // Do not move this like: |
33 | - $mit = "function Finish(){"; |
|
34 | - $js_content = " |
|
33 | + $mit = "function Finish(){"; |
|
34 | + $js_content = " |
|
35 | 35 | // Code added - start |
36 | 36 | var SaveScoreVariable = 0; |
37 | 37 | function mySaveScore() { |
@@ -344,7 +344,7 @@ |
||
344 | 344 | if (is_dir($full_name)) { |
345 | 345 | $filelist[] = $file; |
346 | 346 | } |
347 | - } |
|
347 | + } |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | } |
@@ -12,21 +12,21 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class UniqueAnswerNoOption extends Question |
14 | 14 | { |
15 | - static $typePicture = 'mcuao.png'; |
|
16 | - static $explanationLangVar = 'UniqueAnswerNoOption'; |
|
15 | + static $typePicture = 'mcuao.png'; |
|
16 | + static $explanationLangVar = 'UniqueAnswerNoOption'; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Constructor |
|
20 | - */ |
|
21 | - public function __construct() |
|
18 | + /** |
|
19 | + * Constructor |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | 22 | { |
23 | - //this is highly important |
|
24 | - parent::__construct(); |
|
25 | - $this -> type = UNIQUE_ANSWER_NO_OPTION; |
|
26 | - $this -> isContent = $this-> getIsContent(); |
|
27 | - } |
|
23 | + //this is highly important |
|
24 | + parent::__construct(); |
|
25 | + $this -> type = UNIQUE_ANSWER_NO_OPTION; |
|
26 | + $this -> isContent = $this-> getIsContent(); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
29 | + /** |
|
30 | 30 | * function which redifines Question::createAnswersForm |
31 | 31 | * @param the formvalidator instance |
32 | 32 | * @param the answers number to display |
@@ -283,37 +283,37 @@ discard block |
||
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
286 | - * Function which creates the form to create / edit the answers of the question |
|
287 | - * @param the formvalidator instance |
|
288 | - * @param the answers number to display |
|
289 | - */ |
|
290 | - function processAnswersCreation($form) |
|
286 | + * Function which creates the form to create / edit the answers of the question |
|
287 | + * @param the formvalidator instance |
|
288 | + * @param the answers number to display |
|
289 | + */ |
|
290 | + function processAnswersCreation($form) |
|
291 | 291 | { |
292 | - $questionWeighting = $nbrGoodAnswers = 0; |
|
293 | - $correct = $form -> getSubmitValue('correct'); |
|
294 | - $objAnswer = new Answer($this->id); |
|
295 | - $nb_answers = $form -> getSubmitValue('nb_answers'); |
|
296 | - $minus = 1; |
|
297 | - if ($form -> getSubmitValue('new_question')) { |
|
298 | - $minus = 0; |
|
299 | - } |
|
300 | - |
|
301 | - for ($i=1 ; $i <= $nb_answers - $minus; $i++) { |
|
302 | - $position = trim($form -> getSubmitValue('position['.$i.']')); |
|
303 | - $answer = trim($form -> getSubmitValue('answer['.$i.']')); |
|
292 | + $questionWeighting = $nbrGoodAnswers = 0; |
|
293 | + $correct = $form -> getSubmitValue('correct'); |
|
294 | + $objAnswer = new Answer($this->id); |
|
295 | + $nb_answers = $form -> getSubmitValue('nb_answers'); |
|
296 | + $minus = 1; |
|
297 | + if ($form -> getSubmitValue('new_question')) { |
|
298 | + $minus = 0; |
|
299 | + } |
|
300 | + |
|
301 | + for ($i=1 ; $i <= $nb_answers - $minus; $i++) { |
|
302 | + $position = trim($form -> getSubmitValue('position['.$i.']')); |
|
303 | + $answer = trim($form -> getSubmitValue('answer['.$i.']')); |
|
304 | 304 | $comment = trim($form -> getSubmitValue('comment['.$i.']')); |
305 | 305 | $weighting = trim($form -> getSubmitValue('weighting['.$i.']')); |
306 | 306 | $scenario = $form -> getSubmitValue('scenario'); |
307 | 307 | |
308 | - //$list_destination = $form -> getSubmitValue('destination'.$i); |
|
309 | - //$destination_str = $form -> getSubmitValue('destination'.$i); |
|
308 | + //$list_destination = $form -> getSubmitValue('destination'.$i); |
|
309 | + //$destination_str = $form -> getSubmitValue('destination'.$i); |
|
310 | 310 | |
311 | - $try = $scenario['try'.$i]; |
|
311 | + $try = $scenario['try'.$i]; |
|
312 | 312 | $lp = $scenario['lp'.$i]; |
313 | - $destination = $scenario['destination'.$i]; |
|
314 | - $url = trim($scenario['url'.$i]); |
|
313 | + $destination = $scenario['destination'.$i]; |
|
314 | + $url = trim($scenario['url'.$i]); |
|
315 | 315 | |
316 | - /* |
|
316 | + /* |
|
317 | 317 | How we are going to parse the destination value |
318 | 318 | |
319 | 319 | here we parse the destination value which is a string |
@@ -326,41 +326,41 @@ discard block |
||
326 | 326 | selected_questions= ids of questions |
327 | 327 | url= an url |
328 | 328 | */ |
329 | - /* |
|
329 | + /* |
|
330 | 330 | $destination_str=''; |
331 | 331 | foreach ($list_destination as $destination_id) |
332 | 332 | { |
333 | 333 | $destination_str.=$destination_id.';'; |
334 | 334 | }*/ |
335 | 335 | |
336 | - $goodAnswer= ($correct == $i) ? true : false; |
|
336 | + $goodAnswer= ($correct == $i) ? true : false; |
|
337 | 337 | |
338 | - if ($goodAnswer) { |
|
339 | - $nbrGoodAnswers++; |
|
340 | - $weighting = abs($weighting); |
|
341 | - if($weighting > 0) { |
|
338 | + if ($goodAnswer) { |
|
339 | + $nbrGoodAnswers++; |
|
340 | + $weighting = abs($weighting); |
|
341 | + if($weighting > 0) { |
|
342 | 342 | $questionWeighting += $weighting; |
343 | 343 | } |
344 | - } |
|
344 | + } |
|
345 | 345 | |
346 | - if (empty($try)) |
|
347 | - $try=0; |
|
346 | + if (empty($try)) |
|
347 | + $try=0; |
|
348 | 348 | |
349 | - if (empty($lp)) { |
|
350 | - $lp=0; |
|
351 | - } |
|
349 | + if (empty($lp)) { |
|
350 | + $lp=0; |
|
351 | + } |
|
352 | 352 | |
353 | - if (empty($destination)) { |
|
354 | - $destination=0; |
|
355 | - } |
|
353 | + if (empty($destination)) { |
|
354 | + $destination=0; |
|
355 | + } |
|
356 | 356 | |
357 | - if ($url=='') { |
|
358 | - $url=0; |
|
359 | - } |
|
357 | + if ($url=='') { |
|
358 | + $url=0; |
|
359 | + } |
|
360 | 360 | |
361 | - //1@@1;2;@@2;4;4;@@http://www.chamilo.org |
|
362 | - $dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url; |
|
363 | - $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
|
361 | + //1@@1;2;@@2;4;4;@@http://www.chamilo.org |
|
362 | + $dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url; |
|
363 | + $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | //Create 666 answer |
@@ -373,18 +373,18 @@ discard block |
||
373 | 373 | |
374 | 374 | $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
375 | 375 | |
376 | - // saves the answers into the data base |
|
376 | + // saves the answers into the data base |
|
377 | 377 | $objAnswer -> save(); |
378 | 378 | |
379 | 379 | // sets the total weighting of the question |
380 | 380 | $this -> updateWeighting($questionWeighting); |
381 | 381 | $this -> save(); |
382 | - } |
|
382 | + } |
|
383 | 383 | |
384 | - function return_header($feedback_type = null, $counter = null, $score = null) |
|
384 | + function return_header($feedback_type = null, $counter = null, $score = null) |
|
385 | 385 | { |
386 | - $header = parent::return_header($feedback_type, $counter, $score); |
|
387 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
386 | + $header = parent::return_header($feedback_type, $counter, $score); |
|
387 | + $header .= '<table class="'.$this->question_table_class .'"> |
|
388 | 388 | <tr> |
389 | 389 | <th>'.get_lang("Choice").'</th> |
390 | 390 | <th>'. get_lang("ExpectedChoice").'</th> |
@@ -392,5 +392,5 @@ discard block |
||
392 | 392 | $header .= '<th>'.get_lang("Comment").'</th>'; |
393 | 393 | $header .= '</tr>'; |
394 | 394 | return $header; |
395 | - } |
|
395 | + } |
|
396 | 396 | } |