From 5c6eb5c721b528a4dbd5371975945c465b0df481 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Tue, 4 Apr 2017 17:15:47 -0500 Subject: [PATCH] Merge student homepage progress PR 1668. Fix issues with double language variables. Factorize calls to api_get_configuration_value() --- main/inc/lib/userportal.lib.php | 51 ++++++++++++---------------- main/install/data.sql | 2 +- main/lang/brazilian/trad4all.inc.php | 12 +++++-- main/lang/catalan/trad4all.inc.php | 7 ++-- main/lang/english/trad4all.inc.php | 11 ++---- main/lang/french/trad4all.inc.php | 4 +-- main/lang/german/trad4all.inc.php | 4 +-- main/lang/spanish/trad4all.inc.php | 9 ++--- 8 files changed, 43 insertions(+), 57 deletions(-) diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index 137f4f7088..4a09414a6e 100755 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -1150,6 +1150,13 @@ class IndexManager $sessionCount = 0; $courseCount = 0; + // Student info code check (shows student progress information on + // courses list + $studentInfo = api_get_configuration_value('course_student_info'); + $studentInfoProgress = (!empty($studentInfo['progress']) && $studentInfo['progress'] === true); + $studentInfoScore = (!empty($studentInfo['score']) && $studentInfo['score'] === true); + $studentInfoCertificate = (!empty($studentInfo['certificate']) && $studentInfo['certificate'] === true); + // If we're not in the history view... if (!isset($_GET['history'])) { // Display special courses. @@ -1167,12 +1174,9 @@ class IndexManager //Course option (show student progress) //This code will add new variables (Progress, Score, Certificate) - if (isset(api_get_configuration_value('course_student_info')['progress']) || - isset(api_get_configuration_value('course_student_info')['score']) || - isset(api_get_configuration_value('course_student_info')['certificate'])) { + if ($studentInfoProgress || $studentInfoScore || $studentInfoCertificate) { foreach ($specialCourses as $key => $specialCourseInfo) { - if (isset(api_get_configuration_value('course_student_info')['progress']) && - api_get_configuration_value('course_student_info')['progress'] === true) { + if ($studentInfoProgress) { $progress = Tracking::get_avg_student_progress( $user_id, $specialCourseInfo['course_code'] @@ -1180,8 +1184,7 @@ class IndexManager $specialCourses[$key]['student_info']['progress'] = ($progress === false)? null : $progress; } - if (isset(api_get_configuration_value('course_student_info')['score']) && - api_get_configuration_value('course_student_info')['score'] === true) { + if ($studentInfoScore) { $percentage_score = Tracking::get_avg_student_score( $user_id, $specialCourseInfo['course_code'], @@ -1190,8 +1193,7 @@ class IndexManager $specialCourses[$key]['student_info']['score'] = $percentage_score; } - if (isset(api_get_configuration_value('course_student_info')['certificate']) && - api_get_configuration_value('course_student_info')['certificate'] === true) { + if ($studentInfoCertificate) { $category = Category::load( null, null, @@ -1216,8 +1218,7 @@ class IndexManager foreach ($courses['in_category'] as $key1 => $value) { if (isset($courses['in_category'][$key1]['courses'])) { foreach ($courses['in_category'][$key1]['courses'] as $key2 => $courseInCatInfo) { - if (isset(api_get_configuration_value('course_student_info')['progress']) && - api_get_configuration_value('course_student_info')['progress'] === true) { + if ($studentInfoProgress) { $progress = Tracking::get_avg_student_progress( $user_id, $courseInCatInfo['course_code'] @@ -1225,8 +1226,7 @@ class IndexManager $courses['in_category'][$key1]['courses'][$key2]['student_info']['progress'] = ($progress === false)? null : $progress; } - if (isset(api_get_configuration_value('course_student_info')['score']) && - api_get_configuration_value('course_student_info')['score'] === true) { + if ($studentInfoScore) { $percentage_score = Tracking::get_avg_student_score( $user_id, $specialCourseInfo['course_code'], @@ -1235,8 +1235,7 @@ class IndexManager $courses['in_category'][$key1]['courses'][$key2]['student_info']['score'] = $percentage_score; } - if (isset(api_get_configuration_value('course_student_info')['certificate']) && - api_get_configuration_value('course_student_info')['certificate'] === true) { + if ($studentInfoCertificate) { $category = Category::load( null, null, @@ -1259,8 +1258,7 @@ class IndexManager } } foreach ($courses['not_category'] as $key => $courseNotInCatInfo) { - if (isset(api_get_configuration_value('course_student_info')['progress']) && - api_get_configuration_value('course_student_info')['progress'] === true) { + if ($studentInfoProgress) { $progress = Tracking::get_avg_student_progress( $user_id, $courseNotInCatInfo['course_code'] @@ -1268,8 +1266,7 @@ class IndexManager $courses['not_category'][$key]['student_info']['progress'] = ($progress === false)? null : $progress; } - if (isset(api_get_configuration_value('course_student_info')['score']) && - api_get_configuration_value('course_student_info')['score'] === true) { + if ($studentInfoScore) { $percentage_score = Tracking::get_avg_student_score( $user_id, $courseNotInCatInfo['course_code'], @@ -1278,8 +1275,7 @@ class IndexManager $courses['not_category'][$key]['student_info']['score'] = $percentage_score; } - if (isset(api_get_configuration_value('course_student_info')['certificate']) && - api_get_configuration_value('course_student_info')['certificate'] === true) { + if ($studentInfoCertificate) { $category = Category::load( null, null, @@ -1425,11 +1421,8 @@ class IndexManager //Course option (show student progress) //This code will add new variables (Progress, Score, Certificate) - if (isset(api_get_configuration_value('course_student_info')['progress']) || - isset(api_get_configuration_value('course_student_info')['score']) || - isset(api_get_configuration_value('course_student_info')['certificate'])) { - if (isset(api_get_configuration_value('course_student_info')['progress']) && - api_get_configuration_value('course_student_info')['progress'] === true) { + if ($studentInfoProgress || $studentInfoScore || $studentInfoCertificate) { + if ($studentInfoProgress) { $progress = Tracking::get_avg_student_progress( $user_id, $course['course_code'], @@ -1439,8 +1432,7 @@ class IndexManager $course_session['student_info']['progress'] = ($progress === false)? null : $progress; } - if (isset(api_get_configuration_value('course_student_info')['score']) && - api_get_configuration_value('course_student_info')['score'] === true) { + if ($studentInfoScore) { $percentage_score = Tracking::get_avg_student_score( $user_id, $course['course_code'], @@ -1450,8 +1442,7 @@ class IndexManager $course_session['student_info']['score'] = $percentage_score; } - if (isset(api_get_configuration_value('course_student_info')['certificate']) && - api_get_configuration_value('course_student_info')['certificate'] === true) { + if ($studentInfoCertificate) { $category = Category::load( null, null, diff --git a/main/install/data.sql b/main/install/data.sql index c158acc015..14df38a6ab 100644 --- a/main/install/data.sql +++ b/main/install/data.sql @@ -1959,4 +1959,4 @@ VALUES INSERT INTO settings_current (variable, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_download_documents_by_api_key', 'radio', 'WebServices', 'false', 'AllowDownloadDocumentsByApiKeyTitle', 'AllowDownloadDocumentsByApiKeyComment', '', NULL, 1); INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_download_documents_by_api_key', 'true', 'Yes'); -INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_download_documents_by_api_key', 'false', 'No'); \ No newline at end of file +INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_download_documents_by_api_key', 'false', 'No'); diff --git a/main/lang/brazilian/trad4all.inc.php b/main/lang/brazilian/trad4all.inc.php index 6736531f8c..e0c196bdeb 100644 --- a/main/lang/brazilian/trad4all.inc.php +++ b/main/lang/brazilian/trad4all.inc.php @@ -7861,8 +7861,16 @@ $SkillFromCourseXDeletedSinceThen = "Esta habilidade foi obtida através do curs $SaveAndAddNewItem = "Salvar e adicionar novo item"; $AnnouncementChooseRecipientsDescription = "Por padrão, este anúncio será enviado a todos os usuários. Mas você também pode selecionar outros destinatários."; $ChooseRecipients = "Escolha destinatários"; -$StudentCourseProgressX = "Progresso: %s%"; +$StudentCourseProgressX = "Progresso: %s %%"; $SessionDurationNotStartedMaxX = "Esta sessão tem uma duração máxima de %s dias."; -$StudentCourseScoreX = "Pontuação: %s%"; +$StudentCourseScoreX = "Pontuação: %s %%"; $StudentCourseCertificateX = "Certificado: %s"; +$ConfigureExerciseVisibilityInCourseTitle = "Habilitar para ignorar a configuração do Exercício invisível na sessão em um nível de curso básico"; +$ConfigureExerciseVisibilityInCourseComment = "Para habilitar a configuração da invisibilidade exercício em sessão na camada de base para passar pela configuração global. Se não for definido o parâmetro Global é usado."; +$ExerciseInvisibleInSessionTitle = "Exercer invisível na Sessão"; +$ExerciseInvisibleInSessionComment = "Se um exercício é visível no curso base, então ele aparece invisível na sessão. Se um exercício é invisível no curso básico, então ele não aparece na sessão."; +$Ongoing = "Em progresso"; +$Unclosed = "Não fechado"; +$AttemptStillOngoingPleaseWait = "Tentativa ainda em curso. Por favor, espere."; +$MarkAttemptAsClosed = "Marcar tentativa como fechada"; ?> \ No newline at end of file diff --git a/main/lang/catalan/trad4all.inc.php b/main/lang/catalan/trad4all.inc.php index e7ffd35cbf..b52dcd840a 100644 --- a/main/lang/catalan/trad4all.inc.php +++ b/main/lang/catalan/trad4all.inc.php @@ -7986,9 +7986,6 @@ $Colors = "Colors"; $DesignWithBadgeStudio = "Dissenyar amb Badge Studio"; $DesignWithBadgeStudioComment = "Utilitzi Badge Studio per crear la seva pròpia insígnia dins de la seva plataforma"; $YouAlreadySentThisFile = "Ja va enviar aquest o un altre arxiu amb el mateix nom. Si us plau assegureu-vos d'enviar cada arxiu una sola vegada."; -$StudentCourseProgress = "Progrés: %s%"; -$StudentCourseScore = "Puntuació: %s%"; -$StudentCourseCertificate = "Certificat: %s"; -$MyCourseProgressTitle = "Mostra progrés del curs a l'estudiant"; -$MyCourseProgressTemplateComment = "En activar aquesta opció se'ls mostraran als estudiants el progrés dels seus cursos a la pàgina 'Els meus cursos'."; +$StudentCourseProgressX = "Progrés: %s %%"; +$StudentCourseScoreX = "Puntuació: %s %%"; ?> \ No newline at end of file diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php index 5d138eb81b..903a472b57 100644 --- a/main/lang/english/trad4all.inc.php +++ b/main/lang/english/trad4all.inc.php @@ -2653,7 +2653,7 @@ Best Regards, %s Team"; $MailCronCourseExpirationReminderSubject = "Urgent: %s course expiration reminder"; $ExerciseAndLearningPath = "Exercise and learning path"; -$LearningPathGradebookWarning = "Warning: It is possible to use, in the gradebook, tests that are part of learning paths. If the learning path itself is already included, this test might be part of the gradebook already. The learning paths evaluation is made on the basis of a progress percentage, while the evaluation on tests is made on the basis of a score. Survey evaluation is based on whether the user has answered (1) or not (0). Make sure you test your combinations of gradebook evaluations to avoid mind-blogging situations."; +$LearningPathGradebookWarning = "Warning: It is possible to use, in the gradebook, tests that are part of learning paths. If the learning path itself is already included, this test might be part of the gradebook already. The learning paths evaluation is made on the basis of a progress percentage, while the evaluation on tests is made on the basis of a score. Survey evaluation is based on whether the user has answered (1) or not (0). Make sure you test your combinations of gradebook evaluations to avoid mind-boggling situations."; $ChooseEitherDurationOrTimeLimit = "Choose either duration or time limit"; $ClearList = "Clear the chat"; $SessionBanner = "Session banner"; @@ -7963,11 +7963,6 @@ $OnlyUsersFromCourseSession = "Only users from one course in a session"; $ServerXForwardedForInfo = "If the server is behind a proxy or firewall (and only in those cases), it might be using the X_FORWARDED_FOR HTTP header to show the remote user IP (yours, in this case)."; $GeolocalizationCoordinates = "Geolocalization by coordinates"; $ExportUsersOfACourse = "Export users of a course"; -$StudentCourseProgressX = "Progress: %s%"; -$StudentCourseScoreX = "Rating: %s%"; -$StudentCourseCertificateX = "Certificate: %s"; -$MyCourseProgressTitle = "Show course progress to student"; -$MyCourseProgressTemplateComment = "By activating this option, the students will see their course progress in the page 'My Courses'."; $PauseRecordingAudio = "Pause recording"; $PlayRecordingAudio = "Resume recording"; $YourSessionTimeHasExpired = "You are already registered but your allowed access time has expired."; @@ -7982,9 +7977,9 @@ $SkillFromCourseXDeletedSinceThen = "This skill was obtained through course %s w $SaveAndAddNewItem = "Save and add new item"; $AnnouncementChooseRecipientsDescription = "By default, this announcement will be sent to all users. But you can also select others recipients."; $ChooseRecipients = "Choose recipients"; -$StudentCourseProgressX = "Progress: %s%"; +$StudentCourseProgressX = "Progress: %s %%"; $SessionDurationNotStartedMaxX = "This session has a maximum duration of %s days."; -$StudentCourseScoreX = "Score: %s%"; +$StudentCourseScoreX = "Score: %s %%"; $StudentCourseCertificateX = "Certificate: %s"; $ConfigureExerciseVisibilityInCourseTitle = "Enable to bypass the configuration of Exercise invisible in session at a base course level"; $ConfigureExerciseVisibilityInCourseComment = "To enable the configuration of the exercise invisibility in session in the base course to by pass the global configuration. If not set the global parameter is used."; diff --git a/main/lang/french/trad4all.inc.php b/main/lang/french/trad4all.inc.php index 13dfd59ad2..5e4adb9948 100644 --- a/main/lang/french/trad4all.inc.php +++ b/main/lang/french/trad4all.inc.php @@ -7924,9 +7924,9 @@ $SkillFromCourseXDeletedSinceThen = "Cette compétence a été obtenue au traver $SaveAndAddNewItem = "Enregister et ajouter un nouvel élément"; $AnnouncementChooseRecipientsDescription = "Cette annonce sera envoyée à tous les utilisateurs par défaut, mais vous pouvez également sélectionner d'autres destinataires."; $ChooseRecipients = "Sélectionnez les destinataires"; -$StudentCourseProgressX = "Progrès: %s %"; +$StudentCourseProgressX = "Progrès: %s %%"; $SessionDurationNotStartedMaxX = "Cette session a une durée maximale de %s jours."; -$StudentCourseScoreX = "Score: %s %"; +$StudentCourseScoreX = "Score: %s %%"; $StudentCourseCertificateX = "Certificat: %s"; $ConfigureExerciseVisibilityInCourseTitle = "Permet de supasser la configuration de Exercice invisible dans la session au niveau de chaque cours de base."; $ConfigureExerciseVisibilityInCourseComment = "Permet de définir la configuration du paramètre invisible dans la session au niveau du cours de base afin de surpasser la configuration global. Si le paramètre n'est pas mis dans le cours de base, c'est la valeur du paramètre global qui est utilisé."; diff --git a/main/lang/german/trad4all.inc.php b/main/lang/german/trad4all.inc.php index fe2fcb4fe7..c7f18d725e 100644 --- a/main/lang/german/trad4all.inc.php +++ b/main/lang/german/trad4all.inc.php @@ -7680,8 +7680,8 @@ $SkillFromCourseXDeletedSinceThen = "Diese Fertigkeit wurde durch Kurs %s erworb $SaveAndAddNewItem = "Speichern und neues Element hinzufügen"; $AnnouncementChooseRecipientsDescription = "Standardmäßig wird diese Ankündigung an alle Benutzer gesendet. Aber Sie können auch andere Empfänger auswählen."; $ChooseRecipients = "Empfänger auswählen"; -$StudentCourseProgressX = "Fortschritt: %s%"; +$StudentCourseProgressX = "Fortschritt: %s %%"; $SessionDurationNotStartedMaxX = "Diese Sitzung hat eine maximale Dauer von %s Tagen."; -$StudentCourseScoreX = "Ergebnis: %s%"; +$StudentCourseScoreX = "Ergebnis: %s %%"; $StudentCourseCertificateX = "Zertifikat: %s"; ?> \ No newline at end of file diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php index 0a734ea55b..76846355db 100644 --- a/main/lang/spanish/trad4all.inc.php +++ b/main/lang/spanish/trad4all.inc.php @@ -7978,11 +7978,6 @@ $OnlyUsersFromCourseSession = "Solo usuarios de un curso en una sesión"; $ServerXForwardedForInfo = "Si su servidor está detrás de un reverse proxy o un firewall (y únicamente en estos casos), podría usar la cabecera HTTP X_FORWARDED_FOR para mostrar la dirección IP del usuario distante (usted, en este caso)."; $GeolocalizationCoordinates = "Geolocalización por coordenadas"; $ExportUsersOfACourse = "Exportar usuarios de un curso"; -$StudentCourseProgress = "Progreso: %s%"; -$StudentCourseScore = "Puntuación: %s%"; -$StudentCourseCertificate = "Certificado: %s"; -$MyCourseProgressTitle = "Mostrar progreso del curso al estudiante"; -$MyCourseProgressTemplateComment = "Al activar esta opción se les mostrarán a los estudiantes el progreso de sus cursos en la página 'Mis cursos'."; $PauseRecordingAudio = "Pausar grabación"; $PlayRecordingAudio = "Reanudar grabación"; $YourSessionTimeHasExpired = "Usted ya está registrado pero su periodo de permanencia en este curso ya expiró."; @@ -7997,9 +7992,9 @@ $SkillFromCourseXDeletedSinceThen = "Esta competencia fue adquirida a través de $SaveAndAddNewItem = "Guardar y agregar nuevo elemento"; $AnnouncementChooseRecipientsDescription = "De forma predeterminada, este anuncio será enviado a todos los usuarios. Pero también puede seleccionar otros destinatarios."; $ChooseRecipients = "Elegir destinatarios"; -$StudentCourseProgressX = "Progreso: %s %"; +$StudentCourseProgressX = "Progreso: %s %%"; $SessionDurationNotStartedMaxX = "Esta sesión tiene una duración máxima de %s días."; -$StudentCourseScoreX = "Nota: %s %"; +$StudentCourseScoreX = "Nota: %s %%"; $StudentCourseCertificateX = "Certificado: %s"; $ConfigureExerciseVisibilityInCourseTitle = "Permitir ignorar la configuración de un ejercicio invisible en la sesión a nivel del curso base"; $ConfigureExerciseVisibilityInCourseComment = "Activar la configuración de invisibilidad de los ejercicios en la sesión desde el curso base. Si no está configurado, se usa el parámetro global.";