From 0728911b9f211d7e6618f63ae1b61f006ec64ccf Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 22 May 2017 17:19:27 -0500 Subject: [PATCH 01/18] Minor - Format code - refs BT#12756 --- main/lp/lp_list.php | 373 ++++++++++++++++++++++---------------------- 1 file changed, 189 insertions(+), 184 deletions(-) diff --git a/main/lp/lp_list.php b/main/lp/lp_list.php index c04d5a26a9..9af12a6436 100755 --- a/main/lp/lp_list.php +++ b/main/lp/lp_list.php @@ -10,7 +10,7 @@ use Chamilo\CourseBundle\Entity\CLpCategory; * will be automatically created for it, and the files will be uncompressed there for example ; * * @package chamilo.learnpath - * @author Yannick Warnier + * @author Yannick Warnier */ $this_section = SECTION_COURSES; @@ -28,7 +28,8 @@ $baseWordDir = $courseDir; * Display initialisation and security checks */ // Extra javascript functions for in html head: -$htmlHeadXtra[] = " - - -
-
-
- -
-
-
- {% if message_info != "" %} -
- {{ message_info }} -
- {% endif %} - {% if message_error != "" %} -
- {{ message_error }} -
- {% endif %} -
-
-
- Acción Formativa: - {% if info != false %} -
- IDENTIFICADOR DE ACCIÓN (ID_ACCION): -
- -
- -
-
- -
- -
- -
-
-
-
- -
- -
-
- -
- IDENTIFICADOR DE ESPECIALIDAD PRINCIPAL -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
-
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- - -
- -
- -
-
- -
- DESCRIPCION DE LA ACCION FORMATIVA -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
- {% else %} -
No hay información de la acción formativa
- {% endif %} -
-
-
-
-
-
- Especialidades: - Crear especialidad - - {% for specialty in listSpecialty %} -
- -
- - - - - -
{{ specialty.ORIGEN_ESPECIALIDAD }} {{ specialty.AREA_PROFESIONAL }} {{ specialty.CODIGO_ESPECIALIDAD }} - Borrar - Editar -
-
-
- {% endfor %} -
-
-
- -
-
-
- Participantes: - Crear participante - - {% for participant in listParticipant %} -
- -
- - - - - - -
{{ participant.firstname }} {{ participant.lastname }} {{ participant.NUM_DOCUMENTO }} {{ participant.LETRA_NIF }} - Borrar - Editar -
-
-
- {% endfor %} -
-
-
-
-
diff --git a/plugin/sepe/view/configuracion.tpl b/plugin/sepe/view/configuracion.tpl deleted file mode 100644 index a22d4f4fc4..0000000000 --- a/plugin/sepe/view/configuracion.tpl +++ /dev/null @@ -1,40 +0,0 @@ - - - -
-
-
 
-
- {% if message_info != "" %} -
- {{ message_info }} -
- {% endif %} - {% if message_error != "" %} -
- {{ message_error }} -
- {% endif %} - -
- Usuario SEPE -
- -
- - -
-
- -
-
- -
- - - - -
-
 
