@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | /** |
| 357 | - * @return int |
|
| 357 | + * @return string |
|
| 358 | 358 | */ |
| 359 | 359 | public function selectPassPercentage() |
| 360 | 360 | { |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | * tells if questions are selected randomly, and if so returns the draws |
| 474 | 474 | * |
| 475 | 475 | * @author Olivier Brouckaert |
| 476 | - * @return integer - 0 if not random, otherwise the draws |
|
| 476 | + * @return boolean - 0 if not random, otherwise the draws |
|
| 477 | 477 | */ |
| 478 | 478 | public function isRandom() |
| 479 | 479 | { |
@@ -2830,7 +2830,7 @@ discard block |
||
| 2830 | 2830 | * @param int int lp id |
| 2831 | 2831 | * @param int int lp item id |
| 2832 | 2832 | * @param int int lp item_view id |
| 2833 | - * @param float $weight |
|
| 2833 | + * @param integer $weight |
|
| 2834 | 2834 | * @param array question list |
| 2835 | 2835 | */ |
| 2836 | 2836 | public function save_stat_track_exercise_info( |
@@ -5118,6 +5118,7 @@ discard block |
||
| 5118 | 5118 | /** |
| 5119 | 5119 | * Sends a notification when a user ends an examn |
| 5120 | 5120 | * |
| 5121 | + * @param integer $exe_id |
|
| 5121 | 5122 | */ |
| 5122 | 5123 | public function send_mail_notification_for_exam($question_list_answers, $origin, $exe_id) |
| 5123 | 5124 | { |
@@ -5198,6 +5199,7 @@ discard block |
||
| 5198 | 5199 | /** |
| 5199 | 5200 | * Sends a notification when a user ends an examn |
| 5200 | 5201 | * |
| 5202 | + * @param integer $exe_id |
|
| 5201 | 5203 | */ |
| 5202 | 5204 | function send_notification_for_open_questions($question_list_answers, $origin, $exe_id) |
| 5203 | 5205 | { |
@@ -5295,6 +5297,9 @@ discard block |
||
| 5295 | 5297 | } |
| 5296 | 5298 | } |
| 5297 | 5299 | |
| 5300 | + /** |
|
| 5301 | + * @param integer $exe_id |
|
| 5302 | + */ |
|
| 5298 | 5303 | function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id) |
| 5299 | 5304 | { |
| 5300 | 5305 | if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
@@ -5388,7 +5393,7 @@ discard block |
||
| 5388 | 5393 | |
| 5389 | 5394 | /** |
| 5390 | 5395 | * @param array $user_data result of api_get_user_info() |
| 5391 | - * @param null $start_date |
|
| 5396 | + * @param string $start_date |
|
| 5392 | 5397 | * @param null $duration |
| 5393 | 5398 | * @param string $ip Optional. The user IP |
| 5394 | 5399 | * @return string |
@@ -5446,7 +5451,7 @@ discard block |
||
| 5446 | 5451 | * @param int Maximum number of attempts (0 if no limit) |
| 5447 | 5452 | * @param int Feedback type |
| 5448 | 5453 | * @todo this was function was added due the import exercise via CSV |
| 5449 | - * @return int New exercise ID |
|
| 5454 | + * @return string New exercise ID |
|
| 5450 | 5455 | */ |
| 5451 | 5456 | public function createExercise( |
| 5452 | 5457 | $title, |
@@ -6795,7 +6800,7 @@ discard block |
||
| 6795 | 6800 | * @param bool $show_comment |
| 6796 | 6801 | * @param null $exercise_feedback |
| 6797 | 6802 | * @param bool $show_answers |
| 6798 | - * @param null $modelType |
|
| 6803 | + * @param integer $modelType |
|
| 6799 | 6804 | * @param bool $categoryMinusOne |
| 6800 | 6805 | * @return bool|null|string |
| 6801 | 6806 | */ |
@@ -7956,8 +7961,8 @@ discard block |
||
| 7956 | 7961 | /** |
| 7957 | 7962 | * Returns an HTML ribbon to show on top of the exercise result, with |
| 7958 | 7963 | * colouring depending on the success or failure of the student |
| 7959 | - * @param $score |
|
| 7960 | - * @param $weight |
|
| 7964 | + * @param integer $score |
|
| 7965 | + * @param integer $weight |
|
| 7961 | 7966 | * @param bool $check_pass_percentage |
| 7962 | 7967 | * @return string |
| 7963 | 7968 | */ |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public $feedback_type; |
| 30 | 30 | public $end_time; |
| 31 | 31 | public $start_time; |
| 32 | - public $questionList; // array with the list of this exercise's questions |
|
| 32 | + public $questionList; // array with the list of this exercise's questions |
|
| 33 | 33 | /* including question list of the media */ |
| 34 | 34 | public $questionListUncompressed; |
| 35 | 35 | public $results_disabled; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); |
| 133 | 133 | $table_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
| 134 | 134 | |
| 135 | - $id = intval($id); |
|
| 135 | + $id = intval($id); |
|
| 136 | 136 | if (empty($this->course_id)) { |
| 137 | 137 | |
| 138 | 138 | return false; |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | */ |
| 479 | 479 | public function isRandom() |
| 480 | 480 | { |
| 481 | - if($this->random > 0 || $this->random == -1) { |
|
| 481 | + if ($this->random > 0 || $this->random == -1) { |
|
| 482 | 482 | return true; |
| 483 | 483 | } else { |
| 484 | 484 | return false; |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | $question_media = null; |
| 640 | 640 | if (!empty($objQuestionTmp->parent_id)) { |
| 641 | 641 | $objQuestionMedia = Question::read($objQuestionTmp->parent_id); |
| 642 | - $question_media = Question::getMediaLabel($objQuestionMedia->question); |
|
| 642 | + $question_media = Question::getMediaLabel($objQuestionMedia->question); |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | $questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), ICON_SIZE_MEDIUM).$question_media); |
@@ -1032,7 +1032,7 @@ discard block |
||
| 1032 | 1032 | |
| 1033 | 1033 | foreach ($questions_by_category as $categoryId => $questionList) { |
| 1034 | 1034 | $cat = new TestCategory($categoryId); |
| 1035 | - $cat = (array)$cat; |
|
| 1035 | + $cat = (array) $cat; |
|
| 1036 | 1036 | $cat['iid'] = $cat['id']; |
| 1037 | 1037 | //*$cat['name'] = $cat['name']; |
| 1038 | 1038 | |
@@ -1097,7 +1097,7 @@ discard block |
||
| 1097 | 1097 | { |
| 1098 | 1098 | if ($this->specialCategoryOrders == false) { |
| 1099 | 1099 | if ($from_db && !empty($this->id)) { |
| 1100 | - $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
| 1100 | + $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
| 1101 | 1101 | $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
| 1102 | 1102 | |
| 1103 | 1103 | $sql = "SELECT DISTINCT e.question_order |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | $question_list = array(); |
| 1125 | 1125 | |
| 1126 | 1126 | while ($new_object = Database::fetch_object($result)) { |
| 1127 | - $question_list[$new_object->question_order]= $new_object->question_id; |
|
| 1127 | + $question_list[$new_object->question_order] = $new_object->question_id; |
|
| 1128 | 1128 | $temp_question_list[$counter] = $new_object->question_id; |
| 1129 | 1129 | $counter++; |
| 1130 | 1130 | } |
@@ -1268,7 +1268,7 @@ discard block |
||
| 1268 | 1268 | public function isInList($questionId) |
| 1269 | 1269 | { |
| 1270 | 1270 | if (is_array($this->questionList)) |
| 1271 | - return in_array($questionId,$this->questionList); |
|
| 1271 | + return in_array($questionId, $this->questionList); |
|
| 1272 | 1272 | else |
| 1273 | 1273 | return false; |
| 1274 | 1274 | } |
@@ -1281,7 +1281,7 @@ discard block |
||
| 1281 | 1281 | */ |
| 1282 | 1282 | public function updateTitle($title) |
| 1283 | 1283 | { |
| 1284 | - $this->exercise=$title; |
|
| 1284 | + $this->exercise = $title; |
|
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | 1287 | /** |
@@ -1291,7 +1291,7 @@ discard block |
||
| 1291 | 1291 | */ |
| 1292 | 1292 | public function updateAttempts($attempts) |
| 1293 | 1293 | { |
| 1294 | - $this->attempts=$attempts; |
|
| 1294 | + $this->attempts = $attempts; |
|
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | 1297 | /** |
@@ -1301,7 +1301,7 @@ discard block |
||
| 1301 | 1301 | */ |
| 1302 | 1302 | public function updateFeedbackType($feedback_type) |
| 1303 | 1303 | { |
| 1304 | - $this->feedback_type=$feedback_type; |
|
| 1304 | + $this->feedback_type = $feedback_type; |
|
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | 1307 | /** |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | */ |
| 1313 | 1313 | public function updateDescription($description) |
| 1314 | 1314 | { |
| 1315 | - $this->description=$description; |
|
| 1315 | + $this->description = $description; |
|
| 1316 | 1316 | } |
| 1317 | 1317 | |
| 1318 | 1318 | /** |
@@ -1442,23 +1442,23 @@ discard block |
||
| 1442 | 1442 | * @param string $sound - exercise sound file |
| 1443 | 1443 | * @param string $delete - ask to delete the file |
| 1444 | 1444 | */ |
| 1445 | - public function updateSound($sound,$delete) |
|
| 1445 | + public function updateSound($sound, $delete) |
|
| 1446 | 1446 | { |
| 1447 | 1447 | global $audioPath, $documentPath; |
| 1448 | 1448 | $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
| 1449 | 1449 | |
| 1450 | - if ($sound['size'] && (strstr($sound['type'],'audio') || strstr($sound['type'],'video'))) { |
|
| 1451 | - $this->sound=$sound['name']; |
|
| 1450 | + if ($sound['size'] && (strstr($sound['type'], 'audio') || strstr($sound['type'], 'video'))) { |
|
| 1451 | + $this->sound = $sound['name']; |
|
| 1452 | 1452 | |
| 1453 | - if (@move_uploaded_file($sound['tmp_name'],$audioPath.'/'.$this->sound)) { |
|
| 1453 | + if (@move_uploaded_file($sound['tmp_name'], $audioPath.'/'.$this->sound)) { |
|
| 1454 | 1454 | $query = "SELECT 1 FROM $TBL_DOCUMENT |
| 1455 | - WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath,'',$audioPath).'/'.$this->sound."'"; |
|
| 1456 | - $result=Database::query($query); |
|
| 1455 | + WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath, '', $audioPath).'/'.$this->sound."'"; |
|
| 1456 | + $result = Database::query($query); |
|
| 1457 | 1457 | |
| 1458 | 1458 | if (!Database::num_rows($result)) { |
| 1459 | 1459 | $id = add_document( |
| 1460 | 1460 | $this->course, |
| 1461 | - str_replace($documentPath,'',$audioPath).'/'.$this->sound, |
|
| 1461 | + str_replace($documentPath, '', $audioPath).'/'.$this->sound, |
|
| 1462 | 1462 | 'file', |
| 1463 | 1463 | $sound['size'], |
| 1464 | 1464 | $sound['name'] |
@@ -1477,8 +1477,8 @@ discard block |
||
| 1477 | 1477 | ); |
| 1478 | 1478 | } |
| 1479 | 1479 | } |
| 1480 | - } elseif($delete && is_file($audioPath.'/'.$this->sound)) { |
|
| 1481 | - $this->sound=''; |
|
| 1480 | + } elseif ($delete && is_file($audioPath.'/'.$this->sound)) { |
|
| 1481 | + $this->sound = ''; |
|
| 1482 | 1482 | } |
| 1483 | 1483 | } |
| 1484 | 1484 | |
@@ -1490,7 +1490,7 @@ discard block |
||
| 1490 | 1490 | */ |
| 1491 | 1491 | public function updateType($type) |
| 1492 | 1492 | { |
| 1493 | - $this->type=$type; |
|
| 1493 | + $this->type = $type; |
|
| 1494 | 1494 | } |
| 1495 | 1495 | |
| 1496 | 1496 | /** |
@@ -1526,7 +1526,7 @@ discard block |
||
| 1526 | 1526 | */ |
| 1527 | 1527 | public function enable() |
| 1528 | 1528 | { |
| 1529 | - $this->active=1; |
|
| 1529 | + $this->active = 1; |
|
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | /** |
@@ -1536,7 +1536,7 @@ discard block |
||
| 1536 | 1536 | */ |
| 1537 | 1537 | public function disable() |
| 1538 | 1538 | { |
| 1539 | - $this->active=0; |
|
| 1539 | + $this->active = 0; |
|
| 1540 | 1540 | } |
| 1541 | 1541 | |
| 1542 | 1542 | /** |
@@ -1664,7 +1664,7 @@ discard block |
||
| 1664 | 1664 | api_get_user_id() |
| 1665 | 1665 | ); |
| 1666 | 1666 | |
| 1667 | - if (api_get_setting('search_enabled')=='true') { |
|
| 1667 | + if (api_get_setting('search_enabled') == 'true') { |
|
| 1668 | 1668 | $this->search_engine_edit(); |
| 1669 | 1669 | } |
| 1670 | 1670 | } else { |
@@ -1812,7 +1812,7 @@ discard block |
||
| 1812 | 1812 | public function removeFromList($questionId) |
| 1813 | 1813 | { |
| 1814 | 1814 | // searches the position of the question ID in the list |
| 1815 | - $pos = array_search($questionId,$this->questionList); |
|
| 1815 | + $pos = array_search($questionId, $this->questionList); |
|
| 1816 | 1816 | |
| 1817 | 1817 | // question not found |
| 1818 | 1818 | if ($pos === false) { |
@@ -1847,7 +1847,7 @@ discard block |
||
| 1847 | 1847 | api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'QuizDeleted', api_get_user_id()); |
| 1848 | 1848 | api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'delete', api_get_user_id()); |
| 1849 | 1849 | |
| 1850 | - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian') ) { |
|
| 1850 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
| 1851 | 1851 | $this->search_engine_delete(); |
| 1852 | 1852 | } |
| 1853 | 1853 | } |
@@ -1856,7 +1856,7 @@ discard block |
||
| 1856 | 1856 | * Creates the form to create / edit an exercise |
| 1857 | 1857 | * @param FormValidator $form |
| 1858 | 1858 | */ |
| 1859 | - public function createForm($form, $type='full') |
|
| 1859 | + public function createForm($form, $type = 'full') |
|
| 1860 | 1860 | { |
| 1861 | 1861 | if (empty($type)) { |
| 1862 | 1862 | $type = 'full'; |
@@ -1887,7 +1887,7 @@ discard block |
||
| 1887 | 1887 | 'Width' => '100%', |
| 1888 | 1888 | 'Height' => '150', |
| 1889 | 1889 | ); |
| 1890 | - if (is_array($type)){ |
|
| 1890 | + if (is_array($type)) { |
|
| 1891 | 1891 | $editor_config = array_merge($editor_config, $type); |
| 1892 | 1892 | } |
| 1893 | 1893 | |
@@ -1941,7 +1941,7 @@ discard block |
||
| 1941 | 1941 | '2', |
| 1942 | 1942 | array('id' => 'exerciseType_2') |
| 1943 | 1943 | ); |
| 1944 | - $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions')), ''); |
|
| 1944 | + $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')), ''); |
|
| 1945 | 1945 | |
| 1946 | 1946 | // Type of results display on the final page |
| 1947 | 1947 | $radios_results_disabled = array(); |
@@ -1985,8 +1985,8 @@ discard block |
||
| 1985 | 1985 | // Type of questions disposition on page |
| 1986 | 1986 | $radios = array(); |
| 1987 | 1987 | |
| 1988 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
| 1989 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
| 1988 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
| 1989 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
| 1990 | 1990 | |
| 1991 | 1991 | $form->addGroup($radios, null, get_lang('QuestionsPerPage'), ''); |
| 1992 | 1992 | |
@@ -1996,33 +1996,33 @@ discard block |
||
| 1996 | 1996 | |
| 1997 | 1997 | // feedback type |
| 1998 | 1998 | $radios_feedback = array(); |
| 1999 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'),'0',array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()')); |
|
| 1999 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'), '0', array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()')); |
|
| 2000 | 2000 | |
| 2001 | 2001 | if (api_get_setting('enable_quiz_scenario') == 'true') { |
| 2002 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1' , 'onclick' => 'check_direct_feedback()')); |
|
| 2002 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1', 'onclick' => 'check_direct_feedback()')); |
|
| 2003 | 2003 | } |
| 2004 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'),'2',array('id' =>'exerciseType_2')); |
|
| 2005 | - $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions'))); |
|
| 2004 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'), '2', array('id' =>'exerciseType_2')); |
|
| 2005 | + $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions'))); |
|
| 2006 | 2006 | |
| 2007 | 2007 | //$form->addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"'); |
| 2008 | 2008 | $radios_results_disabled = array(); |
| 2009 | 2009 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
| 2010 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
| 2011 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()')); |
|
| 2012 | - $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),''); |
|
| 2010 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
| 2011 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()')); |
|
| 2012 | + $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
|
| 2013 | 2013 | |
| 2014 | 2014 | // Type of questions disposition on page |
| 2015 | 2015 | $radios = array(); |
| 2016 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1'); |
|
| 2017 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2'); |
|
| 2016 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1'); |
|
| 2017 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2'); |
|
| 2018 | 2018 | $form->addGroup($radios, null, get_lang('ExerciseType')); |
| 2019 | 2019 | |
| 2020 | 2020 | } else { |
| 2021 | 2021 | //Show options freeze |
| 2022 | 2022 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
| 2023 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
| 2024 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()')); |
|
| 2025 | - $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),''); |
|
| 2023 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
| 2024 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()')); |
|
| 2025 | + $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
|
| 2026 | 2026 | $result_disable_group->freeze(); |
| 2027 | 2027 | |
| 2028 | 2028 | //we force the options to the DirectFeedback exercisetype |
@@ -2030,8 +2030,8 @@ discard block |
||
| 2030 | 2030 | $form->addElement('hidden', 'exerciseType', ONE_PER_PAGE); |
| 2031 | 2031 | |
| 2032 | 2032 | // Type of questions disposition on page |
| 2033 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
| 2034 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
| 2033 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
| 2034 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
| 2035 | 2035 | |
| 2036 | 2036 | $type_group = $form->addGroup($radios, null, get_lang('QuestionsPerPage'), ''); |
| 2037 | 2037 | $type_group->freeze(); |
@@ -2163,26 +2163,26 @@ discard block |
||
| 2163 | 2163 | |
| 2164 | 2164 | // number of random question |
| 2165 | 2165 | |
| 2166 | - $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10 ; |
|
| 2166 | + $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10; |
|
| 2167 | 2167 | $option = range(0, $max); |
| 2168 | 2168 | $option[0] = get_lang('No'); |
| 2169 | 2169 | $option[-1] = get_lang('AllQuestionsShort'); |
| 2170 | - $form->addElement('select', 'randomQuestions',array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions')); |
|
| 2170 | + $form->addElement('select', 'randomQuestions', array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions')); |
|
| 2171 | 2171 | |
| 2172 | 2172 | // Random answers |
| 2173 | 2173 | $radios_random_answers = array(); |
| 2174 | - $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'),'1'); |
|
| 2175 | - $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'),'0'); |
|
| 2174 | + $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'), '1'); |
|
| 2175 | + $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'), '0'); |
|
| 2176 | 2176 | $form->addGroup($radios_random_answers, null, get_lang('RandomAnswers'), ''); |
| 2177 | 2177 | |
| 2178 | 2178 | // Random by category |
| 2179 | - $form->addElement('html','<div class="clear"> </div>'); |
|
| 2179 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
| 2180 | 2180 | $radiocat = array(); |
| 2181 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'),'1'); |
|
| 2182 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'),'2'); |
|
| 2183 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'),'0'); |
|
| 2181 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'), '1'); |
|
| 2182 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'), '2'); |
|
| 2183 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'), '0'); |
|
| 2184 | 2184 | $radioCatGroup = $form->addGroup($radiocat, null, get_lang('RandomQuestionByCategory'), ''); |
| 2185 | - $form->addElement('html','<div class="clear"> </div>'); |
|
| 2185 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
| 2186 | 2186 | |
| 2187 | 2187 | // add the radio display the category name for student |
| 2188 | 2188 | $radio_display_cat_name = array(); |
@@ -2203,36 +2203,36 @@ discard block |
||
| 2203 | 2203 | ); |
| 2204 | 2204 | |
| 2205 | 2205 | // Exercise time limit |
| 2206 | - $form->addElement('checkbox', 'activate_start_date_check',null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
|
| 2206 | + $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
|
| 2207 | 2207 | |
| 2208 | 2208 | $var = Exercise::selectTimeLimit(); |
| 2209 | 2209 | |
| 2210 | 2210 | if (($this->start_time != '0000-00-00 00:00:00')) |
| 2211 | - $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
| 2211 | + $form->addElement('html', '<div id="start_date_div" style="display:block;">'); |
|
| 2212 | 2212 | else |
| 2213 | - $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
| 2213 | + $form->addElement('html', '<div id="start_date_div" style="display:none;">'); |
|
| 2214 | 2214 | |
| 2215 | 2215 | $form->addElement('date_time_picker', 'start_time'); |
| 2216 | 2216 | |
| 2217 | - $form->addElement('html','</div>'); |
|
| 2217 | + $form->addElement('html', '</div>'); |
|
| 2218 | 2218 | |
| 2219 | - $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
|
| 2219 | + $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
|
| 2220 | 2220 | |
| 2221 | 2221 | if (($this->end_time != '0000-00-00 00:00:00')) |
| 2222 | - $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
| 2222 | + $form->addElement('html', '<div id="end_date_div" style="display:block;">'); |
|
| 2223 | 2223 | else |
| 2224 | - $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
| 2224 | + $form->addElement('html', '<div id="end_date_div" style="display:none;">'); |
|
| 2225 | 2225 | |
| 2226 | 2226 | $form->addElement('date_time_picker', 'end_time'); |
| 2227 | - $form->addElement('html','</div>'); |
|
| 2227 | + $form->addElement('html', '</div>'); |
|
| 2228 | 2228 | |
| 2229 | 2229 | //$check_option=$this->selectType(); |
| 2230 | 2230 | $diplay = 'block'; |
| 2231 | 2231 | $form->addElement('checkbox', 'propagate_neg', null, get_lang('PropagateNegativeResults')); |
| 2232 | - $form->addElement('html','<div class="clear"> </div>'); |
|
| 2232 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
| 2233 | 2233 | $form->addElement('checkbox', 'review_answers', null, get_lang('ReviewAnswers')); |
| 2234 | 2234 | |
| 2235 | - $form->addElement('html','<div id="divtimecontrol" style="display:'.$diplay.';">'); |
|
| 2235 | + $form->addElement('html', '<div id="divtimecontrol" style="display:'.$diplay.';">'); |
|
| 2236 | 2236 | |
| 2237 | 2237 | //Timer control |
| 2238 | 2238 | //$time_hours_option = range(0,12); |
@@ -2248,12 +2248,12 @@ discard block |
||
| 2248 | 2248 | 'onload' => 'check_load_time()', |
| 2249 | 2249 | ) |
| 2250 | 2250 | ); |
| 2251 | - $expired_date = (int)$this->selectExpiredTime(); |
|
| 2251 | + $expired_date = (int) $this->selectExpiredTime(); |
|
| 2252 | 2252 | |
| 2253 | - if (($expired_date!='0')) { |
|
| 2254 | - $form->addElement('html','<div id="timercontrol" style="display:block;">'); |
|
| 2253 | + if (($expired_date != '0')) { |
|
| 2254 | + $form->addElement('html', '<div id="timercontrol" style="display:block;">'); |
|
| 2255 | 2255 | } else { |
| 2256 | - $form->addElement('html','<div id="timercontrol" style="display:none;">'); |
|
| 2256 | + $form->addElement('html', '<div id="timercontrol" style="display:none;">'); |
|
| 2257 | 2257 | } |
| 2258 | 2258 | $form->addText( |
| 2259 | 2259 | 'enabletimercontroltotalminutes', |
@@ -2264,7 +2264,7 @@ discard block |
||
| 2264 | 2264 | 'cols-size' => [2, 2, 8] |
| 2265 | 2265 | ] |
| 2266 | 2266 | ); |
| 2267 | - $form->addElement('html','</div>'); |
|
| 2267 | + $form->addElement('html', '</div>'); |
|
| 2268 | 2268 | |
| 2269 | 2269 | $form->addElement( |
| 2270 | 2270 | 'text', |
@@ -2288,23 +2288,23 @@ discard block |
||
| 2288 | 2288 | $defaults = array(); |
| 2289 | 2289 | |
| 2290 | 2290 | if (api_get_setting('search_enabled') === 'true') { |
| 2291 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
| 2291 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
| 2292 | 2292 | |
| 2293 | - $form->addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument')); |
|
| 2294 | - $form->addElement ('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); |
|
| 2293 | + $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); |
|
| 2294 | + $form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); |
|
| 2295 | 2295 | |
| 2296 | 2296 | $specific_fields = get_specific_field_list(); |
| 2297 | 2297 | |
| 2298 | 2298 | foreach ($specific_fields as $specific_field) { |
| 2299 | - $form->addElement ('text', $specific_field['code'], $specific_field['name']); |
|
| 2299 | + $form->addElement('text', $specific_field['code'], $specific_field['name']); |
|
| 2300 | 2300 | $filter = array( |
| 2301 | 2301 | 'c_id' => api_get_course_int_id(), |
| 2302 | 2302 | 'field_id' => $specific_field['id'], |
| 2303 | 2303 | 'ref_id' => $this->id, |
| 2304 | - 'tool_id' => "'" . TOOL_QUIZ . "'" |
|
| 2304 | + 'tool_id' => "'".TOOL_QUIZ."'" |
|
| 2305 | 2305 | ); |
| 2306 | 2306 | $values = get_specific_field_values_list($filter, array('value')); |
| 2307 | - if ( !empty($values) ) { |
|
| 2307 | + if (!empty($values)) { |
|
| 2308 | 2308 | $arr_str_values = array(); |
| 2309 | 2309 | foreach ($values as $value) { |
| 2310 | 2310 | $arr_str_values[] = $value['value']; |
@@ -2315,8 +2315,8 @@ discard block |
||
| 2315 | 2315 | //$form->addElement ('html','</div>'); |
| 2316 | 2316 | } |
| 2317 | 2317 | |
| 2318 | - $form->addElement('html','</div>'); //End advanced setting |
|
| 2319 | - $form->addElement('html','</div>'); |
|
| 2318 | + $form->addElement('html', '</div>'); //End advanced setting |
|
| 2319 | + $form->addElement('html', '</div>'); |
|
| 2320 | 2320 | } |
| 2321 | 2321 | |
| 2322 | 2322 | // submit |
@@ -2336,10 +2336,10 @@ discard block |
||
| 2336 | 2336 | } |
| 2337 | 2337 | |
| 2338 | 2338 | // defaults |
| 2339 | - if ($type=='full') { |
|
| 2339 | + if ($type == 'full') { |
|
| 2340 | 2340 | if ($this->id > 0) { |
| 2341 | 2341 | if ($this->random > $this->selectNbrQuestions()) { |
| 2342 | - $defaults['randomQuestions'] = $this->selectNbrQuestions(); |
|
| 2342 | + $defaults['randomQuestions'] = $this->selectNbrQuestions(); |
|
| 2343 | 2343 | } else { |
| 2344 | 2344 | $defaults['randomQuestions'] = $this->random; |
| 2345 | 2345 | } |
@@ -2366,8 +2366,8 @@ discard block |
||
| 2366 | 2366 | $defaults['activate_end_date_check'] = 1; |
| 2367 | 2367 | } |
| 2368 | 2368 | |
| 2369 | - $defaults['start_time'] = ($this->start_time!='0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00'); |
|
| 2370 | - $defaults['end_time'] = ($this->end_time!='0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time()+84600); |
|
| 2369 | + $defaults['start_time'] = ($this->start_time != '0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00'); |
|
| 2370 | + $defaults['end_time'] = ($this->end_time != '0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time() + 84600); |
|
| 2371 | 2371 | |
| 2372 | 2372 | // Get expired time |
| 2373 | 2373 | if ($this->expired_time != '0') { |
@@ -2388,7 +2388,7 @@ discard block |
||
| 2388 | 2388 | $defaults['text_when_finished'] = ""; |
| 2389 | 2389 | $defaults['start_time'] = date('Y-m-d 12:00:00'); |
| 2390 | 2390 | $defaults['display_category_name'] = 1; |
| 2391 | - $defaults['end_time'] = date('Y-m-d 12:00:00', time()+84600); |
|
| 2391 | + $defaults['end_time'] = date('Y-m-d 12:00:00', time() + 84600); |
|
| 2392 | 2392 | $defaults['pass_percentage'] = ''; |
| 2393 | 2393 | $defaults['end_button'] = $this->selectEndButton(); |
| 2394 | 2394 | $defaults['question_selection_type'] = 1; |
@@ -2474,7 +2474,7 @@ discard block |
||
| 2474 | 2474 | $end_time = $form->getSubmitValue('end_time'); |
| 2475 | 2475 | $this->end_time = api_get_utc_datetime($end_time); |
| 2476 | 2476 | } else { |
| 2477 | - $this->end_time = '0000-00-00 00:00:00'; |
|
| 2477 | + $this->end_time = '0000-00-00 00:00:00'; |
|
| 2478 | 2478 | } |
| 2479 | 2479 | |
| 2480 | 2480 | if ($form->getSubmitValue('enabletimercontrol') == 1) { |
@@ -2487,9 +2487,9 @@ discard block |
||
| 2487 | 2487 | } |
| 2488 | 2488 | |
| 2489 | 2489 | if ($form->getSubmitValue('randomAnswers') == 1) { |
| 2490 | - $this->random_answers=1; |
|
| 2490 | + $this->random_answers = 1; |
|
| 2491 | 2491 | } else { |
| 2492 | - $this->random_answers=0; |
|
| 2492 | + $this->random_answers = 0; |
|
| 2493 | 2493 | } |
| 2494 | 2494 | $this->save($type); |
| 2495 | 2495 | } |
@@ -2501,9 +2501,9 @@ discard block |
||
| 2501 | 2501 | } |
| 2502 | 2502 | $course_id = api_get_course_id(); |
| 2503 | 2503 | |
| 2504 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
| 2505 | - require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'; |
|
| 2506 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
| 2504 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
| 2505 | + require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'; |
|
| 2506 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
| 2507 | 2507 | |
| 2508 | 2508 | $specific_fields = get_specific_field_list(); |
| 2509 | 2509 | $ic_slide = new IndexableChunk(); |
@@ -2513,7 +2513,7 @@ discard block |
||
| 2513 | 2513 | if (isset($_REQUEST[$specific_field['code']])) { |
| 2514 | 2514 | $sterms = trim($_REQUEST[$specific_field['code']]); |
| 2515 | 2515 | if (!empty($sterms)) { |
| 2516 | - $all_specific_terms .= ' '. $sterms; |
|
| 2516 | + $all_specific_terms .= ' '.$sterms; |
|
| 2517 | 2517 | $sterms = explode(',', $sterms); |
| 2518 | 2518 | foreach ($sterms as $sterm) { |
| 2519 | 2519 | $ic_slide->addTerm(trim($sterm), $specific_field['code']); |
@@ -2530,15 +2530,15 @@ discard block |
||
| 2530 | 2530 | $xapian_data = array( |
| 2531 | 2531 | SE_COURSE_ID => $course_id, |
| 2532 | 2532 | SE_TOOL_ID => TOOL_QUIZ, |
| 2533 | - SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id), |
|
| 2534 | - SE_USER => (int)api_get_user_id(), |
|
| 2533 | + SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id), |
|
| 2534 | + SE_USER => (int) api_get_user_id(), |
|
| 2535 | 2535 | ); |
| 2536 | 2536 | $ic_slide->xapian_data = serialize($xapian_data); |
| 2537 | - $exercise_description = $all_specific_terms .' '. $this->description; |
|
| 2537 | + $exercise_description = $all_specific_terms.' '.$this->description; |
|
| 2538 | 2538 | $ic_slide->addValue("content", $exercise_description); |
| 2539 | 2539 | |
| 2540 | 2540 | $di = new ChamiloIndexer(); |
| 2541 | - isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english'; |
|
| 2541 | + isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; |
|
| 2542 | 2542 | $di->connectDb(NULL, NULL, $lang); |
| 2543 | 2543 | $di->addChunk($ic_slide); |
| 2544 | 2544 | |
@@ -2557,7 +2557,7 @@ discard block |
||
| 2557 | 2557 | function search_engine_edit() |
| 2558 | 2558 | { |
| 2559 | 2559 | // update search enchine and its values table if enabled |
| 2560 | - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { |
|
| 2560 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
| 2561 | 2561 | $course_id = api_get_course_id(); |
| 2562 | 2562 | |
| 2563 | 2563 | // actually, it consists on delete terms from db, |
@@ -2569,9 +2569,9 @@ discard block |
||
| 2569 | 2569 | $res = Database::query($sql); |
| 2570 | 2570 | |
| 2571 | 2571 | if (Database::num_rows($res) > 0) { |
| 2572 | - require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'); |
|
| 2573 | - require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'); |
|
| 2574 | - require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'); |
|
| 2572 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
| 2573 | + require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'); |
|
| 2574 | + require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'); |
|
| 2575 | 2575 | |
| 2576 | 2576 | $se_ref = Database::fetch_array($res); |
| 2577 | 2577 | $specific_fields = get_specific_field_list(); |
@@ -2582,7 +2582,7 @@ discard block |
||
| 2582 | 2582 | delete_all_specific_field_value($course_id, $specific_field['id'], TOOL_QUIZ, $this->id); |
| 2583 | 2583 | if (isset($_REQUEST[$specific_field['code']])) { |
| 2584 | 2584 | $sterms = trim($_REQUEST[$specific_field['code']]); |
| 2585 | - $all_specific_terms .= ' '. $sterms; |
|
| 2585 | + $all_specific_terms .= ' '.$sterms; |
|
| 2586 | 2586 | $sterms = explode(',', $sterms); |
| 2587 | 2587 | foreach ($sterms as $sterm) { |
| 2588 | 2588 | $ic_slide->addTerm(trim($sterm), $specific_field['code']); |
@@ -2598,17 +2598,17 @@ discard block |
||
| 2598 | 2598 | $xapian_data = array( |
| 2599 | 2599 | SE_COURSE_ID => $course_id, |
| 2600 | 2600 | SE_TOOL_ID => TOOL_QUIZ, |
| 2601 | - SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id), |
|
| 2602 | - SE_USER => (int)api_get_user_id(), |
|
| 2601 | + SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id), |
|
| 2602 | + SE_USER => (int) api_get_user_id(), |
|
| 2603 | 2603 | ); |
| 2604 | 2604 | $ic_slide->xapian_data = serialize($xapian_data); |
| 2605 | - $exercise_description = $all_specific_terms .' '. $this->description; |
|
| 2605 | + $exercise_description = $all_specific_terms.' '.$this->description; |
|
| 2606 | 2606 | $ic_slide->addValue("content", $exercise_description); |
| 2607 | 2607 | |
| 2608 | 2608 | $di = new ChamiloIndexer(); |
| 2609 | - isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english'; |
|
| 2609 | + isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; |
|
| 2610 | 2610 | $di->connectDb(NULL, NULL, $lang); |
| 2611 | - $di->remove_document((int)$se_ref['search_did']); |
|
| 2611 | + $di->remove_document((int) $se_ref['search_did']); |
|
| 2612 | 2612 | $di->addChunk($ic_slide); |
| 2613 | 2613 | |
| 2614 | 2614 | //index and return search engine document id |
@@ -2633,7 +2633,7 @@ discard block |
||
| 2633 | 2633 | function search_engine_delete() |
| 2634 | 2634 | { |
| 2635 | 2635 | // remove from search engine if enabled |
| 2636 | - if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian') ) { |
|
| 2636 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
| 2637 | 2637 | $course_id = api_get_course_id(); |
| 2638 | 2638 | $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); |
| 2639 | 2639 | $sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level IS NULL LIMIT 1'; |
@@ -2641,19 +2641,19 @@ discard block |
||
| 2641 | 2641 | $res = Database::query($sql); |
| 2642 | 2642 | if (Database::num_rows($res) > 0) { |
| 2643 | 2643 | $row = Database::fetch_array($res); |
| 2644 | - require_once(api_get_path(LIBRARY_PATH) .'search/ChamiloIndexer.class.php'); |
|
| 2644 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
| 2645 | 2645 | $di = new ChamiloIndexer(); |
| 2646 | - $di->remove_document((int)$row['search_did']); |
|
| 2646 | + $di->remove_document((int) $row['search_did']); |
|
| 2647 | 2647 | unset($di); |
| 2648 | 2648 | $tbl_quiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION); |
| 2649 | - foreach ( $this->questionList as $question_i) { |
|
| 2649 | + foreach ($this->questionList as $question_i) { |
|
| 2650 | 2650 | $sql = 'SELECT type FROM %s WHERE id=%s'; |
| 2651 | 2651 | $sql = sprintf($sql, $tbl_quiz_question, $question_i); |
| 2652 | 2652 | $qres = Database::query($sql); |
| 2653 | 2653 | if (Database::num_rows($qres) > 0) { |
| 2654 | 2654 | $qrow = Database::fetch_array($qres); |
| 2655 | 2655 | $objQuestion = Question::getInstance($qrow['type']); |
| 2656 | - $objQuestion = Question::read((int)$question_i); |
|
| 2656 | + $objQuestion = Question::read((int) $question_i); |
|
| 2657 | 2657 | $objQuestion->search_engine_edit($this->id, FALSE, TRUE); |
| 2658 | 2658 | unset($objQuestion); |
| 2659 | 2659 | } |
@@ -2664,7 +2664,7 @@ discard block |
||
| 2664 | 2664 | Database::query($sql); |
| 2665 | 2665 | |
| 2666 | 2666 | // remove terms from db |
| 2667 | - require_once api_get_path(LIBRARY_PATH) .'specific_fields_manager.lib.php'; |
|
| 2667 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
| 2668 | 2668 | delete_all_values_for_item($course_id, TOOL_QUIZ, $this->id); |
| 2669 | 2669 | } |
| 2670 | 2670 | } |
@@ -2759,7 +2759,7 @@ discard block |
||
| 2759 | 2759 | */ |
| 2760 | 2760 | public function copy_exercise() |
| 2761 | 2761 | { |
| 2762 | - $exercise_obj= new Exercise(); |
|
| 2762 | + $exercise_obj = new Exercise(); |
|
| 2763 | 2763 | $exercise_obj = $this; |
| 2764 | 2764 | |
| 2765 | 2765 | // force the creation of a new exercise |
@@ -2831,25 +2831,25 @@ discard block |
||
| 2831 | 2831 | $lp_id = 0; |
| 2832 | 2832 | } |
| 2833 | 2833 | if (empty($lp_item_id)) { |
| 2834 | - $lp_item_id = 0; |
|
| 2834 | + $lp_item_id = 0; |
|
| 2835 | 2835 | } |
| 2836 | 2836 | if (empty($lp_item_view_id)) { |
| 2837 | 2837 | $lp_item_view_id = 0; |
| 2838 | 2838 | } |
| 2839 | - $condition = ' WHERE exe_exo_id = ' . "'" . $this->id . "'" .' AND |
|
| 2840 | - exe_user_id = ' . "'" . api_get_user_id() . "'" . ' AND |
|
| 2841 | - c_id = ' . api_get_course_int_id() . ' AND |
|
| 2842 | - status = ' . "'" . Database::escape_string($status). "'" . ' AND |
|
| 2843 | - orig_lp_id = ' . "'" . $lp_id . "'" . ' AND |
|
| 2844 | - orig_lp_item_id = ' . "'" . $lp_item_id . "'" . ' AND |
|
| 2845 | - orig_lp_item_view_id = ' . "'" . $lp_item_view_id . "'" . ' AND |
|
| 2846 | - session_id = ' . "'" . api_get_session_id() . "' LIMIT 1"; //Adding limit 1 just in case |
|
| 2839 | + $condition = ' WHERE exe_exo_id = '."'".$this->id."'".' AND |
|
| 2840 | + exe_user_id = ' . "'".api_get_user_id()."'".' AND |
|
| 2841 | + c_id = ' . api_get_course_int_id().' AND |
|
| 2842 | + status = ' . "'".Database::escape_string($status)."'".' AND |
|
| 2843 | + orig_lp_id = ' . "'".$lp_id."'".' AND |
|
| 2844 | + orig_lp_item_id = ' . "'".$lp_item_id."'".' AND |
|
| 2845 | + orig_lp_item_view_id = ' . "'".$lp_item_view_id."'".' AND |
|
| 2846 | + session_id = ' . "'".api_get_session_id()."' LIMIT 1"; //Adding limit 1 just in case |
|
| 2847 | 2847 | |
| 2848 | 2848 | $sql_track = 'SELECT * FROM '.$track_exercises.$condition; |
| 2849 | 2849 | |
| 2850 | 2850 | $result = Database::query($sql_track); |
| 2851 | 2851 | $new_array = array(); |
| 2852 | - if (Database::num_rows($result) > 0 ) { |
|
| 2852 | + if (Database::num_rows($result) > 0) { |
|
| 2853 | 2853 | $new_array = Database::fetch_array($result, 'ASSOC'); |
| 2854 | 2854 | $new_array['num_exe'] = Database::num_rows($result); |
| 2855 | 2855 | } |
@@ -2892,12 +2892,12 @@ discard block |
||
| 2892 | 2892 | $questionList = array_map('intval', $questionList); |
| 2893 | 2893 | |
| 2894 | 2894 | $params = array( |
| 2895 | - 'exe_exo_id' => $this->id , |
|
| 2895 | + 'exe_exo_id' => $this->id, |
|
| 2896 | 2896 | 'exe_user_id' => api_get_user_id(), |
| 2897 | 2897 | 'c_id' => api_get_course_int_id(), |
| 2898 | 2898 | 'status' => 'incomplete', |
| 2899 | 2899 | 'session_id' => api_get_session_id(), |
| 2900 | - 'data_tracking' => implode(',', $questionList) , |
|
| 2900 | + 'data_tracking' => implode(',', $questionList), |
|
| 2901 | 2901 | 'start_date' => api_get_utc_datetime(), |
| 2902 | 2902 | 'orig_lp_id' => $safe_lp_id, |
| 2903 | 2903 | 'orig_lp_item_id' => $safe_lp_item_id, |
@@ -2929,7 +2929,7 @@ discard block |
||
| 2929 | 2929 | $nbrQuestions = $this->get_count_question_list(); |
| 2930 | 2930 | |
| 2931 | 2931 | $all_button = $html = $label = ''; |
| 2932 | - $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']):null; |
|
| 2932 | + $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']) : null; |
|
| 2933 | 2933 | |
| 2934 | 2934 | if ($this->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT && $this->type == ONE_PER_PAGE) { |
| 2935 | 2935 | $urlTitle = get_lang('ContinueTest'); |
@@ -2940,7 +2940,7 @@ discard block |
||
| 2940 | 2940 | |
| 2941 | 2941 | $html .= Display::url( |
| 2942 | 2942 | $urlTitle, |
| 2943 | - 'exercise_submit_modal.php?' . http_build_query([ |
|
| 2943 | + 'exercise_submit_modal.php?'.http_build_query([ |
|
| 2944 | 2944 | 'learnpath_id' => $safe_lp_id, |
| 2945 | 2945 | 'learnpath_item_id' => $safe_lp_item_id, |
| 2946 | 2946 | 'learnpath_item_view_id' => $safe_lp_item_view_id, |
@@ -2957,7 +2957,7 @@ discard block |
||
| 2957 | 2957 | 'data-size' => 'md' |
| 2958 | 2958 | ] |
| 2959 | 2959 | ); |
| 2960 | - $html .='<br />'; |
|
| 2960 | + $html .= '<br />'; |
|
| 2961 | 2961 | } else { |
| 2962 | 2962 | // User |
| 2963 | 2963 | if (api_is_allowed_to_session_edit()) { |
@@ -2982,7 +2982,7 @@ discard block |
||
| 2982 | 2982 | |
| 2983 | 2983 | //Next question |
| 2984 | 2984 | if (!empty($questions_in_media)) { |
| 2985 | - $questions_in_media = "['".implode("','",$questions_in_media)."']"; |
|
| 2985 | + $questions_in_media = "['".implode("','", $questions_in_media)."']"; |
|
| 2986 | 2986 | $all_button .= ' <a href="javascript://" class="'.$class.'" onclick="save_question_list('.$questions_in_media.'); ">'.$label.'</a>'; |
| 2987 | 2987 | } else { |
| 2988 | 2988 | $all_button .= ' <a href="javascript://" class="'.$class.'" onclick="save_now('.$question_id.', \'\', \''.$currentAnswer.'\'); ">'.$label.'</a>'; |
@@ -3000,7 +3000,7 @@ discard block |
||
| 3000 | 3000 | } |
| 3001 | 3001 | $class .= ' question-validate-btn'; // used to select it with jquery |
| 3002 | 3002 | $all_button = ' <a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>'; |
| 3003 | - $all_button .= ' ' . Display::span(null, ['id' => 'save_all_reponse']); |
|
| 3003 | + $all_button .= ' '.Display::span(null, ['id' => 'save_all_reponse']); |
|
| 3004 | 3004 | $html .= $all_button; |
| 3005 | 3005 | } |
| 3006 | 3006 | } |
@@ -3243,8 +3243,8 @@ discard block |
||
| 3243 | 3243 | $params = array(); |
| 3244 | 3244 | $params['course_id'] = $course_id; |
| 3245 | 3245 | $params['session_id'] = api_get_session_id(); |
| 3246 | - $params['user_id'] = isset($exe_info['exe_user_id'])? $exe_info['exe_user_id'] : api_get_user_id(); |
|
| 3247 | - $params['exercise_id'] = isset($exe_info['exe_exo_id'])? $exe_info['exe_exo_id'] : $this->id; |
|
| 3246 | + $params['user_id'] = isset($exe_info['exe_user_id']) ? $exe_info['exe_user_id'] : api_get_user_id(); |
|
| 3247 | + $params['exercise_id'] = isset($exe_info['exe_exo_id']) ? $exe_info['exe_exo_id'] : $this->id; |
|
| 3248 | 3248 | $params['question_id'] = $questionId; |
| 3249 | 3249 | $params['exe_id'] = isset($exe_info['exe_id']) ? $exe_info['exe_id'] : $exeId; |
| 3250 | 3250 | |
@@ -3297,7 +3297,7 @@ discard block |
||
| 3297 | 3297 | $answer = $objAnswerTmp->selectAnswer($answerId); |
| 3298 | 3298 | $answerComment = $objAnswerTmp->selectComment($answerId); |
| 3299 | 3299 | $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
| 3300 | - $answerWeighting = (float)$objAnswerTmp->selectWeighting($answerId); |
|
| 3300 | + $answerWeighting = (float) $objAnswerTmp->selectWeighting($answerId); |
|
| 3301 | 3301 | $answerAutoId = $objAnswerTmp->selectAutoId($answerId); |
| 3302 | 3302 | |
| 3303 | 3303 | if ($debug) { |
@@ -3307,7 +3307,7 @@ discard block |
||
| 3307 | 3307 | |
| 3308 | 3308 | // Delineation |
| 3309 | 3309 | $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
| 3310 | - $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
| 3310 | + $answer_delineation_destination = $objAnswerTmp->selectDestination(1); |
|
| 3311 | 3311 | |
| 3312 | 3312 | switch ($answerType) { |
| 3313 | 3313 | // for unique answer |
@@ -3320,7 +3320,7 @@ discard block |
||
| 3320 | 3320 | exe_id = '".$exeId."' AND |
| 3321 | 3321 | question_id= '".$questionId."'"; |
| 3322 | 3322 | $result = Database::query($sql); |
| 3323 | - $choice = Database::result($result,0,"answer"); |
|
| 3323 | + $choice = Database::result($result, 0, "answer"); |
|
| 3324 | 3324 | |
| 3325 | 3325 | $studentChoice = $choice == $answerAutoId ? 1 : 0; |
| 3326 | 3326 | if ($studentChoice) { |
@@ -3371,7 +3371,7 @@ discard block |
||
| 3371 | 3371 | } else { |
| 3372 | 3372 | // If no result then the user just hit don't know |
| 3373 | 3373 | $studentChoice = 3; |
| 3374 | - $questionScore += $doubt_score; |
|
| 3374 | + $questionScore += $doubt_score; |
|
| 3375 | 3375 | } |
| 3376 | 3376 | $totalScore = $questionScore; |
| 3377 | 3377 | break; |
@@ -3387,17 +3387,17 @@ discard block |
||
| 3387 | 3387 | } |
| 3388 | 3388 | |
| 3389 | 3389 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
| 3390 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
| 3390 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
| 3391 | 3391 | |
| 3392 | 3392 | if ($studentChoice) { |
| 3393 | - $questionScore +=$answerWeighting; |
|
| 3393 | + $questionScore += $answerWeighting; |
|
| 3394 | 3394 | } |
| 3395 | 3395 | } else { |
| 3396 | 3396 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
| 3397 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
| 3397 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
| 3398 | 3398 | |
| 3399 | 3399 | if (isset($studentChoice)) { |
| 3400 | - $questionScore += $answerWeighting; |
|
| 3400 | + $questionScore += $answerWeighting; |
|
| 3401 | 3401 | } |
| 3402 | 3402 | } |
| 3403 | 3403 | $totalScore += $answerWeighting; |
@@ -3415,16 +3415,16 @@ discard block |
||
| 3415 | 3415 | $choice[$ind] = 1; |
| 3416 | 3416 | } |
| 3417 | 3417 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
| 3418 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
| 3418 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
| 3419 | 3419 | if ($studentChoice) { |
| 3420 | - $questionScore +=$answerWeighting; |
|
| 3420 | + $questionScore += $answerWeighting; |
|
| 3421 | 3421 | } |
| 3422 | 3422 | } else { |
| 3423 | 3423 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
| 3424 | 3424 | if (isset($studentChoice)) { |
| 3425 | 3425 | $questionScore += $answerWeighting; |
| 3426 | 3426 | } |
| 3427 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
| 3427 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
| 3428 | 3428 | } |
| 3429 | 3429 | $totalScore += $answerWeighting; |
| 3430 | 3430 | if ($debug) error_log("studentChoice: $studentChoice"); |
@@ -3436,7 +3436,7 @@ discard block |
||
| 3436 | 3436 | $resultans = Database::query($sql); |
| 3437 | 3437 | while ($row = Database::fetch_array($resultans)) { |
| 3438 | 3438 | $ind = $row['answer']; |
| 3439 | - $result = explode(':',$ind); |
|
| 3439 | + $result = explode(':', $ind); |
|
| 3440 | 3440 | if (isset($result[0])) { |
| 3441 | 3441 | $my_answer_id = isset($result[0]) ? $result[0] : ''; |
| 3442 | 3442 | $option = isset($result[1]) ? $result[1] : ''; |
@@ -3556,10 +3556,10 @@ discard block |
||
| 3556 | 3556 | } |
| 3557 | 3557 | // adds the piece of text that is before the blank |
| 3558 | 3558 | //and ends with '[' into a general storage array |
| 3559 | - $real_text[] = api_substr($temp, 0, $pos +1); |
|
| 3560 | - $answer .= api_substr($temp, 0, $pos +1); |
|
| 3559 | + $real_text[] = api_substr($temp, 0, $pos + 1); |
|
| 3560 | + $answer .= api_substr($temp, 0, $pos + 1); |
|
| 3561 | 3561 | //take the string remaining (after the last "[" we found) |
| 3562 | - $temp = api_substr($temp, $pos +1); |
|
| 3562 | + $temp = api_substr($temp, $pos + 1); |
|
| 3563 | 3563 | // quit the loop if there are no more blanks, and update $pos to the position of next ']' |
| 3564 | 3564 | if (($pos = api_strpos($temp, ']')) === false) { |
| 3565 | 3565 | // adds the end of the text |
@@ -3595,7 +3595,7 @@ discard block |
||
| 3595 | 3595 | //put the contents of the [] answer tag into correct_tags[] |
| 3596 | 3596 | $correct_tags[] = api_substr($temp, 0, $pos); |
| 3597 | 3597 | $j++; |
| 3598 | - $temp = api_substr($temp, $pos +1); |
|
| 3598 | + $temp = api_substr($temp, $pos + 1); |
|
| 3599 | 3599 | } |
| 3600 | 3600 | $answer = ''; |
| 3601 | 3601 | $real_correct_tags = $correct_tags; |
@@ -3618,7 +3618,7 @@ discard block |
||
| 3618 | 3618 | } elseif (!empty($user_tags[$i])) { |
| 3619 | 3619 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
| 3620 | 3620 | // adds the word in red at the end of the string, and strikes it |
| 3621 | - $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>'; |
|
| 3621 | + $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>'; |
|
| 3622 | 3622 | } else { |
| 3623 | 3623 | // adds a tabulation if no word has been typed by the student |
| 3624 | 3624 | $answer .= ''; // remove that causes issue |
@@ -3637,17 +3637,17 @@ discard block |
||
| 3637 | 3637 | } elseif (!empty ($user_tags[$i])) { |
| 3638 | 3638 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
| 3639 | 3639 | // adds the word in red at the end of the string, and strikes it |
| 3640 | - $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>'; |
|
| 3640 | + $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>'; |
|
| 3641 | 3641 | } else { |
| 3642 | 3642 | // adds a tabulation if no word has been typed by the student |
| 3643 | - $answer .= ''; // remove that causes issue |
|
| 3643 | + $answer .= ''; // remove that causes issue |
|
| 3644 | 3644 | } |
| 3645 | 3645 | } |
| 3646 | 3646 | |
| 3647 | 3647 | // adds the correct word, followed by ] to close the blank |
| 3648 | - $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]'; |
|
| 3649 | - if (isset($real_text[$i +1])) { |
|
| 3650 | - $answer .= $real_text[$i +1]; |
|
| 3648 | + $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]'; |
|
| 3649 | + if (isset($real_text[$i + 1])) { |
|
| 3650 | + $answer .= $real_text[$i + 1]; |
|
| 3651 | 3651 | } |
| 3652 | 3652 | } |
| 3653 | 3653 | } else { |
@@ -3780,10 +3780,10 @@ discard block |
||
| 3780 | 3780 | } |
| 3781 | 3781 | // adds the piece of text that is before the blank |
| 3782 | 3782 | //and ends with '[' into a general storage array |
| 3783 | - $realText[] = api_substr($temp, 0, $pos +1); |
|
| 3784 | - $answer .= api_substr($temp, 0, $pos +1); |
|
| 3783 | + $realText[] = api_substr($temp, 0, $pos + 1); |
|
| 3784 | + $answer .= api_substr($temp, 0, $pos + 1); |
|
| 3785 | 3785 | //take the string remaining (after the last "[" we found) |
| 3786 | - $temp = api_substr($temp, $pos +1); |
|
| 3786 | + $temp = api_substr($temp, $pos + 1); |
|
| 3787 | 3787 | // quit the loop if there are no more blanks, and update $pos to the position of next ']' |
| 3788 | 3788 | if (($pos = api_strpos($temp, ']')) === false) { |
| 3789 | 3789 | // adds the end of the text |
@@ -3817,7 +3817,7 @@ discard block |
||
| 3817 | 3817 | //put the contents of the [] answer tag into correct_tags[] |
| 3818 | 3818 | $correctTags[] = api_substr($temp, 0, $pos); |
| 3819 | 3819 | $j++; |
| 3820 | - $temp = api_substr($temp, $pos +1); |
|
| 3820 | + $temp = api_substr($temp, $pos + 1); |
|
| 3821 | 3821 | } |
| 3822 | 3822 | $answer = ''; |
| 3823 | 3823 | $realCorrectTags = $correctTags; |
@@ -3826,7 +3826,7 @@ discard block |
||
| 3826 | 3826 | $queryfill = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." |
| 3827 | 3827 | WHERE |
| 3828 | 3828 | exe_id = '".$exeId."' AND |
| 3829 | - question_id= ".intval($questionId) ; |
|
| 3829 | + question_id= ".intval($questionId); |
|
| 3830 | 3830 | $resfill = Database::query($queryfill); |
| 3831 | 3831 | $rowFill = Database::fetch_assoc($resfill); |
| 3832 | 3832 | $answer = $rowFill['answer']; |
@@ -3849,21 +3849,21 @@ discard block |
||
| 3849 | 3849 | } elseif (!empty($userTags[$i])) { |
| 3850 | 3850 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
| 3851 | 3851 | // adds the word in red at the end of the string, and strikes it |
| 3852 | - $answer .= '<font color="red"><s>' . $userTags[$i] . '</s></font>'; |
|
| 3852 | + $answer .= '<font color="red"><s>'.$userTags[$i].'</s></font>'; |
|
| 3853 | 3853 | } else { |
| 3854 | 3854 | // adds a tabulation if no word has been typed by the student |
| 3855 | 3855 | $answer .= ''; // remove that causes issue |
| 3856 | 3856 | } |
| 3857 | 3857 | // adds the correct word, followed by ] to close the blank |
| 3858 | - $answer .= ' / <font color="green"><b>' . $realCorrectTags[$i] . '</b></font>]'; |
|
| 3859 | - if (isset($realText[$i +1])) { |
|
| 3860 | - $answer .= $realText[$i +1]; |
|
| 3858 | + $answer .= ' / <font color="green"><b>'.$realCorrectTags[$i].'</b></font>]'; |
|
| 3859 | + if (isset($realText[$i + 1])) { |
|
| 3860 | + $answer .= $realText[$i + 1]; |
|
| 3861 | 3861 | } |
| 3862 | 3862 | } |
| 3863 | 3863 | break; |
| 3864 | 3864 | case FREE_ANSWER: |
| 3865 | 3865 | if ($from_database) { |
| 3866 | - $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
|
| 3866 | + $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
|
| 3867 | 3867 | WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'"; |
| 3868 | 3868 | $resq = Database::query($query); |
| 3869 | 3869 | $data = Database::fetch_array($resq); |
@@ -3874,9 +3874,9 @@ discard block |
||
| 3874 | 3874 | $questionScore = $data['marks']; |
| 3875 | 3875 | |
| 3876 | 3876 | if ($questionScore == -1) { |
| 3877 | - $totalScore+= 0; |
|
| 3877 | + $totalScore += 0; |
|
| 3878 | 3878 | } else { |
| 3879 | - $totalScore+= $questionScore; |
|
| 3879 | + $totalScore += $questionScore; |
|
| 3880 | 3880 | } |
| 3881 | 3881 | if ($questionScore == '') { |
| 3882 | 3882 | $questionScore = 0; |
@@ -3897,14 +3897,14 @@ discard block |
||
| 3897 | 3897 | $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
| 3898 | 3898 | WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'"; |
| 3899 | 3899 | $resq = Database::query($query); |
| 3900 | - $choice = Database::result($resq,0,'answer'); |
|
| 3900 | + $choice = Database::result($resq, 0, 'answer'); |
|
| 3901 | 3901 | $choice = str_replace('\r\n', '', $choice); |
| 3902 | 3902 | $choice = stripslashes($choice); |
| 3903 | - $questionScore = Database::result($resq,0,"marks"); |
|
| 3903 | + $questionScore = Database::result($resq, 0, "marks"); |
|
| 3904 | 3904 | if ($questionScore == -1) { |
| 3905 | - $totalScore+=0; |
|
| 3905 | + $totalScore += 0; |
|
| 3906 | 3906 | } else { |
| 3907 | - $totalScore+=$questionScore; |
|
| 3907 | + $totalScore += $questionScore; |
|
| 3908 | 3908 | } |
| 3909 | 3909 | $arrques = $questionName; |
| 3910 | 3910 | $arrans = $choice; |
@@ -3949,7 +3949,7 @@ discard block |
||
| 3949 | 3949 | |
| 3950 | 3950 | while ($a_answers = Database::fetch_array($res_answers)) { |
| 3951 | 3951 | $i_answer_id = $a_answers['id']; //3 |
| 3952 | - $s_answer_label = $a_answers['answer']; // your daddy - your mother |
|
| 3952 | + $s_answer_label = $a_answers['answer']; // your daddy - your mother |
|
| 3953 | 3953 | $i_answer_correct_answer = $a_answers['correct']; //1 - 2 |
| 3954 | 3954 | $i_answer_id_auto = $a_answers['id_auto']; // 3 - 4 |
| 3955 | 3955 | |
@@ -4004,8 +4004,8 @@ discard block |
||
| 4004 | 4004 | $user_answer = ''; |
| 4005 | 4005 | } |
| 4006 | 4006 | echo '<tr>'; |
| 4007 | - echo '<td>' . $s_answer_label . '</td>'; |
|
| 4008 | - echo '<td>' . $user_answer; |
|
| 4007 | + echo '<td>'.$s_answer_label.'</td>'; |
|
| 4008 | + echo '<td>'.$user_answer; |
|
| 4009 | 4009 | |
| 4010 | 4010 | if (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) { |
| 4011 | 4011 | if (isset($real_list[$i_answer_correct_answer]) && $showTotalScoreAndUserChoices == false) { |
@@ -4113,7 +4113,7 @@ discard block |
||
| 4113 | 4113 | if ($from_database) { |
| 4114 | 4114 | // getting the user answer |
| 4115 | 4115 | $TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); |
| 4116 | - $query = "SELECT hotspot_correct, hotspot_coordinate |
|
| 4116 | + $query = "SELECT hotspot_correct, hotspot_coordinate |
|
| 4117 | 4117 | FROM $TBL_TRACK_HOTSPOT |
| 4118 | 4118 | WHERE |
| 4119 | 4119 | hotspot_exe_id = '".$exeId."' AND |
@@ -4121,20 +4121,20 @@ discard block |
||
| 4121 | 4121 | hotspot_answer_id='1'"; |
| 4122 | 4122 | //by default we take 1 because it's a delineation |
| 4123 | 4123 | $resq = Database::query($query); |
| 4124 | - $row = Database::fetch_array($resq,'ASSOC'); |
|
| 4124 | + $row = Database::fetch_array($resq, 'ASSOC'); |
|
| 4125 | 4125 | |
| 4126 | 4126 | $choice = $row['hotspot_correct']; |
| 4127 | 4127 | $user_answer = $row['hotspot_coordinate']; |
| 4128 | 4128 | |
| 4129 | 4129 | // THIS is very important otherwise the poly_compile will throw an error!! |
| 4130 | 4130 | // round-up the coordinates |
| 4131 | - $coords = explode('/',$user_answer); |
|
| 4131 | + $coords = explode('/', $user_answer); |
|
| 4132 | 4132 | $user_array = ''; |
| 4133 | 4133 | foreach ($coords as $coord) { |
| 4134 | - list($x,$y) = explode(';',$coord); |
|
| 4134 | + list($x, $y) = explode(';', $coord); |
|
| 4135 | 4135 | $user_array .= round($x).';'.round($y).'/'; |
| 4136 | 4136 | } |
| 4137 | - $user_array = substr($user_array,0,-1); |
|
| 4137 | + $user_array = substr($user_array, 0, -1); |
|
| 4138 | 4138 | } else { |
| 4139 | 4139 | if (!empty($studentChoice)) { |
| 4140 | 4140 | $newquestionList[] = $questionId; |
@@ -4144,7 +4144,7 @@ discard block |
||
| 4144 | 4144 | $studentChoice = $choice[$answerId]; |
| 4145 | 4145 | $questionScore += $answerWeighting; |
| 4146 | 4146 | |
| 4147 | - if ($hotspot_delineation_result[1]==1) { |
|
| 4147 | + if ($hotspot_delineation_result[1] == 1) { |
|
| 4148 | 4148 | $totalScore += $answerWeighting; //adding the total |
| 4149 | 4149 | } |
| 4150 | 4150 | } |
@@ -4283,13 +4283,13 @@ discard block |
||
| 4283 | 4283 | $user_answer = $_SESSION['exerciseResultCoordinates'][$questionId]; |
| 4284 | 4284 | |
| 4285 | 4285 | //round-up the coordinates |
| 4286 | - $coords = explode('/',$user_answer); |
|
| 4286 | + $coords = explode('/', $user_answer); |
|
| 4287 | 4287 | $user_array = ''; |
| 4288 | 4288 | foreach ($coords as $coord) { |
| 4289 | - list($x,$y) = explode(';',$coord); |
|
| 4289 | + list($x, $y) = explode(';', $coord); |
|
| 4290 | 4290 | $user_array .= round($x).';'.round($y).'/'; |
| 4291 | 4291 | } |
| 4292 | - $user_array = substr($user_array,0,-1); |
|
| 4292 | + $user_array = substr($user_array, 0, -1); |
|
| 4293 | 4293 | |
| 4294 | 4294 | if ($next) { |
| 4295 | 4295 | |
@@ -4316,7 +4316,7 @@ discard block |
||
| 4316 | 4316 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); |
| 4317 | 4317 | // //this is an area in pixels |
| 4318 | 4318 | if ($debug > 0) { |
| 4319 | - error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); |
|
| 4319 | + error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); |
|
| 4320 | 4320 | } |
| 4321 | 4321 | |
| 4322 | 4322 | if ($overlap < 1) { |
@@ -4329,43 +4329,43 @@ discard block |
||
| 4329 | 4329 | // that is overlapped by the user's polygon |
| 4330 | 4330 | $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
| 4331 | 4331 | if ($debug > 1) { |
| 4332 | - error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); |
|
| 4332 | + error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); |
|
| 4333 | 4333 | } |
| 4334 | 4334 | // the final missing area is the percentage of the initial polygon |
| 4335 | 4335 | // that is not overlapped by the user's polygon |
| 4336 | 4336 | $final_missing = 100 - $final_overlap; |
| 4337 | 4337 | if ($debug > 1) { |
| 4338 | - error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); |
|
| 4338 | + error_log(__LINE__.' - Final missing is '.$final_missing, 0); |
|
| 4339 | 4339 | } |
| 4340 | 4340 | // the final excess area is the percentage of the initial polygon's size |
| 4341 | 4341 | // that is covered by the user's polygon outside of the initial polygon |
| 4342 | 4342 | $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
| 4343 | 4343 | if ($debug > 1) { |
| 4344 | - error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); |
|
| 4344 | + error_log(__LINE__.' - Final excess is '.$final_excess, 0); |
|
| 4345 | 4345 | } |
| 4346 | 4346 | } |
| 4347 | 4347 | |
| 4348 | 4348 | //checking the destination parameters parsing the "@@" |
| 4349 | - $destination_items= explode('@@', $answerDestination); |
|
| 4349 | + $destination_items = explode('@@', $answerDestination); |
|
| 4350 | 4350 | $threadhold_total = $destination_items[0]; |
| 4351 | - $threadhold_items=explode(';',$threadhold_total); |
|
| 4351 | + $threadhold_items = explode(';', $threadhold_total); |
|
| 4352 | 4352 | $threadhold1 = $threadhold_items[0]; // overlap |
| 4353 | 4353 | $threadhold2 = $threadhold_items[1]; // excess |
| 4354 | - $threadhold3 = $threadhold_items[2]; //missing |
|
| 4354 | + $threadhold3 = $threadhold_items[2]; //missing |
|
| 4355 | 4355 | |
| 4356 | 4356 | // if is delineation |
| 4357 | - if ($answerId===1) { |
|
| 4357 | + if ($answerId === 1) { |
|
| 4358 | 4358 | //setting colors |
| 4359 | - if ($final_overlap>=$threadhold1) { |
|
| 4360 | - $overlap_color=true; //echo 'a'; |
|
| 4359 | + if ($final_overlap >= $threadhold1) { |
|
| 4360 | + $overlap_color = true; //echo 'a'; |
|
| 4361 | 4361 | } |
| 4362 | 4362 | //echo $excess.'-'.$threadhold2; |
| 4363 | - if ($final_excess<=$threadhold2) { |
|
| 4364 | - $excess_color=true; //echo 'b'; |
|
| 4363 | + if ($final_excess <= $threadhold2) { |
|
| 4364 | + $excess_color = true; //echo 'b'; |
|
| 4365 | 4365 | } |
| 4366 | 4366 | //echo '--------'.$missing.'-'.$threadhold3; |
| 4367 | - if ($final_missing<=$threadhold3) { |
|
| 4368 | - $missing_color=true; //echo 'c'; |
|
| 4367 | + if ($final_missing <= $threadhold3) { |
|
| 4368 | + $missing_color = true; //echo 'c'; |
|
| 4369 | 4369 | } |
| 4370 | 4370 | |
| 4371 | 4371 | // if pass |
@@ -4374,67 +4374,67 @@ discard block |
||
| 4374 | 4374 | $final_missing <= $threadhold3 && |
| 4375 | 4375 | $final_excess <= $threadhold2 |
| 4376 | 4376 | ) { |
| 4377 | - $next=1; //go to the oars |
|
| 4378 | - $result_comment=get_lang('Acceptable'); |
|
| 4379 | - $final_answer = 1; // do not update with update_exercise_attempt |
|
| 4377 | + $next = 1; //go to the oars |
|
| 4378 | + $result_comment = get_lang('Acceptable'); |
|
| 4379 | + $final_answer = 1; // do not update with update_exercise_attempt |
|
| 4380 | 4380 | } else { |
| 4381 | - $next=0; |
|
| 4382 | - $result_comment=get_lang('Unacceptable'); |
|
| 4383 | - $comment=$answerDestination=$objAnswerTmp->selectComment(1); |
|
| 4384 | - $answerDestination=$objAnswerTmp->selectDestination(1); |
|
| 4381 | + $next = 0; |
|
| 4382 | + $result_comment = get_lang('Unacceptable'); |
|
| 4383 | + $comment = $answerDestination = $objAnswerTmp->selectComment(1); |
|
| 4384 | + $answerDestination = $objAnswerTmp->selectDestination(1); |
|
| 4385 | 4385 | //checking the destination parameters parsing the "@@" |
| 4386 | - $destination_items= explode('@@', $answerDestination); |
|
| 4386 | + $destination_items = explode('@@', $answerDestination); |
|
| 4387 | 4387 | } |
| 4388 | - } elseif($answerId>1) { |
|
| 4388 | + } elseif ($answerId > 1) { |
|
| 4389 | 4389 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
| 4390 | - if ($debug>0) { |
|
| 4391 | - error_log(__LINE__.' - answerId is of type noerror',0); |
|
| 4390 | + if ($debug > 0) { |
|
| 4391 | + error_log(__LINE__.' - answerId is of type noerror', 0); |
|
| 4392 | 4392 | } |
| 4393 | 4393 | //type no error shouldn't be treated |
| 4394 | 4394 | $next = 1; |
| 4395 | 4395 | continue; |
| 4396 | 4396 | } |
| 4397 | - if ($debug>0) { |
|
| 4398 | - error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0); |
|
| 4397 | + if ($debug > 0) { |
|
| 4398 | + error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); |
|
| 4399 | 4399 | } |
| 4400 | 4400 | //check the intersection between the oar and the user |
| 4401 | 4401 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
| 4402 | 4402 | //echo 'official';print_r($x_list);print_r($y_list); |
| 4403 | 4403 | //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list); |
| 4404 | - $inter= $result['success']; |
|
| 4404 | + $inter = $result['success']; |
|
| 4405 | 4405 | |
| 4406 | 4406 | //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
| 4407 | - $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
|
| 4407 | + $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId); |
|
| 4408 | 4408 | |
| 4409 | - $poly_answer = convert_coordinates($delineation_cord,'|'); |
|
| 4410 | - $max_coord = poly_get_max($poly_user,$poly_answer); |
|
| 4411 | - $poly_answer_compiled = poly_compile($poly_answer,$max_coord); |
|
| 4412 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
| 4409 | + $poly_answer = convert_coordinates($delineation_cord, '|'); |
|
| 4410 | + $max_coord = poly_get_max($poly_user, $poly_answer); |
|
| 4411 | + $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
|
| 4412 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
| 4413 | 4413 | |
| 4414 | 4414 | if ($overlap == false) { |
| 4415 | 4415 | //all good, no overlap |
| 4416 | 4416 | $next = 1; |
| 4417 | 4417 | continue; |
| 4418 | 4418 | } else { |
| 4419 | - if ($debug>0) { |
|
| 4420 | - error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0); |
|
| 4419 | + if ($debug > 0) { |
|
| 4420 | + error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); |
|
| 4421 | 4421 | } |
| 4422 | 4422 | $organs_at_risk_hit++; |
| 4423 | 4423 | //show the feedback |
| 4424 | - $next=0; |
|
| 4425 | - $comment=$answerDestination=$objAnswerTmp->selectComment($answerId); |
|
| 4426 | - $answerDestination=$objAnswerTmp->selectDestination($answerId); |
|
| 4427 | - |
|
| 4428 | - $destination_items= explode('@@', $answerDestination); |
|
| 4429 | - $try_hotspot=$destination_items[1]; |
|
| 4430 | - $lp_hotspot=$destination_items[2]; |
|
| 4431 | - $select_question_hotspot=$destination_items[3]; |
|
| 4432 | - $url_hotspot=$destination_items[4]; |
|
| 4424 | + $next = 0; |
|
| 4425 | + $comment = $answerDestination = $objAnswerTmp->selectComment($answerId); |
|
| 4426 | + $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
| 4427 | + |
|
| 4428 | + $destination_items = explode('@@', $answerDestination); |
|
| 4429 | + $try_hotspot = $destination_items[1]; |
|
| 4430 | + $lp_hotspot = $destination_items[2]; |
|
| 4431 | + $select_question_hotspot = $destination_items[3]; |
|
| 4432 | + $url_hotspot = $destination_items[4]; |
|
| 4433 | 4433 | } |
| 4434 | 4434 | } |
| 4435 | 4435 | } else { // the first delineation feedback |
| 4436 | - if ($debug>0) { |
|
| 4437 | - error_log(__LINE__.' first',0); |
|
| 4436 | + if ($debug > 0) { |
|
| 4437 | + error_log(__LINE__.' first', 0); |
|
| 4438 | 4438 | } |
| 4439 | 4439 | } |
| 4440 | 4440 | } elseif (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) { |
@@ -4442,7 +4442,7 @@ discard block |
||
| 4442 | 4442 | echo Display::tag('td', $answerMatching[$answerId]); |
| 4443 | 4443 | echo Display::tag( |
| 4444 | 4444 | 'td', |
| 4445 | - "$user_answer / " . Display::tag( |
|
| 4445 | + "$user_answer / ".Display::tag( |
|
| 4446 | 4446 | 'strong', |
| 4447 | 4447 | $answerMatching[$answerCorrect], |
| 4448 | 4448 | ['style' => 'color: #008000; font-weight: bold;'] |
@@ -4594,7 +4594,7 @@ discard block |
||
| 4594 | 4594 | $questionId, |
| 4595 | 4595 | $nano, |
| 4596 | 4596 | $results_disabled |
| 4597 | - ) . '</td> |
|
| 4597 | + ).'</td> |
|
| 4598 | 4598 | </tr> |
| 4599 | 4599 | </table>'; |
| 4600 | 4600 | break; |
@@ -4655,7 +4655,7 @@ discard block |
||
| 4655 | 4655 | |
| 4656 | 4656 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels |
| 4657 | 4657 | if ($debug > 0) { |
| 4658 | - error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); |
|
| 4658 | + error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); |
|
| 4659 | 4659 | } |
| 4660 | 4660 | if ($overlap < 1) { |
| 4661 | 4661 | //shortcut to avoid complicated calculations |
@@ -4666,17 +4666,17 @@ discard block |
||
| 4666 | 4666 | // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon |
| 4667 | 4667 | $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
| 4668 | 4668 | if ($debug > 1) { |
| 4669 | - error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); |
|
| 4669 | + error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); |
|
| 4670 | 4670 | } |
| 4671 | 4671 | // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon |
| 4672 | 4672 | $final_missing = 100 - $final_overlap; |
| 4673 | 4673 | if ($debug > 1) { |
| 4674 | - error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); |
|
| 4674 | + error_log(__LINE__.' - Final missing is '.$final_missing, 0); |
|
| 4675 | 4675 | } |
| 4676 | 4676 | // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon |
| 4677 | 4677 | $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
| 4678 | 4678 | if ($debug > 1) { |
| 4679 | - error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); |
|
| 4679 | + error_log(__LINE__.' - Final excess is '.$final_excess, 0); |
|
| 4680 | 4680 | } |
| 4681 | 4681 | } |
| 4682 | 4682 | |
@@ -4686,7 +4686,7 @@ discard block |
||
| 4686 | 4686 | $threadhold_items = explode(';', $threadhold_total); |
| 4687 | 4687 | $threadhold1 = $threadhold_items[0]; // overlap |
| 4688 | 4688 | $threadhold2 = $threadhold_items[1]; // excess |
| 4689 | - $threadhold3 = $threadhold_items[2]; //missing |
|
| 4689 | + $threadhold3 = $threadhold_items[2]; //missing |
|
| 4690 | 4690 | // if is delineation |
| 4691 | 4691 | if ($answerId === 1) { |
| 4692 | 4692 | //setting colors |
@@ -4718,14 +4718,14 @@ discard block |
||
| 4718 | 4718 | } elseif ($answerId > 1) { |
| 4719 | 4719 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
| 4720 | 4720 | if ($debug > 0) { |
| 4721 | - error_log(__LINE__ . ' - answerId is of type noerror', 0); |
|
| 4721 | + error_log(__LINE__.' - answerId is of type noerror', 0); |
|
| 4722 | 4722 | } |
| 4723 | 4723 | //type no error shouldn't be treated |
| 4724 | 4724 | $next = 1; |
| 4725 | 4725 | continue; |
| 4726 | 4726 | } |
| 4727 | 4727 | if ($debug > 0) { |
| 4728 | - error_log(__LINE__ . ' - answerId is >1 so we\'re probably in OAR', 0); |
|
| 4728 | + error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); |
|
| 4729 | 4729 | } |
| 4730 | 4730 | //check the intersection between the oar and the user |
| 4731 | 4731 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
@@ -4739,7 +4739,7 @@ discard block |
||
| 4739 | 4739 | $poly_answer = convert_coordinates($delineation_cord, '|'); |
| 4740 | 4740 | $max_coord = poly_get_max($poly_user, $poly_answer); |
| 4741 | 4741 | $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
| 4742 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
| 4742 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
| 4743 | 4743 | |
| 4744 | 4744 | if ($overlap == false) { |
| 4745 | 4745 | //all good, no overlap |
@@ -4747,7 +4747,7 @@ discard block |
||
| 4747 | 4747 | continue; |
| 4748 | 4748 | } else { |
| 4749 | 4749 | if ($debug > 0) { |
| 4750 | - error_log(__LINE__ . ' - Overlap is ' . $overlap . ': OAR hit', 0); |
|
| 4750 | + error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); |
|
| 4751 | 4751 | } |
| 4752 | 4752 | $organs_at_risk_hit++; |
| 4753 | 4753 | //show the feedback |
@@ -4759,12 +4759,12 @@ discard block |
||
| 4759 | 4759 | $try_hotspot = $destination_items[1]; |
| 4760 | 4760 | $lp_hotspot = $destination_items[2]; |
| 4761 | 4761 | $select_question_hotspot = $destination_items[3]; |
| 4762 | - $url_hotspot=$destination_items[4]; |
|
| 4762 | + $url_hotspot = $destination_items[4]; |
|
| 4763 | 4763 | } |
| 4764 | 4764 | } |
| 4765 | 4765 | } else { // the first delineation feedback |
| 4766 | 4766 | if ($debug > 0) { |
| 4767 | - error_log(__LINE__ . ' first', 0); |
|
| 4767 | + error_log(__LINE__.' first', 0); |
|
| 4768 | 4768 | } |
| 4769 | 4769 | } |
| 4770 | 4770 | break; |
@@ -4786,7 +4786,7 @@ discard block |
||
| 4786 | 4786 | echo Display::tag('td', $answerMatching[$answerId]); |
| 4787 | 4787 | echo Display::tag( |
| 4788 | 4788 | 'td', |
| 4789 | - "$user_answer / " . Display::tag( |
|
| 4789 | + "$user_answer / ".Display::tag( |
|
| 4790 | 4790 | 'strong', |
| 4791 | 4791 | $answerMatching[$answerCorrect], |
| 4792 | 4792 | ['style' => 'color: #008000; font-weight: bold;'] |
@@ -4872,7 +4872,7 @@ discard block |
||
| 4872 | 4872 | // we use the results from the session (from_db=0) |
| 4873 | 4873 | // TODO Change this, because it is wrong to show the user |
| 4874 | 4874 | // some results that haven't been stored in the database yet |
| 4875 | - if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { |
|
| 4875 | + if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION) { |
|
| 4876 | 4876 | |
| 4877 | 4877 | if ($debug) error_log('$from AND this is a hotspot kind of question '); |
| 4878 | 4878 | |
@@ -4881,19 +4881,19 @@ discard block |
||
| 4881 | 4881 | if ($answerType == HOT_SPOT_DELINEATION) { |
| 4882 | 4882 | if (0) { |
| 4883 | 4883 | if ($overlap_color) { |
| 4884 | - $overlap_color='green'; |
|
| 4884 | + $overlap_color = 'green'; |
|
| 4885 | 4885 | } else { |
| 4886 | - $overlap_color='red'; |
|
| 4886 | + $overlap_color = 'red'; |
|
| 4887 | 4887 | } |
| 4888 | 4888 | if ($missing_color) { |
| 4889 | - $missing_color='green'; |
|
| 4889 | + $missing_color = 'green'; |
|
| 4890 | 4890 | } else { |
| 4891 | - $missing_color='red'; |
|
| 4891 | + $missing_color = 'red'; |
|
| 4892 | 4892 | } |
| 4893 | 4893 | if ($excess_color) { |
| 4894 | - $excess_color='green'; |
|
| 4894 | + $excess_color = 'green'; |
|
| 4895 | 4895 | } else { |
| 4896 | - $excess_color='red'; |
|
| 4896 | + $excess_color = 'red'; |
|
| 4897 | 4897 | } |
| 4898 | 4898 | if (!is_numeric($final_overlap)) { |
| 4899 | 4899 | $final_overlap = 0; |
@@ -4905,33 +4905,33 @@ discard block |
||
| 4905 | 4905 | $final_excess = 0; |
| 4906 | 4906 | } |
| 4907 | 4907 | |
| 4908 | - if ($final_overlap>100) { |
|
| 4908 | + if ($final_overlap > 100) { |
|
| 4909 | 4909 | $final_overlap = 100; |
| 4910 | 4910 | } |
| 4911 | 4911 | |
| 4912 | - $table_resume='<table class="data_table"> |
|
| 4912 | + $table_resume = '<table class="data_table"> |
|
| 4913 | 4913 | <tr class="row_odd" > |
| 4914 | 4914 | <td></td> |
| 4915 | - <td ><b>' . get_lang('Requirements') . '</b></td> |
|
| 4916 | - <td><b>' . get_lang('YourAnswer') . '</b></td> |
|
| 4915 | + <td ><b>' . get_lang('Requirements').'</b></td> |
|
| 4916 | + <td><b>' . get_lang('YourAnswer').'</b></td> |
|
| 4917 | 4917 | </tr> |
| 4918 | 4918 | <tr class="row_even"> |
| 4919 | - <td><b>' . get_lang('Overlap') . '</b></td> |
|
| 4920 | - <td>' . get_lang('Min') . ' ' . $threadhold1 . '</td> |
|
| 4921 | - <td><div style="color:' . $overlap_color . '">' |
|
| 4922 | - . (($final_overlap < 0) ? 0 : intval($final_overlap)) . '</div></td> |
|
| 4919 | + <td><b>' . get_lang('Overlap').'</b></td> |
|
| 4920 | + <td>' . get_lang('Min').' '.$threadhold1.'</td> |
|
| 4921 | + <td><div style="color:' . $overlap_color.'">' |
|
| 4922 | + . (($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
| 4923 | 4923 | </tr> |
| 4924 | 4924 | <tr> |
| 4925 | - <td><b>' . get_lang('Excess') . '</b></td> |
|
| 4926 | - <td>' . get_lang('Max') . ' ' . $threadhold2 . '</td> |
|
| 4927 | - <td><div style="color:' . $excess_color . '">' |
|
| 4928 | - . (($final_excess < 0) ? 0 : intval($final_excess)) . '</div></td> |
|
| 4925 | + <td><b>' . get_lang('Excess').'</b></td> |
|
| 4926 | + <td>' . get_lang('Max').' '.$threadhold2.'</td> |
|
| 4927 | + <td><div style="color:' . $excess_color.'">' |
|
| 4928 | + . (($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
| 4929 | 4929 | </tr> |
| 4930 | 4930 | <tr class="row_even"> |
| 4931 | - <td><b>' . get_lang('Missing') . '</b></td> |
|
| 4932 | - <td>' . get_lang('Max') . ' ' . $threadhold3 . '</td> |
|
| 4933 | - <td><div style="color:' . $missing_color . '">' |
|
| 4934 | - . (($final_missing < 0) ? 0 : intval($final_missing)) . '</div></td> |
|
| 4931 | + <td><b>' . get_lang('Missing').'</b></td> |
|
| 4932 | + <td>' . get_lang('Max').' '.$threadhold3.'</td> |
|
| 4933 | + <td><div style="color:' . $missing_color.'">' |
|
| 4934 | + . (($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
| 4935 | 4935 | </tr> |
| 4936 | 4936 | </table>'; |
| 4937 | 4937 | if ($next == 0) { |
@@ -4946,20 +4946,20 @@ discard block |
||
| 4946 | 4946 | $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
| 4947 | 4947 | } |
| 4948 | 4948 | |
| 4949 | - echo '<h1><div style="color:#333;">' . get_lang('Feedback') . '</div></h1> |
|
| 4949 | + echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1> |
|
| 4950 | 4950 | <p style="text-align:center">'; |
| 4951 | 4951 | |
| 4952 | - $message = '<p>' . get_lang('YourDelineation') . '</p>'; |
|
| 4952 | + $message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
| 4953 | 4953 | $message .= $table_resume; |
| 4954 | - $message .= '<br />' . get_lang('ResultIs') . ' ' . $result_comment . '<br />'; |
|
| 4954 | + $message .= '<br />'.get_lang('ResultIs').' '.$result_comment.'<br />'; |
|
| 4955 | 4955 | if ($organs_at_risk_hit > 0) { |
| 4956 | - $message .= '<p><b>' . get_lang('OARHit') . '</b></p>'; |
|
| 4956 | + $message .= '<p><b>'.get_lang('OARHit').'</b></p>'; |
|
| 4957 | 4957 | } |
| 4958 | - $message .='<p>' . $comment . '</p>'; |
|
| 4958 | + $message .= '<p>'.$comment.'</p>'; |
|
| 4959 | 4959 | echo $message; |
| 4960 | 4960 | } else { |
| 4961 | 4961 | echo $hotspot_delineation_result[0]; //prints message |
| 4962 | - $from_database = 1; // the hotspot_solution.swf needs this variable |
|
| 4962 | + $from_database = 1; // the hotspot_solution.swf needs this variable |
|
| 4963 | 4963 | } |
| 4964 | 4964 | |
| 4965 | 4965 | //save the score attempts |
@@ -4981,20 +4981,20 @@ discard block |
||
| 4981 | 4981 | $exerciseResultCoordinates[$quesId] |
| 4982 | 4982 | ); |
| 4983 | 4983 | } else { |
| 4984 | - if ($final_answer==0) { |
|
| 4984 | + if ($final_answer == 0) { |
|
| 4985 | 4985 | $questionScore = 0; |
| 4986 | - $answer=0; |
|
| 4986 | + $answer = 0; |
|
| 4987 | 4987 | Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
| 4988 | 4988 | if (is_array($exerciseResultCoordinates[$quesId])) { |
| 4989 | - foreach($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
| 4990 | - Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,0,$val); |
|
| 4989 | + foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
| 4990 | + Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, 0, $val); |
|
| 4991 | 4991 | } |
| 4992 | 4992 | } |
| 4993 | 4993 | } else { |
| 4994 | 4994 | Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
| 4995 | 4995 | if (is_array($exerciseResultCoordinates[$quesId])) { |
| 4996 | - foreach($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
| 4997 | - Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,$choice[$idx],$val); |
|
| 4996 | + foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
| 4997 | + Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, $choice[$idx], $val); |
|
| 4998 | 4998 | } |
| 4999 | 4999 | } |
| 5000 | 5000 | } |
@@ -5013,7 +5013,7 @@ discard block |
||
| 5013 | 5013 | echo " |
| 5014 | 5014 | <tr> |
| 5015 | 5015 | <td colspan=\"2\"> |
| 5016 | - <p><em>" . get_lang('HotSpot') . "</em></p> |
|
| 5016 | + <p><em>" . get_lang('HotSpot')."</em></p> |
|
| 5017 | 5017 | |
| 5018 | 5018 | <div id=\"hotspot-solution-$questionId\"></div> |
| 5019 | 5019 | |
@@ -5051,7 +5051,7 @@ discard block |
||
| 5051 | 5051 | |
| 5052 | 5052 | if ($saved_results) { |
| 5053 | 5053 | if ($debug) error_log("Save question results $saved_results"); |
| 5054 | - if ($debug) error_log(print_r($choice ,1 )); |
|
| 5054 | + if ($debug) error_log(print_r($choice, 1)); |
|
| 5055 | 5055 | |
| 5056 | 5056 | if (empty($choice)) { |
| 5057 | 5057 | $choice = 0; |
@@ -5063,14 +5063,14 @@ discard block |
||
| 5063 | 5063 | $ans = $reply[$i]; |
| 5064 | 5064 | Event::saveQuestionAttempt( |
| 5065 | 5065 | $questionScore, |
| 5066 | - $ans . ':' . $choice[$ans], |
|
| 5066 | + $ans.':'.$choice[$ans], |
|
| 5067 | 5067 | $quesId, |
| 5068 | 5068 | $exeId, |
| 5069 | 5069 | $i, |
| 5070 | 5070 | $this->id |
| 5071 | 5071 | ); |
| 5072 | 5072 | if ($debug) { |
| 5073 | - error_log('result =>' . $questionScore . ' ' . $ans . ':' . $choice[$ans]); |
|
| 5073 | + error_log('result =>'.$questionScore.' '.$ans.':'.$choice[$ans]); |
|
| 5074 | 5074 | } |
| 5075 | 5075 | } |
| 5076 | 5076 | } else { |
@@ -5081,7 +5081,7 @@ discard block |
||
| 5081 | 5081 | $reply = array_keys($choice); |
| 5082 | 5082 | |
| 5083 | 5083 | if ($debug) { |
| 5084 | - error_log("reply " . print_r($reply, 1) . ""); |
|
| 5084 | + error_log("reply ".print_r($reply, 1).""); |
|
| 5085 | 5085 | } |
| 5086 | 5086 | for ($i = 0; $i < sizeof($reply); $i++) { |
| 5087 | 5087 | $ans = $reply[$i]; |
@@ -5140,7 +5140,7 @@ discard block |
||
| 5140 | 5140 | |
| 5141 | 5141 | Event::saveQuestionAttempt($questionScore, implode('|', $answer), $quesId, $exeId, 0, $this->id); |
| 5142 | 5142 | } else { |
| 5143 | - Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0,$this->id); |
|
| 5143 | + Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
| 5144 | 5144 | } |
| 5145 | 5145 | } |
| 5146 | 5146 | |
@@ -5150,8 +5150,8 @@ discard block |
||
| 5150 | 5150 | |
| 5151 | 5151 | if ($saved_results) { |
| 5152 | 5152 | $stat_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
| 5153 | - $sql = 'UPDATE ' . $stat_table . ' SET |
|
| 5154 | - exe_result = exe_result + ' . floatval($questionScore) . ' |
|
| 5153 | + $sql = 'UPDATE '.$stat_table.' SET |
|
| 5154 | + exe_result = exe_result + ' . floatval($questionScore).' |
|
| 5155 | 5155 | WHERE exe_id = ' . $exeId; |
| 5156 | 5156 | if ($debug) error_log($sql); |
| 5157 | 5157 | Database::query($sql); |
@@ -5175,7 +5175,7 @@ discard block |
||
| 5175 | 5175 | */ |
| 5176 | 5176 | public function send_mail_notification_for_exam($question_list_answers, $origin, $exe_id) |
| 5177 | 5177 | { |
| 5178 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
| 5178 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
| 5179 | 5179 | return null; |
| 5180 | 5180 | } |
| 5181 | 5181 | // Email configuration settings |
@@ -5226,7 +5226,7 @@ discard block |
||
| 5226 | 5226 | $msg = str_replace("#course#", $courseInfo['name'], $msg1); |
| 5227 | 5227 | |
| 5228 | 5228 | if ($origin != 'learnpath') { |
| 5229 | - $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
| 5229 | + $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
| 5230 | 5230 | } |
| 5231 | 5231 | $msg1 = str_replace("#url#", $url_email, $msg); |
| 5232 | 5232 | $mail_content = $msg1; |
@@ -5255,7 +5255,7 @@ discard block |
||
| 5255 | 5255 | */ |
| 5256 | 5256 | function send_notification_for_open_questions($question_list_answers, $origin, $exe_id) |
| 5257 | 5257 | { |
| 5258 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
| 5258 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
| 5259 | 5259 | return null; |
| 5260 | 5260 | } |
| 5261 | 5261 | // Email configuration settings |
@@ -5318,11 +5318,11 @@ discard block |
||
| 5318 | 5318 | $msg .= '</table><br />'; |
| 5319 | 5319 | |
| 5320 | 5320 | |
| 5321 | - $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
|
| 5322 | - $msg = str_replace("#firstName#", $user_info['firstname'],$msg1); |
|
| 5323 | - $msg1 = str_replace("#lastName#", $user_info['lastname'],$msg); |
|
| 5324 | - $msg = str_replace("#mail#", $user_info['email'],$msg1); |
|
| 5325 | - $msg = str_replace("#course#", $course_info['name'],$msg1); |
|
| 5321 | + $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
|
| 5322 | + $msg = str_replace("#firstName#", $user_info['firstname'], $msg1); |
|
| 5323 | + $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg); |
|
| 5324 | + $msg = str_replace("#mail#", $user_info['email'], $msg1); |
|
| 5325 | + $msg = str_replace("#course#", $course_info['name'], $msg1); |
|
| 5326 | 5326 | |
| 5327 | 5327 | if ($origin != 'learnpath') { |
| 5328 | 5328 | $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
@@ -5351,7 +5351,7 @@ discard block |
||
| 5351 | 5351 | |
| 5352 | 5352 | function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id) |
| 5353 | 5353 | { |
| 5354 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
| 5354 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
| 5355 | 5355 | return null; |
| 5356 | 5356 | } |
| 5357 | 5357 | // Email configuration settings |
@@ -5375,7 +5375,7 @@ discard block |
||
| 5375 | 5375 | $answer_type = $item['answer_type']; |
| 5376 | 5376 | |
| 5377 | 5377 | if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) { |
| 5378 | - $oral_question_list.='<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' |
|
| 5378 | + $oral_question_list .= '<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' |
|
| 5379 | 5379 | .'<tr>' |
| 5380 | 5380 | .'<td width="220" valign="top" bgcolor="#E5EDF8"> '.get_lang('Question').'</td>' |
| 5381 | 5381 | .'<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>' |
@@ -5408,7 +5408,7 @@ discard block |
||
| 5408 | 5408 | .'<td> #mail#</td>' |
| 5409 | 5409 | .'</tr>' |
| 5410 | 5410 | .'</table>'; |
| 5411 | - $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'),$oral_question_list).'<br />'; |
|
| 5411 | + $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'), $oral_question_list).'<br />'; |
|
| 5412 | 5412 | $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
| 5413 | 5413 | $msg = str_replace("#firstName#", $user_info['firstname'], $msg1); |
| 5414 | 5414 | $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg); |
@@ -5416,7 +5416,7 @@ discard block |
||
| 5416 | 5416 | $msg = str_replace("#course#", $course_info['name'], $msg1); |
| 5417 | 5417 | |
| 5418 | 5418 | if ($origin != 'learnpath') { |
| 5419 | - $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
| 5419 | + $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
| 5420 | 5420 | } |
| 5421 | 5421 | $msg1 = str_replace("#url#", $url_email, $msg); |
| 5422 | 5422 | $mail_content = $msg1; |
@@ -5482,10 +5482,10 @@ discard block |
||
| 5482 | 5482 | } |
| 5483 | 5483 | $html = '<div class="question-result">'; |
| 5484 | 5484 | $html .= Display::page_header( |
| 5485 | - Display::return_icon('test-quiz.png', get_lang('Result'),null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result') |
|
| 5485 | + Display::return_icon('test-quiz.png', get_lang('Result'), null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result') |
|
| 5486 | 5486 | ); |
| 5487 | 5487 | $html .= Display::description($array); |
| 5488 | - $html .="</div>"; |
|
| 5488 | + $html .= "</div>"; |
|
| 5489 | 5489 | return $html; |
| 5490 | 5490 | } |
| 5491 | 5491 | |
@@ -5602,7 +5602,7 @@ discard block |
||
| 5602 | 5602 | false, |
| 5603 | 5603 | $objExercise->selectPropagateNeg() |
| 5604 | 5604 | ); |
| 5605 | - $totalScore += $question_result['score']; |
|
| 5605 | + $totalScore += $question_result['score']; |
|
| 5606 | 5606 | } |
| 5607 | 5607 | |
| 5608 | 5608 | if ($objExercise->selectPropagateNeg() == 0 && $totalScore < 0) { |
@@ -5808,7 +5808,7 @@ discard block |
||
| 5808 | 5808 | } |
| 5809 | 5809 | |
| 5810 | 5810 | $rawMessage = ""; |
| 5811 | - if (!empty($message)){ |
|
| 5811 | + if (!empty($message)) { |
|
| 5812 | 5812 | $rawMessage = $message; |
| 5813 | 5813 | $message = Display::return_message($message, 'warning', false); |
| 5814 | 5814 | } |
@@ -5824,7 +5824,7 @@ discard block |
||
| 5824 | 5824 | { |
| 5825 | 5825 | $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); |
| 5826 | 5826 | $sql = "SELECT max_score FROM $TBL_LP_ITEM |
| 5827 | - WHERE c_id = {$this->course_id} AND item_type = '" . TOOL_QUIZ . "' AND path = '{$this->id}'"; |
|
| 5827 | + WHERE c_id = {$this->course_id} AND item_type = '".TOOL_QUIZ."' AND path = '{$this->id}'"; |
|
| 5828 | 5828 | $result = Database::query($sql); |
| 5829 | 5829 | if (Database::num_rows($result) > 0) { |
| 5830 | 5830 | return true; |
@@ -6152,7 +6152,7 @@ discard block |
||
| 6152 | 6152 | $sql_track = "SELECT * FROM $track_exercises WHERE exe_id = $exe_id "; |
| 6153 | 6153 | $result = Database::query($sql_track); |
| 6154 | 6154 | $new_array = array(); |
| 6155 | - if (Database::num_rows($result) > 0 ) { |
|
| 6155 | + if (Database::num_rows($result) > 0) { |
|
| 6156 | 6156 | $new_array = Database::fetch_array($result, 'ASSOC'); |
| 6157 | 6157 | |
| 6158 | 6158 | $new_array['duration'] = null; |
@@ -6164,11 +6164,11 @@ discard block |
||
| 6164 | 6164 | $start_date = api_strtotime($start_date, 'UTC'); |
| 6165 | 6165 | $end_date = api_strtotime($end_date, 'UTC'); |
| 6166 | 6166 | if ($start_date && $end_date) { |
| 6167 | - $mytime = $end_date- $start_date; |
|
| 6167 | + $mytime = $end_date - $start_date; |
|
| 6168 | 6168 | $new_learnpath_item = new learnpathItem(null); |
| 6169 | 6169 | $time_attemp = $new_learnpath_item->get_scorm_time('js', $mytime); |
| 6170 | 6170 | $h = get_lang('h'); |
| 6171 | - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); |
|
| 6171 | + $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp); |
|
| 6172 | 6172 | $new_array['duration'] = $time_attemp; |
| 6173 | 6173 | } |
| 6174 | 6174 | } |
@@ -6190,7 +6190,7 @@ discard block |
||
| 6190 | 6190 | $result = Database::query($sql); |
| 6191 | 6191 | } |
| 6192 | 6192 | } else { |
| 6193 | - $remind_list = explode(',',$exercise_info['questions_to_check']); |
|
| 6193 | + $remind_list = explode(',', $exercise_info['questions_to_check']); |
|
| 6194 | 6194 | |
| 6195 | 6195 | $remind_list_string = ''; |
| 6196 | 6196 | if ($action == 'add') { |
@@ -6202,7 +6202,7 @@ discard block |
||
| 6202 | 6202 | } |
| 6203 | 6203 | $remind_list_string = implode(',', $remind_list); |
| 6204 | 6204 | } |
| 6205 | - } elseif ($action == 'delete') { |
|
| 6205 | + } elseif ($action == 'delete') { |
|
| 6206 | 6206 | if (!empty($remind_list)) { |
| 6207 | 6207 | if (in_array($question_id, $remind_list)) { |
| 6208 | 6208 | $remind_list = array_flip($remind_list); |
@@ -6444,7 +6444,7 @@ discard block |
||
| 6444 | 6444 | true |
| 6445 | 6445 | ); |
| 6446 | 6446 | |
| 6447 | - $counter += count($mediaQuestions[$questionId]) - 1 ; |
|
| 6447 | + $counter += count($mediaQuestions[$questionId]) - 1; |
|
| 6448 | 6448 | $before = count($questionList); |
| 6449 | 6449 | $wasMedia = true; |
| 6450 | 6450 | $nextValue += count($questionList); |
@@ -6523,7 +6523,7 @@ discard block |
||
| 6523 | 6523 | // If it was already seen, then merge the previous with |
| 6524 | 6524 | // the current category |
| 6525 | 6525 | $oldQuestionList = $newCategoryList[$rootElement]['question_list']; |
| 6526 | - $category['question_list'] = array_merge($oldQuestionList , $category['question_list']); |
|
| 6526 | + $category['question_list'] = array_merge($oldQuestionList, $category['question_list']); |
|
| 6527 | 6527 | $newCategoryList[$rootElement] = $category; |
| 6528 | 6528 | } |
| 6529 | 6529 | } |
@@ -6549,7 +6549,7 @@ discard block |
||
| 6549 | 6549 | |
| 6550 | 6550 | if ($useRootAsCategoryTitle) { |
| 6551 | 6551 | if (isset($category['parent_info'])) { |
| 6552 | - $categoryName = $category['parent_info']['title']; |
|
| 6552 | + $categoryName = $category['parent_info']['title']; |
|
| 6553 | 6553 | } |
| 6554 | 6554 | } |
| 6555 | 6555 | $html .= '<div class="row">'; |
@@ -6691,7 +6691,7 @@ discard block |
||
| 6691 | 6691 | // end foreach() |
| 6692 | 6692 | |
| 6693 | 6693 | if ($this->type == ALL_ON_ONE_PAGE) { |
| 6694 | - $exercise_actions = $this->show_button($questionId, $currentQuestion); |
|
| 6694 | + $exercise_actions = $this->show_button($questionId, $currentQuestion); |
|
| 6695 | 6695 | echo Display::div($exercise_actions, array('class'=>'exercise_actions')); |
| 6696 | 6696 | } |
| 6697 | 6697 | } |
@@ -6777,7 +6777,7 @@ discard block |
||
| 6777 | 6777 | |
| 6778 | 6778 | // Showing the question |
| 6779 | 6779 | |
| 6780 | - $exercise_actions = null; |
|
| 6780 | + $exercise_actions = null; |
|
| 6781 | 6781 | |
| 6782 | 6782 | echo '<a id="questionanchor'.$questionId.'"></a><br />'; |
| 6783 | 6783 | echo '<div id="question_div_'.$questionId.'" class="main_question '.$remind_highlight.'" >'; |
@@ -7045,7 +7045,7 @@ discard block |
||
| 7045 | 7045 | $header .= Display::tag('th', get_lang('Feedback')); |
| 7046 | 7046 | } |
| 7047 | 7047 | $s .= '<table class="data_table">'; |
| 7048 | - $s.= Display::tag('tr', $header, array('style' => 'text-align:left;')); |
|
| 7048 | + $s .= Display::tag('tr', $header, array('style' => 'text-align:left;')); |
|
| 7049 | 7049 | } |
| 7050 | 7050 | } |
| 7051 | 7051 | |
@@ -7145,7 +7145,7 @@ discard block |
||
| 7145 | 7145 | $s .= '<td>'; |
| 7146 | 7146 | $s .= $comment; |
| 7147 | 7147 | $s .= '</td>'; |
| 7148 | - $s .='</tr>'; |
|
| 7148 | + $s .= '</tr>'; |
|
| 7149 | 7149 | } else { |
| 7150 | 7150 | $s .= $answer_input; |
| 7151 | 7151 | } |
@@ -7159,7 +7159,7 @@ discard block |
||
| 7159 | 7159 | } |
| 7160 | 7160 | } |
| 7161 | 7161 | |
| 7162 | - $s .='<tr>'; |
|
| 7162 | + $s .= '<tr>'; |
|
| 7163 | 7163 | $s .= Display::tag('td', $answer); |
| 7164 | 7164 | |
| 7165 | 7165 | if (!empty($quiz_question_options)) { |
@@ -7186,7 +7186,7 @@ discard block |
||
| 7186 | 7186 | $s .= $comment; |
| 7187 | 7187 | $s .= '</td>'; |
| 7188 | 7188 | } |
| 7189 | - $s.='</tr>'; |
|
| 7189 | + $s .= '</tr>'; |
|
| 7190 | 7190 | } |
| 7191 | 7191 | |
| 7192 | 7192 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) { |
@@ -7215,16 +7215,16 @@ discard block |
||
| 7215 | 7215 | $answer_input .= '</label>'; |
| 7216 | 7216 | |
| 7217 | 7217 | if ($show_comment) { |
| 7218 | - $s.= '<tr>'; |
|
| 7218 | + $s .= '<tr>'; |
|
| 7219 | 7219 | $s .= '<td>'; |
| 7220 | - $s.= $answer_input; |
|
| 7220 | + $s .= $answer_input; |
|
| 7221 | 7221 | $s .= '</td>'; |
| 7222 | 7222 | $s .= '<td>'; |
| 7223 | 7223 | $s .= $comment; |
| 7224 | 7224 | $s .= '</td>'; |
| 7225 | - $s.= '</tr>'; |
|
| 7225 | + $s .= '</tr>'; |
|
| 7226 | 7226 | } else { |
| 7227 | - $s.= $answer_input; |
|
| 7227 | + $s .= $answer_input; |
|
| 7228 | 7228 | } |
| 7229 | 7229 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
| 7230 | 7230 | $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
@@ -7237,7 +7237,7 @@ discard block |
||
| 7237 | 7237 | } |
| 7238 | 7238 | } |
| 7239 | 7239 | $answer = Security::remove_XSS($answer); |
| 7240 | - $s .='<tr>'; |
|
| 7240 | + $s .= '<tr>'; |
|
| 7241 | 7241 | $s .= Display::tag('td', $answer); |
| 7242 | 7242 | |
| 7243 | 7243 | foreach ($objQuestionTmp->options as $key => $item) { |
@@ -7261,7 +7261,7 @@ discard block |
||
| 7261 | 7261 | $s .= $comment; |
| 7262 | 7262 | $s .= '</td>'; |
| 7263 | 7263 | } |
| 7264 | - $s.='</tr>'; |
|
| 7264 | + $s .= '</tr>'; |
|
| 7265 | 7265 | } elseif ($answerType == FILL_IN_BLANKS) { |
| 7266 | 7266 | list($answer) = explode('::', $answer); |
| 7267 | 7267 | |
@@ -7295,7 +7295,7 @@ discard block |
||
| 7295 | 7295 | $value = str_replace(' ', '', trim($value[0])); |
| 7296 | 7296 | } |
| 7297 | 7297 | $correct_item = preg_quote($correct_item); |
| 7298 | - $correct_item = api_preg_replace('|/|', '\/', $correct_item); // to prevent error if there is a / in the text to find |
|
| 7298 | + $correct_item = api_preg_replace('|/|', '\/', $correct_item); // to prevent error if there is a / in the text to find |
|
| 7299 | 7299 | $answer = api_preg_replace('/'.$correct_item.'/', Display::input('text', "choice[$questionId][]", $value), $answer, 1); |
| 7300 | 7300 | } |
| 7301 | 7301 | $i++; |
@@ -7352,7 +7352,7 @@ discard block |
||
| 7352 | 7352 | } |
| 7353 | 7353 | |
| 7354 | 7354 | if (!empty($answerCorrect) && !empty($selectedValue)) { |
| 7355 | - $s.= '<script> |
|
| 7355 | + $s .= '<script> |
|
| 7356 | 7356 | jsPlumb.ready(function() { |
| 7357 | 7357 | jsPlumb.connect({ |
| 7358 | 7358 | source: "window_'.$windowId.'", |
@@ -7367,14 +7367,14 @@ discard block |
||
| 7367 | 7367 | } |
| 7368 | 7368 | $s .= '</select></div></td>'; |
| 7369 | 7369 | |
| 7370 | - $s.='<td width="45%" valign="top" >'; |
|
| 7370 | + $s .= '<td width="45%" valign="top" >'; |
|
| 7371 | 7371 | |
| 7372 | 7372 | if (isset($select_items[$lines_count])) { |
| 7373 | - $s.= '<div id="window_'.$windowId.'_answer" class="window window_right_question"> |
|
| 7373 | + $s .= '<div id="window_'.$windowId.'_answer" class="window window_right_question"> |
|
| 7374 | 7374 | <b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'].' |
| 7375 | 7375 | </div>'; |
| 7376 | 7376 | } else { |
| 7377 | - $s.=' '; |
|
| 7377 | + $s .= ' '; |
|
| 7378 | 7378 | } |
| 7379 | 7379 | |
| 7380 | 7380 | $s .= '</td>'; |
@@ -7388,16 +7388,16 @@ discard block |
||
| 7388 | 7388 | $s .= '<tr> |
| 7389 | 7389 | <td colspan="2"></td> |
| 7390 | 7390 | <td valign="top">'; |
| 7391 | - $s.='<b>'.$select_items[$lines_count]['letter'].'.</b>'; |
|
| 7391 | + $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b>'; |
|
| 7392 | 7392 | $s .= $select_items[$lines_count]['answer']; |
| 7393 | - $s.="</td> |
|
| 7393 | + $s .= "</td> |
|
| 7394 | 7394 | </tr>"; |
| 7395 | 7395 | $lines_count++; |
| 7396 | 7396 | } // end while() |
| 7397 | 7397 | } // end if() |
| 7398 | 7398 | $matching_correct_answer++; |
| 7399 | 7399 | } |
| 7400 | - } elseif ($answerType == DRAGGABLE) { |
|
| 7400 | + } elseif ($answerType == DRAGGABLE) { |
|
| 7401 | 7401 | // matching type, showing suggestions and answers |
| 7402 | 7402 | // TODO: replace $answerId by $numAnswer |
| 7403 | 7403 | |
@@ -7439,7 +7439,7 @@ discard block |
||
| 7439 | 7439 | $s .= '</select>'; |
| 7440 | 7440 | |
| 7441 | 7441 | if (!empty($answerCorrect) && !empty($selectedValue)) { |
| 7442 | - $s.= '<script> |
|
| 7442 | + $s .= '<script> |
|
| 7443 | 7443 | $(function() { |
| 7444 | 7444 | deleteItem($("#'.$questionId.'_'.$selectedValue.'"), $("#drop_'.$windowId.'")); |
| 7445 | 7445 | }); |
@@ -7447,11 +7447,11 @@ discard block |
||
| 7447 | 7447 | } |
| 7448 | 7448 | |
| 7449 | 7449 | if (isset($select_items[$lines_count])) { |
| 7450 | - $s.= '<div id="window_'.$windowId.'_answer" class=""> |
|
| 7450 | + $s .= '<div id="window_'.$windowId.'_answer" class=""> |
|
| 7451 | 7451 | <b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'].' |
| 7452 | 7452 | </div>'; |
| 7453 | 7453 | } else { |
| 7454 | - $s.=' '; |
|
| 7454 | + $s .= ' '; |
|
| 7455 | 7455 | } |
| 7456 | 7456 | $lines_count++; |
| 7457 | 7457 | //if the left side of the "matching" has been completely |
@@ -7460,7 +7460,7 @@ discard block |
||
| 7460 | 7460 | if (($lines_count - 1) == $num_suggestions) { |
| 7461 | 7461 | // if it remains answers to shown at the right side |
| 7462 | 7462 | while (isset($select_items[$lines_count])) { |
| 7463 | - $s.='<b>'.$select_items[$lines_count]['letter'].'.</b>'; |
|
| 7463 | + $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b>'; |
|
| 7464 | 7464 | $s .= $select_items[$lines_count]['answer']; |
| 7465 | 7465 | $lines_count++; |
| 7466 | 7466 | } |
@@ -7563,9 +7563,9 @@ discard block |
||
| 7563 | 7563 | |
| 7564 | 7564 | if (!$only_questions) { |
| 7565 | 7565 | if ($show_title) { |
| 7566 | - $html .= TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id); |
|
| 7567 | - $html .= '<div class="question_title">'.$current_item.'. '.$questionName.'</div>'; |
|
| 7568 | - $html .= $questionDescription; |
|
| 7566 | + $html .= TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id); |
|
| 7567 | + $html .= '<div class="question_title">'.$current_item.'. '.$questionName.'</div>'; |
|
| 7568 | + $html .= $questionDescription; |
|
| 7569 | 7569 | } else { |
| 7570 | 7570 | $html .= '<div class="media">'; |
| 7571 | 7571 | $html .= '<div class="pull-left">'; |
@@ -7581,11 +7581,11 @@ discard block |
||
| 7581 | 7581 | $html .= '</div>'; |
| 7582 | 7582 | } |
| 7583 | 7583 | //@todo I need to the get the feedback type |
| 7584 | - $html .= '<input type="hidden" name="hidden_hotspot_id" value="'.$questionId.'" />'; |
|
| 7585 | - $html .= '<table class="exercise_questions"> |
|
| 7584 | + $html .= '<input type="hidden" name="hidden_hotspot_id" value="'.$questionId.'" />'; |
|
| 7585 | + $html .= '<table class="exercise_questions"> |
|
| 7586 | 7586 | <tr> |
| 7587 | 7587 | <td valign="top" colspan="2">'; |
| 7588 | - $html .= '</td></tr>'; |
|
| 7588 | + $html .= '</td></tr>'; |
|
| 7589 | 7589 | } |
| 7590 | 7590 | |
| 7591 | 7591 | $canClick = isset($_GET['editQuestion']) ? '0' : (isset($_GET['modifyAnswers']) ? '0' : '1'); |