Fix function setCellValueByColumnAndRow see BT#11698

pull/2487/head
jmontoyaa 9 years ago
parent cdf1aef069
commit 817cfc69f3
  1. 158
      main/exercise/exercise_result.class.php
  2. 69
      main/exercise/hotpotatoes_exercise_result.class.php
  3. 8
      main/mySpace/current_courses.php
  4. 65
      main/survey/survey.lib.php
  5. 38
      main/tracking/exams.php

@ -433,37 +433,44 @@ class ExerciseResult
if ($with_column_user) {
if (api_is_western_name_order()) {
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('FirstName'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('LastName'));
$column++;
} else {
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('LastName'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('FirstName'));
$column++;
}
if ($officialCodeInList === 'true') {
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('OfficialCode'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('OfficialCode'));
$column++;
}
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Email'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Email'));
$column++;
}
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Groups'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Groups'));
$column++;
if ($export_user_fields) {
//show user fields section with a big th colspan that spans over all fields
$extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
$extra_user_fields = UserManager::get_extra_fields(
0,
1000,
5,
'ASC',
false,
1
);
//show the fields names for user fields
foreach ($extra_user_fields as $field) {
$worksheet->SetCellValueByColumnAndRow(
$line,
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($field[3]),
ENT_QUOTES,
@ -474,23 +481,23 @@ class ExerciseResult
}
}
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Title'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Title'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('StartDate'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('StartDate'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('EndDate'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('EndDate'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Duration').' ('.get_lang('MinMinutes').')');
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Duration').' ('.get_lang('MinMinutes').')');
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Score'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Score'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Total'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Total'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Status'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Status'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('ToolLearnpath'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('ToolLearnpath'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('UserIsCurrentlySubscribed'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('UserIsCurrentlySubscribed'));
$line++;
foreach ($this->results as $row) {
@ -498,55 +505,130 @@ class ExerciseResult
if ($with_column_user) {
if (api_is_western_name_order()) {
$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['first_name']),
ENT_QUOTES,
$charset
)
);
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['last_name']),
ENT_QUOTES,
$charset
)
);
$column++;
} else {
$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['last_name']),
ENT_QUOTES,
$charset
)
);
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['first_name']),
ENT_QUOTES,
$charset
)
);
$column++;
}
if ($officialCodeInList === 'true') {
$worksheet->SetCellValueByColumnAndRow($line, $column,api_html_entity_decode(strip_tags($row['official_code']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['official_code']),
ENT_QUOTES,
$charset
)
);
$column++;
}
$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['email']),
ENT_QUOTES,
$charset
)
);
$column++;
}
$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags(implode(", ", GroupManager :: get_user_group_name($row['user_id']))), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags(
implode(
", ",
GroupManager:: get_user_group_name($row['user_id'])
)
),
ENT_QUOTES,
$charset
)
);
$column++;
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);
foreach($user_fields_values as $value) {
$worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
$user_fields_values = UserManager::get_extra_user_data(
$row['user_id'],
false,
false,
false,
true
);
foreach ($user_fields_values as $value) {
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($value),
ENT_QUOTES,
$charset
)
);
$column++;
}
}
$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, $row['start_date']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['start_date']);
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, $row['end_date']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['end_date']);
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, $row['duration']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['duration']);
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, $row['result']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['result']);
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, $row['max']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['max']);
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, $row['status']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['status']);
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, $row['lp_name']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['lp_name']);
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, $row['is_user_subscribed']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['is_user_subscribed']);
$line++;
}

@ -250,18 +250,17 @@ class HotpotatoesExerciseResult
}
if ($with_column_user) {
$worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Email'));
$column++;
if (api_is_western_name_order()) {
$worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('FirstName'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('LastName'));
$column++;
} else {
$worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('LastName'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('FirstName'));
$column++;
}
}
@ -272,42 +271,58 @@ class HotpotatoesExerciseResult
//show the fields names for user fields
foreach ($extra_user_fields as $field) {
$worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($field[3]),
ENT_QUOTES,
$charset
)
);
$column++;
}
}
$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Title'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('StartDate'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('EndDate'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('EndDate'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')');
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Duration').' ('.get_lang('MinMinutes').')');
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Score'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Total'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Status'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Status'));
$line++;
foreach ($this->results as $row) {
$column = 0;
if ($with_column_user) {
$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['email']),
ENT_QUOTES,
$charset
)
);
$column++;
if (api_is_western_name_order()) {
$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow($column, $line,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
$column++;
} else {
$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
$column++;
}
}
@ -316,24 +331,24 @@ class HotpotatoesExerciseResult
//show user fields data, if any, for this user
$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
foreach($user_fields_values as $value) {
$worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
$column++;
}
}
$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['start_date']);
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['end_date']);
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['duration']);
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['result']);
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['max']);
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,$row['status']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['status']);
$line++;
}

