@@ -12,31 +12,31 @@ discard block |
||
| 12 | 12 | **/ |
| 13 | 13 | class HotSpot extends Question |
| 14 | 14 | { |
| 15 | - public static $typePicture = 'hotspot.png'; |
|
| 16 | - public static $explanationLangVar = 'HotSpot'; |
|
| 15 | + public static $typePicture = 'hotspot.png'; |
|
| 16 | + public static $explanationLangVar = 'HotSpot'; |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * HotSpot constructor. |
| 20 | 20 | */ |
| 21 | - public function __construct() |
|
| 22 | - { |
|
| 23 | - parent::__construct(); |
|
| 24 | - $this -> type = HOT_SPOT; |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - public function display() |
|
| 28 | - { |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * @param FormValidator $form |
|
| 33 | - * @param int $fck_config |
|
| 34 | - */ |
|
| 35 | - public function createForm (&$form, $fck_config=0) |
|
| 36 | - { |
|
| 37 | - parent::createForm($form, $fck_config); |
|
| 38 | - |
|
| 39 | - if (!isset($_GET['editQuestion'])) { |
|
| 21 | + public function __construct() |
|
| 22 | + { |
|
| 23 | + parent::__construct(); |
|
| 24 | + $this -> type = HOT_SPOT; |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + public function display() |
|
| 28 | + { |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @param FormValidator $form |
|
| 33 | + * @param int $fck_config |
|
| 34 | + */ |
|
| 35 | + public function createForm (&$form, $fck_config=0) |
|
| 36 | + { |
|
| 37 | + parent::createForm($form, $fck_config); |
|
| 38 | + |
|
| 39 | + if (!isset($_GET['editQuestion'])) { |
|
| 40 | 40 | $form->addElement( |
| 41 | 41 | 'file', |
| 42 | 42 | 'imageUpload', |
@@ -46,54 +46,54 @@ discard block |
||
| 46 | 46 | ) |
| 47 | 47 | ); |
| 48 | 48 | |
| 49 | - // setting the save button here and not in the question class.php |
|
| 50 | - // Saving a question |
|
| 51 | - $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
| 52 | - //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
| 53 | - $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
| 54 | - $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
|
| 55 | - } else { |
|
| 56 | - // setting the save button here and not in the question class.php |
|
| 57 | - // Editing a question |
|
| 58 | - $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion'); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * @param FormValidator $form |
|
| 64 | - * @param null $objExercise |
|
| 65 | - * @return null|false |
|
| 66 | - */ |
|
| 67 | - public function processCreation($form, $objExercise = null) |
|
| 68 | - { |
|
| 69 | - $file_info = $form->getSubmitValue('imageUpload'); |
|
| 70 | - $_course = api_get_course_info(); |
|
| 71 | - parent::processCreation($form, $objExercise); |
|
| 72 | - |
|
| 73 | - if(!empty($file_info['tmp_name'])) { |
|
| 74 | - $this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
|
| 75 | - $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
| 76 | - $picturePath = $documentPath.'/images'; |
|
| 77 | - |
|
| 78 | - // fixed width ang height |
|
| 79 | - if (file_exists($picturePath.'/'.$this->picture)) { |
|
| 80 | - $this->resizePicture('width', 800); |
|
| 81 | - $this->save(); |
|
| 82 | - } else { |
|
| 83 | - return false; |
|
| 84 | - } |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - function createAnswersForm($form) |
|
| 89 | - { |
|
| 90 | - // nothing |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - function processAnswersCreation($form) |
|
| 94 | - { |
|
| 95 | - // nothing |
|
| 96 | - } |
|
| 49 | + // setting the save button here and not in the question class.php |
|
| 50 | + // Saving a question |
|
| 51 | + $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
| 52 | + //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
| 53 | + $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
| 54 | + $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
|
| 55 | + } else { |
|
| 56 | + // setting the save button here and not in the question class.php |
|
| 57 | + // Editing a question |
|
| 58 | + $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion'); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * @param FormValidator $form |
|
| 64 | + * @param null $objExercise |
|
| 65 | + * @return null|false |
|
| 66 | + */ |
|
| 67 | + public function processCreation($form, $objExercise = null) |
|
| 68 | + { |
|
| 69 | + $file_info = $form->getSubmitValue('imageUpload'); |
|
| 70 | + $_course = api_get_course_info(); |
|
| 71 | + parent::processCreation($form, $objExercise); |
|
| 72 | + |
|
| 73 | + if(!empty($file_info['tmp_name'])) { |
|
| 74 | + $this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
|
| 75 | + $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
| 76 | + $picturePath = $documentPath.'/images'; |
|
| 77 | + |
|
| 78 | + // fixed width ang height |
|
| 79 | + if (file_exists($picturePath.'/'.$this->picture)) { |
|
| 80 | + $this->resizePicture('width', 800); |
|
| 81 | + $this->save(); |
|
| 82 | + } else { |
|
| 83 | + return false; |
|
| 84 | + } |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + function createAnswersForm($form) |
|
| 89 | + { |
|
| 90 | + // nothing |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + function processAnswersCreation($form) |
|
| 94 | + { |
|
| 95 | + // nothing |
|
| 96 | + } |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -101,35 +101,35 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | class HotSpotDelineation extends HotSpot |
| 103 | 103 | { |
| 104 | - static $typePicture = 'hotspot-delineation.png'; |
|
| 105 | - static $explanationLangVar = 'HotspotDelineation'; |
|
| 106 | - |
|
| 107 | - function __construct() |
|
| 108 | - { |
|
| 109 | - parent::__construct(); |
|
| 110 | - $this -> type = HOT_SPOT_DELINEATION; |
|
| 111 | - |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - function createForm (&$form, $fck_config=0) |
|
| 115 | - { |
|
| 116 | - parent::createForm ($form, $fck_config); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - function processCreation ($form, $objExercise = null) |
|
| 120 | - { |
|
| 121 | - $file_info = $form -> getSubmitValue('imageUpload'); |
|
| 122 | - parent::processCreation ($form, $objExercise); |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - function createAnswersForm ($form) |
|
| 126 | - { |
|
| 127 | - parent::createAnswersForm ($form); |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - function processAnswersCreation ($form) |
|
| 131 | - { |
|
| 132 | - parent::processAnswersCreation ($form); |
|
| 133 | - } |
|
| 104 | + static $typePicture = 'hotspot-delineation.png'; |
|
| 105 | + static $explanationLangVar = 'HotspotDelineation'; |
|
| 106 | + |
|
| 107 | + function __construct() |
|
| 108 | + { |
|
| 109 | + parent::__construct(); |
|
| 110 | + $this -> type = HOT_SPOT_DELINEATION; |
|
| 111 | + |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + function createForm (&$form, $fck_config=0) |
|
| 115 | + { |
|
| 116 | + parent::createForm ($form, $fck_config); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + function processCreation ($form, $objExercise = null) |
|
| 120 | + { |
|
| 121 | + $file_info = $form -> getSubmitValue('imageUpload'); |
|
| 122 | + parent::processCreation ($form, $objExercise); |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + function createAnswersForm ($form) |
|
| 126 | + { |
|
| 127 | + parent::createAnswersForm ($form); |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + function processAnswersCreation ($form) |
|
| 131 | + { |
|
| 132 | + parent::processAnswersCreation ($form); |
|
| 133 | + } |
|
| 134 | 134 | } |
| 135 | 135 | |
@@ -14,15 +14,15 @@ 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 | - * @param string $document_path |
|
| 22 | - */ |
|
| 23 | - 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 | + * @param string $document_path |
|
| 22 | + */ |
|
| 23 | + public function getExercisesReporting($document_path, $hotpotato_name) |
|
| 24 | 24 | { |
| 25 | - $return = array(); |
|
| 25 | + $return = array(); |
|
| 26 | 26 | $TBL_USER = Database::get_main_table(TABLE_MAIN_USER); |
| 27 | 27 | $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
| 28 | 28 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $hotpotato_name = Database::escape_string($hotpotato_name); |
| 35 | 35 | |
| 36 | 36 | if (!empty($exercise_id)) { |
| 37 | - $session_id_and .= " AND exe_exo_id = $exercise_id "; |
|
| 37 | + $session_id_and .= " AND exe_exo_id = $exercise_id "; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | if (empty($user_id)) { |
@@ -111,25 +111,25 @@ discard block |
||
| 111 | 111 | $this->results = $return; |
| 112 | 112 | |
| 113 | 113 | return true; |
| 114 | - } |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * Exports the complete report as a CSV file |
|
| 119 | - * @param string Document path inside the document tool |
|
| 120 | - * @param integer Optional user ID |
|
| 121 | - * @param boolean Whether to include user fields or not |
|
| 122 | - * @return boolean False on error |
|
| 123 | - */ |
|
| 124 | - public function exportCompleteReportCSV($document_path = '', $hotpotato_name) |
|
| 117 | + /** |
|
| 118 | + * Exports the complete report as a CSV file |
|
| 119 | + * @param string Document path inside the document tool |
|
| 120 | + * @param integer Optional user ID |
|
| 121 | + * @param boolean Whether to include user fields or not |
|
| 122 | + * @return boolean False on error |
|
| 123 | + */ |
|
| 124 | + public function exportCompleteReportCSV($document_path = '', $hotpotato_name) |
|
| 125 | 125 | { |
| 126 | - global $charset; |
|
| 127 | - $this->getExercisesReporting($document_path, $hotpotato_name); |
|
| 128 | - $filename = 'exercise_results_'.date('YmdGis').'.csv'; |
|
| 129 | - if (!empty($user_id)) { |
|
| 130 | - $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv'; |
|
| 131 | - } |
|
| 132 | - $data = ''; |
|
| 126 | + global $charset; |
|
| 127 | + $this->getExercisesReporting($document_path, $hotpotato_name); |
|
| 128 | + $filename = 'exercise_results_'.date('YmdGis').'.csv'; |
|
| 129 | + if (!empty($user_id)) { |
|
| 130 | + $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv'; |
|
| 131 | + } |
|
| 132 | + $data = ''; |
|
| 133 | 133 | |
| 134 | 134 | if (api_is_western_name_order()) { |
| 135 | 135 | if(!empty($this->results[0]['first_name'])) { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | $data .= get_lang('Email').';'; |
| 150 | 150 | |
| 151 | - /*if ($export_user_fields) { |
|
| 151 | + /*if ($export_user_fields) { |
|
| 152 | 152 | //show user fields section with a big th colspan that spans over all fields |
| 153 | 153 | $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
| 154 | 154 | $num = count($extra_user_fields); |
@@ -157,25 +157,25 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | }*/ |
| 159 | 159 | |
| 160 | - $data .= get_lang('Title').';'; |
|
| 161 | - $data .= get_lang('StartDate').';'; |
|
| 162 | - $data .= get_lang('Score').';'; |
|
| 163 | - $data .= get_lang('Total').';'; |
|
| 164 | - $data .= "\n"; |
|
| 160 | + $data .= get_lang('Title').';'; |
|
| 161 | + $data .= get_lang('StartDate').';'; |
|
| 162 | + $data .= get_lang('Score').';'; |
|
| 163 | + $data .= get_lang('Total').';'; |
|
| 164 | + $data .= "\n"; |
|
| 165 | 165 | |
| 166 | - //results |
|
| 167 | - foreach($this->results as $row) { |
|
| 166 | + //results |
|
| 167 | + foreach($this->results as $row) { |
|
| 168 | 168 | if (api_is_western_name_order()) { |
| 169 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
| 170 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
| 169 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
| 170 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
| 171 | 171 | } else { |
| 172 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
| 173 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
| 172 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
| 173 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
| 177 | 177 | |
| 178 | - /*if ($export_user_fields) { |
|
| 178 | + /*if ($export_user_fields) { |
|
| 179 | 179 | //show user fields data, if any, for this user |
| 180 | 180 | $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
| 181 | 181 | foreach($user_fields_values as $value) { |
@@ -183,40 +183,40 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | }*/ |
| 185 | 185 | |
| 186 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
| 187 | - $data .= str_replace("\r\n",' ',$row['exe_date']).';'; |
|
| 188 | - $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
| 189 | - $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
| 190 | - $data .= "\n"; |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - //output the results |
|
| 194 | - $len = strlen($data); |
|
| 195 | - header('Content-type: application/octet-stream'); |
|
| 196 | - header('Content-Type: application/force-download'); |
|
| 197 | - header('Content-length: '.$len); |
|
| 198 | - if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
|
| 199 | - header('Content-Disposition: filename= '.$filename); |
|
| 200 | - } else { |
|
| 201 | - header('Content-Disposition: attachment; filename= '.$filename); |
|
| 202 | - } |
|
| 203 | - if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
|
| 204 | - header('Pragma: '); |
|
| 205 | - header('Cache-Control: '); |
|
| 206 | - header('Cache-Control: public'); // IE cannot download from sessions without a cache |
|
| 207 | - } |
|
| 208 | - header('Content-Description: '.$filename); |
|
| 209 | - header('Content-transfer-encoding: binary'); |
|
| 210 | - // @todo add this utf-8 header for all csv files |
|
| 211 | - echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
| 212 | - echo $data; |
|
| 213 | - return true; |
|
| 214 | - } |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * Exports the complete report as an XLS file |
|
| 218 | - * @return boolean False on error |
|
| 219 | - */ |
|
| 186 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
| 187 | + $data .= str_replace("\r\n",' ',$row['exe_date']).';'; |
|
| 188 | + $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
| 189 | + $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
| 190 | + $data .= "\n"; |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + //output the results |
|
| 194 | + $len = strlen($data); |
|
| 195 | + header('Content-type: application/octet-stream'); |
|
| 196 | + header('Content-Type: application/force-download'); |
|
| 197 | + header('Content-length: '.$len); |
|
| 198 | + if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
|
| 199 | + header('Content-Disposition: filename= '.$filename); |
|
| 200 | + } else { |
|
| 201 | + header('Content-Disposition: attachment; filename= '.$filename); |
|
| 202 | + } |
|
| 203 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
|
| 204 | + header('Pragma: '); |
|
| 205 | + header('Cache-Control: '); |
|
| 206 | + header('Cache-Control: public'); // IE cannot download from sessions without a cache |
|
| 207 | + } |
|
| 208 | + header('Content-Description: '.$filename); |
|
| 209 | + header('Content-transfer-encoding: binary'); |
|
| 210 | + // @todo add this utf-8 header for all csv files |
|
| 211 | + echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
| 212 | + echo $data; |
|
| 213 | + return true; |
|
| 214 | + } |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * Exports the complete report as an XLS file |
|
| 218 | + * @return boolean False on error |
|
| 219 | + */ |
|
| 220 | 220 | public function exportCompleteReportXLS( |
| 221 | 221 | $document_path = '', |
| 222 | 222 | $user_id = null, |
@@ -225,37 +225,37 @@ discard block |
||
| 225 | 225 | $exercise_id = 0, |
| 226 | 226 | $hotpotato_name = null |
| 227 | 227 | ) { |
| 228 | - global $charset; |
|
| 229 | - $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
| 230 | - $filename = 'exercise_results_'.api_get_local_time().'.xls'; |
|
| 231 | - if (!empty($user_id)) { |
|
| 232 | - $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls'; |
|
| 233 | - } |
|
| 228 | + global $charset; |
|
| 229 | + $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
| 230 | + $filename = 'exercise_results_'.api_get_local_time().'.xls'; |
|
| 231 | + if (!empty($user_id)) { |
|
| 232 | + $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls'; |
|
| 233 | + } |
|
| 234 | 234 | |
| 235 | 235 | $spreadsheet = new PHPExcel(); |
| 236 | 236 | $spreadsheet->setActiveSheetIndex(0); |
| 237 | 237 | $worksheet = $spreadsheet->getActiveSheet(); |
| 238 | 238 | |
| 239 | 239 | |
| 240 | - $line = 0; |
|
| 241 | - $column = 0; //skip the first column (row titles) |
|
| 240 | + $line = 0; |
|
| 241 | + $column = 0; //skip the first column (row titles) |
|
| 242 | 242 | |
| 243 | - // check if exists column 'user' |
|
| 244 | - $with_column_user = false; |
|
| 245 | - foreach ($this->results as $result) { |
|
| 246 | - if (!empty($result['last_name']) && !empty($result['first_name'])) { |
|
| 247 | - $with_column_user = true; |
|
| 248 | - break; |
|
| 249 | - } |
|
| 250 | - } |
|
| 243 | + // check if exists column 'user' |
|
| 244 | + $with_column_user = false; |
|
| 245 | + foreach ($this->results as $result) { |
|
| 246 | + if (!empty($result['last_name']) && !empty($result['first_name'])) { |
|
| 247 | + $with_column_user = true; |
|
| 248 | + break; |
|
| 249 | + } |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | - if ($with_column_user) { |
|
| 253 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
| 254 | - $column++; |
|
| 252 | + if ($with_column_user) { |
|
| 253 | + $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
| 254 | + $column++; |
|
| 255 | 255 | |
| 256 | 256 | if (api_is_western_name_order()) { |
| 257 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
| 258 | - $column++; |
|
| 257 | + $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
| 258 | + $column++; |
|
| 259 | 259 | $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName')); |
| 260 | 260 | $column++; |
| 261 | 261 | } else { |
@@ -264,36 +264,36 @@ discard block |
||
| 264 | 264 | $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
| 265 | 265 | $column++; |
| 266 | 266 | } |
| 267 | - } |
|
| 267 | + } |
|
| 268 | 268 | |
| 269 | - if ($export_user_fields) { |
|
| 270 | - //show user fields section with a big th colspan that spans over all fields |
|
| 271 | - $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
| 269 | + if ($export_user_fields) { |
|
| 270 | + //show user fields section with a big th colspan that spans over all fields |
|
| 271 | + $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
| 272 | 272 | |
| 273 | - //show the fields names for user fields |
|
| 274 | - foreach ($extra_user_fields as $field) { |
|
| 275 | - $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
| 276 | - $column++; |
|
| 277 | - } |
|
| 278 | - } |
|
| 273 | + //show the fields names for user fields |
|
| 274 | + foreach ($extra_user_fields as $field) { |
|
| 275 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
| 276 | + $column++; |
|
| 277 | + } |
|
| 278 | + } |
|
| 279 | 279 | |
| 280 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
| 281 | - $column++; |
|
| 282 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
| 280 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
| 281 | + $column++; |
|
| 282 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
| 283 | 283 | $column++; |
| 284 | 284 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('EndDate')); |
| 285 | 285 | $column++; |
| 286 | 286 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
| 287 | - $column++; |
|
| 288 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
| 289 | - $column++; |
|
| 290 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
| 291 | - $column++; |
|
| 287 | + $column++; |
|
| 288 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
| 289 | + $column++; |
|
| 290 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
| 291 | + $column++; |
|
| 292 | 292 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Status')); |
| 293 | - $line++; |
|
| 293 | + $line++; |
|
| 294 | 294 | |
| 295 | - foreach ($this->results as $row) { |
|
| 296 | - $column = 0; |
|
| 295 | + foreach ($this->results as $row) { |
|
| 296 | + $column = 0; |
|
| 297 | 297 | |
| 298 | 298 | if ($with_column_user) { |
| 299 | 299 | $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
@@ -310,38 +310,38 @@ discard block |
||
| 310 | 310 | $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
| 311 | 311 | $column++; |
| 312 | 312 | } |
| 313 | - } |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | - if ($export_user_fields) { |
|
| 316 | - //show user fields data, if any, for this user |
|
| 317 | - $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
| 318 | - foreach($user_fields_values as $value) { |
|
| 319 | - $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
| 320 | - $column++; |
|
| 321 | - } |
|
| 322 | - } |
|
| 315 | + if ($export_user_fields) { |
|
| 316 | + //show user fields data, if any, for this user |
|
| 317 | + $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
| 318 | + foreach($user_fields_values as $value) { |
|
| 319 | + $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
| 320 | + $column++; |
|
| 321 | + } |
|
| 322 | + } |
|
| 323 | 323 | |
| 324 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
| 325 | - $column++; |
|
| 326 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']); |
|
| 324 | + $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
| 325 | + $column++; |
|
| 326 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']); |
|
| 327 | 327 | $column++; |
| 328 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']); |
|
| 328 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']); |
|
| 329 | + $column++; |
|
| 330 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
| 331 | + $column++; |
|
| 332 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
| 333 | + $column++; |
|
| 334 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
| 329 | 335 | $column++; |
| 330 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
| 331 | - $column++; |
|
| 332 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
| 333 | - $column++; |
|
| 334 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
| 335 | - $column++; |
|
| 336 | 336 | $worksheet->SetCellValueByColumnAndRow($line,$column,$row['status']); |
| 337 | - $line++; |
|
| 338 | - } |
|
| 337 | + $line++; |
|
| 338 | + } |
|
| 339 | 339 | |
| 340 | 340 | $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename); |
| 341 | 341 | $writer = new PHPExcel_Writer_Excel2007($spreadsheet); |
| 342 | 342 | $writer->save($file); |
| 343 | 343 | DocumentManager::file_send_for_download($file, true, $filename); |
| 344 | 344 | |
| 345 | - return true; |
|
| 346 | - } |
|
| 345 | + return true; |
|
| 346 | + } |
|
| 347 | 347 | } |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | $is_allowedToEdit=$is_courseAdmin; |
| 55 | 55 | |
| 56 | 56 | if (isset($_SESSION['gradebook'])){ |
| 57 | - $gradebook= $_SESSION['gradebook']; |
|
| 57 | + $gradebook= $_SESSION['gradebook']; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | if (!empty($gradebook) && $gradebook=='view') { |
| 61 | - $interbreadcrumb[]= array ( |
|
| 61 | + $interbreadcrumb[]= array ( |
|
| 62 | 62 | 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), |
| 63 | 63 | 'name' => get_lang('ToolGradebook') |
| 64 | 64 | ); |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | Display::display_header($nameTools,"Exercises"); |
| 72 | 72 | |
| 73 | 73 | if (isset($_POST['ok'])) { |
| 74 | - $message = get_lang('TestLimitsAdded'); |
|
| 75 | - Display::display_normal_message($message); |
|
| 74 | + $message = get_lang('TestLimitsAdded'); |
|
| 75 | + Display::display_normal_message($message); |
|
| 76 | 76 | } |
| 77 | 77 | ?> |
| 78 | 78 | <script type="text/javascript"> |
@@ -139,22 +139,22 @@ discard block |
||
| 139 | 139 | * @todo shouldn't this be moved to the part above (around line 111: action handling) |
| 140 | 140 | */ |
| 141 | 141 | if (isset($_POST['ok'])) { |
| 142 | - $exercise_id = intval($_POST['exe_id']); |
|
| 143 | - if ($_POST['limit']==1) { |
|
| 144 | - $minutes = intval($_POST['minutes']); |
|
| 145 | - $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id"; |
|
| 146 | - Database::query($query); |
|
| 147 | - } else { |
|
| 148 | - $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= 0 WHERE id= $exercise_id"; |
|
| 149 | - Database::query($query); |
|
| 150 | - } |
|
| 142 | + $exercise_id = intval($_POST['exe_id']); |
|
| 143 | + if ($_POST['limit']==1) { |
|
| 144 | + $minutes = intval($_POST['minutes']); |
|
| 145 | + $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id"; |
|
| 146 | + Database::query($query); |
|
| 147 | + } else { |
|
| 148 | + $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= 0 WHERE id= $exercise_id"; |
|
| 149 | + Database::query($query); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - if ($_POST['attempt']==1) { |
|
| 153 | - $attempts = intval($_POST['attempts']); |
|
| 154 | - $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id"; |
|
| 155 | - Database::query($query); |
|
| 156 | - } else { |
|
| 157 | - $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = 0 WHERE id= $exercise_id"; |
|
| 158 | - Database::query($query); |
|
| 159 | - } |
|
| 152 | + if ($_POST['attempt']==1) { |
|
| 153 | + $attempts = intval($_POST['attempts']); |
|
| 154 | + $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id"; |
|
| 155 | + Database::query($query); |
|
| 156 | + } else { |
|
| 157 | + $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = 0 WHERE id= $exercise_id"; |
|
| 158 | + Database::query($query); |
|
| 159 | + } |
|
| 160 | 160 | } |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | //user has submitted a file |
| 49 | 49 | if (isset($_FILES['user_upload'])) { |
| 50 | - $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
| 51 | - if ($upload_ok) { |
|
| 52 | - //file got on the server without problems, now process it |
|
| 50 | + $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
| 51 | + if ($upload_ok) { |
|
| 52 | + //file got on the server without problems, now process it |
|
| 53 | 53 | $new_path = handle_uploaded_document( |
| 54 | 54 | $_course, |
| 55 | 55 | $_FILES['user_upload'], |
@@ -61,21 +61,21 @@ discard block |
||
| 61 | 61 | $_POST['unzip'], |
| 62 | 62 | $_POST['if_exists'] |
| 63 | 63 | ); |
| 64 | - $new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : ''; |
|
| 65 | - $new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : ''; |
|
| 64 | + $new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : ''; |
|
| 65 | + $new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : ''; |
|
| 66 | 66 | |
| 67 | - if ($new_path && ($new_comment || $new_title)) |
|
| 68 | - if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
| 69 | - $table_document = Database::get_course_table(TABLE_DOCUMENT); |
|
| 70 | - $ct = ''; |
|
| 67 | + if ($new_path && ($new_comment || $new_title)) |
|
| 68 | + if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
| 69 | + $table_document = Database::get_course_table(TABLE_DOCUMENT); |
|
| 70 | + $ct = ''; |
|
| 71 | 71 | if ($new_comment) { |
| 72 | 72 | $ct .= ", comment='$new_comment'"; |
| 73 | 73 | } |
| 74 | 74 | if ($new_title) { |
| 75 | 75 | $ct .= ", title='$new_title'"; |
| 76 | 76 | } |
| 77 | - Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'"); |
|
| 78 | - } |
|
| 77 | + Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'"); |
|
| 78 | + } |
|
| 79 | 79 | //check for missing images in html files |
| 80 | 80 | $missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path); |
| 81 | 81 | if ($missing_files) { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | //they want to create a directory |
| 134 | 134 | if (isset($_POST['create_dir']) && $_POST['dirname']!='') { |
| 135 | 135 | $added_slash = $path == '/' ? '' : '/'; |
| 136 | - $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']); |
|
| 136 | + $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']); |
|
| 137 | 137 | $created_dir = create_unexisting_directory( |
| 138 | 138 | $_course, |
| 139 | 139 | api_get_user_id(), |
@@ -153,15 +153,15 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (isset($_GET['createdir'])) { |
| 156 | - //create the form that asks for the directory name |
|
| 157 | - $new_folder_text = '<form action="'.api_get_self().'" method="POST">'; |
|
| 158 | - $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>'; |
|
| 159 | - $new_folder_text .= get_lang('NewDir') .' '; |
|
| 160 | - $new_folder_text .= '<input type="text" name="dirname"/>'; |
|
| 161 | - $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>'; |
|
| 162 | - $new_folder_text .= '</form>'; |
|
| 163 | - //show the form |
|
| 164 | - Display::display_normal_message($new_folder_text); |
|
| 156 | + //create the form that asks for the directory name |
|
| 157 | + $new_folder_text = '<form action="'.api_get_self().'" method="POST">'; |
|
| 158 | + $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>'; |
|
| 159 | + $new_folder_text .= get_lang('NewDir') .' '; |
|
| 160 | + $new_folder_text .= '<input type="text" name="dirname"/>'; |
|
| 161 | + $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>'; |
|
| 162 | + $new_folder_text .= '</form>'; |
|
| 163 | + //show the form |
|
| 164 | + Display::display_normal_message($new_folder_text); |
|
| 165 | 165 | } else { //give them a link to create a directory |
| 166 | 166 | ?> |
| 167 | 167 | <p> |