diff --git a/main/admin/user_edit.php b/main/admin/user_edit.php
index 8488e53c0a..d64bdad8b9 100644
--- a/main/admin/user_edit.php
+++ b/main/admin/user_edit.php
@@ -234,7 +234,7 @@ if (!$user_data['platform_admin']) {
// EXTRA FIELDS
-$extra = UserManager::get_extra_fields(0, 50, 5, 'ASC');
+$extra = UserManager::get_extra_fields(0, 50, 5, 'ASC', true, true);
foreach ($extra as $id => $field_details) {
if ($field_details[6] == 0) {
continue;
diff --git a/main/exercice/exercise.lib.php b/main/exercice/exercise.lib.php
index 94f7afa44c..68933babbb 100644
--- a/main/exercice/exercise.lib.php
+++ b/main/exercice/exercise.lib.php
@@ -959,11 +959,10 @@ function get_exam_results_data($from, $number_of_items, $column, $direction, $ex
$user_list_id = array ();
$duration_list = '';
- $date_list = '';
- $more_details_list = '';
-
- for ($i = 0; $i < $sizeof; $i++) {
+
+ for ($i = 0; $i < $sizeof; $i++) {
$revised = $results[$i]['revised'];
+
if ($from_gradebook && ($is_allowedToEdit || $is_tutor)) {
if (in_array($results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'], $users_array_id)) {
continue;
@@ -971,19 +970,16 @@ function get_exam_results_data($from, $number_of_items, $column, $direction, $ex
$users_array_id[] = $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'];
}
if ($is_allowedToEdit || $is_tutor) {
- $user = $results[$i]['firstname'] . $results[$i]['lastname'];
- //$test = $results[$i]['col3'];
+ $user = $results[$i]['firstname'] . $results[$i]['lastname'];
$user_groups = displayGroupsForUser('
', $results[$i]['user_id']);
} else {
$user = $results[$i]['firstname'] . $results[$i]['lastname'];
- //$test = $results[$i]['col0'];
+
}
$user_list_id[] = $results[$i]['exe_user_id'];
$id = $results[$i]['exe_id'];
- //$quiz_name_list = $test;
- $dt = api_convert_and_format_date($results[$i]['exe_weighting']);
- $res = $results[$i]['exe_result'];
+ $dt = api_convert_and_format_date($results[$i]['exe_weighting']);
// we filter the results if we have the permission to
if (isset ($results[$i]['results_disabled']))
@@ -991,8 +987,7 @@ function get_exam_results_data($from, $number_of_items, $column, $direction, $ex
else
$result_disabled = 0;
- if ($result_disabled == 0) {
- $add_start_date = $lang_nostartdate;
+ if ($result_disabled == 0) {
if ($is_allowedToEdit || $is_tutor) {
$user = $results[$i]['firstname'] . $results[$i]['lastname'];
@@ -1015,14 +1010,12 @@ function get_exam_results_data($from, $number_of_items, $column, $direction, $ex
if ($results[$i]['exstep'] > 1) {
$duration_list = ' ( ' . $results[$i]['steps_counter'] . ' ' . get_lang('Steps') . ' )';
}
- //$add_start_date = api_convert_and_format_date($start_date) . ' / ';
} else {
- $duration_list = get_lang('NoLogOfDuration');
- //echo get_lang('NoLogOfDuration');
+ $duration_list = get_lang('NoLogOfDuration');
}
// Date conversion
- $date_list = api_get_local_time($results[$i]['start_date']). ' / ' . api_get_local_time($results[$i]['exe_date']);
+
// there are already a duration test period calculated??
//echo '
'.get_lang('ClickLinkToViewComment') . ' #url#
';
}
- $message .= '
'.get_lang('Regards') . '
'; + $message .= ''.get_lang('Regards').'
'; $message .= $from_name; $message = str_replace("#test#", Security::remove_XSS($test), $message); @@ -219,17 +206,10 @@ if ($_REQUEST['comments'] == 'update' && ($is_allowedToEdit || $is_tutor) && $_G } } + if ($is_allowedToEdit && $origin != 'learnpath') { // the form - if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) { - if ($_SESSION['export_user_fields']) { - $alt = get_lang('ExportWithUserFields'); - $extra_user_fields = ''; - } else { - $alt = get_lang('ExportWithoutUserFields'); - $extra_user_fields = ''; - } - + if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) { $actions .= '' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'','32').''; $actions .=''.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'),'',32).''; @@ -241,13 +221,16 @@ if ($is_allowedToEdit && $origin != 'learnpath') { } //Deleting an attempt -if ($_GET['delete'] == 'delete' && ($is_allowedToEdit || api_is_coach()) && !empty ($_GET['did']) && $_GET['did'] == strval(intval($_GET['did']))) { - $sql = 'DELETE FROM ' . $TBL_TRACK_EXERCICES . ' WHERE exe_id = ' . intval($_GET['did']); - Database::query($sql); - $sql = 'DELETE FROM ' . $TBL_TRACK_ATTEMPT . ' WHERE exe_id = ' . intval($_GET['did']); - Database::query($sql); - header('Location: exercise_report.php?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&exerciseId='.$exercise_id); - exit; +if ( ($is_allowedToEdit || $is_tutor || api_is_coach()) && $_GET['delete'] == 'delete' && !empty ($_GET['did'])) { + $exe_id = intval($_GET['did']); + if (!empty($exe_id)) { + $sql = 'DELETE FROM '.$TBL_TRACK_EXERCICES.' WHERE exe_id = '.$exe_id; + Database::query($sql); + $sql = 'DELETE FROM '.$TBL_TRACK_ATTEMPT.' WHERE exe_id = '.$exe_id; + Database::query($sql); + header('Location: exercise_report.php?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&exerciseId='.$exercise_id); + exit; + } } if ($is_allowedToEdit || $is_tutor) { @@ -270,7 +253,7 @@ Display :: display_header($nameTools); $actions = Display::div($actions, array('class'=> 'actions')); -$extra = ' + + exercise_list = array(); - $this->readExercisesList(); - if($get_questions) - { - foreach($this->exercises_list as $exe) - { - $this->exercises_list['questions'] = $this->getExerciseQuestionList($exe['id']); - } - } - */ + public function ExerciseResult($get_questions=false,$get_answers=false) { } /** @@ -90,6 +77,7 @@ class ExerciseResult } return true; } + /** * Gets the results of all students (or just one student if access is limited) * @param string The document path (for HotPotatoes retrieval) @@ -97,13 +85,14 @@ class ExerciseResult */ function _getExercisesReporting($document_path, $user_id = null, $filter=0, $exercise_id = 0, $hotpotato_name = null) { $return = array(); + $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); $TBL_USER = Database::get_main_table(TABLE_MAIN_USER); $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); $TBL_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY); - $TBL_TRACK_EXERCISES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); + $TBL_TRACK_EXERCISES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_TRACK_HOTPOTATOES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); $TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $TBL_TRACK_ATTEMPT_RECORDING= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); @@ -215,9 +204,10 @@ class ExerciseResult $return[$i]['email'] = $results[$i]['exemail']; } $return[$i]['title'] = $results[$i]['extitle']; - $return[$i]['time'] = api_convert_and_format_date($results[$i]['exdate'], null, date_default_timezone_get()); + $return[$i]['time'] = api_convert_and_format_date($results[$i]['exdate']); $return[$i]['result'] = $results[$i]['exresult']; $return[$i]['max'] = $results[$i]['exweight']; + $return[$i]['status'] = $revised ? get_lang('Validated') : get_lang('NotValidated'); } } @@ -233,10 +223,9 @@ class ExerciseResult $return[$i]['email'] = $hpresults[$i]['email']; $return[$i]['first_name'] = $hpresults[$i]['userpart1']; $return[$i]['last_name'] = $hpresults[$i]['userpart2']; - //$return[$i]['user_id'] = $results[$i]['userid']; } $return[$i]['title'] = $title; - $return[$i]['time'] = api_convert_and_format_date($hpresults[$i]['exdate'], null, date_default_timezone_get()); + $return[$i]['time'] = api_convert_and_format_date($hpresults[$i]['exdate']); $return[$i]['result'] = $hpresults[$i]['exe_result']; $return[$i]['max'] = $hpresults[$i]['exe_weighting']; } @@ -283,13 +272,14 @@ class ExerciseResult $num = count($extra_user_fields); foreach($extra_user_fields as $field) { $data .= '"'.str_replace("\r\n",' ',api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)).'";'; - } - $display_extra_user_fields = true; + } } + $data .= get_lang('Title').';'; - $data .= get_lang('Date').';'; + $data .= get_lang('StartDate').';'; $data .= get_lang('Score').';'; $data .= get_lang('Total').';'; + $data .= get_lang('Status').';'; $data .= "\n"; //results @@ -322,6 +312,7 @@ class ExerciseResult $data .= str_replace("\r\n",' ',$row['time']).';'; $data .= str_replace("\r\n",' ',$row['result']).';'; $data .= str_replace("\r\n",' ',$row['max']).';'; + $data .= str_replace("\r\n",' ',$row['status']).';'; $data .= "\n"; } @@ -352,7 +343,7 @@ class ExerciseResult */ public function exportCompleteReportXLS($document_path='',$user_id = null, $export_user_fields= false, $export_filter = 0, $exercise_id=0, $hotpotato_name = null) { global $charset; - $this->_getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id,$hotpotato_name); + $this->_getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); $filename = 'exercise_results_'.date('YmdGis').'.xls'; if(!empty($user_id)) { $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.xls'; @@ -383,17 +374,14 @@ class ExerciseResult $worksheet->write($line,$column,get_lang('Email')); $column++; - if (api_is_western_name_order()) { - + if (api_is_western_name_order()) { $worksheet->write($line,$column,get_lang('FirstName')); - $column++; - + $column++; $worksheet->write($line,$column,get_lang('LastName')); $column++; } else { $worksheet->write($line,$column,get_lang('LastName')); - $column++; - + $column++; $worksheet->write($line,$column,get_lang('FirstName')); $column++; } @@ -412,11 +400,13 @@ class ExerciseResult $worksheet->write($line,$column,get_lang('Title')); $column++; - $worksheet->write($line,$column,get_lang('Date')); + $worksheet->write($line,$column,get_lang('StartDate')); $column++; $worksheet->write($line,$column,get_lang('Score')); $column++; $worksheet->write($line,$column,get_lang('Total')); + $column++; + $worksheet->write($line,$column,get_lang('Status')); $line++; foreach($this->results as $row) { @@ -432,8 +422,7 @@ class ExerciseResult if ($export_user_fields) { //show user fields data, if any, for this user - $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); - + $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); foreach($user_fields_values as $value) { $worksheet->write($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); $column++; @@ -446,6 +435,8 @@ class ExerciseResult $worksheet->write($line,$column,$row['result']); $column++; $worksheet->write($line,$column,$row['max']); + $column++; + $worksheet->write($line,$column,$row['status']); $line++; } //output the results