Skip to content

Commit 896b085

Browse files
committed
Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x
2 parents 23d2100 + 8ff67c3 commit 896b085

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3482
-15
lines changed

main/exercise/exercise_report.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,8 @@
500500
'comparative_group_report.php?'.api_get_cidreq().'&id='.$exercise_id,
501501
['class' => 'btn btn-default']
502502
);
503+
504+
$actions .= ExerciseFocusedPlugin::create()->getLinkReporting($exercise_id);
503505
}
504506
} else {
505507
$actions .= '<a href="exercise.php">'.

main/glossary/index.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ function sorter($item1, $item2)
9090
$form->addHtmlEditor(
9191
'name',
9292
get_lang('TermName'),
93-
false,
93+
true,
9494
false,
9595
['ToolbarSet' => 'TitleAsHtml']
9696
);
9797
} else {
98-
$form->addElement('text', 'name', get_lang('TermName'), ['id' => 'glossary_title']);
98+
$form->addText('name', get_lang('TermName'), true, ['id' => 'glossary_title']);
9999
}
100100

101101
$form->addHtmlEditor(
@@ -107,7 +107,6 @@ function sorter($item1, $item2)
107107
);
108108
$form->addButtonCreate(get_lang('TermAddButton'), 'SubmitGlossary');
109109
// setting the rules
110-
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
111110
// The validation or display
112111
if ($form->validate()) {
113112
$check = Security::check_token('post');
@@ -154,12 +153,12 @@ function sorter($item1, $item2)
154153
$form->addHtmlEditor(
155154
'name',
156155
get_lang('TermName'),
157-
false,
156+
true,
158157
false,
159158
['ToolbarSet' => 'TitleAsHtml']
160159
);
161160
} else {
162-
$form->addElement('text', 'name', get_lang('TermName'), ['id' => 'glossary_title']);
161+
$form->addText('name', get_lang('TermName'), true, ['id' => 'glossary_title']);
163162
}
164163

165164
$form->addHtmlEditor(
@@ -192,9 +191,6 @@ function sorter($item1, $item2)
192191
$form->addButtonUpdate(get_lang('TermUpdateButton'), 'SubmitGlossary');
193192
$form->setDefaults($glossary_data);
194193

195-
// setting the rules
196-
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
197-
198194
// The validation or display
199195
if ($form->validate()) {
200196
$check = Security::check_token('post');

main/img/icons/22/webcam_na.png

5.12 KB
Loading

main/inc/lib/TrackingCourseLog.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ public static function getItemResourcesData($from, $numberOfItems, $column, $dir
284284
$row[4] = $ip;
285285
}
286286

287+
$row[5] = Security::remove_XSS($row[5]);
288+
287289
$resources[] = $row;
288290
}
289291
}

main/inc/lib/formvalidator/FormValidator.class.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,14 +2102,10 @@ function plain_url_filter($html, $mode = NO_HTML)
21022102

21032103
/**
21042104
* Prevent execution of event handlers in HTML elements.
2105-
*
2106-
* @param string $html
2107-
*
2108-
* @return string
21092105
*/
2110-
function attr_on_filter($html)
2106+
function attr_on_filter(string $html): string
21112107
{
2112-
$prefix = uniqid('data-cke-').'-';
2108+
$pattern = '/\s*on\w+=(?:"[^"]*"|\'[^\']*\'|[^\s>]+)/i';
21132109

2114-
return preg_replace('/\b(on[a-z]+)\b\s*=/i', '$1'.$prefix.'$2', $html);
2110+
return preg_replace($pattern, '', $html);
21152111
}

plugin/exercisefocused/admin.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/* For licensing terms, see /license.txt */
4+
5+
use Chamilo\PluginBundle\ExerciseFocused\Controller\AdminController;
6+
use Chamilo\PluginBundle\ExerciseFocused\Entity\Log;
7+
use Symfony\Component\HttpFoundation\Request as HttpRequest;
8+
use Symfony\Component\HttpFoundation\Response as HttpResponse;
9+
10+
$cidReset = true;
11+
12+
require_once __DIR__.'/../../main/inc/global.inc.php';
13+
14+
api_protect_admin_script();
15+
16+
$em = Database::getManager();
17+
$logRepository = $em->getRepository(Log::class);
18+
19+
$reportingController = new AdminController(
20+
ExerciseFocusedPlugin::create(),
21+
HttpRequest::createFromGlobals(),
22+
$em,
23+
$logRepository
24+
);
25+
26+
try {
27+
$response = $reportingController();
28+
} catch (Exception $e) {
29+
$response = HttpResponse::create('', HttpResponse::HTTP_FORBIDDEN);
30+
}
31+
32+
$response->send();

