diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f4184f..302cc11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ Todas las modificaciones importantes del proyecto se documentarán en este archivo. +## [2.0.4] - 2026-01-18 +- Se eliminaron las comprobaciones redundantes de administrador (`is_siteadmin()`) en varias vistas clave, mejorando la detección correcta de roles locales (profesores vs estudiantes) y el sistema de permisos basado en capacidades. +- Se agrega negrilla en el titulo del bloque para mejorar la visibilidad. + ## [2.0.3] — 2026-01-18 - Opción para mostrar/ocultar las descripciones en el bloque principal. - Adición del gráfico radar en resultados detallados y acceso permitido a los estudiantes a esta vista. diff --git a/README.md b/README.md index b4b8319..b6fb66d 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Este repositorio incluye: El recorrido comienza con una invitación clara y directa. Desde el bloque principal del curso, el estudiante puede visualizar su estado actual y acceder al test con un solo click, facilitando la participación sin fricciones.

- Invitación al Test + Invitación al Test

**Interfaz de Evaluación Optimizada** @@ -74,7 +74,7 @@ Para garantizar la integridad de los datos, el sistema implementa una validació Entendemos que el tiempo es valioso. Si el estudiante debe interrumpir su sesión, el sistema guarda automáticamente su avance. Al regresar, el bloque muestra el porcentaje de progreso y permite reanudar el test exactamente donde se dejó, resaltando visualmente la siguiente pregunta a responder.

- Progreso del Test + Progreso del Test    Continuar Test

@@ -83,7 +83,7 @@ Entendemos que el tiempo es valioso. Si el estudiante debe interrumpir su sesió Si el estudiante ha completado las 44 preguntas pero aún no ha procesado el envío, el bloque muestra una notificación clara y amigable, invitándolo a formalizar la entrega y conocer su tipo de personalidad.

- Confirmación de Test Completado + Confirmación de Test Completado

