Browse Source

Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

jmontoyaa 8 years ago
parent
commit
d89edfcfc2

+ 2 - 2
main/admin/settings.lib.php

@@ -1364,7 +1364,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                 break;
             case 'textarea':
                 if ($row['variable'] == 'header_extra_content') {
-                    $file = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content.txt';
+                    $file = api_get_home_path().'header_extra_content.txt';
                     $value = '';
                     if (file_exists($file)) {
                         $value = file_get_contents($file);
@@ -1372,7 +1372,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10'), $hideme);
                     $default_values[$row['variable']] = $value;
                 } elseif ($row['variable'] == 'footer_extra_content') {
-                    $file = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt';
+                    $file = api_get_home_path().'footer_extra_content.txt';
                     $value = '';
                     if (file_exists($file)) {
                         $value = file_get_contents($file);

+ 4 - 4
main/admin/settings.php

@@ -278,12 +278,12 @@ if (!empty($_GET['category']) &&
                 $old_value = api_get_setting($key);
                 switch ($key) {
                     case 'header_extra_content':
-                        file_put_contents(api_get_path(SYS_PATH).api_get_home_path().'/header_extra_content.txt', $value);
-                        $value = api_get_home_path().'/header_extra_content.txt';
+                        file_put_contents(api_get_home_path().'header_extra_content.txt', $value);
+                        $value = api_get_home_path().'header_extra_content.txt';
                         break;
                     case 'footer_extra_content':
-                        file_put_contents(api_get_path(SYS_PATH).api_get_home_path().'/footer_extra_content.txt', $value);
-                        $value = api_get_home_path().'/footer_extra_content.txt';
+                        file_put_contents(api_get_home_path().'footer_extra_content.txt', $value);
+                        $value = api_get_home_path().'footer_extra_content.txt';
                         break;
                     case 'InstitutionUrl':
                     case 'course_validation_terms_and_conditions_url':

+ 31 - 1
main/admin/user_export.php

@@ -15,12 +15,19 @@ api_protect_admin_script();
 $course_table = Database:: get_main_table(TABLE_MAIN_COURSE);
 $user_table = Database:: get_main_table(TABLE_MAIN_USER);
 $course_user_table = Database:: get_main_table(TABLE_MAIN_COURSE_USER);
+$session_course_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
 
 $tool_name = get_lang('ExportUserListXMLCSV');
 
 $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
 
 set_time_limit(0);
+$coursesSessions = [];
+$coursesSessions[''] = '--';
+
+$allCoursesFromSessions = SessionManager::getAllCoursesFromAllSessions();
+
+$coursesSessions = array_merge($coursesSessions, $allCoursesFromSessions);
 
 $courses = array ();
 $courses[''] = '--';
@@ -52,6 +59,7 @@ $form->addElement('radio', 'file_type', null, 'XLS', 'xls');
 
 $form->addElement('checkbox', 'addcsvheader', get_lang('AddCSVHeader'), get_lang('YesAddCSVHeader'),'1');
 $form->addElement('select', 'course_code', get_lang('OnlyUsersFromCourse'), $courses);
+$form->addElement('select', 'course_session', get_lang('OnlyUsersFromCourseSession'), $coursesSessions);
 $form->addButtonExport(get_lang('Export'));
 $form->setDefaults(array('file_type' => 'csv'));
 
@@ -62,6 +70,20 @@ if ($form->validate()) {
 	$courseInfo = api_get_course_info($course_code);
 	$courseId = $courseInfo['real_id'];
 
+	$courseSessionValue = explode(':', $export['course_session']);
+	$courseSessionCode = '';
+	$sessionId = 0;
+	$courseSessionId = 0;
+	$sessionInfo = [];
+
+	if (is_array($courseSessionValue) && isset($courseSessionValue[1])) {
+        $courseSessionCode = $courseSessionValue[0];
+        $sessionId = $courseSessionValue[1];
+        $courseSessionInfo= api_get_course_info($courseSessionCode);
+        $courseSessionId = $courseSessionInfo['real_id'];
+        $sessionInfo = api_get_session_info($sessionId);
+    }
+
 	$sql = "SELECT
 				u.user_id 	AS UserId,
 				u.lastname 	AS LastName,
@@ -81,7 +103,15 @@ if ($form->validate()) {
 						cu.relation_type<>".COURSE_RELATION_TYPE_RRHH."
 					ORDER BY lastname,firstname";
 		$filename = 'export_users_'.$course_code.'_'.api_get_local_time();
-	} else {
+	} else if (strlen($courseSessionCode) > 0) {
+        $sql .= " FROM $user_table u, $session_course_user_table scu
+					WHERE
+						u.user_id = scu.user_id AND
+						scu.c_id = $courseSessionId AND
+						scu.session_id = $sessionId 
+					ORDER BY lastname,firstname";
+        $filename = 'export_users_'.$courseSessionCode.'_'.$sessionInfo['name'].'_'.api_get_local_time();
+    } else {
 		if (api_is_multiple_url_enabled()) {
 			$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
 			$access_url_id = api_get_current_access_url_id();

+ 2 - 2
main/inc/lib/api.lib.php

@@ -2346,7 +2346,7 @@ function api_get_setting($variable, $key = null)
 {
     global $_setting;
     if ($variable == 'header_extra_content') {
-        $filename = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content.txt';
+        $filename = api_get_home_path().'header_extra_content.txt';
         if (file_exists($filename)) {
             $value = file_get_contents($filename);
             return $value;
@@ -2355,7 +2355,7 @@ function api_get_setting($variable, $key = null)
         }
     }
     if ($variable == 'footer_extra_content') {
-        $filename = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt';
+        $filename = api_get_home_path().'footer_extra_content.txt';
         if (file_exists($filename)) {
             $value = file_get_contents($filename);
             return $value;

+ 2 - 0
main/inc/lib/diagnoser.lib.php

@@ -430,6 +430,8 @@ class Diagnoser
 
         $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[SERVER]', 'php_uname()', 'http://be2.php.net/php_uname', php_uname(), null, null, get_lang('UnameInfo'));
 
+        $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[SERVER]', '$_SERVER["HTTP_X_FORWARDED_FOR"]', 'http://be.php.net/reserved.variables.server', (!empty($_SERVER["HTTP_X_FORWARDED_FOR"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : ''), null, null, get_lang('ServerXForwardedForInfo'));
+
         return $array;
     }
 

+ 20 - 0
main/inc/lib/sessionmanager.lib.php

@@ -5134,6 +5134,26 @@ class SessionManager
         return $coursesFromSession;
     }
 
+    /**
+     * getAllCoursesFromAllSessions
+     *
+     * @return array
+     */
+    public static function getAllCoursesFromAllSessions()
+    {
+        $sessions = SessionManager::get_sessions_list();
+        $coursesFromSession = array();
+        if (!empty($sessions)) {
+            foreach ($sessions as $session) {
+                $courseList = SessionManager::get_course_list_by_session_id($session['id']);
+                foreach ($courseList as $course) {
+                    $coursesFromSession[$course['code'].':'.$session['id']] = $course['visual_code'] . ' - ' . $course['title'] . ' (' . $session['name'] . ')';
+                }
+            }
+        }
+        return $coursesFromSession;
+    }
+
     /**
      * @param string $status
      * @param int $userId

+ 4 - 0
main/lang/brazilian/trad4all.inc.php

@@ -7838,4 +7838,8 @@ $DeleteCorrections = "Excluir correções";
 $AllowMyFilesTitle = "Permitir Minha página Arquivos";
 $AllowMyFilesComment = "Permitir que os usuários fazer upload de arquivos em um espaço pessoal na plataforma.";
 $InstallMultiURLDetectedNotMainURL = "Você está usando o recurso multi-URL e está tentando atualizar seu portal usando um URL secundário. Por favor, conecte-se ao URL principal para continuar com a atualização: %s";
+$OnlyXQuestionsPickedRandomly = "Apenas %s perguntas serão escolhidas aleatoriamente após a configuração do quiz.";
+$AllowDownloadDocumentsByApiKeyTitle = "Permitir download de documentos do curso por chave da API";
+$AllowDownloadDocumentsByApiKeyComment = "Fazer download de documentos que verificam a chave REST API para um usuário";
+$UploadCorrectionsExplanationWithDownloadLinkX = "Primeiro você tem que baixar as correções aqui . Depois que você tem que descompactar esse arquivo e editar os arquivos como você queria sem alterar os nomes dos arquivos. Em seguida, crie um arquivo zip com esses arquivos modificados e faça o upload desse formulário.";
 ?>

+ 2 - 0
main/lang/english/trad4all.inc.php

@@ -7958,4 +7958,6 @@ $UploadCorrectionsExplanationWithDownloadLinkX = "First you have to download the
 After that you have to unzip that file and edit the files as you wanted without changing the file names.
 Then create a zip file with those modified files and upload it in this form.";
 $PostsPendingModeration = "Posts pending moderation";
+$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).";
 ?>

+ 6 - 0
main/lang/french/trad4all.inc.php

@@ -7901,4 +7901,10 @@ $AllowMyFilesTitle = "Activer la page 'Mes fichiers'";
 $AllowMyFilesComment = "Permettre aux utilisateurs de télécharger des fichiers vers un espace personnel sur la plate-forme.";
 $InstallMultiURLDetectedNotMainURL = "Vous utilisez actuellement la fonctionnalité de multi-URL et êtes sur le point de mettre à jour votre portail en utilisant une URL secondaire. Merci de vous connecter à l'URL principale pour continuer le processus de mise à jour: %s";
 $OnlyXQuestionsPickedRandomly = "Seules %s questions seront tirées au hasard selon les règles établies dans la configuration de l'exercice.";
+$AllowDownloadDocumentsByApiKeyTitle = "Permettre le téléchargement de documents par API";
+$AllowDownloadDocumentsByApiKeyComment = "Permettre le téléchargement de documents du cours via une authentification sur base de la clef API d'un utilisateur. Cette option est utile pour l'application mobile et ne devrait être utilisée que si votre portail est en HTTPS.";
+$UploadCorrectionsExplanationWithDownloadLinkX = "Veuillez d'abord télécharger les corrections <a href=\"%s\">ici</a> puis les décompresser et éditer les fichiers sans changer leurs noms. Ensuite, créez un fichier zip avec les fichiers modifiés et téléchargez-le vers le serveur sous cette forme.";
+$PostsPendingModeration = "Participations en attente de modération";
+$OnlyUsersFromCourseSession = "Seulement les utilisateurs d'un cours dans une session";
+$ServerXForwardedForInfo = "Si le serveur est derrière un proxy ou un firewall (et uniquement dans ces cas), il pourrait utiliser le header HTTP X_FORWARDED_FOR pour montrer l'adresse IP de l'utilisateur distant (la vôtre, dans ce cas précis).";
 ?>

+ 6 - 0
main/lang/spanish/trad4all.inc.php

@@ -7969,4 +7969,10 @@ $AllowMyFilesTitle = "Permitir uso de página 'Mis documentos'";
 $AllowMyFilesComment = "Permitir a los usuarios subir archivos en un espacio personal en la plataforma.";
 $InstallMultiURLDetectedNotMainURL = "Usted actualmente está usando la funcionalidad de multi-url y está intentando actualizar su portal usando una URL secundaria. Por favor, conéctese a la URL principal para proceder con la actualización: %s";
 $OnlyXQuestionsPickedRandomly = "Solo %s preguntas serán seleccionadas aleatoriamente según la configuración del ejercicio.";
+$AllowDownloadDocumentsByApiKeyTitle = "Permitir descargar documentos del curso a través de la clave de API";
+$AllowDownloadDocumentsByApiKeyComment = "Descargar documentos con la llave API";
+$UploadCorrectionsExplanationWithDownloadLinkX = "Primero necesita descargar las correcciones <a href=\"%s\">aquí</a>. Luego descomprima el archivo y edita los documentos sin cambiar sus nombres. Finalmente, crea un archivo zip con estos documentos y vuelva a subir el archivo en esta forma a través de este formulario.";
+$PostsPendingModeration = "Contribuciones a la espera de moderación";
+$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).";
 ?>

+ 0 - 1
main/template/default/layout/head.tpl

@@ -33,4 +33,3 @@ var disconnect_lang = '{{ "ChatDisconnected"|get_lang }}';
 
 {{ css_custom_file_to_string }}
 {{ css_style_print }}
-{{ header_extra_content }}