@ -220,14 +220,18 @@ if (isset($_GET['export'])) {
$column = 0; //skip the first column (row titles)
foreach ($headers as $header) {
$worksheet->SetCellValueByColumnAndRow($line, $column, $header);
$worksheet->setCellValueByColumnAndRow($column, $line, $header);
$column++;
}
$line++;
foreach ($array as $row) {
$column = 0;
foreach ($row as $item) {
$worksheet->SetCellValueByColumnAndRow($line, $column, html_entity_decode(strip_tags($item)));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
html_entity_decode(strip_tags($item))
);
$column++;
}
$line++;

@ -2559,7 +2559,7 @@ class SurveyUtil
$sql = "SELECT q.question_id, q.type, q.survey_question, count(o.question_option_id) as number_of_options
FROM $table_survey_question q LEFT JOIN $table_survey_question_option o
ON q.question_id = o.question_id
WHERE q.survey_id = '".Database::escape_string($_GET['survey_id'])."' AND
WHERE q.survey_id = '".$surveyId."' AND
q.c_id = $course_id AND
o.c_id = $course_id
GROUP BY q.question_id
@ -2614,7 +2614,7 @@ class SurveyUtil
LEFT JOIN $table_survey_question_option sqo
ON sq.question_id = sqo.question_id
WHERE
sq.survey_id = '".intval($_GET['survey_id'])."' AND
sq.survey_id = '".$surveyId."' AND
sq.c_id = $course_id AND
sqo.c_id = $course_id
ORDER BY sq.sort ASC, sqo.sort ASC";
@ -2641,7 +2641,7 @@ class SurveyUtil
$display_percentage_header = 0;
} else if ($row['type'] == 'percentage') {
$possible_answers[$row['question_id']][$row['question_option_id']] = $row['question_option_id'];
} else if ($row['type'] <> 'comment' AND $row['type'] <> 'pagebreak' AND $row['type'] <> 'percentage') {
} else if ($row['type'] <> 'comment' && $row['type'] <> 'pagebreak' && $row['type'] <> 'percentage') {
echo '<th>';
echo $row['option_text'];
echo '</th>';
@ -2661,7 +2661,7 @@ class SurveyUtil
$sql = "SELECT * FROM $table_survey_answer
WHERE
c_id = $course_id AND
survey_id='".intval($_GET['survey_id'])."'
survey_id='".$surveyId."'
ORDER BY user ASC";
$result = Database::query($sql);
$i = 1;
@ -3030,6 +3030,14 @@ class SurveyUtil
*/
public static function export_complete_report_xls($survey_data, $filename, $user_id = 0)
{
$course_id = api_get_course_int_id();
$surveyId = isset($_GET['survey_id']) ? (int) $_GET['survey_id'] : 0;
if (empty($course_id) || empty($surveyId)) {
return false;
}
$spreadsheet = new PHPExcel();
$spreadsheet->setActiveSheetIndex(0);
$worksheet = $spreadsheet->getActiveSheet();
@ -3037,24 +3045,21 @@ class SurveyUtil
$column = 1; // Skip the first column (row titles)
// Show extra fields blank space (enough for extra fields on next line)
//if (!empty($_REQUEST['fields_filter'])) {
// Show user fields section with a big th colspan that spans over all fields
$extra_user_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', false, true);
$num = count($extra_user_fields);
for ($i = 0; $i < $num; $i++) {
$worksheet->SetCellValueByColumnAndRow($line, $column, '');
$worksheet->setCellValueByColumnAndRow($column, $line, '');
$column++;
}
$display_extra_user_fields = true;
//}
// Database table definitions
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER);
$course_id = api_get_course_int_id();
// First line (questions)
$sql = "SELECT
questions.question_id,
@ -3065,7 +3070,7 @@ class SurveyUtil
LEFT JOIN $table_survey_question_option options
ON questions.question_id = options.question_id AND options.c_id = $course_id
WHERE
questions.survey_id = '".intval($_GET['survey_id'])."' AND
questions.survey_id = '".$surveyId."' AND
questions.c_id = $course_id
GROUP BY questions.question_id
ORDER BY questions.sort ASC";
@ -3074,15 +3079,16 @@ class SurveyUtil
// We show the questions if
// 1. there is no question filter and the export button has not been clicked
// 2. there is a quesiton filter but the question is selected for display
if (!(isset($_POST['submit_question_filter'])) || (isset($_POST['submit_question_filter']) && is_array($_POST['questions_filter']) &&
if (!(isset($_POST['submit_question_filter'])) ||
(isset($_POST['submit_question_filter']) && is_array($_POST['questions_filter']) &&
in_array($row['question_id'], $_POST['questions_filter']))
) {
// We do not show comment and pagebreak question types
if ($row['type'] != 'comment' && $row['type'] != 'pagebreak') {
if ($row['number_of_options'] == 0 && $row['type'] == 'open') {
$worksheet->SetCellValueByColumnAndRow(
$line,
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['survey_question']),
ENT_QUOTES
@ -3091,9 +3097,9 @@ class SurveyUtil
$column ++;
} else {
for ($ii = 0; $ii < $row['number_of_options']; $ii ++) {
$worksheet->SetCellValueByColumnAndRow(
$line,
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['survey_question']),
ENT_QUOTES
@ -3105,6 +3111,8 @@ class SurveyUtil
}
}
}
$line++;
$column = 1;
@ -3112,9 +3120,9 @@ class SurveyUtil
if ($display_extra_user_fields) {
// Show the fields names for user fields
foreach ($extra_user_fields as & $field) {
$worksheet->SetCellValueByColumnAndRow(
$line,
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES)
);
$column++;
@ -3134,9 +3142,11 @@ class SurveyUtil
survey_question_option.sort as option_sort
FROM $table_survey_question survey_question
LEFT JOIN $table_survey_question_option survey_question_option
ON survey_question.question_id = survey_question_option.question_id AND survey_question_option.c_id = $course_id
ON
survey_question.question_id = survey_question_option.question_id AND
survey_question_option.c_id = $course_id
WHERE
survey_question.survey_id = '".intval($_GET['survey_id'])."' AND
survey_question.survey_id = $surveyId AND
survey_question.c_id = $course_id
ORDER BY survey_question.sort ASC, survey_question_option.sort ASC";
$result = Database::query($sql);
@ -3147,13 +3157,14 @@ class SurveyUtil
// 1. there is no question filter and the export button has not been clicked
// 2. there is a quesiton filter but the question is selected for display
if (!isset($_POST['submit_question_filter']) ||
(isset($_POST['questions_filter']) && is_array($_POST['questions_filter']) && in_array($row['question_id'], $_POST['questions_filter']))
(isset($_POST['questions_filter']) && is_array($_POST['questions_filter']) &&
in_array($row['question_id'], $_POST['questions_filter']))
) {
// We do not show comment and pagebreak question types
if ($row['type'] != 'comment' && $row['type'] != 'pagebreak') {
$worksheet->SetCellValueByColumnAndRow(
$line,
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['option_text']),
ENT_QUOTES
@ -3172,11 +3183,11 @@ class SurveyUtil
$old_user = '';
$answers_of_user = array();
$sql = "SELECT * FROM $table_survey_answer
WHERE c_id = $course_id AND survey_id='".intval($_GET['survey_id'])."' ";
WHERE c_id = $course_id AND survey_id = $surveyId";
if ($user_id != 0) {
$sql .= "AND user='".intval($user_id)."' ";
$sql .= " AND user='".intval($user_id)."' ";
}
$sql .= "ORDER BY user ASC";
$sql .= " ORDER BY user ASC";
$open_question_iterator = 1;
$result = Database::query($sql);
@ -3190,7 +3201,7 @@ class SurveyUtil
true
);
foreach ($return as $elem) {
$worksheet->SetCellValueByColumnAndRow($line, $column, $elem);
$worksheet->setCellValueByColumnAndRow($column, $line, $elem);
$column++;
}
$answers_of_user = array();
@ -3216,7 +3227,7 @@ class SurveyUtil
// this is to display the last user
foreach ($return as $elem) {
$worksheet->SetCellValueByColumnAndRow($line, $column, $elem);
$worksheet->setCellValueByColumnAndRow($column, $line, $elem);
$column++;
}

@ -408,63 +408,63 @@ function export_complete_report_xls($filename, $array)
$column = 0; //skip the first column (row titles)
if ($global) {
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Courses'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Courses'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Exercises'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Exercises'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('ExamTaken'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('ExamTaken'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('ExamNotTaken'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('ExamNotTaken'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, sprintf(get_lang('ExamPassX'), $filter_score) . '%');
$worksheet->setCellValueByColumnAndRow($column, $line, sprintf(get_lang('ExamPassX'), $filter_score) . '%');
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('ExamFail'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('ExamFail'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('TotalStudents'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('TotalStudents'));
$column++;
$line++;
foreach ($array as $row) {
$column = 0;
foreach ($row as $item) {
$worksheet->SetCellValueByColumnAndRow($line, $column, html_entity_decode(strip_tags($item)));
$worksheet->setCellValueByColumnAndRow($column, $line, html_entity_decode(strip_tags($item)));
$column++;
}
$line++;
}
$line++;
} else {
$worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Exercises'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Exercises'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('User'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('User'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Percentage'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Percentage'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Status'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Status'));
$column++;
$worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Attempts'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Attempts'));
$column++;
$line++;
foreach ($array as $row) {
$column = 0;
$worksheet->SetCellValueByColumnAndRow(
$worksheet->setCellValueByColumnAndRow(
$line,
$column,
html_entity_decode(strip_tags($row['exercise']))
);
$column++;
foreach ($row['users'] as $key=>$user) {
foreach ($row['users'] as $key => $user) {
$column = 1;
$worksheet->SetCellValueByColumnAndRow(
$line,
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
html_entity_decode(strip_tags($user))
);
$column++;
foreach ($row['results'][$key] as $result_item) {
$worksheet->SetCellValueByColumnAndRow(
$line,
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
html_entity_decode(strip_tags($result_item))
);
$column++;

Loading…
Cancel
Save