diff --git a/CHANGELOG.md b/CHANGELOG.md index cbe7150..2f4184f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Todas las modificaciones importantes del proyecto se documentarán en este archivo. +## [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. +- Se mantiene el titulo "Exploración de Personalidad" en todas las vistas del bloque. +- Se ha eliminado las referencias a la palabra "Test". + ## [2.0.2] — 2026-01-08 - Paginación en la lista de estudiantes en el panel de administración. - Nueva forma de mostrar las estadísticas generales en el panel de administración. diff --git a/README.md b/README.md index 0a16623..b4b8319 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Este repositorio incluye: - Acceso a **vista individual** por estudiante. - Posibilidad de **eliminación** de resultados individuales. - Exportación **CSV** y **PDF** agregados por curso. +- Opción para **mostrar/ocultar** las descripciones en el bloque principal **(oculto por defecto)**. - **Controles de privacidad**: acceso restringido por capacidades, matrícula y (en vista individual) reglas de grupo. --- @@ -50,14 +51,14 @@ 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** Se presenta un entorno de respuesta limpio y libre de distracciones. La interfaz ha sido diseñada para priorizar la legibilidad y la facilidad de uso, permitiendo que el estudiante se concentre totalmente en el proceso de autodescubrimiento.

- Formulario del Test + Formulario del Test

**Asistencia y Validación en Tiempo Real** @@ -73,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

@@ -82,15 +83,19 @@ 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** -Al concluir, el estudiante recibe un diagnóstico detallado de su tipo de personalidad. La presentación incluye un gráfico con una explicación clara, Además, se la da recomendaciones prácticas para su desarrollo personal. +Al finalizar, el estudiante recibe una tarjeta donde puede ver su tipo MBTI con lo que signfica cada letra, junto con un acceso directo a sus resultados detallados donde podrá ver gráficos y la descripción de su tipo de personalidad.

- Resultados del Estudiante + Resultados del Estudiante +

+ +

+ Vista Detallada del Estudiante

### 2. Experiencia del Profesor @@ -100,7 +105,7 @@ Al concluir, el estudiante recibe un diagnóstico detallado de su tipo de person El profesor cuenta con una vista ejecutiva desde el bloque, donde puede monitorizar métricas clave y gráficos de tendencia de forma inmediata, además de acceder a funciones avanzadas de exportación y administración.

- Bloque del Profesor + Bloque del Profesor

**Centro de Gestión y Analíticas** @@ -108,19 +113,17 @@ El profesor cuenta con una vista ejecutiva desde el bloque, donde puede monitori Un panel de administración que centraliza el seguimiento grupal. Permite visualizar quiénes han completado el proceso, quiénes están en curso y gestionar los resultados colectivos para adaptar la estrategia pedagógica del aula.

- Panel de Administración + Panel de Administración

**Seguimiento Individualizado y Detallado** -El docente puede profundizar en el perfil específico de cada estudiante. Esta vista permite comprender las necesidades particulares de cada alumno y las recomendaciones sugeridas por el sistema para brindar un apoyo docente más humano y dirigido. - -

- Vista Detallada del Estudiante -

+El docente puede profundizar en el perfil específico de cada estudiante. Esta vista permite conocer el tipo de personalidad y su descripción detallada. +- **Nota:** Esta vista es la misma que la del estudiante, pero accesible por el profesor para cualquier alumno del curso. --- + ## Sección técnica Esta sección describe el comportamiento **tal como está implementado** en el bloque (cálculo, persistencia, flujos y controles de acceso). @@ -183,7 +186,7 @@ Implementación técnica: El flujo del estudiante está diseñado para soportar progreso parcial: - Se crea/actualiza un registro con `is_completed = 0` mientras el test está en curso. -- El autosave se ejecuta tras **2 segundos** de inactividad después de responder. +- El autosave se ejecuta tras **400 milisegundos** de inactividad después de responder. - La navegación **Anterior/Siguiente** guarda progreso en el servidor. Reglas de integridad implementadas: diff --git a/block_personality_test.php b/block_personality_test.php index 675deba..08e4534 100644 --- a/block_personality_test.php +++ b/block_personality_test.php @@ -217,7 +217,8 @@ private function get_test_invitation() { $url = new moodle_url('/blocks/personality_test/view.php', array('cid' => $COURSE->id)); $data = [ 'icon' => $this->get_personality_test_icon('4em', '', true), - 'url' => $url->out(false) + 'url' => $url->out(false), + 'showdescriptions' => !empty($this->config->showdescriptions) ]; return $OUTPUT->render_from_template('block_personality_test/student_invitation', $data); @@ -245,7 +246,8 @@ private function get_continue_test_card($answered_count) { 'progress_percentage' => $progress_percentage, 'progress_percentage_formatted' => number_format($progress_percentage, 1), 'all_answered' => $all_answered, - 'url' => $url->out(false) + 'url' => $url->out(false), + 'showdescriptions' => !empty($this->config->showdescriptions) ]; return $OUTPUT->render_from_template('block_personality_test/student_continue', $data); @@ -378,7 +380,9 @@ function get_content() 'mbti_description' => get_string('mbti_' . strtolower($mbti_score), 'block_personality_test'), 'chart_id' => $chart_id, 'uniqid' => $USER->id, - 'instanceid' => $this->instance->id + 'instanceid' => $this->instance->id, + 'showdescriptions' => !empty($this->config->showdescriptions), + 'summary_url' => (new moodle_url('/blocks/personality_test/view_individual.php', array('userid' => $USER->id, 'cid' => $COURSE->id)))->out(false) ]; $this->content->text = $OUTPUT->render_from_template('block_personality_test/student_results', $template_data); diff --git a/edit_form.php b/edit_form.php new file mode 100644 index 0000000..fab1392 --- /dev/null +++ b/edit_form.php @@ -0,0 +1,13 @@ +addElement('header', 'config_header', get_string('blocksettings', 'block')); + + // Checkbox/Select for showing descriptions. Default is No (0). + $mform->addElement('selectyesno', 'config_showdescriptions', get_string('config_showdescriptions', 'block_personality_test')); + $mform->setDefault('config_showdescriptions', 0); + $mform->setType('config_showdescriptions', PARAM_BOOL); + $mform->addHelpButton('config_showdescriptions', 'config_showdescriptions', 'block_personality_test'); + } +} diff --git a/lang/en/block_personality_test.php b/lang/en/block_personality_test.php index 284261d..9b9394d 100644 --- a/lang/en/block_personality_test.php +++ b/lang/en/block_personality_test.php @@ -1,15 +1,13 @@ Please read the instructions carefully before starting the test.