-
-
diff --git a/plugin/sepe/view/datos_identificativos.tpl b/plugin/sepe/view/datos_identificativos.tpl deleted file mode 100644 index fed7056ddb..0000000000 --- a/plugin/sepe/view/datos_identificativos.tpl +++ /dev/null @@ -1,95 +0,0 @@ - - - -
- -
- {% if message_info != "" %} -
- {{ message_info }} -
- {% endif %} - {% if message_error != "" %} -
- {{ message_error }} -
- {% endif %} -
-
-
- Datos Identificativos del Centro - {% if info != false %} -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- {% else %} -
No hay datos identificativos del centro
- {% endif %} -
-
-
-
-
diff --git a/plugin/sepe/view/editar_accion_formativa.tpl b/plugin/sepe/view/editar_accion_formativa.tpl deleted file mode 100644 index e587883a0f..0000000000 --- a/plugin/sepe/view/editar_accion_formativa.tpl +++ /dev/null @@ -1,357 +0,0 @@ - - -
-
-
-
- -
-
-
- {% if rmessage == "YES" %} -
- {{ responseMessage }} -
- {% endif %} -
-
- Acción Formativa -
- IDENTIFICADOR DE ACCIÓN (ID_ACCION): -
- -
- -
-
- -
- -
- -
-
-
- -
- -
- -
-
- -
- IDENTIFICADOR DE ESPECIALIDAD PRINCIPAL -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
- - -
- -
- -
-
- Número de horas de la acción formativa. -
-
- -
- -
- - / - - / - -
-
Fecha de inicio de la acción formativa.
-
- -
- -
- - / - - / - -
-
Fecha de finalización de la acción formativa.
-
- -
- -
- -
-
Indica si la acción formativa se imparte de forma completa.
-
- -
- -
- -
-
Procedencia de la dotación económica. - -
-
- -
- -
- -
-
Número de plazas ofertadas. -
-
- - -
- DESCRIPCION DE LA ACCION FORMATIVA -
- -
- -
Nombre o descripción breve de la acción formativa.
-
-
- -
- -
- -
Breve texto descriptivo de los objetivos, contenidos y estructura de la acción formativa.
-
-
- -
- -
- -
Breve texto que señala el período temporal durante el que se desarrolla la acción formativa.
-
-
- -
- -
- -
Breve texto que especifica los requisitos de acceso a la formación.
-
-
- -
- -
- -
Teléfono, sitio web o dirección de correo electrónico a través de los que obtener información específica y detallada sobre la acción formativa.
-
-
-
- -
- - - -
-
-
-
diff --git a/plugin/sepe/view/editar_datos_identificativos.tpl b/plugin/sepe/view/editar_datos_identificativos.tpl deleted file mode 100644 index b99670f08b..0000000000 --- a/plugin/sepe/view/editar_datos_identificativos.tpl +++ /dev/null @@ -1,89 +0,0 @@ - - -
-
-
-
- -
-
-
- {% if message_info != "" %} -
- {{ message_info }} -
- {% endif %} - {% if message_error != "" %} -
- {{ message_error }} -
- {% endif %} -
-
- Datos Identificativos del Centro - -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
- - - -
-
-
-
diff --git a/plugin/sepe/view/editar_especialidad_accion.tpl b/plugin/sepe/view/editar_especialidad_accion.tpl deleted file mode 100644 index e84c642f94..0000000000 --- a/plugin/sepe/view/editar_especialidad_accion.tpl +++ /dev/null @@ -1,435 +0,0 @@ - - - -
-
-
-
- -
-
-
- {% if message_info != "" %} -
- {{ message_info }} -
- {% endif %} - {% if message_error != "" %} -
- {{ message_error }} -
- {% endif %} -
-
- Especialidad Acción Formativa -
- IDENTIFICADOR DE ESPECIALIDAD: -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
- -
- CENTRO DE IMPARTICIÓN: -
- -
- -
-
- -
- -
- -
-
-
- -
- -
- - / - - / - -
-
Fecha de inicio de la especialidad formativa.
-
- -
- -
- - / - - / - -
-
Fecha de finalización de especialidad formativa.
-
- -
- -
- - Modo de impartición de la especialidad formativa de la acción. -
-
- -
- DATOS DE DURACIÓN: -
- -
- -
-
Número de horas realizadas de forma presencial.
-
- -
- -
- -
-
Número de horas realizadas a través de teleformación.
-
-
- -
- {% if new_action == "SI" %} - CENTROS DE SESIONES PRESENCIALES: -
Debe guardar los cambios antes de crear un centro presencial
- {% else %} - CENTROS DE SESIONES PRESENCIALES: - Crear centro presencial - - {% for classroom in listClassroom %} -
- -
- -
-
- {% endfor %} - - {% endif %} -
- -
- {% if new_action == "SI" %} - TUTORES-FORMADORES: -
Debe guardar los cambios antes de crear un centro presencial
- {% else %} - TUTORES-FORMADORES: - Crear tutor-formador - - {% for tutor in listTutors %} -
- -
- -
-
- {% endfor %} - - {% endif %} - -
- - -
- USO DEL CONTENIDO -
- HORARIO MAÑANA -
Se considerará el período temporal comprendido entre las 7:00 y las 15:00 horas.
-
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
-
- -
- HORARIO TARDE -
Se considerará el período temporal comprendido entre las 15:00 horas y las 23:00 horas.
-
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
-
- - -
- HORARIO NOCHE -
Se considerará el período temporal comprendido entre las 23:00 horas y las 7:00 horas.
-
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
-
- -
- SEGUIMIENTO Y EVALUACIÓN -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
-
- - -
- -
- - - -
-
-
-
diff --git a/plugin/sepe/view/editar_especialidad_classroom.tpl b/plugin/sepe/view/editar_especialidad_classroom.tpl deleted file mode 100644 index 284ebedfff..0000000000 --- a/plugin/sepe/view/editar_especialidad_classroom.tpl +++ /dev/null @@ -1,95 +0,0 @@ - - - -
-
-
-
- -
-
-
- {% if message_info != "" %} -
- {{ message_info }} -
- {% endif %} - {% if message_error != "" %} -
- {{ message_error }} -
- {% endif %} - - - {% if new_classroom == "SI" %} -
-
- -
- -
-
-
- -
-
- Listado de centros -
- -
- -
-
-
-
- - -
diff --git a/plugin/sepe/view/editar_especialidad_participante.tpl b/plugin/sepe/view/editar_especialidad_participante.tpl deleted file mode 100644 index d9b773c8ad..0000000000 --- a/plugin/sepe/view/editar_especialidad_participante.tpl +++ /dev/null @@ -1,480 +0,0 @@ - - - -
-
-
-
- -
-
-
- {% if message_info != "" %} -
- {{ message_info }} -
- {% endif %} - {% if message_error != "" %} -
- {{ message_error }} -
- {% endif %} -
-
- ESPECIALIDADES DEL PARTICIPANTE -
- IDENTIFICADOR DE ESPECIALIDAD: -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
- -
- -
- - / - - / - -
-
Alta para acceder a la especialidad de la acción formativa. -
-
- -
- -
- - / - - / - -
-
Baja para acceder a la especialidad de la acción formativa. -
-
- - -
- {% if new_specialty == "SI" %} - TUTORÍAS PRESENCIALES: -
Debe guardar los cambios antes de crear un centro de tutorias presenciales
- {% else %} - TUTORÍAS PRESENCIALES: - Crear tutoria presencial - - {% for tutorial in listSpecialtyTutorials %} -
- -
- -
-
- {% endfor %} - - {% endif %} -
- - -
- EVALUACIÓN FINAL: -
- CENTRO PRESENCIAL DE EVALUACIÓN FINAL -
- -
- -
-
- -
- -
- -
-
-
- -
- -
- - / - - / - -
-
Fecha de inicio de la evaluación final. -
-
- -
- -
- - / - - / - -
-
Fecha de finalización de la evaluación final. -
-
- -
- -
- RESULTADOS: -
- -
- -
Valor que indica la situación del participante y el resultado logrado por el participante en la especialidad de la acción formativa.
- Puede tomar los valores de:
-
    -
  • 0 – Iniciado
  • -
  • 1 – Abandona por colocación
  • -
  • 2 – Abandona por otras causas
  • -
  • 3 – Termina con evaluación positiva
  • -
  • 4 – Termina con evaluación negativa
  • -
  • 5 – Termina sin evaluar
  • -
  • 6 – Exento (de la realización del módulo de formación práctica en centros de trabajo por formación en alternancia con el empleo o por acreditación de la experiencia laboral requerida a tal fin, según lo establecido en el artículo 5bis4 del Real Decreto 34/2008, de 18 de enero).
  • -
  • 7 – Eximido (de la realización aquellos módulos formativos asociados a unidades de competencia para las que se ha obtenido acreditación, ya sea mediante formación o a través de procesos de reconocimiento de las competencias profesionales adquiridas por la experiencia laboral, regulados en el Real Decreto 1224/2009, de 17 de julio).
  • -
