';
- $this->content->text .= '';
-
- // Test description
- $this->content->text .= '
';
- $this->content->text .= '';
- $this->content->text .= ' ';
- $this->content->text .= get_string('test_description', 'block_personality_test');
- $this->content->text .= '';
- $this->content->text .= '
';
-
- // Tipo MBTI del estudiante
- $this->content->text .= '
';
- $this->content->text .= '
' . $mbti_score . '
';
- $mbti_dimensions_key = 'mbti_dimensions_' . strtolower($mbti_score);
- $this->content->text .= '' . get_string($mbti_dimensions_key, 'block_personality_test') . '';
- $this->content->text .= '';
-
- // Descripción detallada del tipo MBTI usando strings de idioma
- $mbti_key = 'mbti_' . strtolower($mbti_score);
- $this->content->text .= '
';
- $this->content->text .= get_string($mbti_key, 'block_personality_test');
- $this->content->text .= '
';
-
- // Definimos las etiquetas de las dimensiones para el gráfico usando strings de idioma
$mbti_labels = [
get_string('introversion', 'block_personality_test'),
get_string('feeling', 'block_personality_test'),
@@ -761,7 +350,6 @@ function get_content()
get_string('judging', 'block_personality_test')
];
- // El orden de los datos DEBE corresponder exactamente al orden de $mbti_labels.
$user_data = [
(float)$scores['introversion'],
(float)$scores['feeling'],
@@ -773,97 +361,33 @@ function get_content()
(float)$scores['judging'],
];
- // Creamos un ID único para el canvas del gráfico usando el ID del usuario
$chart_id = 'graficoRadar_' . $USER->id;
-
- // Insertamos el
';
-
- // Retornamos el contenido del bloque
return $this->content;
- } // Fin else (datos de entry existen)
- } // Fin else (entry existe)
+ }
+ }
}
- // Devolver el objeto de contenido construido
return $this->content;
- } // Fin get_content
+ }
}
diff --git a/download_csv.php b/download_csv.php
index 4fdb1b5..74e8297 100644
--- a/download_csv.php
+++ b/download_csv.php
@@ -1,8 +1,11 @@
last_action;
+ // Use updated_at as the last action timestamp
+ $lastaction = $entry->updated_at;
fputcsv($output, [
$student_user->idnumber,
diff --git a/download_pdf.php b/download_pdf.php
index f4f80d6..0728d8f 100644
--- a/download_pdf.php
+++ b/download_pdf.php
@@ -1,11 +1,11 @@
+
+
+ ').html(response);
+ var newContent = responseObj.find('#personality-test-results-region').html();
+
+ if (newContent) {
+ container.html(newContent);
+ var input = container.find('#searchInput');
+ if (input.length) {
+ input.focus();
+ var tmpStr = input.val();
+ input.val('');
+ input.val(tmpStr);
+ }
+ }
+ container.css('opacity', '1');
+ });
+ }
+});
+{{/js}}
diff --git a/templates/individual_view.mustache b/templates/individual_view.mustache
new file mode 100644
index 0000000..c20d97a
--- /dev/null
+++ b/templates/individual_view.mustache
@@ -0,0 +1,163 @@
+{{#in_progress}}
+
+
+
{{test_in_progress_title}}
+
{{test_in_progress_message}}
+
+
+
{{progress_label}}:
+
+
+ {{progress_percentage}}%
+
+
+
{{has_answered_label}}: {{answered_message}}
+
+ {{#show_submit_reminder}}
+
+
+ {{remind_submit_test}}
+
+ {{/show_submit_reminder}}
+
+
{{results_available_message}}
+
+
+
+
+{{/in_progress}}
+
+{{#is_completed}}
+
+
+
+
+
+
+
+
+
+
+
{{user_fullname}}
+
{{email_label}}: {{user_email}}
+
{{date_label}}: {{test_date}}
+
{{mbti_label}}: {{mbti_type}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{#dimension_bars}}
+
+
+ {{label1}} ({{value1}})
+ {{label2}} ({{value2}})
+
+
+
+ {{percent1_display}}%
+
+
+ {{percent2_display}}%
+
+
+
+ {{/dimension_bars}}
+
+
+
+
+
+
+
+
+
+
+
+
{{mbti_type}}
+
({{mbti_dimensions_str}})
+
{{mbti_description}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | {{dimension_header}} |
+ {{score_header}} |
+ {{preference_header}} |
+
+
+
+ {{#score_rows}}
+
+ | {{label1}} - {{label2}} |
+ {{value1}} - {{value2}} |
+ {{dominant}} |
+
+ {{/score_rows}}
+
+
+
+
+
+
+
+
+
+
+
+
+{{/is_completed}}
diff --git a/templates/student_continue.mustache b/templates/student_continue.mustache
new file mode 100644
index 0000000..3fefe20
--- /dev/null
+++ b/templates/student_continue.mustache
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+ {{#str}}test_description, block_personality_test{{/str}}
+
+
+
+ {{#all_answered}}
+
+
+
+
+ {{#str}}all_answered_title, block_personality_test{{/str}}
+ {{#str}}all_answered_message, block_personality_test{{/str}}
+
+
+
+ {{/all_answered}}
+
+
+
+ {{#str}}your_progress, block_personality_test{{/str}}
+ {{answered_count}}/72
+
+
+
{{progress_percentage_formatted}}% {{#str}}completed, block_personality_test{{/str}}
+
+
+
+
diff --git a/templates/student_invitation.mustache b/templates/student_invitation.mustache
new file mode 100644
index 0000000..10befd9
--- /dev/null
+++ b/templates/student_invitation.mustache
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+ {{#str}}what_is_mbti, block_personality_test{{/str}}
+
+
{{#str}}test_description, block_personality_test{{/str}}
+
+ - {{#str}}feature_72_questions, block_personality_test{{/str}}
+ - {{#str}}feature_16_types, block_personality_test{{/str}}
+ - {{#str}}feature_instant_results, block_personality_test{{/str}}
+
+
+
+
+
+
+
diff --git a/templates/student_results.mustache b/templates/student_results.mustache
new file mode 100644
index 0000000..7e4d740
--- /dev/null
+++ b/templates/student_results.mustache
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+ {{#str}}test_description, block_personality_test{{/str}}
+
+
+
+
+
{{mbti_score}}
+ {{mbti_dimensions_str}}
+
+
+
+ {{{mbti_description}}}
+
+
+
+
+{{#js}}
+require(['jquery'], function($) {
+ var instanceId = "{{instanceid}}";
+ /* Check if instanceId is valid before proceeding */
+ if (instanceId && window.location.hash) {
+ var targetHash = "#inst" + instanceId;
+ if (window.location.hash === targetHash) {
+ /* Add a small delay to ensure rendering is complete */
+ setTimeout(function() {
+ var $target = $(targetHash);
+ if ($target.length) {
+ /* Scroll to element with some top offset (e.g. 100px for header) */
+ $('html, body').animate({
+ scrollTop: $target.offset().top - 100
+ }, 500);
+ }
+ }, 300);
+ }
+ }
+});
+{{/js}}
diff --git a/templates/teacher_dashboard.mustache b/templates/teacher_dashboard.mustache
new file mode 100644
index 0000000..51da78b
--- /dev/null
+++ b/templates/teacher_dashboard.mustache
@@ -0,0 +1,58 @@
+
+
+{{^has_data}}
+
+
{{#str}}participation_stats, block_personality_test{{/str}}
+
+ - {{#str}}total_participants, block_personality_test{{/str}}: {{total_students}}
+ - {{#str}}completed_tests, block_personality_test{{/str}}: 0
+ - {{#str}}in_progress_tests, block_personality_test{{/str}}: {{in_progress}}
+
+
+
{{#str}}sin_datos_estudiantes, block_personality_test{{/str}}
+
{{#str}}waiting_first_completion, block_personality_test{{/str}}
+
+{{/has_data}}
+
+{{#has_data}}
+
+ {{#str}}participation_stats, block_personality_test{{/str}}:
+ {{completed_str}}
+
+
+
{{#str}}titulo_resultados_estudiantes, block_personality_test{{/str}}
+
+
+
{{#str}}titulo_distribucion_rasgos, block_personality_test{{/str}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{{/has_data}}
+{{#admin_url}}
+
+{{/admin_url}}
diff --git a/templates/test_view.mustache b/templates/test_view.mustache
new file mode 100644
index 0000000..3774a69
--- /dev/null
+++ b/templates/test_view.mustache
@@ -0,0 +1,276 @@
+
+
+

+
+
+
{{test_page_title}}
+
+ {{{test_intro_p1}}}
+ {{{test_intro_p2}}}
+
+
+
+ {{test_benefit_note}} {{test_benefit_required}} (*)
+
+
+
+
+
+
diff --git a/version.php b/version.php
index 437b26a..6855bb5 100644
--- a/version.php
+++ b/version.php
@@ -1,17 +1,17 @@
version = 2025122200;
-$plugin->requires = 2022112800;
+$plugin->version = 2026010800;
+$plugin->requires = 2022041900; // Moodle 4.0+
$plugin->component = 'block_personality_test';
$plugin->maturity = MATURITY_STABLE;
-$plugin->release = '2.0.1';
+$plugin->release = '2.0.2';
diff --git a/view.php b/view.php
index fb9961a..73efa5b 100644
--- a/view.php
+++ b/view.php
@@ -1,4 +1,13 @@
record_exists('block_instances', array('blockname' => 'personality_test', 'parentcontextid' => $context->id))) {
+ redirect(new moodle_url('/course/view.php', array('id' => $courseid)));
+}
+
// If a user with reporting capability tries to open the student test view, redirect them to admin silently
if (has_capability('block/personality_test:viewreports', $context) && !has_capability('block/personality_test:taketest', $context)) {
redirect(new moodle_url('/blocks/personality_test/admin_view.php', array('cid' => $courseid)), get_string('teachers_redirect_message', 'block_personality_test'), null, \core\output\notification::NOTIFY_INFO);
@@ -117,306 +131,71 @@
echo $OUTPUT->header();
echo $OUTPUT->box_start('generalbox');
-// Display personality test icon centered above title
-$iconurl = new moodle_url('/blocks/personality_test/pix/personality_test_icon.svg');
-echo '
';
-echo '

';
-echo '
';
-
-echo "
".get_string('test_page_title', 'block_personality_test')."
";
-echo "
-
-".get_string('test_intro_p1', 'block_personality_test')."
-".get_string('test_intro_p2', 'block_personality_test')."
-
-
-
- ".get_string('test_benefit_note', 'block_personality_test')." ".get_string('test_benefit_required', 'block_personality_test')." (*)
-
-";
-
-$action_form = new moodle_url('/blocks/personality_test/save.php');
-?>
-
-
-
-
+$should_auto_scroll = ($existing_response && $answered_count > 0 && $answered_count < 72 && !$scroll_to_finish);
+$action_form = new moodle_url('/blocks/personality_test/save.php');
- (new moodle_url('/blocks/personality_test/pix/icon.svg'))->out(),
+ 'test_page_title' => get_string('test_page_title', 'block_personality_test'),
+ 'test_intro_p1' => get_string('test_intro_p1', 'block_personality_test'),
+ 'test_intro_p2' => get_string('test_intro_p2', 'block_personality_test'),
+ 'test_benefit_note' => get_string('test_benefit_note', 'block_personality_test'),
+ 'test_benefit_required' => get_string('test_benefit_required', 'block_personality_test'),
+ 'action_form' => $action_form->out(),
+ 'questions' => $questions,
+ 'hidden_answers' => $hidden_answers,
+ 'courseid' => $courseid,
+ 'page' => $page,
+ 'sesskey' => sesskey(),
+ 'show_previous' => ($page > 1),
+ 'show_next' => ($page < $total_pages),
+ 'show_finish' => ($page >= $total_pages),
+ 'btn_previous_label' => get_string('btn_previous', 'block_personality_test'),
+ 'btn_next_label' => get_string('btn_next', 'block_personality_test'),
+ 'btn_finish_label' => get_string('btn_finish', 'block_personality_test'),
+ 'wwwroot' => $CFG->wwwroot,
+ 'should_auto_scroll' => $should_auto_scroll,
+ 'scroll_to_finish' => $scroll_to_finish,
+];
+
+echo $OUTPUT->render_from_template('block_personality_test/test_view', $template_data);
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
diff --git a/view_individual.php b/view_individual.php
index 818bca4..1dc12ed 100644
--- a/view_individual.php
+++ b/view_individual.php
@@ -1,4 +1,13 @@
get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$context = context_course::instance($courseid);
+// Check if the block is added to the course
+if (!$DB->record_exists('block_instances', array('blockname' => 'personality_test', 'parentcontextid' => $context->id))) {
+ redirect(new moodle_url('/course/view.php', array('id' => $courseid)));
+}
+
// Silent redirect if user lacks report capability
if (!has_capability('block/personality_test:viewreports', $context)) {
redirect(new moodle_url('/course/view.php', array('id' => $courseid)));
@@ -58,15 +72,10 @@
echo $OUTPUT->header();
+$template_data = [];
+
// Verificar si el test está completado
if ($test_result->is_completed == 0) {
- // Mostrar alerta de progreso
- echo "
";
- echo "
";
- echo "
" . get_string('test_in_progress', 'block_personality_test') . "
";
- echo "
" . get_string('test_in_progress_message', 'block_personality_test', fullname($user)) . "
";
- echo "
";
-
// Calcular progreso
$answered = 0;
for ($i = 1; $i <= 72; $i++) {
@@ -78,236 +87,108 @@
$progress_percentage = round(($answered / 72) * 100, 1);
- echo "
" . get_string('progress_label', 'block_personality_test') . ":
";
- echo "
";
- echo "
";
- echo "" . $progress_percentage . "%";
- echo "
";
- echo "
";
- echo "
" . get_string('has_answered', 'block_personality_test') . ": " . get_string('of_72_questions', 'block_personality_test', $answered) . "
";
+ $template_data = [
+ 'in_progress' => true,
+ 'is_completed' => false,
+ 'test_in_progress_title' => get_string('test_in_progress', 'block_personality_test'),
+ 'test_in_progress_message' => get_string('test_in_progress_message', 'block_personality_test', fullname($user)),
+ 'progress_label' => get_string('progress_label', 'block_personality_test'),
+ 'progress_percentage' => $progress_percentage,
+ 'has_answered_label' => get_string('has_answered', 'block_personality_test'),
+ 'answered_message' => get_string('of_72_questions', 'block_personality_test', $answered),
+ 'show_submit_reminder' => ($answered == 72),
+ 'remind_submit_test' => get_string('remind_submit_test', 'block_personality_test'),
+ 'results_available_message' => get_string('results_available_when_complete', 'block_personality_test', fullname($user)),
+ 'back_url' => (new moodle_url('/blocks/personality_test/admin_view.php', array('cid' => $courseid)))->out(),
+ 'back_to_admin_label' => get_string('back_to_admin', 'block_personality_test')
+ ];
- // Special message if all questions answered but not submitted
- if ($answered == 72) {
- echo "
";
- echo " ";
- echo "" . get_string('remind_submit_test', 'block_personality_test') . "";
- echo "
";
+} else {
+ // Si llegamos aquí, el test está completado, preparar datos para resultados completos
+ // Calcular tipo MBTI
+ $mbti = '';
+ $mbti .= ($test_result->extraversion > $test_result->introversion) ? 'E' : 'I';
+ $mbti .= ($test_result->sensing > $test_result->intuition) ? 'S' : 'N';
+ $mbti .= ($test_result->thinking >= $test_result->feeling) ? 'T' : 'F';
+ $mbti .= ($test_result->judging > $test_result->perceptive) ? 'J' : 'P';
+
+ $mbti_key = 'mbti_' . strtolower($mbti);
+ $mbti_dimensions_key = 'mbti_dimensions_' . strtolower($mbti);
+
+ // Preparar dimension bars
+ $dimension_bars = [];
+ $raw_dimensions = [
+ [get_string('extraversion', 'block_personality_test'), $test_result->extraversion, get_string('introversion', 'block_personality_test'), $test_result->introversion],
+ [get_string('sensing', 'block_personality_test'), $test_result->sensing, get_string('intuition', 'block_personality_test'), $test_result->intuition],
+ [get_string('thinking', 'block_personality_test'), $test_result->thinking, get_string('feeling', 'block_personality_test'), $test_result->feeling],
+ [get_string('judging', 'block_personality_test'), $test_result->judging, get_string('perceptive', 'block_personality_test'), $test_result->perceptive]
+ ];
+
+ foreach ($raw_dimensions as $dim) {
+ $total = $dim[1] + $dim[3];
+ $percent1 = $total > 0 ? ($dim[1] / $total) * 100 : 50;
+ $percent2 = $total > 0 ? ($dim[3] / $total) * 100 : 50;
+
+ $dimension_bars[] = [
+ 'label1' => $dim[0],
+ 'value1' => $dim[1],
+ 'label2' => $dim[2],
+ 'value2' => $dim[3],
+ 'percent1' => $percent1,
+ 'percent2' => $percent2,
+ 'percent1_display' => round($percent1, 1),
+ 'percent2_display' => round($percent2, 1)
+ ];
}
- echo "
" . get_string('results_available_when_complete', 'block_personality_test', fullname($user)) . "
";
- echo "
";
-
- // Botón para volver
- echo "
";
- echo "
";
-
- echo $OUTPUT->footer();
- exit;
-}
-
-// Si llegamos aquí, el test está completado, mostrar resultados completos
-// Calcular tipo MBTI
-$mbti = '';
-$mbti .= ($test_result->extraversion > $test_result->introversion) ? 'E' : 'I';
-$mbti .= ($test_result->sensing > $test_result->intuition) ? 'S' : 'N';
-$mbti .= ($test_result->thinking >= $test_result->feeling) ? 'T' : 'F';
-$mbti .= ($test_result->judging > $test_result->perceptive) ? 'J' : 'P';
-
-echo "
";
-
-// Header con información del estudiante
-echo "
";
-echo "
";
-echo "
";
-echo "";
-echo "
";
-echo "
";
-echo "
";
-echo "
" . fullname($user) . "
";
-echo "
" . get_string('email', 'block_personality_test') . ": " . $user->email . "
";
-echo "
" . get_string('test_date', 'block_personality_test') . ": " . date('d/m/Y H:i', $test_result->created_at) . "
";
-echo "
" . get_string('mbti_type', 'block_personality_test') . ": " . $mbti . "
";
-echo "
";
-echo "
";
-echo "
";
-echo "
";
-echo "
";
-echo "
";
-
-// Resultados detallados
-echo "
";
-
-// Dimensiones principales
-echo "
";
-echo "
";
-echo "";
-echo "
";
-
-// Función para mostrar barras de progreso comparativas
-function render_dimension_bar($label1, $value1, $label2, $value2, $max_value = 100) {
- $total = $value1 + $value2;
- $percent1 = $total > 0 ? ($value1 / $total) * 100 : 50;
- $percent2 = $total > 0 ? ($value2 / $total) * 100 : 50;
-
- echo "
";
- echo "
";
- echo "" . $label1 . " (" . $value1 . ")";
- echo "" . $label2 . " (" . $value2 . ")";
- echo "
";
- echo "
";
- echo "
";
- echo round($percent1, 1) . "%";
- echo "
";
- echo "
";
- echo round($percent2, 1) . "%";
- echo "
";
- echo "
";
- echo "
";
-}
-
-render_dimension_bar(
- get_string('extraversion', 'block_personality_test'),
- $test_result->extraversion,
- get_string('introversion', 'block_personality_test'),
- $test_result->introversion
-);
-
-render_dimension_bar(
- get_string('sensing', 'block_personality_test'),
- $test_result->sensing,
- get_string('intuition', 'block_personality_test'),
- $test_result->intuition
-);
-
-render_dimension_bar(
- get_string('thinking', 'block_personality_test'),
- $test_result->thinking,
- get_string('feeling', 'block_personality_test'),
- $test_result->feeling
-);
-
-render_dimension_bar(
- get_string('judging', 'block_personality_test'),
- $test_result->judging,
- get_string('perceptive', 'block_personality_test'),
- $test_result->perceptive
-);
-
-echo "
";
-echo "
";
-echo "
";
-
-// Resumen y acciones
-echo "
";
-echo "
";
-echo "";
-echo "
";
-
-// Usar cadenas de idioma para las descripciones MBTI
-$mbti_key = 'mbti_' . strtolower($mbti);
-$mbti_dimensions_key = 'mbti_dimensions_' . strtolower($mbti);
-
-echo "
";
-echo "
" . $mbti . "
";
-echo "
(" . get_string($mbti_dimensions_key, 'block_personality_test') . ")
";
-echo "
" . get_string($mbti_key, 'block_personality_test') . "
";
-echo "
";
-
-echo "
";
-
-echo "
";
-echo "
";
-echo "
";
-
-echo "
";
-
-// Datos detallados en tabla
-echo "
";
-echo "
";
-echo "
";
-echo "";
-echo "
";
-echo "
";
-echo "
";
-echo "";
-echo "";
-echo "| " . get_string('dimension', 'block_personality_test') . " | ";
-echo "" . get_string('score', 'block_personality_test') . " | ";
-echo "" . get_string('preference', 'block_personality_test') . " | ";
-echo "
";
-echo "";
-echo "";
-
-$dimensions = [
- [get_string('extraversion', 'block_personality_test'), get_string('introversion', 'block_personality_test'), $test_result->extraversion, $test_result->introversion],
- [get_string('sensing', 'block_personality_test'), get_string('intuition', 'block_personality_test'), $test_result->sensing, $test_result->intuition],
- [get_string('thinking', 'block_personality_test'), get_string('feeling', 'block_personality_test'), $test_result->thinking, $test_result->feeling],
- [get_string('judging', 'block_personality_test'), get_string('perceptive', 'block_personality_test'), $test_result->judging, $test_result->perceptive]
-];
+ // Preparar score rows
+ $score_rows = [];
+ foreach ($raw_dimensions as $dim) {
+ $dominant = ($dim[1] >= $dim[3]) ? $dim[0] : $dim[2];
+ $score_rows[] = [
+ 'label1' => $dim[0],
+ 'value1' => $dim[1],
+ 'label2' => $dim[2],
+ 'value2' => $dim[3],
+ 'dominant' => $dominant
+ ];
+ }
-foreach ($dimensions as $dim) {
- $label1 = $dim[0];
- $label2 = $dim[1];
- $value1 = $dim[2];
- $value2 = $dim[3];
- $dominant = ($value1 >= $value2) ? $label1 : $label2;
- echo "";
- echo "| " . $label1 . " - " . $label2 . " | ";
- echo "" . $value1 . " - " . $value2 . " | ";
- echo "" . $dominant . " | ";
- echo "
";
+ $template_data = [
+ 'in_progress' => false,
+ 'is_completed' => true,
+ 'iconurl' => (new moodle_url('/blocks/personality_test/pix/icon.svg'))->out(),
+ 'individual_results_title' => get_string('individual_results', 'block_personality_test'),
+ 'user_fullname' => fullname($user),
+ 'email_label' => get_string('email', 'block_personality_test'),
+ 'user_email' => $user->email,
+ 'date_label' => get_string('test_date', 'block_personality_test'),
+ 'test_date' => date('d/m/Y H:i', $test_result->created_at),
+ 'mbti_label' => get_string('mbti_type', 'block_personality_test'),
+ 'mbti_type' => $mbti,
+ 'dimensions_title' => get_string('personality_dimensions', 'block_personality_test'),
+ 'dimension_bars' => $dimension_bars,
+ 'summary_actions_title' => get_string('summary_actions', 'block_personality_test'),
+ 'mbti_dimensions_str' => get_string($mbti_dimensions_key, 'block_personality_test'),
+ 'mbti_description' => get_string($mbti_key, 'block_personality_test'),
+ 'download_url' => (new moodle_url('/blocks/personality_test/download_pdf.php', array('userid' => $userid, 'cid' => $courseid)))->out(false),
+ 'download_pdf_label' => get_string('download_pdf', 'block_personality_test'),
+ 'delete_url' => (new moodle_url('/blocks/personality_test/admin_view.php', array('cid' => $courseid, 'action' => 'delete', 'userid' => $userid, 'sesskey' => sesskey())))->out(false),
+ 'confirm_delete_msg' => get_string('confirm_delete_individual', 'block_personality_test'),
+ 'delete_results_label' => get_string('delete_results', 'block_personality_test'),
+ 'detailed_scores_title' => get_string('detailed_scores', 'block_personality_test'),
+ 'dimension_header' => get_string('dimension', 'block_personality_test'),
+ 'score_header' => get_string('score', 'block_personality_test'),
+ 'preference_header' => get_string('preference', 'block_personality_test'),
+ 'score_rows' => $score_rows,
+ 'back_to_admin_url' => (new moodle_url('/blocks/personality_test/admin_view.php', array('cid' => $courseid)))->out(false),
+ 'back_to_admin_label' => get_string('back_to_admin', 'block_personality_test'),
+ 'back_to_course_url' => (new moodle_url('/course/view.php', array('id' => $courseid)))->out(false),
+ 'back_to_course_label' => get_string('back_to_course', 'block_personality_test')
+ ];
}
-echo "";
-echo "
";
-echo "
";
-echo "
";
-echo "
";
-echo "
";
-echo "
";
-
-echo "
";
-
-// Botones de navegación con diseño moderno
-echo html_writer::start_div('mt-5 text-center d-flex gap-3 justify-content-center');
-echo html_writer::link(
- new moodle_url('/blocks/personality_test/admin_view.php', array('cid' => $courseid)),
- '
' . get_string('back_to_admin', 'block_personality_test'),
- array('class' => 'btn btn-secondary btn-modern mr-3')
-);
-echo html_writer::link(
- new moodle_url('/course/view.php', array('id' => $courseid)),
- '
' . get_string('back_to_course', 'block_personality_test'),
- array('class' => 'btn btn-modern', 'style' => 'background: linear-gradient(135deg, #00bf91 0%, #00a07a 100%); border: none; color: white;')
-);
-echo html_writer::end_div();
+echo $OUTPUT->render_from_template('block_personality_test/individual_view', $template_data);
echo $OUTPUT->footer();
?>