'; -$string['accept_code_honor_text'] = 'Accept'; -$string['redirect_accept_success'] = 'Congratulations, you can now view your results in the course sidebar.'; -$string['redirect_accept_exist'] = 'You have already completed the test, redirecting to course.'; +$string['management_title'] = 'Personality Exploration Management'; +$string['admin_dashboard_description'] = 'Personality Exploration Administration Panel. Here you can view detailed statistics, manage student responses and export data.'; +$string['redirect_accept_success'] = 'Congratulations, you can now view your results here.'; +$string['redirect_accept_exist'] = 'You have already completed the exploration, redirecting to course.'; $string['accept_message'] = 'Personality detected'; $string['required_message'] = 'Please complete the personality assessment to continue'; -$string['personality_test_actived'] = 'Personality test activated'; +$string['personality_test_actived'] = 'Personality Exploration activated'; $string['personality_test_configempty'] = 'Please configure this block'; $string['submit_text'] = 'Continue and go to course'; $string['num_estudiantes'] = 'Students'; @@ -17,32 +15,36 @@ $string['no'] = 'No'; $string['btn_previous'] = 'Previous'; $string['btn_next'] = 'Next'; -$string['btn_finish'] = 'Finish Test'; +$string['btn_finish'] = 'Finish Exploration'; $string['progress_saved'] = 'Progress saved successfully'; -$string['test_completed_redirect'] = 'You have already completed this test'; +$string['test_completed_redirect'] = 'You have already completed this exploration'; $string['page_of'] = 'Page {$a->current} of {$a->total}'; $string['your_progress'] = 'Your Progress'; $string['completed'] = 'completed'; -$string['continue_test'] = 'Continue Test'; +$string['continue_test'] = 'Continue Exploration'; $string['all_answered_title'] = 'All Questions Answered!'; -$string['all_answered_message'] = 'You have answered all 72 questions. Don\'t forget to click "Finish Test" to submit your answers and see your personality results!'; +$string['all_answered_message'] = 'You have answered all 72 questions. Don\'t forget to click "Finish Exploration" to submit your answers and view your personality results!'; $string['go_to_administration'] = 'Go to Administration Panel'; +$string['see_detailed_results'] = 'View Detailed Results'; // Test in progress and remind strings -$string['test_in_progress'] = 'Test in Progress'; -$string['test_in_progress_message'] = '{$a} has started the test but has not completed it yet.'; -$string['results_available_when_complete'] = 'Full results will be available when {$a} finishes the test.'; -$string['remind_submit_test'] = 'Remind the student to click the "Finish Test" button to view the results.'; +$string['test_in_progress'] = 'Exploration in Progress'; +$string['test_in_progress_message'] = '{$a} has started the exploration but has not completed it yet.'; +$string['results_available_when_complete'] = 'Full results will be available when {$a} finishes the exploration.'; +$string['remind_submit_test'] = 'Remind the student to click the "Finish Exploration" button to view the results.'; $string['questions'] = 'questions'; $string['progress_label'] = 'Progress'; $string['has_answered'] = 'Has answered'; -$string['finish_test_now'] = 'Finish Test'; +$string['finish_test_now'] = 'Finish Exploration'; $string['test_results'] = 'Your Results'; -$string["personality_test_content"] = "Personality Test"; -$string['personality_test:addinstance'] = 'Add a new Personality Test block'; -$string['personality_test:myaddinstance'] = 'Add a new Personality Test block to My Moodle'; +$string["personality_test_content"] = "Personality Exploration"; +$string['personality_test:addinstance'] = 'Add a new Personality Exploration block'; +$string['personality_test:myaddinstance'] = 'Add a new Personality Exploration block to My Moodle'; $string['total_participants'] = 'Total Students'; +$string['config_showdescriptions'] = 'Show descriptions'; +$string['config_showdescriptions_help'] = 'Show or hide the description banners in the block.'; + // Question strings $string["personality_test:q1"] = "Takes pride in being objective, despite being accused of being cold and indifferent."; $string["personality_test:q2"] = "Needs to recharge alone, after meetings, phone calls or socializing; the more intense the encounter the more exhausted he feels afterwards."; @@ -125,14 +127,14 @@ // --- Strings for PDF and Charts --- // General PDF/Chart Titles -$string['pdf_report_title'] = 'Personality Test Report'; -$string['pdf_report_subject'] = 'Personality Test Results for course: {$a}'; +$string['pdf_report_title'] = 'Personality Exploration Report'; +$string['pdf_report_subject'] = 'Personality Exploration Results for course: {$a}'; $string['summary_information'] = 'Summary Information'; $string['total_students_processed'] = 'Total students processed: {$a}'; $string['generated_on'] = 'Generated on'; $string['sin_datos_estudiantes_pdf'] = 'No student data available to generate PDF.'; $string['sin_datos_estudiantes'] = 'No student results available to display yet.'; -$string['waiting_first_completion'] = 'Once at least one test has been completed, results and charts will be available here.'; +$string['waiting_first_completion'] = 'Once at least one exploration has been completed, results and charts will be available here.'; // MBTI Table $string['titulo_distribucion_mbti'] = 'MBTI Distribution'; @@ -162,14 +164,14 @@ $string['Percepcion'] = 'Perceiving'; // Errors -$string['error_recuperando_resultados'] = 'Error retrieving test results.'; +$string['error_recuperando_resultados'] = 'Error retrieving exploration results.'; $string['error_puntuacion_invalida'] = 'Error: Invalid MBTI score calculated.'; // Administrative section $string['admin_manage_title'] = 'Personality Exploration Administration'; $string['no_admin_access'] = 'You do not have administrative access to this course.'; $string['total_students'] = 'Total Students'; -$string['completed_tests'] = 'Completed Tests'; +$string['completed_tests'] = 'Completed Explorations'; $string['in_progress_tests'] = 'In Progress'; $string['completion_rate'] = 'Completion Rate'; $string['general_statistics'] = 'General Statistics'; @@ -177,7 +179,7 @@ $string['average_dimensions'] = 'Average Dimension Scores'; $string['no_data_available'] = 'No data available yet.'; $string['no_participants'] = 'No results available yet'; -$string['no_participants_message'] = 'No students have started the test yet.'; +$string['no_participants_message'] = 'No students have started the exploration yet.'; $string['participants_list'] = 'Student Responses'; $string['status'] = 'Status'; $string['completed_status'] = 'Completed'; @@ -198,20 +200,20 @@ $string['delete_participation'] = 'Delete Participation'; $string['back_to_course'] = 'Back to Course'; $string['confirm_delete'] = 'Confirm Deletion'; -$string['confirm_delete_message'] = 'Are you sure you want to delete the test results for {$a}? This action cannot be undone.'; +$string['confirm_delete_message'] = 'Are you sure you want to delete the exploration results for {$a}? This action cannot be undone.'; $string['confirm_delete_yes'] = 'Yes, Delete'; $string['cancel'] = 'Cancel'; $string['participation_deleted'] = 'Participation has been successfully deleted.'; // Individual results page -$string['individual_results'] = 'Individual Results'; -$string['no_test_results'] = 'No test results found for this student.'; +$string['individual_results'] = 'Individual Personality Exploration Results'; +$string['no_test_results'] = 'No exploration results found for this student.'; $string['back_to_admin'] = 'Back to Administration Panel'; $string['personality_dimensions'] = 'Personality Dimensions'; $string['summary_actions'] = 'Summary & Actions'; $string['download_pdf'] = 'Export PDF'; $string['delete_results'] = 'Delete Results'; -$string['confirm_delete_individual'] = 'Are you sure you want to delete these test results?'; +$string['confirm_delete_individual'] = 'Are you sure you want to delete these exploration results?'; $string['detailed_scores'] = 'Detailed Scores'; $string['dimension'] = 'Dimension'; $string['score'] = 'Score'; @@ -224,6 +226,7 @@ $string['feeling'] = 'Feeling'; $string['judging'] = 'Judging'; $string['perceptive'] = 'Perceptive'; +$string['radar_chart_title'] = 'Radar Chart of Personality Dimensions'; // Detailed MBTI Type Descriptions $string['mbti_istj'] = 'ISTJ individuals are characterized by their sense of duty, responsibility, and discipline. They tend to act logically and orderly, especially in situations requiring structure or planning. Under pressure, they remain calm and seek practical solutions, relying on experience and facts. Their strength lies in their reliability and commitment, though they may appear inflexible when facing changes or unconventional ideas. They need to learn to adapt more fluidly and appreciate emotional perspectives as well.'; @@ -262,26 +265,26 @@ $string['mbti_dimensions_entj'] = 'Extraversion - Intuition - Thinking - Judging'; // Test invitation -$string['test_title'] = 'Personality Test'; +$string['test_title'] = 'Personality '; $string['discover_your_personality'] = 'Discover your personality type'; -$string['what_is_mbti'] = 'What is the Myers-Briggs Test (MBTI)?'; +$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.'; $string['feature_72_questions'] = '72 quick questions'; $string['feature_16_types'] = '16 unique personality types'; $string['feature_instant_results'] = 'Instant results with detailed profile'; -$string['start_test'] = 'Start Test'; -$string['test_completed'] = 'Test Completed'; -$string['your_personality_type'] = 'Your Personality Type'; +$string['start_test'] = 'Start Exploration'; +$string['test_completed'] = 'Personality Exploration Completed'; +$string['your_results_here'] = 'View your results here'; // Test page strings $string['test_page_title'] = 'Discover Your Personality Type'; -$string['test_intro_p1'] = 'This test will help you identify your personality type based on the Myers-Briggs model, which analyzes four key dimensions: Extraversion/Introversion, Sensing/Intuition, Thinking/Feeling, and Judging/Perceiving.'; +$string['test_intro_p1'] = 'This exploration will help you identify your personality type based on the Myers-Briggs model, which analyzes four key dimensions: Extraversion/Introversion, Sensing/Intuition, Thinking/Feeling, and Judging/Perceiving.'; $string['test_intro_p2'] = 'Understanding your personality type will allow you to better know yourself, recognize your strengths, and understand how you interact with the world around you.'; $string['test_benefit_note'] = 'Note:'; $string['test_benefit_required'] = 'All questions are required'; $string['select_option'] = 'Select'; $string['participation_stats'] = 'Participation'; -$string['students_completed_test'] = '{$a->completed} of {$a->total} students have completed the test ({$a->percentage}%)'; +$string['students_completed_test'] = '{$a->completed} of {$a->total} students have completed the exploration ({$a->percentage}%)'; // CSV Export Headers $string['csv_header_userid'] = 'Student ID'; @@ -290,10 +293,9 @@ $string['csv_header_last_action_date'] = 'Date of Last Action'; // Export filenames -$string['export_filename'] = 'Personality_Test_MBTI'; - +$string['export_filename'] = 'Personality_Exploration_MBTI'; // Security and validation strings -$string['all_questions_required'] = 'You must answer all 72 questions before finishing the test. You have been redirected to the first unanswered question.'; +$string['all_questions_required'] = 'You must answer all 72 questions before finishing the exploration. You have been redirected to the first unanswered question.'; // Redirect and acceptance messages $string['teachers_redirect_message'] = 'Teachers are redirected to the admin panel.'; diff --git a/lang/es/block_personality_test.php b/lang/es/block_personality_test.php index 1451ced..43b791a 100644 --- a/lang/es/block_personality_test.php +++ b/lang/es/block_personality_test.php @@ -1,15 +1,13 @@ Por favor, lea atentamente las instrucciones antes de comenzar el test.

