@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | // the form |
| 74 | 74 | if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) { |
| 75 | 75 | $actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&path='.$hotpotatoes_path.' ">'. |
| 76 | - Display::return_icon('save.png', get_lang('Export'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 76 | + Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 77 | 77 | } |
| 78 | 78 | } else { |
| 79 | - $actions .= '<a href="exercise.php">' . |
|
| 80 | - Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 79 | + $actions .= '<a href="exercise.php">'. |
|
| 80 | + Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | if ($is_allowedToEdit) { |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | if ($is_allowedToEdit || $is_tutor) { |
| 101 | 101 | $nameTools = get_lang('StudentScore'); |
| 102 | - $interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises')); |
|
| 102 | + $interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); |
|
| 103 | 103 | $objExerciseTmp = new Exercise(); |
| 104 | 104 | /*if ($objExerciseTmp->read($exercise_id)) { |
| 105 | 105 | $interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$exercise_id, "name" => $objExerciseTmp->name); |
| 106 | 106 | }*/ |
| 107 | 107 | } else { |
| 108 | - $interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises')); |
|
| 108 | + $interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); |
|
| 109 | 109 | $objExerciseTmp = new Exercise(); |
| 110 | 110 | /*if ($objExerciseTmp->read($exercise_id)) { |
| 111 | 111 | $nameTools = get_lang('Results').': '.$objExerciseTmp->name; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | $actions = Display::div($actions, array('class'=> 'actions')); |
| 118 | 118 | |
| 119 | -$extra = '<script type="text/javascript"> |
|
| 119 | +$extra = '<script type="text/javascript"> |
|
| 120 | 120 | $(document).ready(function() { |
| 121 | 121 | |
| 122 | 122 | $( "#dialog:ui-dialog" ).dialog( "destroy" ); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | // Generating group list |
| 171 | 171 | |
| 172 | 172 | $group_list = GroupManager::get_group_list(); |
| 173 | -$group_parameters = array('group_all:'.get_lang('All'),'group_none:'.get_lang('None')); |
|
| 173 | +$group_parameters = array('group_all:'.get_lang('All'), 'group_none:'.get_lang('None')); |
|
| 174 | 174 | |
| 175 | 175 | foreach ($group_list as $group) { |
| 176 | 176 | $group_parameters[] = $group['id'].':'.$group['name']; |
@@ -193,14 +193,14 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | // Column config |
| 195 | 195 | // @todo fix search firstname/lastname that doesn't work. rmove search for the moment |
| 196 | - $column_model = array( |
|
| 197 | - array('name'=>'firstname', 'index'=>'firstname', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
| 198 | - array('name'=>'lastname', 'index'=>'lastname', 'width'=>'50', 'align'=>'left', 'formatter'=>'action_formatter', 'search' => 'false'), |
|
| 199 | - array('name'=>'login', 'hidden'=>'true', 'index'=>'username', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
| 200 | - array('name'=>'group_name', 'index'=>'group_id', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
| 201 | - array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'), |
|
| 202 | - array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
| 203 | - array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false') |
|
| 196 | + $column_model = array( |
|
| 197 | + array('name'=>'firstname', 'index'=>'firstname', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
| 198 | + array('name'=>'lastname', 'index'=>'lastname', 'width'=>'50', 'align'=>'left', 'formatter'=>'action_formatter', 'search' => 'false'), |
|
| 199 | + array('name'=>'login', 'hidden'=>'true', 'index'=>'username', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
| 200 | + array('name'=>'group_name', 'index'=>'group_id', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
| 201 | + array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'), |
|
| 202 | + array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
| 203 | + array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false') |
|
| 204 | 204 | ); |
| 205 | 205 | |
| 206 | 206 | $action_links = ' |
@@ -223,10 +223,10 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | //Column config |
| 225 | 225 | // @todo fix search firstname/lastname that doesn't work. rmove search for the moment |
| 226 | - $column_model = array( |
|
| 227 | - array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'), |
|
| 228 | - array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
| 229 | - array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false') |
|
| 226 | + $column_model = array( |
|
| 227 | + array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'), |
|
| 228 | + array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
| 229 | + array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false') |
|
| 230 | 230 | ); |
| 231 | 231 | } |
| 232 | 232 | |
@@ -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 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param FormValidator $form |
| 33 | 33 | * @param int $fck_config |
| 34 | 34 | */ |
| 35 | - public function createForm (&$form, $fck_config=0) |
|
| 35 | + public function createForm(&$form, $fck_config = 0) |
|
| 36 | 36 | { |
| 37 | 37 | parent::createForm($form, $fck_config); |
| 38 | 38 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | // Saving a question |
| 51 | 51 | $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
| 52 | 52 | //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
| 53 | - $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
| 53 | + $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array('jpg', 'jpeg', 'png', 'gif')); |
|
| 54 | 54 | $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
| 55 | 55 | } else { |
| 56 | 56 | // setting the save button here and not in the question class.php |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $_course = api_get_course_info(); |
| 71 | 71 | parent::processCreation($form, $objExercise); |
| 72 | 72 | |
| 73 | - if(!empty($file_info['tmp_name'])) { |
|
| 73 | + if (!empty($file_info['tmp_name'])) { |
|
| 74 | 74 | $this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
| 75 | 75 | $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
| 76 | 76 | $picturePath = $documentPath.'/images'; |
@@ -111,25 +111,25 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - function createForm (&$form, $fck_config=0) |
|
| 114 | + function createForm(&$form, $fck_config = 0) |
|
| 115 | 115 | { |
| 116 | - parent::createForm ($form, $fck_config); |
|
| 116 | + parent::createForm($form, $fck_config); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - function processCreation ($form, $objExercise = null) |
|
| 119 | + function processCreation($form, $objExercise = null) |
|
| 120 | 120 | { |
| 121 | 121 | $file_info = $form -> getSubmitValue('imageUpload'); |
| 122 | - parent::processCreation ($form, $objExercise); |
|
| 122 | + parent::processCreation($form, $objExercise); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - function createAnswersForm ($form) |
|
| 125 | + function createAnswersForm($form) |
|
| 126 | 126 | { |
| 127 | - parent::createAnswersForm ($form); |
|
| 127 | + parent::createAnswersForm($form); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - function processAnswersCreation ($form) |
|
| 130 | + function processAnswersCreation($form) |
|
| 131 | 131 | { |
| 132 | - parent::processAnswersCreation ($form); |
|
| 132 | + parent::processAnswersCreation($form); |
|
| 133 | 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 | } |
@@ -24,13 +24,13 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $return = array(); |
| 26 | 26 | $TBL_USER = Database::get_main_table(TABLE_MAIN_USER); |
| 27 | - $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
|
| 27 | + $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
|
| 28 | 28 | |
| 29 | 29 | $cid = api_get_course_id(); |
| 30 | 30 | $course_id = api_get_course_int_id(); |
| 31 | 31 | //$user_id = intval($user_id); |
| 32 | 32 | $user_id = null; |
| 33 | - $session_id_and = ' AND te.session_id = ' . api_get_session_id() . ' '; |
|
| 33 | + $session_id_and = ' AND te.session_id = '.api_get_session_id().' '; |
|
| 34 | 34 | $hotpotato_name = Database::escape_string($hotpotato_name); |
| 35 | 35 | |
| 36 | 36 | if (!empty($exercise_id)) { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | if (empty($user_id)) { |
| 41 | - $sql="SELECT firstname as userpart1, lastname as userpart2 , |
|
| 41 | + $sql = "SELECT firstname as userpart1, lastname as userpart2 , |
|
| 42 | 42 | email, |
| 43 | 43 | tth.exe_name, |
| 44 | 44 | tth.exe_result, |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | tth.exe_name = '$hotpotato_name' |
| 51 | 51 | ORDER BY tth.c_id ASC, tth.exe_date ASC"; |
| 52 | 52 | } else { |
| 53 | - $user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' '; |
|
| 53 | + $user_id_and = ' AND te.exe_user_id = '.api_get_user_id().' '; |
|
| 54 | 54 | // get only this user's results |
| 55 | 55 | |
| 56 | 56 | $sql = "SELECT '', exe_name, exe_result , exe_weighting, exe_date |
| 57 | 57 | FROM $TBL_TRACK_HOTPOTATOES |
| 58 | 58 | WHERE |
| 59 | - exe_user_id = '" . $user_id . "' AND |
|
| 59 | + exe_user_id = '".$user_id."' AND |
|
| 60 | 60 | c_id = $course_id AND |
| 61 | 61 | tth.exe_name = '$hotpotato_name' |
| 62 | 62 | ORDER BY c_id ASC, exe_date ASC"; |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | $results = array(); |
| 66 | 66 | |
| 67 | 67 | $resx = Database::query($sql); |
| 68 | - while ($rowx = Database::fetch_array($resx,'ASSOC')) { |
|
| 68 | + while ($rowx = Database::fetch_array($resx, 'ASSOC')) { |
|
| 69 | 69 | $results[] = $rowx; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $hpresults = array(); |
| 73 | 73 | $resx = Database::query($sql); |
| 74 | - while ($rowx = Database::fetch_array($resx,'ASSOC')) { |
|
| 74 | + while ($rowx = Database::fetch_array($resx, 'ASSOC')) { |
|
| 75 | 75 | $hpresults[] = $rowx; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -90,19 +90,19 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | // Print the Result of Hotpotatoes Tests |
| 92 | 92 | if (is_array($hpresults)) { |
| 93 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 93 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 94 | 94 | $return[$i] = array(); |
| 95 | 95 | $title = GetQuizName($hpresults[$i]['exe_name'], $document_path); |
| 96 | - if ($title =='') { |
|
| 96 | + if ($title == '') { |
|
| 97 | 97 | $title = basename($hpresults[$i]['exe_name']); |
| 98 | 98 | } |
| 99 | - if(empty($user_id)) { |
|
| 99 | + if (empty($user_id)) { |
|
| 100 | 100 | $return[$i]['email'] = $hpresults[$i]['email']; |
| 101 | 101 | $return[$i]['first_name'] = $hpresults[$i]['userpart1']; |
| 102 | 102 | $return[$i]['last_name'] = $hpresults[$i]['userpart2']; |
| 103 | 103 | } |
| 104 | 104 | $return[$i]['title'] = $title; |
| 105 | - $return[$i]['exe_date'] = $hpresults[$i]['exe_date']; |
|
| 105 | + $return[$i]['exe_date'] = $hpresults[$i]['exe_date']; |
|
| 106 | 106 | |
| 107 | 107 | $return[$i]['result'] = $hpresults[$i]['exe_result']; |
| 108 | 108 | $return[$i]['max'] = $hpresults[$i]['exe_weighting']; |
@@ -132,17 +132,17 @@ discard block |
||
| 132 | 132 | $data = ''; |
| 133 | 133 | |
| 134 | 134 | if (api_is_western_name_order()) { |
| 135 | - if(!empty($this->results[0]['first_name'])) { |
|
| 135 | + if (!empty($this->results[0]['first_name'])) { |
|
| 136 | 136 | $data .= get_lang('FirstName').';'; |
| 137 | 137 | } |
| 138 | - if(!empty($this->results[0]['last_name'])) { |
|
| 138 | + if (!empty($this->results[0]['last_name'])) { |
|
| 139 | 139 | $data .= get_lang('LastName').';'; |
| 140 | 140 | } |
| 141 | 141 | } else { |
| 142 | - if(!empty($this->results[0]['last_name'])) { |
|
| 142 | + if (!empty($this->results[0]['last_name'])) { |
|
| 143 | 143 | $data .= get_lang('LastName').';'; |
| 144 | 144 | } |
| 145 | - if(!empty($this->results[0]['first_name'])) { |
|
| 145 | + if (!empty($this->results[0]['first_name'])) { |
|
| 146 | 146 | $data .= get_lang('FirstName').';'; |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -164,16 +164,16 @@ discard block |
||
| 164 | 164 | $data .= "\n"; |
| 165 | 165 | |
| 166 | 166 | //results |
| 167 | - foreach($this->results as $row) { |
|
| 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 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
|
| 176 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
|
| 177 | 177 | |
| 178 | 178 | /*if ($export_user_fields) { |
| 179 | 179 | //show user fields data, if any, for this user |
@@ -183,10 +183,10 @@ 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']).';'; |
|
| 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 | 190 | $data .= "\n"; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | header('Content-Description: '.$filename); |
| 209 | 209 | header('Content-transfer-encoding: binary'); |
| 210 | 210 | // @todo add this utf-8 header for all csv files |
| 211 | - echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
| 211 | + echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
| 212 | 212 | echo $data; |
| 213 | 213 | return true; |
| 214 | 214 | } |
@@ -250,25 +250,25 @@ discard block |
||
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | if ($with_column_user) { |
| 253 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
| 253 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Email')); |
|
| 254 | 254 | $column++; |
| 255 | 255 | |
| 256 | 256 | if (api_is_western_name_order()) { |
| 257 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
| 257 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName')); |
|
| 258 | 258 | $column++; |
| 259 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName')); |
|
| 259 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName')); |
|
| 260 | 260 | $column++; |
| 261 | 261 | } else { |
| 262 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName')); |
|
| 262 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName')); |
|
| 263 | 263 | $column++; |
| 264 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
| 264 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName')); |
|
| 265 | 265 | $column++; |
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | if ($export_user_fields) { |
| 270 | 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); |
|
| 271 | + $extra_user_fields = UserManager::get_extra_fields(0, 1000, 5, 'ASC', false, 1); |
|
| 272 | 272 | |
| 273 | 273 | //show the fields names for user fields |
| 274 | 274 | foreach ($extra_user_fields as $field) { |
@@ -277,63 +277,63 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
| 280 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Title')); |
|
| 281 | 281 | $column++; |
| 282 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
| 282 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('StartDate')); |
|
| 283 | 283 | $column++; |
| 284 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('EndDate')); |
|
| 284 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('EndDate')); |
|
| 285 | 285 | $column++; |
| 286 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
|
| 286 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
|
| 287 | 287 | $column++; |
| 288 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
| 288 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Score')); |
|
| 289 | 289 | $column++; |
| 290 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
| 290 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Total')); |
|
| 291 | 291 | $column++; |
| 292 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Status')); |
|
| 292 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Status')); |
|
| 293 | 293 | $line++; |
| 294 | 294 | |
| 295 | 295 | foreach ($this->results as $row) { |
| 296 | 296 | $column = 0; |
| 297 | 297 | |
| 298 | 298 | if ($with_column_user) { |
| 299 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
|
| 299 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
|
| 300 | 300 | $column++; |
| 301 | 301 | |
| 302 | 302 | if (api_is_western_name_order()) { |
| 303 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
| 303 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
| 304 | 304 | $column++; |
| 305 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
| 305 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
| 306 | 306 | $column++; |
| 307 | 307 | } else { |
| 308 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
| 308 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
| 309 | 309 | $column++; |
| 310 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
| 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 | 315 | if ($export_user_fields) { |
| 316 | 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)); |
|
| 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 | 320 | $column++; |
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
| 324 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
| 325 | 325 | $column++; |
| 326 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']); |
|
| 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 | 329 | $column++; |
| 330 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
| 330 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['duration']); |
|
| 331 | 331 | $column++; |
| 332 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
| 332 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['result']); |
|
| 333 | 333 | $column++; |
| 334 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
| 334 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['max']); |
|
| 335 | 335 | $column++; |
| 336 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['status']); |
|
| 336 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['status']); |
|
| 337 | 337 | $line++; |
| 338 | 338 | } |
| 339 | 339 | |
@@ -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 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | $newName = !empty($_REQUEST['newName']) ? $_REQUEST['newName'] : ''; |
| 23 | 23 | $hotpotatoesName = !empty($_REQUEST['hotpotatoesName']) ? Security::remove_XSS($_REQUEST['hotpotatoesName']) : ''; |
| 24 | -$is_allowedToEdit = api_is_allowed_to_edit(null,true); |
|
| 24 | +$is_allowedToEdit = api_is_allowed_to_edit(null, true); |
|
| 25 | 25 | |
| 26 | 26 | // document path |
| 27 | 27 | $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | if (isset($_SESSION['gradebook'])) { |
| 41 | - $gradebook = $_SESSION['gradebook']; |
|
| 41 | + $gradebook = $_SESSION['gradebook']; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (!empty($gradebook) && $gradebook == 'view') { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); |
| 52 | 52 | $nameTools = get_lang('adminHP'); |
| 53 | 53 | |
| 54 | -Display::display_header($nameTools,"Exercise"); |
|
| 54 | +Display::display_header($nameTools, "Exercise"); |
|
| 55 | 55 | |
| 56 | 56 | /** @todo probably wrong !!!! */ |
| 57 | 57 | require_once api_get_path(SYS_CODE_PATH).'/exercice/hotpotatoes.lib.php'; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | <?php |
| 65 | 65 | if (isset($newName)) { |
| 66 | - if ($newName!="") { |
|
| 66 | + if ($newName != "") { |
|
| 67 | 67 | //alter database record for that test |
| 68 | 68 | SetComment($hotpotatoesName, $newName); |
| 69 | 69 | echo "<script language='Javascript' type='text/javascript'> window.location='exercise.php'; </script>"; |
@@ -679,12 +679,15 @@ discard block |
||
| 679 | 679 | $option1 = $option2 = $option3 = ''; |
| 680 | 680 | for ($k = 1; $k <= 100; $k++) { |
| 681 | 681 | $selected1 = $selected2 = $selected3 = ''; |
| 682 | - if ($k == $threadhold1[$i]) |
|
| 683 | - $selected1 = 'selected="selected"'; |
|
| 684 | - if ($k == $threadhold2[$i]) |
|
| 685 | - $selected2 = 'selected="selected"'; |
|
| 686 | - if ($k == $threadhold3[$i]) |
|
| 687 | - $selected3 = 'selected="selected"'; |
|
| 682 | + if ($k == $threadhold1[$i]) { |
|
| 683 | + $selected1 = 'selected="selected"'; |
|
| 684 | + } |
|
| 685 | + if ($k == $threadhold2[$i]) { |
|
| 686 | + $selected2 = 'selected="selected"'; |
|
| 687 | + } |
|
| 688 | + if ($k == $threadhold3[$i]) { |
|
| 689 | + $selected3 = 'selected="selected"'; |
|
| 690 | + } |
|
| 688 | 691 | $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>'; |
| 689 | 692 | $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>'; |
| 690 | 693 | $option3.='<option ' . $selected3 . '>' . $k . ' %</option>'; |
@@ -731,7 +734,10 @@ discard block |
||
| 731 | 734 | <div class="checkbox"> |
| 732 | 735 | <p> |
| 733 | 736 | <label> |
| 734 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
| 737 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) { |
|
| 738 | + echo'checked'; |
|
| 739 | +} |
|
| 740 | +?> /> |
|
| 735 | 741 | <?php echo get_lang('TryAgain'); ?> |
| 736 | 742 | </label> |
| 737 | 743 | </p> |
@@ -784,7 +790,10 @@ discard block |
||
| 784 | 790 | <div class="checkbox"> |
| 785 | 791 | <p> |
| 786 | 792 | <label> |
| 787 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
| 793 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) { |
|
| 794 | + echo'checked'; |
|
| 795 | +} |
|
| 796 | +?> /> |
|
| 788 | 797 | <?php echo get_lang('TryAgain'); ?> |
| 789 | 798 | </label> |
| 790 | 799 | </p> |
@@ -823,7 +832,10 @@ discard block |
||
| 823 | 832 | <th ><?php echo get_lang('OAR'); ?>*</th> |
| 824 | 833 | <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?> |
| 825 | 834 | <th colspan="2" ><?php echo get_lang('Comment'); ?></th> |
| 826 | - <th ><?php if ($answerType == HOT_SPOT_DELINEATION) echo get_lang('Scenario'); ?></th> |
|
| 835 | + <th ><?php if ($answerType == HOT_SPOT_DELINEATION) { |
|
| 836 | + echo get_lang('Scenario'); |
|
| 837 | +} |
|
| 838 | +?></th> |
|
| 827 | 839 | <?php } else { ?> |
| 828 | 840 | <th colspan="3" ><?php echo get_lang('Comment'); ?></th> |
| 829 | 841 | <?php } ?> |
@@ -849,7 +861,10 @@ discard block |
||
| 849 | 861 | <div class="checkbox"> |
| 850 | 862 | <p> |
| 851 | 863 | <label> |
| 852 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> /> |
|
| 864 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) { |
|
| 865 | + echo'checked'; |
|
| 866 | +} |
|
| 867 | +?> /> |
|
| 853 | 868 | <?php echo get_lang('TryAgain'); ?> |
| 854 | 869 | </label> |
| 855 | 870 | </p> |
@@ -998,7 +1013,10 @@ discard block |
||
| 998 | 1013 | <div class="checkbox"> |
| 999 | 1014 | <p> |
| 1000 | 1015 | <label> |
| 1001 | - <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) echo'checked'; ?> /> |
|
| 1016 | + <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) { |
|
| 1017 | + echo'checked'; |
|
| 1018 | +} |
|
| 1019 | +?> /> |
|
| 1002 | 1020 | <?php echo get_lang('TryAgain'); ?> |
| 1003 | 1021 | </label> |
| 1004 | 1022 | </p> |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | $name_no_ext = substr($name, 0, strlen($name) - strlen(strstr($name, $ext))); |
| 64 | 64 | $n = 0; |
| 65 | 65 | $unique = ''; |
| 66 | - while (file_exists($path . $name_no_ext . $unique . $ext)) { |
|
| 67 | - $unique = '_' . ++$n; |
|
| 66 | + while (file_exists($path.$name_no_ext.$unique.$ext)) { |
|
| 67 | + $unique = '_'.++$n; |
|
| 68 | 68 | } |
| 69 | - return $name_no_ext . $unique . $ext; |
|
| 69 | + return $name_no_ext.$unique.$ext; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | // Not used at the moment, but could be handy if we want to limit the size of an upload (e.g. image upload in html editor). |
| 106 | 106 | $max_file_size = intval($_POST['MAX_FILE_SIZE']); |
| 107 | 107 | if ($show_output) { |
| 108 | - Display::display_error_message(get_lang('UplExceedMaxPostSize'). format_file_size($max_file_size)); |
|
| 108 | + Display::display_error_message(get_lang('UplExceedMaxPostSize').format_file_size($max_file_size)); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | return false; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | case 4: |
| 120 | 120 | // No file was uploaded. |
| 121 | 121 | if ($show_output) { |
| 122 | - Display::display_error_message(get_lang('UplNoFileUploaded').' '. get_lang('UplSelectFileFirst')); |
|
| 122 | + Display::display_error_message(get_lang('UplNoFileUploaded').' '.get_lang('UplSelectFileFirst')); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return false; |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | // Display success message with extra info to user |
| 460 | 460 | if ($output) { |
| 461 | 461 | Display::display_confirmation_message( |
| 462 | - get_lang('UplUploadSucceeded') . '<br /> ' . $documentTitle . ' ' . get_lang('UplFileOverwritten'), |
|
| 462 | + get_lang('UplUploadSucceeded').'<br /> '.$documentTitle.' '.get_lang('UplFileOverwritten'), |
|
| 463 | 463 | false |
| 464 | 464 | ); |
| 465 | 465 | } |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | // Display success message to user |
| 584 | 584 | if ($output) { |
| 585 | 585 | Display::display_confirmation_message( |
| 586 | - get_lang('UplUploadSucceeded') . '<br />' . get_lang('UplFileSavedAs') .' '.$documentTitle, |
|
| 586 | + get_lang('UplUploadSucceeded').'<br />'.get_lang('UplFileSavedAs').' '.$documentTitle, |
|
| 587 | 587 | false |
| 588 | 588 | ); |
| 589 | 589 | } |
@@ -730,12 +730,12 @@ discard block |
||
| 730 | 730 | function dir_total_space($dir_path) |
| 731 | 731 | { |
| 732 | 732 | $save_dir = getcwd(); |
| 733 | - chdir($dir_path) ; |
|
| 733 | + chdir($dir_path); |
|
| 734 | 734 | $handle = opendir($dir_path); |
| 735 | 735 | $sumSize = 0; |
| 736 | 736 | $dirList = array(); |
| 737 | 737 | while ($element = readdir($handle)) { |
| 738 | - if ( $element == '.' || $element == '..') { |
|
| 738 | + if ($element == '.' || $element == '..') { |
|
| 739 | 739 | continue; // Skip the current and parent directories |
| 740 | 740 | } |
| 741 | 741 | if (is_file($element)) { |
@@ -746,11 +746,11 @@ discard block |
||
| 746 | 746 | } |
| 747 | 747 | } |
| 748 | 748 | |
| 749 | - closedir($handle) ; |
|
| 749 | + closedir($handle); |
|
| 750 | 750 | |
| 751 | 751 | if (sizeof($dirList) > 0) { |
| 752 | 752 | foreach ($dirList as $j) { |
| 753 | - $sizeDir = dir_total_space($j); // Recursivity |
|
| 753 | + $sizeDir = dir_total_space($j); // Recursivity |
|
| 754 | 754 | $sumSize += $sizeDir; |
| 755 | 755 | } |
| 756 | 756 | } |
@@ -784,63 +784,63 @@ discard block |
||
| 784 | 784 | |
| 785 | 785 | static $mime_type = array(); |
| 786 | 786 | |
| 787 | - $mime_type[] = 'application/msword'; $extension[] = '.doc'; |
|
| 788 | - $mime_type[] = 'application/rtf'; $extension[] = '.rtf'; |
|
| 789 | - $mime_type[] = 'application/vnd.ms-powerpoint'; $extension[] = '.ppt'; |
|
| 790 | - $mime_type[] = 'application/vnd.ms-excel'; $extension[] = '.xls'; |
|
| 791 | - $mime_type[] = 'application/pdf'; $extension[] = '.pdf'; |
|
| 792 | - $mime_type[] = 'application/postscript'; $extension[] = '.ps'; |
|
| 793 | - $mime_type[] = 'application/mac-binhex40'; $extension[] = '.hqx'; |
|
| 794 | - $mime_type[] = 'application/x-gzip'; $extension[] = 'tar.gz'; |
|
| 795 | - $mime_type[] = 'application/x-shockwave-flash'; $extension[] = '.swf'; |
|
| 796 | - $mime_type[] = 'application/x-stuffit'; $extension[] = '.sit'; |
|
| 797 | - $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
| 798 | - $mime_type[] = 'application/zip'; $extension[] = '.zip'; |
|
| 799 | - $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
| 800 | - $mime_type[] = 'text/html'; $extension[] = '.html'; |
|
| 801 | - $mime_type[] = 'text/plain'; $extension[] = '.txt'; |
|
| 802 | - $mime_type[] = 'text/rtf'; $extension[] = '.rtf'; |
|
| 803 | - $mime_type[] = 'img/gif'; $extension[] = '.gif'; |
|
| 804 | - $mime_type[] = 'img/jpeg'; $extension[] = '.jpg'; |
|
| 805 | - $mime_type[] = 'img/png'; $extension[] = '.png'; |
|
| 806 | - $mime_type[] = 'audio/midi'; $extension[] = '.mid'; |
|
| 807 | - $mime_type[] = 'audio/mpeg'; $extension[] = '.mp3'; |
|
| 808 | - $mime_type[] = 'audio/x-aiff'; $extension[] = '.aif'; |
|
| 809 | - $mime_type[] = 'audio/x-pn-realaudio'; $extension[] = '.rm'; |
|
| 810 | - $mime_type[] = 'audio/x-pn-realaudio-plugin'; $extension[] = '.rpm'; |
|
| 811 | - $mime_type[] = 'audio/x-wav'; $extension[] = '.wav'; |
|
| 812 | - $mime_type[] = 'video/mpeg'; $extension[] = '.mpg'; |
|
| 813 | - $mime_type[] = 'video/mpeg4-generic'; $extension[] = '.mp4'; |
|
| 814 | - $mime_type[] = 'video/quicktime'; $extension[] = '.mov'; |
|
| 815 | - $mime_type[] = 'video/x-msvideo'; $extension[] = '.avi'; |
|
| 816 | - |
|
| 817 | - $mime_type[] = 'video/x-ms-wmv'; $extension[] = '.wmv'; |
|
| 818 | - $mime_type[] = 'video/x-flv'; $extension[] = '.flv'; |
|
| 819 | - $mime_type[] = 'image/svg+xml'; $extension[] = '.svg'; |
|
| 820 | - $mime_type[] = 'image/svg+xml'; $extension[] = '.svgz'; |
|
| 821 | - $mime_type[] = 'video/ogg'; $extension[] = '.ogv'; |
|
| 822 | - $mime_type[] = 'audio/ogg'; $extension[] = '.oga'; |
|
| 823 | - $mime_type[] = 'application/ogg'; $extension[] = '.ogg'; |
|
| 824 | - $mime_type[] = 'application/ogg'; $extension[] = '.ogx'; |
|
| 825 | - $mime_type[] = 'application/x-freemind'; $extension[] = '.mm'; |
|
| 826 | - |
|
| 827 | - $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12'; $extension[] = '.docm'; |
|
| 828 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $extension[] = '.docx'; |
|
| 829 | - $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12'; $extension[] = '.dotm'; |
|
| 830 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; $extension[] = '.dotx'; |
|
| 831 | - $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; $extension[] = '.potm'; |
|
| 832 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; $extension[] = '.potx'; |
|
| 833 | - $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; $extension[] = '.ppam'; |
|
| 834 | - $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; $extension[] = '.ppsm'; |
|
| 835 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; $extension[] = '.ppsx'; |
|
| 836 | - $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; $extension[] = '.pptm'; |
|
| 837 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; $extension[] = '.pptx'; |
|
| 838 | - $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12'; $extension[] = '.xlam'; |
|
| 839 | - $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; $extension[] = '.xlsb'; |
|
| 840 | - $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12'; $extension[] = '.xlsm'; |
|
| 841 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $extension[] = '.xlsx'; |
|
| 842 | - $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12'; $extension[] = '.xltm'; |
|
| 843 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; $extension[] = '.xltx'; |
|
| 787 | + $mime_type[] = 'application/msword'; $extension[] = '.doc'; |
|
| 788 | + $mime_type[] = 'application/rtf'; $extension[] = '.rtf'; |
|
| 789 | + $mime_type[] = 'application/vnd.ms-powerpoint'; $extension[] = '.ppt'; |
|
| 790 | + $mime_type[] = 'application/vnd.ms-excel'; $extension[] = '.xls'; |
|
| 791 | + $mime_type[] = 'application/pdf'; $extension[] = '.pdf'; |
|
| 792 | + $mime_type[] = 'application/postscript'; $extension[] = '.ps'; |
|
| 793 | + $mime_type[] = 'application/mac-binhex40'; $extension[] = '.hqx'; |
|
| 794 | + $mime_type[] = 'application/x-gzip'; $extension[] = 'tar.gz'; |
|
| 795 | + $mime_type[] = 'application/x-shockwave-flash'; $extension[] = '.swf'; |
|
| 796 | + $mime_type[] = 'application/x-stuffit'; $extension[] = '.sit'; |
|
| 797 | + $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
| 798 | + $mime_type[] = 'application/zip'; $extension[] = '.zip'; |
|
| 799 | + $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
| 800 | + $mime_type[] = 'text/html'; $extension[] = '.html'; |
|
| 801 | + $mime_type[] = 'text/plain'; $extension[] = '.txt'; |
|
| 802 | + $mime_type[] = 'text/rtf'; $extension[] = '.rtf'; |
|
| 803 | + $mime_type[] = 'img/gif'; $extension[] = '.gif'; |
|
| 804 | + $mime_type[] = 'img/jpeg'; $extension[] = '.jpg'; |
|
| 805 | + $mime_type[] = 'img/png'; $extension[] = '.png'; |
|
| 806 | + $mime_type[] = 'audio/midi'; $extension[] = '.mid'; |
|
| 807 | + $mime_type[] = 'audio/mpeg'; $extension[] = '.mp3'; |
|
| 808 | + $mime_type[] = 'audio/x-aiff'; $extension[] = '.aif'; |
|
| 809 | + $mime_type[] = 'audio/x-pn-realaudio'; $extension[] = '.rm'; |
|
| 810 | + $mime_type[] = 'audio/x-pn-realaudio-plugin'; $extension[] = '.rpm'; |
|
| 811 | + $mime_type[] = 'audio/x-wav'; $extension[] = '.wav'; |
|
| 812 | + $mime_type[] = 'video/mpeg'; $extension[] = '.mpg'; |
|
| 813 | + $mime_type[] = 'video/mpeg4-generic'; $extension[] = '.mp4'; |
|
| 814 | + $mime_type[] = 'video/quicktime'; $extension[] = '.mov'; |
|
| 815 | + $mime_type[] = 'video/x-msvideo'; $extension[] = '.avi'; |
|
| 816 | + |
|
| 817 | + $mime_type[] = 'video/x-ms-wmv'; $extension[] = '.wmv'; |
|
| 818 | + $mime_type[] = 'video/x-flv'; $extension[] = '.flv'; |
|
| 819 | + $mime_type[] = 'image/svg+xml'; $extension[] = '.svg'; |
|
| 820 | + $mime_type[] = 'image/svg+xml'; $extension[] = '.svgz'; |
|
| 821 | + $mime_type[] = 'video/ogg'; $extension[] = '.ogv'; |
|
| 822 | + $mime_type[] = 'audio/ogg'; $extension[] = '.oga'; |
|
| 823 | + $mime_type[] = 'application/ogg'; $extension[] = '.ogg'; |
|
| 824 | + $mime_type[] = 'application/ogg'; $extension[] = '.ogx'; |
|
| 825 | + $mime_type[] = 'application/x-freemind'; $extension[] = '.mm'; |
|
| 826 | + |
|
| 827 | + $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12'; $extension[] = '.docm'; |
|
| 828 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $extension[] = '.docx'; |
|
| 829 | + $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12'; $extension[] = '.dotm'; |
|
| 830 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; $extension[] = '.dotx'; |
|
| 831 | + $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; $extension[] = '.potm'; |
|
| 832 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; $extension[] = '.potx'; |
|
| 833 | + $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; $extension[] = '.ppam'; |
|
| 834 | + $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; $extension[] = '.ppsm'; |
|
| 835 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; $extension[] = '.ppsx'; |
|
| 836 | + $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; $extension[] = '.pptm'; |
|
| 837 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; $extension[] = '.pptx'; |
|
| 838 | + $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12'; $extension[] = '.xlam'; |
|
| 839 | + $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; $extension[] = '.xlsb'; |
|
| 840 | + $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12'; $extension[] = '.xlsm'; |
|
| 841 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $extension[] = '.xlsx'; |
|
| 842 | + $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12'; $extension[] = '.xltm'; |
|
| 843 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; $extension[] = '.xltx'; |
|
| 844 | 844 | |
| 845 | 845 | // Test on PC (files with no extension get application/octet-stream) |
| 846 | 846 | //$mime_type[] = 'application/octet-stream'; $extension[] = '.ext'; |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | |
| 850 | 850 | foreach ($mime_type as $key => & $type) { |
| 851 | 851 | if ($type == $file_type) { |
| 852 | - $file_name .= $extension[$key]; |
|
| 852 | + $file_name .= $extension[$key]; |
|
| 853 | 853 | break; |
| 854 | 854 | } |
| 855 | 855 | } |
@@ -957,12 +957,12 @@ discard block |
||
| 957 | 957 | } |
| 958 | 958 | |
| 959 | 959 | // It happens on Linux that $upload_path sometimes doesn't start with '/' |
| 960 | - if ($upload_path[0] != '/' && substr($base_work_dir,-1,1) != '/') { |
|
| 960 | + if ($upload_path[0] != '/' && substr($base_work_dir, -1, 1) != '/') { |
|
| 961 | 961 | $upload_path = '/'.$upload_path; |
| 962 | 962 | } |
| 963 | 963 | |
| 964 | 964 | if ($upload_path[strlen($upload_path) - 1] == '/') { |
| 965 | - $upload_path=substr($upload_path, 0, -1); |
|
| 965 | + $upload_path = substr($upload_path, 0, -1); |
|
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | /* Uncompressing phase */ |
@@ -974,15 +974,15 @@ discard block |
||
| 974 | 974 | - add it to the database |
| 975 | 975 | - parse & change relative html links |
| 976 | 976 | */ |
| 977 | - if (PHP_OS == 'Linux' && ! get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC *** |
|
| 977 | + if (PHP_OS == 'Linux' && !get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC *** |
|
| 978 | 978 | // Shell Method - if this is possible, it gains some speed |
| 979 | - exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." " .$uploaded_file['tmp_name']); |
|
| 979 | + exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." ".$uploaded_file['tmp_name']); |
|
| 980 | 980 | } else { |
| 981 | 981 | // PHP method - slower... |
| 982 | 982 | $save_dir = getcwd(); |
| 983 | 983 | chdir($base_work_dir.$upload_path); |
| 984 | 984 | $unzippingState = $zip_file->extract(); |
| 985 | - for ($j=0; $j < count($unzippingState); $j++) { |
|
| 985 | + for ($j = 0; $j < count($unzippingState); $j++) { |
|
| 986 | 986 | $state = $unzippingState[$j]; |
| 987 | 987 | |
| 988 | 988 | // Fix relative links in html files |
@@ -996,8 +996,8 @@ discard block |
||
| 996 | 996 | if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder'; |
| 997 | 997 | |
| 998 | 998 | $safe_file = api_replace_dangerous_char($file, 'strict'); |
| 999 | - @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file); |
|
| 1000 | - set_default_settings($upload_path, $safe_file,$filetype); |
|
| 999 | + @rename($base_work_dir.$upload_path.'/'.$file, $base_work_dir.$upload_path.'/'.$safe_file); |
|
| 1000 | + set_default_settings($upload_path, $safe_file, $filetype); |
|
| 1001 | 1001 | } |
| 1002 | 1002 | } |
| 1003 | 1003 | |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | $zip = new PclZip($uploaded_file['tmp_name']); |
| 1048 | 1048 | |
| 1049 | 1049 | // Check the zip content (real size and file extension) |
| 1050 | - $zip_content_array = (array)$zip->listContent(); |
|
| 1050 | + $zip_content_array = (array) $zip->listContent(); |
|
| 1051 | 1051 | |
| 1052 | 1052 | $realSize = 0; |
| 1053 | 1053 | foreach ($zip_content_array as & $this_content) { |
@@ -1143,7 +1143,7 @@ discard block |
||
| 1143 | 1143 | function filter_extension(&$filename) |
| 1144 | 1144 | { |
| 1145 | 1145 | if (substr($filename, -1) == '/') { |
| 1146 | - return 1; // Authorize directories |
|
| 1146 | + return 1; // Authorize directories |
|
| 1147 | 1147 | } |
| 1148 | 1148 | $blacklist = api_get_setting('upload_extensions_list_type'); |
| 1149 | 1149 | if ($blacklist != 'whitelist') { // if = blacklist |
@@ -1369,9 +1369,9 @@ discard block |
||
| 1369 | 1369 | $upload_path = str_replace('//', '/', $upload_path); |
| 1370 | 1370 | |
| 1371 | 1371 | if ($upload_path == '/') { |
| 1372 | - $upload_path=''; |
|
| 1372 | + $upload_path = ''; |
|
| 1373 | 1373 | } elseif (!empty($upload_path) && $upload_path[0] != '/') { |
| 1374 | - $upload_path="/$upload_path"; |
|
| 1374 | + $upload_path = "/$upload_path"; |
|
| 1375 | 1375 | } |
| 1376 | 1376 | |
| 1377 | 1377 | $endchar = substr($filename, strlen($filename) - 1, 1); |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | $img_path_list = array(); |
| 1410 | 1410 | |
| 1411 | 1411 | if (!$fp = fopen($html_file, 'r')) { |
| 1412 | - return ; |
|
| 1412 | + return; |
|
| 1413 | 1413 | } |
| 1414 | 1414 | |
| 1415 | 1415 | // Aearch and store occurences of the <img> tag in an array |
@@ -1429,7 +1429,7 @@ discard block |
||
| 1429 | 1429 | $img_tag_list = $matches[0]; |
| 1430 | 1430 | } |
| 1431 | 1431 | |
| 1432 | - fclose ($fp); |
|
| 1432 | + fclose($fp); |
|
| 1433 | 1433 | unset($buffer); |
| 1434 | 1434 | |
| 1435 | 1435 | // Search the image file path from all the <IMG> tag detected |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | |
| 1530 | 1530 | if (!is_dir($base_work_dir.$systemFolderName)) { |
| 1531 | 1531 | $result = mkdir( |
| 1532 | - $base_work_dir . $systemFolderName, |
|
| 1532 | + $base_work_dir.$systemFolderName, |
|
| 1533 | 1533 | api_get_permissions_for_new_directories(), |
| 1534 | 1534 | true |
| 1535 | 1535 | ); |
@@ -1542,7 +1542,7 @@ discard block |
||
| 1542 | 1542 | WHERE |
| 1543 | 1543 | c_id = $course_id AND |
| 1544 | 1544 | ( |
| 1545 | - path = '" . Database::escape_string($systemFolderName). "' |
|
| 1545 | + path = '".Database::escape_string($systemFolderName)."' |
|
| 1546 | 1546 | ) |
| 1547 | 1547 | "; |
| 1548 | 1548 | |
@@ -1693,7 +1693,7 @@ discard block |
||
| 1693 | 1693 | |
| 1694 | 1694 | // Fix the image tags |
| 1695 | 1695 | |
| 1696 | - for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb ; $i++) { |
|
| 1696 | + for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb; $i++) { |
|
| 1697 | 1697 | $replace_what = $original_img_path[$i]; |
| 1698 | 1698 | // We only need the directory and the filename /path/to/file_html_files/missing_file.gif -> file_html_files/missing_file.gif |
| 1699 | 1699 | $exploded_file_path = explode('/', $new_img_path[$i]); |
@@ -1734,7 +1734,7 @@ discard block |
||
| 1734 | 1734 | .'</body>' |
| 1735 | 1735 | .'</html>'; |
| 1736 | 1736 | if (file_exists($file_path)) { |
| 1737 | - if (!($fp = fopen ($file_path, 'w'))) { |
|
| 1737 | + if (!($fp = fopen($file_path, 'w'))) { |
|
| 1738 | 1738 | return false; |
| 1739 | 1739 | } |
| 1740 | 1740 | return fwrite($fp, $file_content); |
@@ -1754,7 +1754,7 @@ discard block |
||
| 1754 | 1754 | // Open the file |
| 1755 | 1755 | if (file_exists($full_file_name)) { |
| 1756 | 1756 | $fp = fopen($full_file_name, 'r'); |
| 1757 | - $buffer = fread ($fp, filesize ($full_file_name)); |
|
| 1757 | + $buffer = fread($fp, filesize($full_file_name)); |
|
| 1758 | 1758 | |
| 1759 | 1759 | // Parse the contents |
| 1760 | 1760 | $new_html_content = api_replace_links_in_string($upload_path, $buffer); |
@@ -1897,7 +1897,7 @@ discard block |
||
| 1897 | 1897 | |
| 1898 | 1898 | foreach ($tag_list as & $this_tag) { |
| 1899 | 1899 | //Display::display_normal_message(htmlentities($this_tag)); //debug |
| 1900 | - if ( preg_match("~".$param_name."[\s]*=[\s]*[\"]{1}([^\"]+)[\"]{1}~i", $this_tag, $matches)) { |
|
| 1900 | + if (preg_match("~".$param_name."[\s]*=[\s]*[\"]{1}([^\"]+)[\"]{1}~i", $this_tag, $matches)) { |
|
| 1901 | 1901 | $file_path_list[] = $matches[1]; // older |
| 1902 | 1902 | $href_list[] = $matches[0]; // to also add target="_self" |
| 1903 | 1903 | } |
@@ -1918,9 +1918,9 @@ discard block |
||
| 1918 | 1918 | |
| 1919 | 1919 | // Fix the link to use download.php or showinframes.php |
| 1920 | 1920 | if (preg_match("/<a([\s]*[\"\/:'=a-z0-9]*){5}href[^<]*>/i", $tag_list[$count])) { |
| 1921 | - $replace_by[$count] = " $param_name =\"showinframes.php?file=" . $upload_path.$file_path_list[$count]."\" target=\"_self\" "; |
|
| 1921 | + $replace_by[$count] = " $param_name =\"showinframes.php?file=".$upload_path.$file_path_list[$count]."\" target=\"_self\" "; |
|
| 1922 | 1922 | } else { |
| 1923 | - $replace_by[$count] = " $param_name =\"download.php?doc_url=" . $upload_path.$file_path_list[$count]."\" "; |
|
| 1923 | + $replace_by[$count] = " $param_name =\"download.php?doc_url=".$upload_path.$file_path_list[$count]."\" "; |
|
| 1924 | 1924 | } |
| 1925 | 1925 | } else { |
| 1926 | 1926 | // "mailto" or url already fixed, leave as is |
@@ -1929,7 +1929,7 @@ discard block |
||
| 1929 | 1929 | } |
| 1930 | 1930 | } elseif ($is_absolute_hyperlink) { |
| 1931 | 1931 | //$message .= "Absolute hyperlink, don't change, add target=_self: "; |
| 1932 | - $replace_by[$count] = " $param_name=\"" . $file_path_list[$count] . "\" target =\"_self\""; |
|
| 1932 | + $replace_by[$count] = " $param_name=\"".$file_path_list[$count]."\" target =\"_self\""; |
|
| 1933 | 1933 | } else { |
| 1934 | 1934 | // Don't change anything |
| 1935 | 1935 | //$message .= "Local anchor, don't change: "; |
@@ -1974,7 +1974,7 @@ discard block |
||
| 1974 | 1974 | { |
| 1975 | 1975 | // Do we need a / or not? |
| 1976 | 1976 | $added_slash = ($upload_path == '/') ? '' : '/'; |
| 1977 | - $folder_id = DocumentManager::get_document_id(api_get_course_info(), $upload_path); |
|
| 1977 | + $folder_id = DocumentManager::get_document_id(api_get_course_info(), $upload_path); |
|
| 1978 | 1978 | // Build the form |
| 1979 | 1979 | $form = "<p><strong>".get_lang('MissingImagesDetected')."</strong></p>" |
| 1980 | 1980 | ."<form method=\"post\" action=\"".api_get_self()."\" enctype=\"multipart/form-data\">" |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | /* |
| 60 | 60 | Header and Breadcrumbs |
| 61 | 61 | */ |
| 62 | -if (isset($_SESSION['gradebook'])){ |
|
| 63 | - $gradebook= $_SESSION['gradebook']; |
|
| 62 | +if (isset($_SESSION['gradebook'])) { |
|
| 63 | + $gradebook = $_SESSION['gradebook']; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -if (!empty($gradebook) && $gradebook=='view') { |
|
| 67 | - $interbreadcrumb[]= array ( |
|
| 66 | +if (!empty($gradebook) && $gradebook == 'view') { |
|
| 67 | + $interbreadcrumb[] = array( |
|
| 68 | 68 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
| 69 | 69 | 'name' => get_lang('ToolGradebook') |
| 70 | 70 | ); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | "name" => prepare4display($currentForum['forum_title']) |
| 89 | 89 | ); |
| 90 | 90 | if ($message <> 'PostDeletedSpecial') { |
| 91 | - $interbreadcrumb[]= array( |
|
| 91 | + $interbreadcrumb[] = array( |
|
| 92 | 92 | "url" => "viewthread.php?forum=".intval($_GET['forum'])."&gradebook=".$gradebook."&thread=".intval($_GET['thread']), |
| 93 | 93 | "name" => prepare4display($currentThread['thread_title']) |
| 94 | 94 | ); |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | 121 | if ($message <> 'PostDeletedSpecial') { |
| 122 | - if (isset($_GET['gradebook']) and $_GET['gradebook']=='view') { |
|
| 123 | - $info_thread=get_thread_information($_GET['thread']); |
|
| 122 | + if (isset($_GET['gradebook']) and $_GET['gradebook'] == 'view') { |
|
| 123 | + $info_thread = get_thread_information($_GET['thread']); |
|
| 124 | 124 | $interbreadcrumb[] = array( |
| 125 | 125 | "url" => "viewthread.php?".api_get_cidreq()."&forum=".$info_thread['forum_id']."&thread=".intval($_GET['thread']), |
| 126 | 126 | "name" => prepare4display($currentThread['thread_title']) |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | // the last element of the breadcrumb navigation is already set in interbreadcrumb, so give empty string |
| 136 | - $interbreadcrumb[]=array("url" => "#","name" => get_lang('QualifyThread')); |
|
| 136 | + $interbreadcrumb[] = array("url" => "#", "name" => get_lang('QualifyThread')); |
|
| 137 | 137 | Display :: display_header(''); |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | $action = isset($_GET['action']) ? $_GET['action'] : ''; |
| 145 | 145 | |
| 146 | -if ($action =='delete' && |
|
| 146 | +if ($action == 'delete' && |
|
| 147 | 147 | isset($_GET['content']) && |
| 148 | 148 | isset($_GET['id']) && api_is_allowed_to_edit(false, true) |
| 149 | 149 | ) { |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | if (isset($rows)) { |
| 241 | 241 | $counter = 1; |
| 242 | 242 | foreach ($rows as $row) { |
| 243 | - if ($row['status']=='0') { |
|
| 244 | - $style =" id = 'post".$post_en."' class=\"hide-me\" style=\"border:1px solid red; display:none; background-color:#F7F7F7; width:95%; margin: 0px 0px 4px 40px; \" "; |
|
| 243 | + if ($row['status'] == '0') { |
|
| 244 | + $style = " id = 'post".$post_en."' class=\"hide-me\" style=\"border:1px solid red; display:none; background-color:#F7F7F7; width:95%; margin: 0px 0px 4px 40px; \" "; |
|
| 245 | 245 | } else { |
| 246 | 246 | $style = ""; |
| 247 | 247 | $post_en = $row['post_parent_id']; |
@@ -258,20 +258,20 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | echo "<div ".$style."><table class=\"data_table\">"; |
| 260 | 260 | |
| 261 | - if ($row['visible']=='0') { |
|
| 262 | - $titleclass='forum_message_post_title_2_be_approved'; |
|
| 263 | - $messageclass='forum_message_post_text_2_be_approved'; |
|
| 264 | - $leftclass='forum_message_left_2_be_approved'; |
|
| 261 | + if ($row['visible'] == '0') { |
|
| 262 | + $titleclass = 'forum_message_post_title_2_be_approved'; |
|
| 263 | + $messageclass = 'forum_message_post_text_2_be_approved'; |
|
| 264 | + $leftclass = 'forum_message_left_2_be_approved'; |
|
| 265 | 265 | } else { |
| 266 | - $titleclass='forum_message_post_title'; |
|
| 267 | - $messageclass='forum_message_post_text'; |
|
| 268 | - $leftclass='forum_message_left'; |
|
| 266 | + $titleclass = 'forum_message_post_title'; |
|
| 267 | + $messageclass = 'forum_message_post_text'; |
|
| 268 | + $leftclass = 'forum_message_left'; |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | echo "<tr>"; |
| 272 | 272 | echo "<td rowspan=\"3\" class=\"$leftclass\">"; |
| 273 | 273 | |
| 274 | - echo '<br /><b>'. api_convert_and_format_date($row['post_date'], DATE_TIME_FORMAT_LONG).'</b><br />'; |
|
| 274 | + echo '<br /><b>'.api_convert_and_format_date($row['post_date'], DATE_TIME_FORMAT_LONG).'</b><br />'; |
|
| 275 | 275 | |
| 276 | 276 | echo "</td>"; |
| 277 | 277 | |
@@ -311,8 +311,8 @@ discard block |
||
| 311 | 311 | |
| 312 | 312 | // Show past data |
| 313 | 313 | if (api_is_allowed_to_edit() && $counter > 0) { |
| 314 | - if (isset($_GET['gradebook'])){ |
|
| 315 | - $view_gradebook='&gradebook=view'; |
|
| 314 | + if (isset($_GET['gradebook'])) { |
|
| 315 | + $view_gradebook = '&gradebook=view'; |
|
| 316 | 316 | } |
| 317 | 317 | echo '<h4>'.get_lang('QualificationChangesHistory').'</h4>'; |
| 318 | 318 | if (isset($_GET['type']) && $_GET['type'] == 'false') { |
@@ -342,12 +342,12 @@ discard block |
||
| 342 | 342 | ); |
| 343 | 343 | $table_list .= '</td></tr>'; |
| 344 | 344 | } |
| 345 | - $table_list.= '</table>'; |
|
| 345 | + $table_list .= '</table>'; |
|
| 346 | 346 | |
| 347 | 347 | echo $table_list; |
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | -if ($origin!='learnpath') { |
|
| 351 | +if ($origin != 'learnpath') { |
|
| 352 | 352 | Display :: display_footer(); |
| 353 | 353 | } |
@@ -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> |
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | $_course = api_get_course_info(); |
| 14 | -$courseDir = $_course['path'] . "/document"; |
|
| 14 | +$courseDir = $_course['path']."/document"; |
|
| 15 | 15 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
| 16 | -$base_work_dir = $sys_course_path . $courseDir; |
|
| 16 | +$base_work_dir = $sys_course_path.$courseDir; |
|
| 17 | 17 | $noPHP_SELF = true; |
| 18 | 18 | $max_filled_space = DocumentManager::get_course_quota(); |
| 19 | 19 | |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | $nameTools = get_lang('UplUploadDocument'); |
| 37 | 37 | $interbreadcrumb[] = array( |
| 38 | - "url" => api_get_path(WEB_CODE_PATH)."document/document.php?curdirpath=" . urlencode($path) . '&'.api_get_cidreq(), |
|
| 38 | + "url" => api_get_path(WEB_CODE_PATH)."document/document.php?curdirpath=".urlencode($path).'&'.api_get_cidreq(), |
|
| 39 | 39 | "name" => $langDocuments |
| 40 | 40 | ); |
| 41 | 41 | Display::display_header($nameTools, "Doc"); |
| 42 | 42 | //show the title |
| 43 | -api_display_tool_title($nameTools . $add_group_to_title); |
|
| 43 | +api_display_tool_title($nameTools.$add_group_to_title); |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * Process |
@@ -74,7 +74,7 @@ discard block |
||
| 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'"); |
|
| 77 | + Database::query("UPDATE $table_document SET".substr($ct, 1)." WHERE id = '$docid'"); |
|
| 78 | 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); |
@@ -124,14 +124,14 @@ discard block |
||
| 124 | 124 | replace_img_path_in_html_file( |
| 125 | 125 | $_POST['img_file_path'], |
| 126 | 126 | $paths_to_replace_in_file, |
| 127 | - $base_work_dir . $_POST['related_file'] |
|
| 127 | + $base_work_dir.$_POST['related_file'] |
|
| 128 | 128 | ); |
| 129 | 129 | //update parent folders |
| 130 | 130 | item_property_update_on_folder($_course, $_POST['curdirpath'], $_user['user_id']); |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | //they want to create a directory |
| 134 | -if (isset($_POST['create_dir']) && $_POST['dirname']!='') { |
|
| 134 | +if (isset($_POST['create_dir']) && $_POST['dirname'] != '') { |
|
| 135 | 135 | $added_slash = $path == '/' ? '' : '/'; |
| 136 | 136 | $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']); |
| 137 | 137 | $created_dir = create_unexisting_directory( |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | //create the form that asks for the directory name |
| 157 | 157 | $new_folder_text = '<form action="'.api_get_self().'" method="POST">'; |
| 158 | 158 | $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>'; |
| 159 | - $new_folder_text .= get_lang('NewDir') .' '; |
|
| 159 | + $new_folder_text .= get_lang('NewDir').' '; |
|
| 160 | 160 | $new_folder_text .= '<input type="text" name="dirname"/>'; |
| 161 | 161 | $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>'; |
| 162 | 162 | $new_folder_text .= '</form>'; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | <p> |
| 168 | 168 | <a href="<?php echo api_get_self(); ?>?path=<?php echo $path; ?>&createdir=1"> |
| 169 | 169 | <?php echo Display::return_icon('new_folder.gif'); ?> |
| 170 | - <?php echo(get_lang('CreateDir'));?> |
|
| 170 | + <?php echo(get_lang('CreateDir')); ?> |
|
| 171 | 171 | </a> |
| 172 | 172 | </p> |
| 173 | 173 | <?php |
@@ -190,11 +190,11 @@ discard block |
||
| 190 | 190 | </td> |
| 191 | 191 | </tr> |
| 192 | 192 | <tr> |
| 193 | -<td><?php echo get_lang('Title');?></td> |
|
| 193 | +<td><?php echo get_lang('Title'); ?></td> |
|
| 194 | 194 | <td><input type="text" size="20" name="title" style="width:300px;"></td> |
| 195 | 195 | </tr> |
| 196 | 196 | <tr> |
| 197 | -<td valign="top"><?php echo get_lang('Comment');?></td> |
|
| 197 | +<td valign="top"><?php echo get_lang('Comment'); ?></td> |
|
| 198 | 198 | <td><textarea rows="3" cols="20" name="comment" wrap="virtual" style="width:300px;"></textarea></td> |
| 199 | 199 | </tr> |
| 200 | 200 | <tr> |
@@ -202,21 +202,21 @@ discard block |
||
| 202 | 202 | <?php echo get_lang('Options'); ?> |
| 203 | 203 | </td> |
| 204 | 204 | <td> |
| 205 | -- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress'));?><br/> |
|
| 206 | -- <?php echo (get_lang('UplWhatIfFileExists'));?><br/> |
|
| 207 | - <input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong'));?>" checked="checked"/> <?php echo (get_lang('UplDoNothing'));?><br/> |
|
| 208 | - <input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong'));?>"/> <?php echo (get_lang('UplOverwrite'));?><br/> |
|
| 209 | - <input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong'));?>"/> <?php echo (get_lang('UplRename'));?> |
|
| 205 | +- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress')); ?><br/> |
|
| 206 | +- <?php echo (get_lang('UplWhatIfFileExists')); ?><br/> |
|
| 207 | + <input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong')); ?>" checked="checked"/> <?php echo (get_lang('UplDoNothing')); ?><br/> |
|
| 208 | + <input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong')); ?>"/> <?php echo (get_lang('UplOverwrite')); ?><br/> |
|
| 209 | + <input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong')); ?>"/> <?php echo (get_lang('UplRename')); ?> |
|
| 210 | 210 | </td> |
| 211 | 211 | </tr> |
| 212 | 212 | </table> |
| 213 | 213 | |
| 214 | -<input type="submit" value="<?php echo(get_lang('Ok'));?>"> |
|
| 214 | +<input type="submit" value="<?php echo(get_lang('Ok')); ?>"> |
|
| 215 | 215 | </form> |
| 216 | 216 | <!-- end upload form --> |
| 217 | 217 | |
| 218 | 218 | <!-- so they can get back to the documents --> |
| 219 | - <p><?php echo (get_lang('Back'));?> <?php echo (get_lang('To'));?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview'));?></a></p> |
|
| 219 | + <p><?php echo (get_lang('Back')); ?> <?php echo (get_lang('To')); ?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview')); ?></a></p> |
|
| 220 | 220 | <?php |
| 221 | 221 | |
| 222 | 222 | Display::display_footer(); |
@@ -64,9 +64,10 @@ |
||
| 64 | 64 | $new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : ''; |
| 65 | 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))) { |
|
| 67 | + if ($new_path && ($new_comment || $new_title)) { |
|
| 68 | + if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
| 69 | 69 | $table_document = Database::get_course_table(TABLE_DOCUMENT); |
| 70 | + } |
|
| 70 | 71 | $ct = ''; |
| 71 | 72 | if ($new_comment) { |
| 72 | 73 | $ct .= ", comment='$new_comment'"; |