plugin/exercisefocused/index.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
/* For licensing terms, see /license.txt */
4+
5+
use Chamilo\CoreBundle\Entity\TrackEExercises;
6+
use Chamilo\PluginBundle\ExerciseFocused\Entity\Log;
7+
8+
$plugin = ExerciseFocusedPlugin::create();
9+
10+
$exerciseId = (int) ($_GET['exerciseId'] ?? 0);
11+
12+
$renderRegion = $plugin->isEnableForExercise($exerciseId);
13+
14+
if ($renderRegion) {
15+
$_template['show_region'] = true;
16+
17+
$em = Database::getManager();
18+
19+
$existingExeId = (int) ChamiloSession::read('exe_id');
20+
$trackingExercise = null;
21+
22+
if ($existingExeId) {
23+
$trackingExercise = $em->find(TrackEExercises::class, $existingExeId);
24+
}
25+
26+
$_template['sec_token'] = Security::get_token('exercisefocused');
27+
28+
if ('true' === $plugin->get(ExerciseFocusedPlugin::SETTING_ENABLE_OUTFOCUSED_LIMIT)) {
29+
$logRepository = $em->getRepository(Log::class);
30+
31+
if ($trackingExercise) {
32+
$countOutfocused = $logRepository->countByActionInExe($trackingExercise, Log::TYPE_OUTFOCUSED);
33+
} else {
34+
$countOutfocused = 0;
35+
}
36+
37+
$_template['count_outfocused'] = $countOutfocused;
38+
$_template['remaining_outfocused'] = (int) $plugin->get(ExerciseFocusedPlugin::SETTING_OUTFOCUSED_LIMIT) - $countOutfocused;
39+
}
40+
41+
if ($trackingExercise) {
42+
$exercise = new Exercise($trackingExercise->getCId());
43+
44+
if ($exercise->read($trackingExercise->getExeExoId())) {
45+
$_template['exercise_type'] = (int) $exercise->selectType();
46+
}
47+
}
48+
}