-
-
-
- -
- -
- -
- Puntuación obtenida en la prueba de evaluación final del módulo (con independencia de la convocatoria en la que se obtuvo) reflejando, en su caso, las puntuaciones correspondientes a las unidades formativas que lo compongan.
-Adopta un valor entre 5 y 10, registrándose con cuatro dígitos para dar cabida a las calificaciones decimales (por ejemplo, la calificación 7,6 debe registrarse como 760). -
-
-
- -
- -
- - -
Suma de la puntuación media obtenida en la evaluación durante el proceso de aprendizaje, y de la puntuación obtenida en la prueba de evaluación final del módulo, ponderándolas previamente con un peso de 30 por ciento y 70 por ciento, respectivamente. -Adopta un valor entre 5 y 10, sin que pueda ser inferior a 5, ni inferior a la obtenida en la prueba de evaluación final.
-Se registra con cuatro dígitos para dar cabida a las puntuaciones decimales (por ejemplo, la puntuación 8,3 debe registrarse como 830).
-
-
-
- -
-
-
-
-
diff --git a/plugin/sepe/view/editar_especialidad_tutor.tpl b/plugin/sepe/view/editar_especialidad_tutor.tpl deleted file mode 100644 index fae86f92ef..0000000000 --- a/plugin/sepe/view/editar_especialidad_tutor.tpl +++ /dev/null @@ -1,299 +0,0 @@ - - - - -
-
-
-
- -
-
-
- {% if message_info != "" %} -
- {{ message_info }} -
- {% endif %} - {% if message_error != "" %} -
- {{ message_error }} -
- {% endif %} - - {% if new_tutor == "SI" %} -
-
- -
- -
-
-
- -
-
- Listado de tutores -
- -
- - -
-
-
-
- diff --git a/plugin/sepe/view/editar_especialidad_tutorials.tpl b/plugin/sepe/view/editar_especialidad_tutorials.tpl deleted file mode 100644 index 27c5486724..0000000000 --- a/plugin/sepe/view/editar_especialidad_tutorials.tpl +++ /dev/null @@ -1,199 +0,0 @@ - - - -
-
-
-
- -
-
-
- {% if message_info != "" %} -
- {{ message_info }} -
- {% endif %} - {% if message_error != "" %} -
- {{ message_error }} -
- {% endif %} -
-
- CENTRO PRESENCIAL -
- -
- -
-
- -
- -
- -
-
-
- -
- -
- - / - - / - -
-
Fecha de inicio de la tutoría presencial.
-
- -
- -
- - / - - / - -
-
Fecha de finalización de la tutoría presencial.
-
- -
- -
-
- -
diff --git a/plugin/sepe/view/editar_participante_accion.tpl b/plugin/sepe/view/editar_participante_accion.tpl deleted file mode 100644 index 2843f4ac7b..0000000000 --- a/plugin/sepe/view/editar_participante_accion.tpl +++ /dev/null @@ -1,410 +0,0 @@ - - - - -
-
-
-
- -
-
-
- {% if message_info != "" %} -
- {{ message_info }} -
- {% endif %} - {% if message_error != "" %} -
- {{ message_error }} -
- {% endif %} -
-
- Participante Acción Formativa -
- LISTADO DE USUARIOS DEL CURSO CHAMILO: -
- -
- - -
-
-
- - -
- - IDENTIFICADOR PARTICIPANTE: -
- -
- - -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- El campo de "Número del documento" tiene una longitud de 10 caracteres alfanuméricos. - - - - - - - - -
TipoNúmeroCarácter de control NIF
DbbN8L
EbbXN7
bbYN7
bbZN7
L
L
L
UbbN8L
WbbN8L
GN10L
HbbN8L
-
- -
- -
- -
- -
-
-
- CONTRATO FORMACION: -
- -
- - Dato alfanumérico de 14 posiciones formado por la concatenación de:
-
    -
  • 1 posición alfabética que indica el organismo que asignó identificador al contrato. En la actualidad siempre “E” estatal.
  • -
  • 2 posiciones numéricas con el código de la provincia.
  • -
  • 4 posiciones numéricas con el año del contrato.
  • -
  • 7 posiciones numéricas con el número secuencial asignado al contrato en la provincia y año.