**Análisis de Perfil y Recomendaciones Personalizadas** diff --git a/admin_view.php b/admin_view.php index 2f0e1aa..3cd1d26 100644 --- a/admin_view.php +++ b/admin_view.php @@ -33,7 +33,7 @@ } // Friendly redirect for unauthorized users -if (!has_capability('block/personality_test:viewreports', $context) && !is_siteadmin()) { +if (!has_capability('block/personality_test:viewreports', $context)) { redirect(new moodle_url('/course/view.php', array('id' => $courseid))); } @@ -53,11 +53,8 @@ if ($confirm) { // Privacy check $targetuser = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST); - if (!is_siteadmin() && ( - !is_enrolled($context, $targetuser, 'block/personality_test:taketest', true) - || has_capability('block/personality_test:viewreports', $context, $userid) - || is_siteadmin($userid) - )) { + if (!is_enrolled($context, $targetuser, 'block/personality_test:taketest', true) + || has_capability('block/personality_test:viewreports', $context, $userid)) { redirect(new moodle_url('/course/view.php', array('id' => $courseid))); } diff --git a/block_personality_test.php b/block_personality_test.php index 08e4534..9489d2d 100644 --- a/block_personality_test.php +++ b/block_personality_test.php @@ -99,9 +99,6 @@ private function _get_teacher_content($DB, $COURSE) { $filtered_student_ids = array(); foreach ($student_ids as $candidateid) { $candidateid = (int)$candidateid; - if (is_siteadmin($candidateid)) { - continue; - } if (has_capability('block/personality_test:viewreports', $context, $candidateid)) { continue; } diff --git a/download_pdf.php b/download_pdf.php index 0728d8f..6876b68 100644 --- a/download_pdf.php +++ b/download_pdf.php @@ -44,7 +44,7 @@ $context = context_course::instance($course->id); require_login($course, false); - $canviewreports = has_capability('block/personality_test:viewreports', $context) || is_siteadmin(); + $canviewreports = has_capability('block/personality_test:viewreports', $context); if (!$canviewreports && (int)$userid !== (int)$USER->id) { redirect(new moodle_url('/course/view.php', ['id' => $course->id])); } diff --git a/lang/en/block_personality_test.php b/lang/en/block_personality_test.php index 9b9394d..858589f 100644 --- a/lang/en/block_personality_test.php +++ b/lang/en/block_personality_test.php @@ -265,7 +265,7 @@ $string['mbti_dimensions_entj'] = 'Extraversion - Intuition - Thinking - Judging'; // Test invitation -$string['test_title'] = 'Personality '; +$string['test_title'] = 'Personality Exploration'; $string['discover_your_personality'] = 'Discover your personality type'; $string['what_is_mbti'] = 'What is the Myers-Briggs Type Indicator (MBTI)?'; $string['test_description'] = 'A self-reflective tool designed to reveal your natural preferences across four fundamental dimensions. Its goal is to provide you with a detailed profile of your strengths, blind spots, and how you interact with the world and the people around you.'; diff --git a/lib.php b/lib.php index 55ab867..f6177fd 100644 --- a/lib.php +++ b/lib.php @@ -77,7 +77,7 @@ function block_personality_test_get_report_data($courseid) { require_login($course, false); // Check permissions - if (!has_capability('block/personality_test:viewreports', $context) && !is_siteadmin()) { + if (!has_capability('block/personality_test:viewreports', $context)) { return false; } @@ -89,9 +89,6 @@ function block_personality_test_get_report_data($courseid) { $student_ids = array(); foreach ($enrolled_ids as $candidateid) { $candidateid = (int)$candidateid; - if (is_siteadmin($candidateid)) { - continue; - } if (has_capability('block/personality_test:viewreports', $context, $candidateid)) { continue; } diff --git a/templates/student_continue.mustache b/templates/student_continue.mustache index 89de0ce..430e0de 100644 --- a/templates/student_continue.mustache +++ b/templates/student_continue.mustache @@ -1,7 +1,7 @@
{{{icon}}} -
{{#str}}test_title, block_personality_test{{/str}}
+
{{#str}}test_title, block_personality_test{{/str}}
{{#str}}discover_your_personality, block_personality_test{{/str}}
diff --git a/templates/student_invitation.mustache b/templates/student_invitation.mustache index d12967a..82a94da 100644 --- a/templates/student_invitation.mustache +++ b/templates/student_invitation.mustache @@ -1,7 +1,7 @@
{{{icon}}} -
{{#str}}test_title, block_personality_test{{/str}}
+
{{#str}}test_title, block_personality_test{{/str}}
{{#str}}discover_your_personality, block_personality_test{{/str}}
diff --git a/templates/student_results.mustache b/templates/student_results.mustache index 374b8fe..be5e8f0 100644 --- a/templates/student_results.mustache +++ b/templates/student_results.mustache @@ -4,7 +4,7 @@ {{{icon}}}
-
{{#str}}test_completed, block_personality_test{{/str}}
+
{{#str}}test_completed, block_personality_test{{/str}}
{{#str}}your_results_here, block_personality_test{{/str}}
@@ -32,7 +32,7 @@
- {{#str}} see_detailed_results, block_personality_test {{/str}} + {{#str}} see_detailed_results, block_personality_test {{/str}}
diff --git a/version.php b/version.php index af28399..3c5f59d 100644 --- a/version.php +++ b/version.php @@ -1,7 +1,7 @@ version = 2026011800; // YYYYMMDDXX (year, month, day, 2-digit version number). +$plugin->version = 2026011801; // YYYYMMDDXX (year, month, day, 2-digit version number). $plugin->requires = 2022041900; // Moodle 4.0+ $plugin->component = 'block_personality_test'; $plugin->maturity = MATURITY_STABLE; -$plugin->release = '2.0.3'; +$plugin->release = '2.0.4'; diff --git a/view_individual.php b/view_individual.php index be6efb0..87762cf 100644 --- a/view_individual.php +++ b/view_individual.php @@ -22,16 +22,15 @@ // Verificar permisos y manejo de privacidad $is_own_results = ($USER->id == $userid); $can_view_reports = has_capability('block/personality_test:viewreports', $context); -$is_siteadmin = is_siteadmin($USER); // Acceso básico: Si no es propietario, ni profesor (con permisos), ni admin -> Redirigir -if (!$is_own_results && !$can_view_reports && !$is_siteadmin) { +if (!$is_own_results && !$can_view_reports) { redirect(new moodle_url('/course/view.php', array('id' => $courseid))); } // Check if teacher can access this specific user info (Grouping check) // Si no es admin y no son sus propios resultados... -if (!$is_siteadmin && !$is_own_results) { +if (!$is_own_results) { // Si el usuario tiene la capacidad de ver todos los grupos, permitir. if (!has_capability('moodle/site:accessallgroups', $context)) { // Obtener grupos del profesor y del estudiante objetivo