'; -$string['accept_code_honor_text'] = 'Acepto'; -$string['redirect_accept_success'] = 'Enhorabuena, ahora puedes ver tus resultados en la barra lateral del curso.'; -$string['redirect_accept_exist'] = 'Ya ha completado el test, será redirigido al curso.'; +$string['admin_dashboard_description'] = 'Panel de Administración de la Exploración de Personalidad. Aquí puede ver estadísticas detalladas, gestionar respuestas de estudiantes y exportar datos.'; +$string['redirect_accept_success'] = 'Enhorabuena, ahora puedes ver tus resultados aquí.'; +$string['redirect_accept_exist'] = 'Ya ha completado la exploración, será redirigido al curso.'; $string['accept_message'] = 'Personalidad detectada'; $string['required_message'] = 'Por favor, realice la evaluación de personalidad para continuar'; -$string['personality_test_actived'] = 'Test de personalidad activado'; +$string['personality_test_actived'] = 'Exploración de personalidad activada'; $string['personality_test_configempty'] = 'Por favor, configure este bloque'; $string['submit_text'] = 'Continuar e ir al curso'; $string['num_estudiantes'] = 'Estudiantes'; @@ -17,32 +15,36 @@ $string['no'] = 'No'; $string['btn_previous'] = 'Anterior'; $string['btn_next'] = 'Siguiente'; -$string['btn_finish'] = 'Finalizar Test'; +$string['btn_finish'] = 'Finalizar Exploración'; $string['progress_saved'] = 'Progreso guardado exitosamente'; -$string['test_completed_redirect'] = 'Ya has completado este test'; +$string['test_completed_redirect'] = 'Ya has completado esta exploración'; $string['page_of'] = 'Página {$a->current} de {$a->total}'; $string['your_progress'] = 'Tu Progreso'; $string['completed'] = 'completado'; -$string['continue_test'] = 'Continuar Test'; +$string['continue_test'] = 'Continuar Exploración'; $string['all_answered_title'] = '¡Todas las Preguntas Respondidas!'; -$string['all_answered_message'] = 'Has respondido las 72 preguntas. ¡No olvides hacer clic en "Finalizar Test" para enviar tus respuestas y conocer tu tipo de personalidad!'; +$string['all_answered_message'] = 'Has respondido las 72 preguntas. ¡No olvides hacer clic en "Finalizar Exploración" para enviar tus respuestas y conocer tu tipo de personalidad!'; $string['go_to_administration'] = 'Ir al Panel de Administración'; +$string['see_detailed_results'] = 'Ver Resultados Detallados'; // Test in progress and remind strings -$string['test_in_progress'] = 'Test en Progreso'; -$string['test_in_progress_message'] = '{$a} ha comenzado el test pero aún no lo ha completado.'; -$string['results_available_when_complete'] = 'Los resultados completos estarán disponibles cuando {$a} termine el test.'; -$string['remind_submit_test'] = 'Recuérdale al estudiante que haga clic en el botón "Finalizar Test" para ver los resultados.'; +$string['test_in_progress'] = 'Exploración en Progreso'; +$string['test_in_progress_message'] = '{$a} ha comenzado la exploración pero aún no la ha completado.'; +$string['results_available_when_complete'] = 'Los resultados completos estarán disponibles cuando {$a} termine la exploración.'; +$string['remind_submit_test'] = 'Recuérdale al estudiante que haga clic en el botón "Finalizar Exploración" para ver los resultados.'; $string['questions'] = 'preguntas'; $string['progress_label'] = 'Progreso'; $string['has_answered'] = 'Ha respondido'; -$string['finish_test_now'] = 'Finalizar Test'; +$string['finish_test_now'] = 'Finalizar Exploración'; $string['test_results'] = 'Tus Resultados'; -$string["personality_test_content"] = "Test de Personalidad"; -$string['personality_test:addinstance'] = 'Añadir un nuevo bloque de Test de Personalidad'; -$string['personality_test:myaddinstance'] = 'Añadir un nuevo bloque de Test de Personalidad a Mi Moodle'; +$string["personality_test_content"] = "Exploración de Personalidad"; +$string['personality_test:addinstance'] = 'Añadir un nuevo bloque de Exploración de Personalidad'; +$string['personality_test:myaddinstance'] = 'Añadir un nuevo bloque de Exploración de Personalidad a Mi Moodle'; $string['total_participants'] = 'Total Estudiantes'; +$string['config_showdescriptions'] = 'Mostrar descripciones'; +$string['config_showdescriptions_help'] = 'Mostrar u ocultar los banners de descripción en el bloque.'; + // Question strings $string["personality_test:q1"] = "Se enorgullece de su objetividad, a pesar de que algunos lo acusan de ser frío e indiferente."; $string["personality_test:q2"] = "Necesita recargar energías solo, después de reuniones, llamadas telefónicas o socialización; cuanto más intenso es el encuentro más agotado se siente posteriormente."; @@ -125,14 +127,14 @@ // --- Cadenas para el PDF y Gráficos --- // Títulos Generales PDF/Gráfico -$string['pdf_report_title'] = 'Reporte del Test de Personalidad'; -$string['pdf_report_subject'] = 'Resultados del Test de Personalidad para el curso: {$a}'; +$string['pdf_report_title'] = 'Reporte de la Exploración de Personalidad'; +$string['pdf_report_subject'] = 'Resultados de la Exploración de Personalidad para el curso: {$a}'; $string['summary_information'] = 'Información Resumen'; $string['total_students_processed'] = 'Total de estudiantes procesados: {$a}'; $string['generated_on'] = 'Generado el'; $string['sin_datos_estudiantes_pdf'] = 'No hay datos de estudiantes para generar el PDF.'; $string['sin_datos_estudiantes'] = 'Aún no hay resultados de estudiantes para mostrar.'; -$string['waiting_first_completion'] = 'Cuando al menos un test haya sido completado, los resultados y las gráficas estarán disponibles aquí.'; +$string['waiting_first_completion'] = 'Cuando al menos una exploración haya sido completada, los resultados y las gráficas estarán disponibles aquí.'; // Tabla MBTI $string['titulo_distribucion_mbti'] = 'Distribución MBTI'; @@ -162,14 +164,14 @@ $string['Percepcion'] = 'Percepción'; // Errores -$string['error_recuperando_resultados'] = 'Error al recuperar los resultados del test.'; +$string['error_recuperando_resultados'] = 'Error al recuperar los resultados de la exploración.'; $string['error_puntuacion_invalida'] = 'Error: Puntuación MBTI inválida calculada.'; // Sección administrativa $string['admin_manage_title'] = 'Administración - Exploración de Personalidad'; $string['no_admin_access'] = 'No tienes acceso administrativo a este curso.'; $string['total_students'] = 'Total de Estudiantes'; -$string['completed_tests'] = 'Tests Completados'; +$string['completed_tests'] = 'Exploraciones Completadas'; $string['in_progress_tests'] = 'En Progreso'; $string['completion_rate'] = 'Tasa de Finalización'; $string['general_statistics'] = 'Estadísticas Generales'; @@ -177,7 +179,7 @@ $string['average_dimensions'] = 'Puntuaciones Promedio de Dimensiones'; $string['no_data_available'] = 'No hay datos disponibles aún.'; $string['no_participants'] = 'Aún no hay resultados disponibles'; -$string['no_participants_message'] = 'Ningún estudiante ha comenzado el test aún.'; +$string['no_participants_message'] = 'Ningún estudiante ha comenzado la exploración aún.'; $string['participants_list'] = 'Respuestas de Estudiantes'; $string['status'] = 'Estado'; $string['completed_status'] = 'Completado'; @@ -198,20 +200,20 @@ $string['delete_participation'] = 'Eliminar Participación'; $string['back_to_course'] = 'Volver al Curso'; $string['confirm_delete'] = 'Confirmar Eliminación'; -$string['confirm_delete_message'] = '¿Estás seguro de que quieres eliminar los resultados del test para {$a}? Esta acción no se puede deshacer.'; +$string['confirm_delete_message'] = '¿Estás seguro de que quieres eliminar los resultados de la exploración para {$a}? Esta acción no se puede deshacer.'; $string['confirm_delete_yes'] = 'Sí, Eliminar'; $string['cancel'] = 'Cancelar'; $string['participation_deleted'] = 'La participación ha sido eliminada exitosamente.'; // Página de resultados individuales -$string['individual_results'] = 'Resultados Individuales'; -$string['no_test_results'] = 'No se encontraron resultados del test para este estudiante.'; +$string['individual_results'] = 'Resultados Individuales de la Exploración de Personalidad'; +$string['no_test_results'] = 'No se encontraron resultados de la exploración para este estudiante.'; $string['back_to_admin'] = 'Volver al Panel de Administración'; $string['personality_dimensions'] = 'Dimensiones de Personalidad'; $string['summary_actions'] = 'Resumen y Acciones'; $string['download_pdf'] = 'Exportar PDF'; $string['delete_results'] = 'Eliminar Resultados'; -$string['confirm_delete_individual'] = '¿Estás seguro de que quieres eliminar estos resultados del test?'; +$string['confirm_delete_individual'] = '¿Estás seguro de que quieres eliminar estos resultados de la exploración?'; $string['detailed_scores'] = 'Puntuaciones Detalladas'; $string['dimension'] = 'Dimensión'; $string['score'] = 'Puntuación'; @@ -223,7 +225,8 @@ $string['thinking'] = 'Pensamiento'; $string['feeling'] = 'Sentimiento'; $string['judging'] = 'Juicio'; -$string['perceptive'] = 'Percepción'; +$string['perceptive'] = 'Percepción'; +$string['radar_chart_title'] = 'Gráfico Radar de Dimensiones de Personalidad'; // Descripciones detalladas de tipos MBTI $string['mbti_istj'] = 'La persona ISTJ se caracteriza por su sentido del deber, la responsabilidad y la disciplina. Tiende a actuar de forma lógica y ordenada, especialmente en situaciones que requieren estructura o planificación. En momentos de presión, mantiene la calma y busca soluciones prácticas, confiando en la experiencia y los hechos. Su fortaleza radica en su fiabilidad y compromiso, aunque puede mostrarse inflexible ante los cambios o las ideas poco convencionales. Necesita aprender a adaptarse con mayor soltura y a valorar también las perspectivas emocionales.'; @@ -262,26 +265,26 @@ $string['mbti_dimensions_entj'] = 'Extraversión - Intuición - Pensamiento - Juicio'; // Invitación al test -$string['test_title'] = 'Test de Personalidad'; +$string['test_title'] = 'Exploración de Personalidad'; $string['discover_your_personality'] = 'Descubre tu tipo de personalidad'; -$string['what_is_mbti'] = '¿Qué es el Test de Myers-Briggs (MBTI)?'; +$string['what_is_mbti'] = '¿Qué es el Indicador de Myers-Briggs (MBTI)?'; $string['test_description'] = 'Una herramienta de introspección diseñada para revelar tus preferencias naturales en cuatro ejes fundamentales. Su objetivo es brindarte un perfil detallado sobre tus fortalezas, puntos ciegos y la forma en que interactúas con el mundo y las personas que te rodean.'; $string['feature_72_questions'] = '72 preguntas rápidas'; $string['feature_16_types'] = '16 tipos únicos de personalidad'; $string['feature_instant_results'] = 'Resultados instantáneos con perfil detallado'; -$string['start_test'] = 'Iniciar Test'; -$string['test_completed'] = 'Test Completado'; -$string['your_personality_type'] = 'Tu Tipo de Personalidad'; +$string['start_test'] = 'Iniciar Exploración'; +$string['test_completed'] = 'Exploración de Personalidad Completada'; +$string['your_results_here'] = 'Mira tus resultados aquí'; // Strings de página de test $string['test_page_title'] = 'Descubre Tu Tipo de Personalidad'; -$string['test_intro_p1'] = 'Este test te ayudará a identificar tu tipo de personalidad según el modelo Myers-Briggs, que analiza cuatro dimensiones clave: Extraversión/Introversión, Sensación/Intuición, Pensamiento/Sentimiento y Juicio/Percepción.'; +$string['test_intro_p1'] = 'Esta exploración te ayudará a identificar tu tipo de personalidad según el modelo Myers-Briggs, que analiza cuatro dimensiones clave: Extraversión/Introversión, Sensación/Intuición, Pensamiento/Sentimiento y Juicio/Percepción.'; $string['test_intro_p2'] = 'Comprender tu tipo de personalidad te permitirá conocerte mejor, reconocer tus fortalezas y entender cómo interactúas con el mundo que te rodea.'; $string['test_benefit_note'] = 'Nota:'; $string['test_benefit_required'] = 'Todas las preguntas son obligatorias'; $string['select_option'] = 'Selecciona'; $string['participation_stats'] = 'Participación'; -$string['students_completed_test'] = '{$a->completed} de {$a->total} estudiantes han completado el test ({$a->percentage}%)'; +$string['students_completed_test'] = '{$a->completed} de {$a->total} estudiantes han completado la exploración ({$a->percentage}%)'; // CSV Export Headers $string['csv_header_userid'] = 'ID Estudiante'; @@ -290,10 +293,9 @@ $string['csv_header_last_action_date'] = 'Fecha de Última Acción'; // Nombres de archivos exportables -$string['export_filename'] = 'Test_Personalidad_MBTI'; - +$string['export_filename'] = 'Exploracion_Personalidad_MBTI'; // Security and validation strings -$string['all_questions_required'] = 'Debes responder las 72 preguntas antes de finalizar el test. Has sido redirigido a la primera pregunta sin responder.'; +$string['all_questions_required'] = 'Debes responder las 72 preguntas antes de finalizar la exploración. Has sido redirigido a la primera pregunta sin responder.'; // Redirect and acceptance messages $string['teachers_redirect_message'] = 'Los profesores son redirigidos al panel de administración.'; diff --git a/save.php b/save.php index 3b149e5..2443a26 100644 --- a/save.php +++ b/save.php @@ -267,10 +267,10 @@ function prepare_data_object($userid, $courseid, $existing_response) { // Save final results with is_completed = 1 if(save_personality_test($courseid,$extra_res,$intra_res,$sensi_res,$intui_res,$ratio_res,$emoti_res,$estru_res,$perce_res, $responses)){ - $redirect = new moodle_url('/course/view.php', array('id'=>$courseid)); + $redirect = new moodle_url('/blocks/personality_test/view_individual.php', array('cid' => $courseid, 'userid' => $USER->id)); redirect($redirect, get_string('redirect_accept_success', 'block_personality_test') ); }else{ - $redirect = new moodle_url('/course/view.php', array('id'=>$courseid)); + $redirect = new moodle_url('/blocks/personality_test/view_individual.php', array('cid' => $courseid, 'userid' => $USER->id)); redirect($redirect, get_string('redirect_accept_exist', 'block_personality_test') ); } ?> diff --git a/templates/individual_view.mustache b/templates/individual_view.mustache index c20d97a..af3871e 100644 --- a/templates/individual_view.mustache +++ b/templates/individual_view.mustache @@ -104,9 +104,10 @@ {{download_pdf_label}} - + {{#can_view_reports}} {{delete_results_label}} + {{/can_view_reports}} @@ -116,44 +117,64 @@ - -
-
-
-
-
{{detailed_scores_title}}
-
-
-
- - - - - - - - - - {{#score_rows}} - - - - - - {{/score_rows}} - -
{{dimension_header}}{{score_header}}{{preference_header}}
{{label1}} - {{label2}}{{value1}} - {{value2}}{{dominant}}
+ +
+
+ +
{{detailed_scores_title}}
+
+
+
+ +
+
{{score_header}}
+ +
+ {{#score_rows}} +
+ +
+
{{label1}}
+
+ {{value1}} +
+
+ + +
vs
+ + +
+
{{label2}}
+
+ {{value2}} +
+
+
+ {{/score_rows}}
+ + +
+
{{radar_chart_title}}
+
+ +
+
+ {{#can_view_reports}} {{back_to_admin_label}} + {{/can_view_reports}} {{back_to_course_label}} diff --git a/templates/student_continue.mustache b/templates/student_continue.mustache index 3fefe20..89de0ce 100644 --- a/templates/student_continue.mustache +++ b/templates/student_continue.mustache @@ -5,12 +5,14 @@ {{#str}}discover_your_personality, block_personality_test{{/str}}
+ {{#showdescriptions}}
{{#str}}test_description, block_personality_test{{/str}}
+ {{/showdescriptions}} {{#all_answered}}
diff --git a/templates/student_invitation.mustache b/templates/student_invitation.mustache index 10befd9..d12967a 100644 --- a/templates/student_invitation.mustache +++ b/templates/student_invitation.mustache @@ -5,6 +5,7 @@ {{#str}}discover_your_personality, block_personality_test{{/str}}
+ {{#showdescriptions}}
@@ -21,6 +22,7 @@
+ {{/showdescriptions}}
{{#str}}test_completed, block_personality_test{{/str}}
- {{#str}}your_personality_type, block_personality_test{{/str}} + {{#str}}your_results_here, block_personality_test{{/str}}
+ {{#showdescriptions}}
{{#str}}test_description, block_personality_test{{/str}}
+ {{/showdescriptions}}
-

{{mbti_score}}

- {{mbti_dimensions_str}} + +
+
+ +
+

{{mbti_score}}

+ {{mbti_dimensions_str}} +
+
+
-

- {{{mbti_description}}} -

- - +
{{#js}} require(['jquery'], function($) { diff --git a/templates/test_view.mustache b/templates/test_view.mustache index 3774a69..5ec269f 100644 --- a/templates/test_view.mustache +++ b/templates/test_view.mustache @@ -142,8 +142,8 @@ document.querySelectorAll('.answer-btn').forEach(function(button) { clearTimeout(autoSaveTimer); } - // Auto-save after 2 seconds of inactivity - autoSaveTimer = setTimeout(autoSaveProgress, 2000); + // Auto-save after 400ms of inactivity + autoSaveTimer = setTimeout(autoSaveProgress, 400); }); }); diff --git a/version.php b/version.php index 6855bb5..af28399 100644 --- a/version.php +++ b/version.php @@ -1,7 +1,7 @@ version = 2026010800; +$plugin->version = 2026011800; // 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.2'; +$plugin->release = '2.0.3'; diff --git a/view.php b/view.php index 73efa5b..7e748a3 100644 --- a/view.php +++ b/view.php @@ -44,7 +44,7 @@ // If test is completed, redirect to results if ($existing_response && $existing_response->is_completed) { - redirect(new moodle_url('/course/view.php', array('id' => $courseid)), + redirect(new moodle_url('/blocks/personality_test/view_individual.php', array('cid' => $courseid, 'userid' => $USER->id)), get_string('test_completed_redirect', 'block_personality_test'), null, \core\output\notification::NOTIFY_INFO); } diff --git a/view_individual.php b/view_individual.php index 1dc12ed..be6efb0 100644 --- a/view_individual.php +++ b/view_individual.php @@ -14,59 +14,71 @@ $userid = required_param('userid', PARAM_INT); $courseid = required_param('cid', PARAM_INT); - -// Verificar permisos: solo administradores y profesores -$isadmin = is_siteadmin($USER); -$course = $DB->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))); -} +$user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST); +$test_result = $DB->get_record('personality_test', array('user' => $userid)); + +// 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); -// Silent redirect if user lacks report capability -if (!has_capability('block/personality_test:viewreports', $context)) { +// Acceso básico: Si no es propietario, ni profesor (con permisos), ni admin -> Redirigir +if (!$is_own_results && !$can_view_reports && !$is_siteadmin) { redirect(new moodle_url('/course/view.php', array('id' => $courseid))); } -// Obtener datos del usuario y test -$userfields = \core_user\fields::for_name()->with_userpic()->get_sql('', false, '', '', false)->selects; -$user = $DB->get_record('user', array('id' => $userid), $userfields, MUST_EXIST); -$test_result = $DB->get_record('personality_test', array('user' => $userid)); - -// Prevent teachers from viewing students outside their groups unless they can access all groups -if (!is_siteadmin($USER)) { - // If the current user has accessallgroups, allow +// 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) { + // Si el usuario tiene la capacidad de ver todos los grupos, permitir. if (!has_capability('moodle/site:accessallgroups', $context)) { - // Get groups for teacher and target student - list($teachergroups, $tg) = groups_get_user_groups($courseid, $USER->id); - list($studentgroups, $sg) = groups_get_user_groups($courseid, $userid); - - // If both have groups defined and no intersection, redirect silently - if (!empty($teachergroups) && !empty($studentgroups)) { - $common = array_intersect($teachergroups, $studentgroups); - if (empty($common)) { - redirect(new moodle_url('/course/view.php', array('id' => $courseid))); - } - } - // If teacher has no groups but student does, block access (teacher not in student's group) - if (empty($teachergroups) && !empty($studentgroups)) { - redirect(new moodle_url('/course/view.php', array('id' => $courseid))); + // Obtener grupos del profesor y del estudiante objetivo + $usergroups = groups_get_all_groups($courseid, $userid); + $teachergroups = groups_get_all_groups($courseid, $USER->id); + + // Si ambos tienen grupos y no hay intersección, bloquear. + if (!empty($usergroups) && !empty($teachergroups)) { + $usergroupids = array_keys($usergroups); + $teachergroupids = array_keys($teachergroups); + $intersection = array_intersect($usergroupids, $teachergroupids); + + if (empty($intersection)) { + redirect(new moodle_url('/course/view.php', array('id' => $courseid))); + } } + // Nota: Si el curso está en modo grupos separados y el profe no está en ningun grupo, + // o el estudiante no está en ninguno, Moodle suele manejarlo con accessallgroups. + // Asumimos aquí una comprobación básica de grupos. + } + + // Cross-course privacy check: Ensure target user is enrolled in this course context + if (!is_enrolled($context, $user)) { + redirect(new moodle_url('/course/view.php', array('id' => $courseid))); } } + if (!$test_result) { + if ($is_own_results) { + // Si es el estudiante viendo sus "resultados" inexistentes, mandar al bloque para que lo haga + redirect(new moodle_url('/course/view.php', array('id' => $courseid))); + } redirect(new moodle_url('/blocks/personality_test/admin_view.php', array('cid' => $courseid)), get_string('no_test_results', 'block_personality_test')); } +// Si está incompleto y es el estudiante, sacarlo antes de pintar nada +if ($test_result->is_completed == 0 && $is_own_results) { + redirect(new moodle_url('/course/view.php', array('id' => $courseid))); +} + // Configurar página $PAGE->set_url(new moodle_url('/blocks/personality_test/view_individual.php', array('userid' => $userid, 'cid' => $courseid))); $PAGE->set_context($context); -$PAGE->set_title(get_string('individual_results', 'block_personality_test') . ': ' . fullname($user)); -$PAGE->set_heading(get_string('individual_results', 'block_personality_test') . ': ' . fullname($user)); +$PAGE->set_title(get_string('individual_results', 'block_personality_test')); +$PAGE->set_heading(get_string('individual_results', 'block_personality_test')); $PAGE->requires->css(new moodle_url('/blocks/personality_test/styles.css')); @@ -84,9 +96,12 @@ $answered++; } } + $progress_percentage = ($answered / 72) * 100; - $progress_percentage = round(($answered / 72) * 100, 1); - + // Url de retorno depende de quien ve + $back_url = $can_view_reports ? (new moodle_url('/blocks/personality_test/admin_view.php', array('cid' => $courseid)))->out() : (new moodle_url('/course/view.php', array('id' => $courseid)))->out(); + $back_label = $can_view_reports ? get_string('back_to_admin', 'block_personality_test') : get_string('back_to_course', 'block_personality_test'); + $template_data = [ 'in_progress' => true, 'is_completed' => false, @@ -99,8 +114,8 @@ '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') + 'back_url' => $back_url, + 'back_to_admin_label' => $back_label ]; } else { @@ -153,6 +168,38 @@ 'dominant' => $dominant ]; } + + // --- Radar Chart Logic Injection --- + $mbti_labels = [ + get_string('introversion', 'block_personality_test'), + get_string('feeling', 'block_personality_test'), + get_string('sensing', 'block_personality_test'), + get_string('perceptive', 'block_personality_test'), + get_string('extraversion', 'block_personality_test'), + get_string('thinking', 'block_personality_test'), + get_string('intuition', 'block_personality_test'), + get_string('judging', 'block_personality_test') + ]; + + $chart_data = [ + (float)$test_result->introversion, + (float)$test_result->feeling, + (float)$test_result->sensing, + (float)$test_result->perceptive, + (float)$test_result->extraversion, + (float)$test_result->thinking, + (float)$test_result->intuition, + (float)$test_result->judging, + ]; + + $chart_id = 'graficoRadarIndividual_' . $userid; + $PAGE->requires->js_call_amd('block_personality_test/results_radar', 'init', [ + $chart_id, + $mbti_labels, + $chart_data, + get_string('mbti_type', 'block_personality_test') . ': ' . $mbti + ]); + // ----------------------------------- $template_data = [ 'in_progress' => false, @@ -167,12 +214,15 @@ 'mbti_label' => get_string('mbti_type', 'block_personality_test'), 'mbti_type' => $mbti, 'dimensions_title' => get_string('personality_dimensions', 'block_personality_test'), + 'radar_chart_title' => get_string('radar_chart_title', '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'), + // Permissions for delete action + 'can_delete' => $can_view_reports, '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'), @@ -181,6 +231,10 @@ 'score_header' => get_string('score', 'block_personality_test'), 'preference_header' => get_string('preference', 'block_personality_test'), 'score_rows' => $score_rows, + // Chart Data + 'chart_id' => $chart_id, + // Nav + 'can_view_reports' => $can_view_reports, '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),