-
-
- -
- -
- -
-
- -
- ID TUTOR EMPRESA: -
- -
- -
-
- - - -
- - -
- ID TUTOR FORMACIÓN: -
- -
- -
-
- - - -
-
- - -
- {% if new_participant == "SI" %} - ESPECIALIDADES DEL PARTICIPANTE: -
Debe guardar los cambios antes de crear una especialidad al participante.
- {% else %} - ESPECIALIDADES DEL PARTICIPANTE: - Crear especialidad - - {% for specialty in listParticipantSpecialty %} -
- -
- -
-
- {% endfor %} - - {% endif %} -
- -
-
-
-
-
diff --git a/plugin/sepe/view/listado_acciones_formativas.tpl b/plugin/sepe/view/listado_acciones_formativas.tpl deleted file mode 100644 index b39c08e8b3..0000000000 --- a/plugin/sepe/view/listado_acciones_formativas.tpl +++ /dev/null @@ -1,72 +0,0 @@ - - - -
-
- {% if message_info != "" %} -
- {{ message_info }} -
- {% endif %} - {% if message_error != "" %} -
- {{ message_error }} -
- {% endif %} - - -
- {% if lista_curso_acciones|length > 0 %} - - {% for lista in lista_curso_acciones %} - - - - - {% endfor %} -
Curso: {{ lista.title }} -> ID ACCION: {{ lista.ORIGEN_ACCION }} {{ lista.CODIGO_ACCION }} - Borrar - Desvincular - Ver / Editar - -
- {% else %} -
- No hay acciones formativas asociadas a un curso. -
- {% endif %} -
- -
- - - -
- - {% for lista in lista_curso_libre_acciones %} - - - - - - {% endfor %} -
Curso: {{ lista.title }} - - - Asignar acción - Crear acción -
-
-
-
diff --git a/plugin/sepe/view/menu_sepe_administracion.tpl b/plugin/sepe/view/menu_sepe_administracion.tpl deleted file mode 100644 index ab2ef1f0b2..0000000000 --- a/plugin/sepe/view/menu_sepe_administracion.tpl +++ /dev/null @@ -1,5 +0,0 @@ -
-
- {{ html_text }} -
-
From 4c3ee4f7b07afad5e5cb348831a4bc98ff2f91ea Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 23 May 2017 15:11:01 +0200 Subject: [PATCH 09/18] Fix query --- plugin/studentfollowup/post.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/studentfollowup/post.php b/plugin/studentfollowup/post.php index 0bcca546ba..236a109931 100644 --- a/plugin/studentfollowup/post.php +++ b/plugin/studentfollowup/post.php @@ -50,6 +50,9 @@ $relatedPosts = []; if ($post) { $qb = $em->createQueryBuilder(); $criteria = Criteria::create(); + + $criteria->where(Criteria::expr()->eq('parent', $post->getId())); + if ($showPrivate == false) { $criteria->andWhere(Criteria::expr()->eq('private', false)); } @@ -57,7 +60,7 @@ if ($post) { if (!empty($post->getParent())) { $criteria->andWhere(Criteria::expr()->eq('parent', $post->getParent())); } - $criteria->andWhere(Criteria::expr()->eq('parent', $post->getId())); + $criteria->orWhere(Criteria::expr()->eq('id', $post->getId())); $qb @@ -68,7 +71,6 @@ if ($post) { ->orderBy('p.createdAt', 'desc') ; $query = $qb->getQuery(); - //var_dump($query->getSQL()); $relatedPosts = $query->getResult(); } //var_dump($post->getTitle()); From e03cf21923990d4b6ddd3ba2dee33b1f56100325 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 23 May 2017 15:20:52 +0200 Subject: [PATCH 10/18] Fix query see BT#12723 --- plugin/studentfollowup/post.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/studentfollowup/post.php b/plugin/studentfollowup/post.php index 236a109931..3c79b78a36 100644 --- a/plugin/studentfollowup/post.php +++ b/plugin/studentfollowup/post.php @@ -51,16 +51,16 @@ if ($post) { $qb = $em->createQueryBuilder(); $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('parent', $post->getId())); + if (!empty($post->getParent())) { + $criteria->where(Criteria::expr()->in('parent', [$post->getParent()->getId(), $post->getId()])); + } else { + $criteria->where(Criteria::expr()->eq('parent', $post->getId())); + } if ($showPrivate == false) { $criteria->andWhere(Criteria::expr()->eq('private', false)); } - if (!empty($post->getParent())) { - $criteria->andWhere(Criteria::expr()->eq('parent', $post->getParent())); - } - $criteria->orWhere(Criteria::expr()->eq('id', $post->getId())); $qb From 198c1dc631ae9039a37bbb353195a1c4f5eeb16b Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 23 May 2017 15:40:43 +0200 Subject: [PATCH 11/18] Minor - format code --- main/course_description/index.php | 4 ++-- main/course_description/layout.php | 4 ++-- main/course_description/listing.php | 30 ++++++++++++++--------------- main/inc/lib/template.lib.php | 1 + 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/main/course_description/index.php b/main/course_description/index.php index a938003be6..eafd2f1e2c 100755 --- a/main/course_description/index.php +++ b/main/course_description/index.php @@ -24,12 +24,12 @@ api_protect_course_script(true); $actions = array('listing', 'add', 'edit', 'delete', 'history'); $action = 'listing'; if (isset($_GET['action']) && in_array($_GET['action'], $actions)) { - $action = $_GET['action']; + $action = $_GET['action']; } $description_type = ''; if (isset($_GET['description_type'])) { - $description_type = intval($_GET['description_type']); + $description_type = intval($_GET['description_type']); } $id = null; diff --git a/main/course_description/layout.php b/main/course_description/layout.php index 44c484a293..3a40124c1b 100755 --- a/main/course_description/layout.php +++ b/main/course_description/layout.php @@ -11,7 +11,7 @@ api_protect_course_script(true); // Header -Display :: display_header(''); +Display::display_header(''); // Introduction section Display::display_introduction_section(TOOL_COURSE_DESCRIPTION); @@ -23,4 +23,4 @@ Event::event_access_tool(TOOL_COURSE_DESCRIPTION); echo $content; // Footer -Display :: display_footer(); +Display::display_footer(); diff --git a/main/course_description/listing.php b/main/course_description/listing.php index 07179cf60e..62146aeb79 100755 --- a/main/course_description/listing.php +++ b/main/course_description/listing.php @@ -18,27 +18,27 @@ if (api_is_allowed_to_edit(null, true)) { } $categories[ADD_BLOCK] = get_lang('NewBloc'); - $i = 1; - echo ''; } $history = isset($history) ? $history : null; // display course description list if ($history) { - echo '
+ echo '
@@ -49,7 +49,7 @@ if ($history) { $user_info = api_get_user_info(); if (isset($descriptions) && count($descriptions) > 0) { - foreach ($descriptions as $id => $description) { + foreach ($descriptions as $id => $description) { if (!empty($description)) { $actions = ''; if (api_is_allowed_to_edit(null, true) && !$history) { diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index aea15044f0..f2c5ebca88 100755 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -427,6 +427,7 @@ class Template $show_course_navigation_menu = null; if (!empty($this->course_id) && $this->user_is_logged_in) { + if (api_get_setting('show_toolshortcuts') != 'false') { //Course toolbar $show_course_shortcut = CourseHome::show_navigation_tool_shortcuts(); From 1507783a39c30305f2484e1a7a856fc35ea4463e Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 23 May 2017 15:42:56 +0200 Subject: [PATCH 12/18] Add missing toolbar see BT#12807 --- main/template/default/layout/show_header.tpl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main/template/default/layout/show_header.tpl b/main/template/default/layout/show_header.tpl index ade002ecdd..8871287c06 100755 --- a/main/template/default/layout/show_header.tpl +++ b/main/template/default/layout/show_header.tpl @@ -34,6 +34,11 @@ {% endif %} {% include template ~ "/layout/page_header.tpl" %} +{% if show_course_shortcut is not null %} + +{% endif %}
{% block breadcrumb %} From 443dd0a0862ab8dbcd7ab11883bce1b580bf3f03 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 23 May 2017 15:51:36 +0200 Subject: [PATCH 13/18] Fix UI, update lang see BT#12723 --- main/inc/lib/banner.lib.php | 6 +++--- plugin/studentfollowup/lang/english.php | 2 ++ plugin/studentfollowup/post.php | 1 + plugin/studentfollowup/posts.php | 1 + plugin/studentfollowup/view/post.html.twig | 10 ++-------- plugin/studentfollowup/view/posts.html.twig | 2 +- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/main/inc/lib/banner.lib.php b/main/inc/lib/banner.lib.php index 8705088ab3..605d404eb0 100755 --- a/main/inc/lib/banner.lib.php +++ b/main/inc/lib/banner.lib.php @@ -343,9 +343,10 @@ function return_navigation_array() if (true) { $params = array('variable = ? AND subkey = ?' => ['status', 'studentfollowup']); $result = api_get_settings_params_simple($params); + $plugin = StudentFollowUpPlugin::create(); if (!empty($result) && $result['selected_value'] === 'installed') { $navigation['follow_up']['url'] = api_get_path(WEB_PLUGIN_PATH).'studentfollowup/posts.php'; - $navigation['follow_up']['title'] = get_lang('MyDossier'); + $navigation['follow_up']['title'] = $plugin->get_lang('CareDetailView'); $navigation['follow_up']['key'] = 'homepage'; $navigation['follow_up']['icon'] = 'homepage.png'; } @@ -363,8 +364,7 @@ function return_navigation_array() // Reports if (!empty($possible_tabs['reports'])) { if (api_get_setting('show_tabs', 'reports') == 'true') { - if ( - (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) + if ((api_is_platform_admin() || api_is_drh() || api_is_session_admin()) && Rights::hasRight('show_tabs:reports') ) { $navigation['reports'] = $possible_tabs['reports']; diff --git a/plugin/studentfollowup/lang/english.php b/plugin/studentfollowup/lang/english.php index 56daa91589..ec282c344b 100644 --- a/plugin/studentfollowup/lang/english.php +++ b/plugin/studentfollowup/lang/english.php @@ -5,4 +5,6 @@ $strings['plugin_comment'] = "Care system (Zorgdossier) [CS] Career follow system (Structuurschema) [CFS] Competence based evaluation system (Competentie evaluatie systeem) [CBES]"; $strings['tool_enable'] = 'Enable plugin'; +$strings['CareDetailView'] = 'Care detail view'; + diff --git a/plugin/studentfollowup/post.php b/plugin/studentfollowup/post.php index 3c79b78a36..85987efd61 100644 --- a/plugin/studentfollowup/post.php +++ b/plugin/studentfollowup/post.php @@ -89,6 +89,7 @@ $tpl->assign( ); $tpl->assign('information_icon', Display::return_icon('info.png')); $tpl->assign('student_info', api_get_user_info($studentId)); +$tpl->assign('care_title', $plugin->get_lang('CareDetailView')); $content = $tpl->fetch('/'.$plugin->get_name().'/view/post.html.twig'); // Assign into content diff --git a/plugin/studentfollowup/posts.php b/plugin/studentfollowup/posts.php index c91c801ed7..896830c8cf 100644 --- a/plugin/studentfollowup/posts.php +++ b/plugin/studentfollowup/posts.php @@ -74,6 +74,7 @@ $tpl->assign('post_url', $url); $tpl->assign('information_icon', Display::return_icon('info.png')); $tpl->assign('student_info', api_get_user_info($studentId)); $tpl->assign('pagination', $pagination); +$tpl->assign('care_title', $plugin->get_lang('CareDetailView')); $content = $tpl->fetch('/'.$plugin->get_name().'/view/posts.html.twig'); // Assign into content $tpl->assign('content', $content); diff --git a/plugin/studentfollowup/view/post.html.twig b/plugin/studentfollowup/view/post.html.twig index fe090bcfa1..19182badc3 100644 --- a/plugin/studentfollowup/view/post.html.twig +++ b/plugin/studentfollowup/view/post.html.twig @@ -14,16 +14,10 @@ {% if countElements > 1 %} {{ information_icon }} + {{ countElements }} {% else %} - {{ information_icon }} + {{ information_icon }} + 1 {% endif %} {% endif %} - - {% if post.parent %} - - {{ post.parent.title }} - - {% endif %} {% endif %} {#{% if type == 'all' %}#} @@ -78,7 +72,7 @@

- Care detail view - {{ student_info.complete_name }} - {{ post.title }} + {{ care_title }} - {{ student_info.complete_name }} - {{ post.title }} {% if post.parent %} {{ post.parent.title }} {% endif %} diff --git a/plugin/studentfollowup/view/posts.html.twig b/plugin/studentfollowup/view/posts.html.twig index f5bf29f439..39db3694cd 100644 --- a/plugin/studentfollowup/view/posts.html.twig +++ b/plugin/studentfollowup/view/posts.html.twig @@ -1,6 +1,6 @@ {% import 'studentfollowup/view/post.html.twig' as template %} -

Care detail view - {{ student_info.complete_name }}

+

{{ care_title }} - {{ student_info.complete_name }}

{% if posts %} {% for post in posts %} {{ template.post_template('simple', post, information_icon, post_url, current_url) }} From 0895998f540189a970d74289119c91b0c7a6373c Mon Sep 17 00:00:00 2001 From: Alex Aragon Date: Tue, 23 May 2017 09:49:19 -0500 Subject: [PATCH 14/18] fix in radio button - refs #1607 --- app/Resources/public/css/base.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index 2c7c895294..d38cb54b54 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -308,8 +308,11 @@ header{ text-align:center; vertical-align:middle; } +.radio input[type="radio"]{ + margin-left: -25px; +} input[type=checkbox], input[type=radio]{ - margin: 8px 0 0; + margin: 6px 0 0; } #gradebook_list .centered .badge-group { width: auto; From 35023e42d79ac06ff2b91bc8ed1019606ec241b9 Mon Sep 17 00:00:00 2001 From: Alex Aragon Date: Tue, 23 May 2017 10:36:57 -0500 Subject: [PATCH 15/18] fix selection prerequisites in lesson - refs #1542 --- app/Resources/public/css/base.css | 5 +++++ main/lp/lp_edit_item_prereq.php | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index d38cb54b54..bb59955fc7 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -314,6 +314,11 @@ header{ input[type=checkbox], input[type=radio]{ margin: 6px 0 0; } +.prerequisites input[type=radio]{ + margin: 0 0 0 -25px; + vertical-align: middle; + height: 20px; +} #gradebook_list .centered .badge-group { width: auto; } diff --git a/main/lp/lp_edit_item_prereq.php b/main/lp/lp_edit_item_prereq.php index 9c8ebd3f45..84475b65c8 100755 --- a/main/lp/lp_edit_item_prereq.php +++ b/main/lp/lp_edit_item_prereq.php @@ -91,6 +91,7 @@ echo '
'; echo $lp->return_new_tree(); echo '
'; echo '
'; +echo '
'; $lpItem = new learnpathItem($_GET['id']); if (isset($is_success) && $is_success == true) { echo $lp->display_manipulate($_GET['id'], $lpItem->get_type()); @@ -100,5 +101,5 @@ if (isset($is_success) && $is_success == true) { echo $lp->display_item_prerequisites_form($_GET['id']); } echo '
'; - +echo '
'; Display::display_footer(); From 37de579dfff6cf29cab25e95ddc22c36a7e399c4 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Tue, 23 May 2017 11:58:15 -0500 Subject: [PATCH 16/18] Allow publish learnpath categories as course tool - refs BT#12756 --- main/inc/lib/course_home.lib.php | 38 +++- main/lp/learnpath.class.php | 176 ++++++++++++++++ main/lp/lp_controller.php | 12 +- main/lp/lp_list.php | 28 ++- main/template/default/learnpath/list.tpl | 238 ++++++++++++---------- src/Chamilo/CourseBundle/Entity/CTool.php | 3 +- 6 files changed, 374 insertions(+), 121 deletions(-) diff --git a/main/inc/lib/course_home.lib.php b/main/inc/lib/course_home.lib.php index 8f986a4431..a4f06363f3 100755 --- a/main/inc/lib/course_home.lib.php +++ b/main/inc/lib/course_home.lib.php @@ -2,6 +2,7 @@ /* For licensing terms, see /license.txt */ use Chamilo\CourseBundle\Entity\CTool; +use Chamilo\CourseBundle\Entity\CLpCategory; /** * Class CourseHome @@ -461,6 +462,8 @@ class CourseHome // Condition for the session $session_id = $sessionId ?: api_get_session_id(); $course_id = $courseId ?: api_get_course_int_id(); + $userId = api_get_user_id(); + $user = api_get_user_entity($userId); $condition_session = api_get_session_condition( $session_id, true, @@ -572,12 +575,12 @@ class CourseHome $lp = new learnpath( api_get_course_id(), $lp_id, - api_get_user_id() + $userId ); $path = $lp->get_preview_image_path(ICON_SIZE_BIG); $add = learnpath::is_lp_visible_for_student( $lp_id, - api_get_user_id(), + $userId, api_get_course_id(), api_get_session_id() ); @@ -586,6 +589,16 @@ class CourseHome } } + if ($temp_row['image'] === 'lp_category.gif') { + $lpCategory = self::getPublishedLpCategoryFromLink( + $temp_row['link'] + ); + $add = learnpath::categoryIsVisibleForStudent( + $lpCategory, + $user + ); + } + if ($add) { $all_tools_list[] = $temp_row; } @@ -675,7 +688,7 @@ class CourseHome WHERE blog_id =".$blog_id; } else { $sql_blogs = "SELECT * FROM $tbl_blogs_rel_user blogs_rel_user - WHERE blog_id =".$blog_id." AND user_id = ".api_get_user_id(); + WHERE blog_id =".$blog_id." AND user_id = ".$userId; } $result_blogs = Database::query($sql_blogs); @@ -1173,6 +1186,25 @@ class CourseHome return $lp_id; } + /** + * Get published learning path category from link inside course home + * @param string $link + * @return CLpCategory + */ + public static function getPublishedLpCategoryFromLink($link) + { + $query = parse_url($link, PHP_URL_QUERY); + parse_str($query, $params); + + $id = isset($params['id']) ? (int) $params['id'] : 0; + + $em = Database::getManager(); + /** @var CLpCategory $category */ + $category = $em->find('ChamiloCourseBundle:CLpCategory', $id); + + return $category; + } + /** * @param bool $include_admin_tools * @return array diff --git a/main/lp/learnpath.class.php b/main/lp/learnpath.class.php index 32aeb01b08..a04cc406fc 100755 --- a/main/lp/learnpath.class.php +++ b/main/lp/learnpath.class.php @@ -9,6 +9,8 @@ use Gedmo\Sortable\Entity\Repository\SortableRepository; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Finder\Finder; use Chamilo\CourseBundle\Entity\CLp; +use Chamilo\CourseBundle\Entity\CTool; +use Chamilo\UserBundle\Entity\User; /** * Class learnpath @@ -4145,6 +4147,8 @@ class learnpath foreach ($learPaths as $lp) { learnpath::toggle_visibility($lp['iid'], 0); } + + learnpath::toggleCategoryPublish($id, 0); } return api_item_property_update( @@ -4247,6 +4251,178 @@ class learnpath } } + /** + * Generate the link for a learnpath category as course tool + * @param int $categoryId + * @return string + */ + private static function getCategoryLinkForTool($categoryId) + { + $link = 'lp/lp_controller.php?'.api_get_cidreq().'&' + .http_build_query( + [ + 'action' => 'view_category', + 'id' => $categoryId + ] + ); + + return $link; + } + + /** + * Publishes a learnpath. + * Show or hide the learnpath category on the course homepage + * @param int $id + * @param int $setVisibility + * @return bool + */ + public static function toggleCategoryPublish($id, $setVisibility = 1) + { + $courseId = api_get_course_int_id(); + $sessionId = api_get_session_id(); + $sessionCondition = api_get_session_condition($sessionId, true, false, 't.sessionId'); + + $em = Database::getManager(); + + /** @var CLpCategory $category */ + $category = $em->find('ChamiloCourseBundle:CLpCategory', $id); + + if (!$category) { + return false; + } + + $link = self::getCategoryLinkForTool($id); + + /** @var CTool $tool */ + $tool = $em + ->createQuery(" + SELECT t FROM ChamiloCourseBundle:CTool t + WHERE + t.cId = :course AND + t.link = :link1 AND + t.image = 'lp_category.gif' AND + t.link LIKE :link2 + $sessionCondition + ") + ->setParameters([ + 'course' => (int) $courseId, + 'link1' => $link, + 'link2' => "$link%" + ]) + ->getOneOrNullResult(); + + if ($setVisibility == 0 && $tool) { + $em->remove($tool); + $em->flush(); + + return true; + } + + if ($setVisibility == 1 && !$tool) { + $tool = new CTool(); + $tool + ->setCategory('authoring') + ->setCId($courseId) + ->setName($category->getName()) + ->setLink($link) + ->setImage('lp_category.gif') + ->setVisibility(1) + ->setAdmin(0) + ->setAddress('pastillegris.gif') + ->setAddedTool(0) + ->setSessionId($sessionId) + ->setTarget('_self'); + + $em->persist($tool); + $em->flush(); + + $tool->setId($tool->getIid()); + + $em->persist($tool); + $em->flush(); + + return true; + } + + if ($setVisibility == 1 && $tool) { + $tool + ->setName($category->getName()) + ->setVisibility(1); + + $em->persist($tool); + $em->flush(); + + return true; + } + + return false; + } + + /** + * Check if the learnpath category is visible for a user + * @param CLpCategory $category + * @param User $user + * @return bool + */ + public static function categoryIsVisibleForStudent( + CLpCategory $category, + User $user + ) + { + $isAllowedToEdit = api_is_allowed_to_edit(null, true); + + if ($isAllowedToEdit) { + return true; + } + + $users = $category->getUsers(); + + if (empty($users) || !$users->count()) { + return true; + } + + if ($category->hasUserAdded($user)) { + return true; + } + + return false; + } + + /** + * Check if a learnpath category is published as course tool + * @param CLpCategory $category + * @param int $courseId + * @return bool + */ + public static function categoryIsPusblished( + CLpCategory $category, + $courseId + ) + { + $link = self::getCategoryLinkForTool($category->getId()); + $em = Database::getManager(); + + $tools = $em + ->createQuery(" + SELECT t FROM ChamiloCourseBundle:CTool t + WHERE t.cId = :course AND + t.name = :name AND + t.image = 'lp_category.gif' AND + t.link LIKE :link + ") + ->setParameters([ + 'course' => $courseId, + 'name' => $category->getName(), + 'link' => "$link%" + ]) + ->getResult(); + + /** @var CTool $tool */ + $tool = current($tools); + + return $tool ? $tool->getVisibility() : false; + } + /** * Restart the whole learnpath. Return the URL of the first element. * Make sure the results are saved with anoter method. This method should probably be diff --git a/main/lp/lp_controller.php b/main/lp/lp_controller.php index b99f5f7b53..8cd585b93c 100755 --- a/main/lp/lp_controller.php +++ b/main/lp/lp_controller.php @@ -334,9 +334,11 @@ if (isset($_SESSION['oLP'])) { } if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') { - if (isset($_REQUEST['action']) && !in_array($_REQUEST['action'], ['list', 'view'])) { + if (isset($_REQUEST['action']) && !in_array($_REQUEST['action'], ['list', 'view', 'view_category'])) { if (!empty($_REQUEST['lp_id'])) { $_REQUEST['action'] = 'view'; + } elseif($_REQUEST['action'] == 'view_category') { + $_REQUEST['action'] = 'view_category'; } else { $_REQUEST['action'] = 'list'; } @@ -873,6 +875,14 @@ switch ($action) { require 'lp_list.php'; } break; + case 'toggle_category_publish': + if (!$is_allowed_to_edit) { + api_not_allowed(true); + } + + learnpath::toggleCategoryPublish($_REQUEST['id'], $_REQUEST['new_status']); + require 'lp_list.php'; + break; case 'toggle_publish': // Change lp published status (visibility on homepage). if (!$is_allowed_to_edit) { diff --git a/main/lp/lp_list.php b/main/lp/lp_list.php index 9af12a6436..74c05e5f88 100755 --- a/main/lp/lp_list.php +++ b/main/lp/lp_list.php @@ -141,6 +141,20 @@ $userId = api_get_user_id(); $userInfo = api_get_user_info(); $lpIsShown = false; +$filteredCategoryId = $action === 'view_category' && !empty($_GET['id']); + +if ($filteredCategoryId) { + /** @var CLpCategory $category */ + foreach ($categories as $category) { + if ($category->getId() != $filteredCategoryId) { + continue; + } + + $interbreadcrumb[] = ['name' => $nameTools, 'url' => api_get_self()]; + $nameTools = $category->getName(); + } +} + $test_mode = api_get_setting('server_type'); $user = UserManager::getRepository()->find($userId); @@ -149,13 +163,8 @@ $data = []; foreach ($categories as $item) { $categoryId = $item->getId(); - if (!$is_allowed_to_edit) { - $users = $item->getUsers(); - if (!empty($users) && $users->count() > 0) { - if (!$item->hasUserAdded($user)) { - continue; - } - } + if (!learnpath::categoryIsVisibleForStudent($item, $user)) { + continue; } $list = new LearnpathList( @@ -848,6 +857,10 @@ foreach ($categories as $item) { $item->getId(), $current_session ), + 'category_is_published' => learnpath::categoryIsPusblished( + $item, + $courseInfo['real_id'] + ), 'lp_list' => $listData ]; } @@ -861,6 +874,7 @@ $template->assign('message', $message); $template->assign('introduction_section', $introductionSection); $template->assign('data', $data); $template->assign('lp_is_shown', $lpIsShown); +$template->assign('filtered_category', $filteredCategoryId); $templateName = $template->get_template('learnpath/list.tpl'); $content = $template->fetch($templateName); $template->assign('content', $content); diff --git a/main/template/default/learnpath/list.tpl b/main/template/default/learnpath/list.tpl index b9ab95bfb2..cfa5872e53 100644 --- a/main/template/default/learnpath/list.tpl +++ b/main/template/default/learnpath/list.tpl @@ -11,140 +11,160 @@ {{ introduction_section }} {% for lp_data in data %} - {% if categories|length > 1 and lp_data.category.id %} - {% if is_allowed_to_edit %} - - {% elseif lp_data.lp_list is not empty %} - + + {% elseif lp_data.lp_list is not empty %} + + {% endif %} {% endif %} - {% endif %} - - {% if lp_data.lp_list %} -
-

'.get_lang('ThematicAdvanceHistory').'

- - - - {% if is_allowed_to_edit %} - - - - - {% else %} - {% if not is_invitee %} - - {% endif %} - - {% endif %} - - - - {% for row in lp_data.lp_list %} + {% if lp_data.lp_list %} +
+
{{ "Title"|get_lang }}{{ "PublicationDate"|get_lang }}{{ "ExpirationDate"|get_lang }}{{ "Progress"|get_lang }}{{ "AuthoringOptions"|get_lang }}{{ "Progress"|get_lang }}{{ "Actions"|get_lang }}
+ - + {% if is_allowed_to_edit %} - - - + + + + {% else %} {% if not is_invitee %} + + {% endif %} + + + {% endif %} + + + + {% for row in lp_data.lp_list %} + + + {% if is_allowed_to_edit %} + + + {% else %} + {% if not is_invitee %} + + {% endif %} {% endif %} - {% endif %} - - - {% endfor %} - -
- {{ row.learnpath_icon }} - - {{ row.title }} - {{ row.session_image }} - {{ row.extra }} - - {{ "Title"|get_lang }} - {% if row.start_time %} - {{ row.start_time }} - {% endif %} - - {{ row.end_time }} - - {{ row.dsp_progress }} - {{ "PublicationDate"|get_lang }}{{ "ExpirationDate"|get_lang }}{{ "Progress"|get_lang }}{{ "AuthoringOptions"|get_lang }}{{ "Progress"|get_lang }}{{ "Actions"|get_lang }}
+ {{ row.learnpath_icon }} + + {{ row.title }} + {{ row.session_image }} + {{ row.extra }} + + + {% if row.start_time %} + {{ row.start_time }} + {% endif %} + + {{ row.end_time }} + {{ row.dsp_progress }} + {{ row.dsp_progress }} + - {{ row.action_build }} - {{ row.action_edit }} - {{ row.action_visible }} - {{ row.action_tracking }} - {{ row.action_publish }} - {{ row.action_subscribe_users }} - {{ row.action_serious_game }} - {{ row.action_reinit }} - {{ row.action_default_view }} - {{ row.action_debug }} - {{ row.action_export }} - {{ row.action_copy }} - {{ row.action_auto_launch }} - {{ row.action_pdf }} - {{ row.action_delete }} - {{ row.action_order }} -
-
+ + {{ row.action_build }} + {{ row.action_edit }} + {{ row.action_visible }} + {{ row.action_tracking }} + {{ row.action_publish }} + {{ row.action_subscribe_users }} + {{ row.action_serious_game }} + {{ row.action_reinit }} + {{ row.action_default_view }} + {{ row.action_debug }} + {{ row.action_export }} + {{ row.action_copy }} + {{ row.action_auto_launch }} + {{ row.action_pdf }} + {{ row.action_delete }} + {{ row.action_order }} + + + {% endfor %} + + +
+ {% endif %} {% endif %} {% endfor %} diff --git a/src/Chamilo/CourseBundle/Entity/CTool.php b/src/Chamilo/CourseBundle/Entity/CTool.php index cc9cc9216b..fff5ba06ac 100644 --- a/src/Chamilo/CourseBundle/Entity/CTool.php +++ b/src/Chamilo/CourseBundle/Entity/CTool.php @@ -96,7 +96,8 @@ class CTool * * @ORM\Column(name="target", type="string", length=20, nullable=false) */ - private $target; + private + $target; /** * @var string From b965163df0d7a8f2dd236a78d8cb9004042d0655 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Tue, 23 May 2017 12:50:38 -0500 Subject: [PATCH 17/18] Allow save learnpath category with HTML code when save_titles_as_html is enabled - refs BT#12756 --- main/lp/learnpath.class.php | 6 +++--- main/lp/lp_add_category.php | 13 +++++++++++-- main/lp/lp_list.php | 2 +- main/lp/lp_subscribe_users_to_category.php | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/main/lp/learnpath.class.php b/main/lp/learnpath.class.php index a04cc406fc..b1e71271ef 100755 --- a/main/lp/learnpath.class.php +++ b/main/lp/learnpath.class.php @@ -4323,7 +4323,7 @@ class learnpath $tool ->setCategory('authoring') ->setCId($courseId) - ->setName($category->getName()) + ->setName(strip_tags($category->getName())) ->setLink($link) ->setImage('lp_category.gif') ->setVisibility(1) @@ -4346,7 +4346,7 @@ class learnpath if ($setVisibility == 1 && $tool) { $tool - ->setName($category->getName()) + ->setName(strip_tags($category->getName())) ->setVisibility(1); $em->persist($tool); @@ -4412,7 +4412,7 @@ class learnpath ") ->setParameters([ 'course' => $courseId, - 'name' => $category->getName(), + 'name' => strip_tags($category->getName()), 'link' => "$link%" ]) ->getResult(); diff --git a/main/lp/lp_add_category.php b/main/lp/lp_add_category.php index ab72405203..d683a7ada9 100644 --- a/main/lp/lp_add_category.php +++ b/main/lp/lp_add_category.php @@ -31,8 +31,17 @@ $form = new FormValidator( $form->addElement('header', null, get_lang('AddLPCategory')); // Title -$form->addElement('text', 'name', api_ucfirst(get_lang('Name'))); -$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); +if (api_get_configuration_value('save_titles_as_html')) { + $form->addHtmlEditor( + 'name', + get_lang('Name'), + true, + false, + ['ToolbarSet' => 'Minimal'] + ); +} else { + $form->addText('name', get_lang('Name'), true); +} $form->addElement('hidden', 'action', 'add_lp_category'); $form->addElement('hidden', 'c_id', api_get_course_int_id()); diff --git a/main/lp/lp_list.php b/main/lp/lp_list.php index 74c05e5f88..cbd0aa825d 100755 --- a/main/lp/lp_list.php +++ b/main/lp/lp_list.php @@ -151,7 +151,7 @@ if ($filteredCategoryId) { } $interbreadcrumb[] = ['name' => $nameTools, 'url' => api_get_self()]; - $nameTools = $category->getName(); + $nameTools = strip_tags($category->getName()); } } diff --git a/main/lp/lp_subscribe_users_to_category.php b/main/lp/lp_subscribe_users_to_category.php index ef507f3a75..78f05f04e2 100644 --- a/main/lp/lp_subscribe_users_to_category.php +++ b/main/lp/lp_subscribe_users_to_category.php @@ -36,7 +36,7 @@ $interbreadcrumb[] = array( 'url' => 'lp_controller.php?action=list&'.api_get_cidreq(), 'name' => get_lang('LearningPaths') ); -$interbreadcrumb[] = array('url' => '#', 'name' => $category->getName()); +$interbreadcrumb[] = array('url' => '#', 'name' => strip_tags($category->getName())); // Find course. $course = $em->getRepository('ChamiloCoreBundle:Course')->find($courseId); From dec5d02cdb53d47172a0ae15f47be9e0b0f4e8ab Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Tue, 23 May 2017 15:15:15 -0500 Subject: [PATCH 18/18] Minor - Format composer.json code --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 2adb487ffc..8fc177a67f 100755 --- a/composer.json +++ b/composer.json @@ -105,13 +105,13 @@ "knplabs/doctrine-behaviors": "~1.1", "jimmiw/php-time-ago": "^0.4.14", "phpoffice/phpword": "^0.12.1|dev-master", - "facebook/php-sdk-v4" : "~5.0", - "kigkonsult/icalcreator" : "0.1.0", + "facebook/php-sdk-v4": "~5.0", + "kigkonsult/icalcreator": "0.1.0", "essence/essence": "2.6.1", "pclzip/pclzip": "2.8.2", "chamilo/chash": "dev-master", "ircmaxell/random-lib": "^1.2", - "ocramius/proxy-manager" : "~1.0|2.0.*" + "ocramius/proxy-manager": "~1.0|2.0.*" }, "require-dev": { "behat/behat": "@stable", @@ -151,6 +151,6 @@ } }, "config": { - "component-dir": "web/assets" + "component-dir": "web/assets" } }