plugin/exercisefocused/install.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
/* For licensing terms, see /license.txt */
4+
5+
ExerciseFocusedPlugin::create()->install();
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/* For licensing terms, see /license.txt */
4+
5+
$strings['plugin_title'] = "Exercise Focused";
6+
$strings['plugin_comment'] = "Show a message to return to the exercise when the user exits the Chamilo window/tab.";
7+
8+
$strings['tool_enable'] = "Enable tool";
9+
$strings['enable_time_limit'] = 'Enable time limit';
10+
$strings['time_limit'] = "Limit time";
11+
$strings['time_limit_help'] = "Limit time (in seconds) to return to the exercise. After this time the exercise will be closed.";
12+
$strings['enable_outfocused_limit'] = "Enable maximum of outfocused";
13+
$strings['outfocused_limit'] = "Maximum number of outfocused allowed";
14+
$strings['outfocused_limit_help'] = "Number of outfocused allowed. After this limit the exercise will be closed.";
15+
$strings['session_field_filters'] = "Session field as filter";
16+
$strings['session_field_filters_help'] = "Extra field names separeted by a comma.";
17+
$strings['percentage_sampling'] = "Percentage of sampling attempts";
18+
$strings['percentage_sampling_help'] = "A percentage of attempts will be selected for random review";
19+
20+
$strings['ReportByAttempts'] = "Exercise focused: Report by attempts";
21+
$strings['YouHaveLeftTheExercise'] = "Careful! We detect that you have left the exam window.<br><br>You must return and complete it.";
22+
$strings['YouHaveXTimeToReturn'] = "You have <span class=\"h3 text-danger\" id=\"time-limit-target\">%s</span> seconds to return";
23+
$strings['YouAreAllowedXOutfocused'] = "You are allowed <span class=\"h3 text-danger\" id=\"outfocused-limit-target\">%d</span> outfocused";
24+
$strings['OutfocusedLimitExceeded'] = "You have exceeded the allowed limit of outfocused";
25+
$strings['SelectExercise'] = "Select exercise";
26+
$strings['UnselectExercise'] = "Unselect exercise";
27+
$strings['Returns'] = "Returns";
28+
$strings['MaxOutfocusedReached'] = "Max outfocused reached";
29+
$strings['TimeLimitReached'] = "Time limit reached";
30+
$strings['Outfocused'] = "Outfocused";
31+
$strings['Return'] = "Return";
32+
$strings['Motive'] = "Motive";
33+
$strings['AlertBeforeLeaving'] = "Please stay within the exam";
34+
$strings['RandomSampling'] = "Random sampling";
35+
$strings['WindowTitleOutfocused'] = '🚨 Stay within the exam!';
36+
$strings['LevelReached'] = 'Level reached';
37+
$strings['ExerciseStartDateAndTime'] = "Exercise start date and time";
38+
$strings['ExerciseEndDateAndTime'] = "Exercise end date and time";
39+
$strings['MotiveExerciseFinished'] = "Successfully completed the exam";
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/* For licensing terms, see /license.txt */
4+
5+
$strings['plugin_title'] = "Enfoque en el Ejercicio";
6+
$strings['plugin_comment'] = "Mostrar un mensaje para regresar al ejercicio cuando el usuario sale de la ventana/pestaña de Chamilo.";
7+
8+
$strings['tool_enable'] = "Habilitar herramienta";
9+
$strings['enable_time_limit'] = 'Habilitar límite de tiempo';
10+
$strings['time_limit'] = "Límite de tiempo";
11+
$strings['time_limit_help'] = "Límite el tiempo (en segundos) para regresar al ejercicio. Pasado este tiempo, el ejercicio se cerrará.";
12+
$strings['enable_outfocused_limit'] = "Habilitar el máximo de desenfoque";
13+
$strings['outfocused_limit'] = "Número máximo de desenfoques permitidos";
14+
$strings['outfocused_limit_help'] = "Número de desenfoques permitidos. Después de este límite, el ejercicio se cerrará.";
15+
$strings['session_field_filters'] = "Campo de sesión como filtro";
16+
$strings['session_field_filters_help'] = "Nombres de campos adicionales separados por comas.";
17+
$strings['percentage_sampling'] = "Porcentaje de intentos de muestreo";
18+
$strings['percentage_sampling_help'] = "Se seleccionará un porcentaje de intentos para una revisión aleatoria";
19+
20+
$strings['ReportByAttempts'] = "Enfoque en el Ejercicio: Informe por intentos";
21+
$strings['YouHaveLeftTheExercise'] = "¡Cuidado! Detectamos que has abandonado la ventana del examen.<br><br>Debes retornar y culminarlo.";
22+
$strings['YouHaveXTimeToReturn'] = "Tienes <span class=\"h3 text-danger\" id=\"time-limit-target\">%s</span> segundos para regresar";
23+
$strings['YouAreAllowedXOutfocused'] = "Se te permite <span class=\"h3 text-danger\" id=\"outfocused-limit-target\">%d</span> desenfoques";
24+
$strings['OutfocusedLimitExceeded'] = "Has excedido el límite permitido de desenfoques";
25+
$strings['SelectExercise'] = "Seleccionar ejercicio";
26+
$strings['UnselectExercise'] = "Deseleccionar ejercicio";
27+
$strings['Returns'] = "Regresos";
28+
$strings['MaxOutfocusedReached'] = "Se ha alcanzado el máximo de desenfoques";
29+
$strings['TimeLimitReached'] = "Se ha alcanzado el límite de tiempo";
30+
$strings['Outfocused'] = "Desenfoques";
31+
$strings['Return'] = "Regresos";
32+
$strings['Motive'] = "Motivo";
33+
$strings['AlertBeforeLeaving'] = "Por favor, mantente dentro del examen.";
34+
$strings['RandomSampling'] = "Muestreo Aleatorio";
35+
$strings['WindowTitleOutfocused'] = '🚨 Retorna y culmina tu examen';
36+
$strings['LevelReached'] = 'Nivel alcanzado';
37+
$strings['ExerciseStartDateAndTime'] = "Fecha y hora de inicio del ejercicio";
38+
$strings['ExerciseEndDateAndTime'] = "Fecha y hora de finalización del ejercicio";
39+
$strings['MotiveExerciseFinished'] = "Culminó exitosamente el examen";

0 commit comments

Comments
 (0)