Browse Source

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

Julio Montoya 11 years ago
parent
commit
59d92d7b55

+ 5 - 2
main/admin/user_edit.php

@@ -250,8 +250,11 @@ $group[] =$form->createElement('radio', 'send_mail', null, get_lang('Yes'), 1);
 $group[] =$form->createElement('radio', 'send_mail', null, get_lang('No'), 0);
 $form->addGroup($group, 'mail', get_lang('SendMailToNewUser'), ' ', false);
 
-// Registration Date
-$form->addElement('static', 'registration_date', get_lang('RegistrationDate'), $user_data['registration_date']);
+// Registration User and Date
+$creatorInfo = api_get_user_info($user_data['creator_id']);
+$date = sprintf(get_lang('CreatedByXYOnZ'), 'user_information.php?user_id='.$user_data['creator_id'], $creatorInfo['username'], $user_data['registration_date']);
+$form->addElement('html', '<div class="control-group"><label class="control-label">'.get_lang('RegistrationDate').'</label><div class="controls">'.$date.'</div></div>');
+
 
 if (!$user_data['platform_admin']) {
 	// Expiration Date

+ 50 - 25
main/admin/user_import.php

@@ -2,7 +2,6 @@
 /* For licensing terms, see /license.txt */
 /**
  * This tool allows platform admins to add users by uploading a CSV or XML file
- * @todo Add some langvars to DLTT
  * @package chamilo.admin
  */
 
@@ -22,7 +21,8 @@ require_once api_get_path(LIBRARY_PATH).'import.lib.php';
 // Set this option to true to enforce strict purification for usenames.
 $purification_option_for_usernames = false;
 
-function validate_data($users) {
+function validate_data($users)
+{
     global $defined_auth_sources;
     $errors = array();
     $usernames = array();
@@ -85,7 +85,8 @@ function validate_data($users) {
 /**
  * Add missing user-information (which isn't required, like password, username etc).
  */
-function complete_missing_data($user) {
+function complete_missing_data($user)
+{
     global $purification_option_for_usernames;
     // 1. Create a username if necessary.
     if (UserManager::is_username_empty($user['UserName'])) {
@@ -110,7 +111,7 @@ function complete_missing_data($user) {
 
 /**
  * Save the imported data
- * @param   array   List of users
+ * @param   array   $users List of users
  * @return  void
  * @uses global variable $inserted_in_course, which returns the list of courses the user was inserted in
  */
@@ -196,7 +197,8 @@ function save_data($users)
  * @param string $file Path to the CSV-file
  * @return array All userinformation read from the file
  */
-function parse_csv_data($file) {
+function parse_csv_data($file)
+{
     $users = Import :: csv_to_array($file);
     foreach ($users as $index => $user) {
         if (isset ($user['Courses'])) {
@@ -208,30 +210,36 @@ function parse_csv_data($file) {
 }
 /**
  * XML-parser: handle start of element
+ * @param   string  $parser Deprecated?
+ * @param   string  $data The data to be parsed
  */
-function element_start($parser, $data) {
+function element_start($parser, $data)
+{
     $data = api_utf8_decode($data);
     global $user;
     global $current_tag;
     switch ($data) {
-        case 'Contact' :
+        case 'Contact':
             $user = array ();
             break;
-        default :
+        default:
             $current_tag = $data;
     }
 }
 
 /**
  * XML-parser: handle end of element
+ * @param   string  $parser Deprecated?
+ * @param   string  $data   The data to be parsed
  */
-function element_end($parser, $data) {
+function element_end($parser, $data)
+{
     $data = api_utf8_decode($data);
     global $user;
     global $users;
     global $current_value;
     switch ($data) {
-        case 'Contact' :
+        case 'Contact':
             if ($user['Status'] == '5') {
                 $user['Status'] = STUDENT;
             }
@@ -240,7 +248,7 @@ function element_end($parser, $data) {
             }
             $users[] = $user;
             break;
-        default :
+        default:
             $user[$data] = $current_value;
             break;
     }
@@ -248,8 +256,12 @@ function element_end($parser, $data) {
 
 /**
  * XML-parser: handle character data
+ * @param   string  $parser Parser (deprecated?)
+ * @param   string  $data The data to be parsed
+ * @return  void
  */
-function character_data($parser, $data) {
+function character_data($parser, $data)
+{
     $data = trim(api_utf8_decode($data));
     global $current_value;
     $current_value = $data;
@@ -258,12 +270,10 @@ function character_data($parser, $data) {
 /**
  * Read the XML-file
  * @param string $file Path to the XML-file
- * @return array All userinformation read from the file
+ * @return array All user information read from the file
  */
-function parse_xml_data($file) {
-    global $current_tag;
-    global $current_value;
-    global $user;
+function parse_xml_data($file)
+{
     global $users;
     $users = array();
     $parser = xml_parser_create('UTF-8');
@@ -276,10 +286,11 @@ function parse_xml_data($file) {
 }
 
 $this_section = SECTION_PLATFORM_ADMIN;
-api_protect_admin_script(true);
+api_protect_admin_script(true, null, 'login');
 
 
 $defined_auth_sources[] = PLATFORM_AUTH_SOURCE;
+
 if (is_array($extAuthSource)) {
     $defined_auth_sources = array_merge($defined_auth_sources, array_keys($extAuthSource));
 }
@@ -292,7 +303,7 @@ $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', true);
 $user_id_error = array();
 $error_message = '';
 
-if ($_POST['formSent'] AND $_FILES['import_file']['size'] !== 0) {
+if ($_POST['formSent'] and $_FILES['import_file']['size'] !== 0) {
     $file_type = $_POST['file_type'];
     Security::clear_token();
     $tok = Security::get_token();
@@ -354,7 +365,9 @@ if ($_POST['formSent'] AND $_FILES['import_file']['size'] !== 0) {
         $warning_message = '<ul>';
         foreach ($errors as $index => $error_user) {
             $warning_message .= '<li><b>'.$error_user['error'].'</b>: ';
-            $warning_message .= '<strong>'.$error_user['UserName'].'</strong>&nbsp;('.api_get_person_name($error_user['FirstName'], $error_user['LastName']).')';
+            $warning_message .=
+                '<strong>'.$error_user['UserName'].'</strong>&nbsp;('.
+                api_get_person_name($error_user['FirstName'], $error_user['LastName']).')';
             $warning_message .= '</li>';
         }
         $warning_message .= '</ul>';
@@ -384,8 +397,20 @@ $form->addElement('header', '', $tool_name);
 $form->addElement('hidden', 'formSent');
 $form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
 $group = array();
-$group[] = $form->createElement('radio', 'file_type', '', 'CSV (<a href="example.csv" target="_blank">'.get_lang('ExampleCSVFile').'</a>)', 'csv');
-$group[] = $form->createElement('radio', 'file_type', null, 'XML (<a href="example.xml" target="_blank">'.get_lang('ExampleXMLFile').'</a>)', 'xml');
+$group[] = $form->createElement(
+    'radio',
+    'file_type',
+    '',
+    'CSV (<a href="example.csv" target="_blank">'.get_lang('ExampleCSVFile').'</a>)',
+    'csv'
+    );
+$group[] = $form->createElement(
+    'radio',
+    'file_type',
+    null,
+    'XML (<a href="example.xml" target="_blank">'.get_lang('ExampleXMLFile').'</a>)',
+    'xml'
+    );
 $form->addGroup($group, '', get_lang('FileType'), '<br/>');
 
 $group = array();
@@ -423,8 +448,8 @@ if ($count_fields > 0) {
 
     <blockquote>
 <pre>
-<b>LastName</b>;<b>FirstName</b>;<b>Email</b>;UserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;<font style="color:red;"><?php if (count($list) > 0) echo implode(';', $list).';'; ?></font>Courses;
-<b>xxx</b>;<b>xxx</b>;<b>xxx</b>;xxx;xxx;<?php echo implode('/', $defined_auth_sources); ?>;xxx;xxx;user/teacher/drh;<font style="color:red;"><?php if (count($list_reponse) > 0) echo implode(';', $list_reponse).';'; ?></font>xxx1|xxx2|xxx3;<br />
+<b>LastName</b>;<b>FirstName</b>;<b>Email</b>;UserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;<span style="color:red;"><?php if (count($list) > 0) echo implode(';', $list).';'; ?></span>Courses;
+<b>xxx</b>;<b>xxx</b>;<b>xxx</b>;xxx;xxx;<?php echo implode('/', $defined_auth_sources); ?>;xxx;xxx;user/teacher/drh;<span style="color:red;"><?php if (count($list_reponse) > 0) echo implode(';', $list_reponse).';'; ?></span>xxx1|xxx2|xxx3;<br />
 </pre>
     </blockquote>
 
@@ -443,7 +468,7 @@ if ($count_fields > 0) {
         <b>&lt;Email&gt;xxx&lt;/Email&gt;</b>
         &lt;OfficialCode&gt;xxx&lt;/OfficialCode&gt;
         &lt;PhoneNumber&gt;xxx&lt;/PhoneNumber&gt;
-        &lt;Status&gt;user/teacher/drh<?php if ($result_xml != '') { echo '<br /><font style="color:red;">', $result_xml; echo '</font>'; } ?>&lt;/Status&gt;
+        &lt;Status&gt;user/teacher/drh<?php if ($result_xml != '') { echo '<br /><span style="color:red;">', $result_xml; echo '</span>'; } ?>&lt;/Status&gt;
         &lt;Courses&gt;xxx1|xxx2|xxx3&lt;/Courses&gt;
         &lt;/Contact&gt;
 &lt;/Contacts&gt;

+ 70 - 20
main/admin/user_information.php

@@ -1,10 +1,13 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- *    @author Bart Mollet
- *    @package chamilo.admin
+ * Script showing information about a user (name, e-mail, courses and sessions)
+ * @author Bart Mollet
+ * @package chamilo.admin
+ */
+/**
+ * INIT SECTION
  */
-/* INIT SECTION */
 // name of the language file that needs to be included
 $language_file = 'admin';
 $cidReset = true;
@@ -20,6 +23,10 @@ if (!isset($_GET['user_id'])) {
 }
 $user = api_get_user_info($_GET['user_id']);
 $tool_name = $user['complete_name'].(empty($user['official_code'])?'':' ('.$user['official_code'].')');
+
+/**
+ * Display
+ */
 Display::display_header($tool_name);
 
 $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
@@ -37,15 +44,25 @@ if (isset($_GET['action'])) {
     }
 }
 // only allow platform admins to login_as, or session admins only for students (not teachers nor other admins)
-$statusname = api_get_status_langvars();
 $login_as_icon = null;
 $editUser = null;
-if (api_is_platform_admin() || (api_is_session_admin() && $row['6'] == $statusname[STUDENT])) {
-    $login_as_icon = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_list.php?action=login_as&amp;user_id='.$user['user_id'].'&amp;sec_token='.$_SESSION['sec_token'].'">'.Display::return_icon('login_as.gif', get_lang('LoginAs')).'</a>';
-    $editUser = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array()), api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user['user_id']);
+if (api_is_platform_admin()) {
+    $login_as_icon =
+        '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_list.php'
+        .'?action=login_as&amp;user_id='.$user['user_id'].'&amp;'
+        .'sec_token='.$_SESSION['sec_token'].'">'
+        .Display::return_icon('login_as.gif', get_lang('LoginAs')).'</a>';
+    $editUser = Display::url(
+        Display::return_icon(
+            'edit.png',
+            get_lang('Edit'),
+            array()
+        ),
+        api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user['user_id']
+    );
 }
 echo '<div class="actions">
-        <a href="'.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.intval($_GET['user_id']).'" title="'.get_lang('Reporting').'">'.Display::return_icon('statistics.png',get_lang('Reporting'),'',  ICON_SIZE_MEDIUM).'
+        <a href="'.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.intval($_GET['user_id']).'" title="'.get_lang('Reporting').'">'.Display::return_icon('statistics.png', get_lang('Reporting'), '', ICON_SIZE_MEDIUM).'
         </a>
         '.$login_as_icon.'
         '.$editUser.'
@@ -54,9 +71,9 @@ echo '<div class="actions">
 echo Display::page_header($tool_name);
 
 // Getting the user image
-$sysdir_array = UserManager::get_user_picture_path_by_id($user['user_id'],'system',false,true);
+$sysdir_array = UserManager::get_user_picture_path_by_id($user['user_id'], 'system', false, true);
 $sysdir = $sysdir_array['dir'];
-$webdir_array = UserManager::get_user_picture_path_by_id($user['user_id'],'web',false,true);
+$webdir_array = UserManager::get_user_picture_path_by_id($user['user_id'], 'web', false, true);
 $webdir = $webdir_array['dir'];
 $fullurl = $webdir.$webdir_array['file'];
 $system_image_path = $sysdir.$webdir_array['file'];
@@ -65,10 +82,21 @@ $resizing = (($height > 200) ? 'height="200"' : '');
 $height += 30;
 $width += 30;
 $window_name = 'window'.uniqid('');
-$onclick = $window_name."=window.open('".$fullurl."','".$window_name."','alwaysRaised=yes, alwaysLowered=no,alwaysOnTop=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=".$width.",height=".$height.",left=200,top=20'); return false;";
-echo '<a href="javascript: void(0);" onclick="'.$onclick.'" ><img src="'.$fullurl.'" '.$resizing.' alt="'.$alt.'"/></a><br />';
-echo '<p>'. ($user['status'] == 1 ? get_lang('Teacher') : get_lang('Student')).'</p>';
+$onclick = $window_name."=window.open('".$fullurl."','".$window_name
+    ."','alwaysRaised=yes, alwaysLowered=no,alwaysOnTop=yes,toolbar=no,"
+    ."location=no,directories=no,status=no,menubar=no,scrollbars=no,"
+    ."resizable=no,width=".$width.",height=".$height.",left=200,top=20');"
+    ." return false;";
+echo '<a href="javascript: void(0);" onclick="'.$onclick.'" >'
+    .'<img src="'.$fullurl.'" '.$resizing.' alt="'.$alt.'"/></a><br />';
+echo '<p>'.($user['status'] == 1 ? get_lang('Teacher') : get_lang('Student'))
+    .'</p>';
 echo '<p>'.Display :: encrypted_mailto_link($user['mail'], $user['mail']).'</p>';
+// Show info about who created this user and when
+$creatorId = $user['creator_id'];
+$creatorInfo = api_get_user_info($creatorId);
+$registrationDate = $user['registration_date'];
+echo '<p>'.sprintf(get_lang('CreatedByXYOnZ'), 'user_information.php?user_id='.$creatorId, $creatorInfo['username'], api_get_utc_datetime($registrationDate)).'</p>';
 
 /**
  * Show the sessions and the courses in which this user is subscribed
@@ -139,10 +167,21 @@ if (count($sessions) > 0) {
             $session_item['date_end'] = null;
         }
 
-        $dates = array_filter(array($session_item['date_start'], $session_item['date_end']));
-        echo Display::page_subheader($session_item['session_name'], ' '.implode(' - ', $dates));
+        $dates = array_filter(
+            array($session_item['date_start'], $session_item['date_end'])
+        );
+        echo Display::page_subheader(
+            $session_item['session_name'],
+            ' '.implode(' - ', $dates)
+        );
 
-        Display :: display_sortable_table($header, $data, array (), array(), array ('user_id' => intval($_GET['user_id'])));
+        Display :: display_sortable_table(
+            $header,
+            $data,
+            array (),
+            array(),
+            array ('user_id' => intval($_GET['user_id']))
+        );
     }
 } else {
     echo '<p>'.get_lang('NoSessionsForThisUser').'</p>';
@@ -171,15 +210,20 @@ if (Database::num_rows($res) > 0) {
         $tools = '<a href="course_information.php?code='.$course->code.'">'.Display::return_icon('synthese_view.gif', get_lang('Overview')).'</a>'.
                 '<a href="'.api_get_path(WEB_COURSE_PATH).$course->directory.'">'.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>' .
                 '<a href="course_edit.php?course_code='.$course->code.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
-        if ( $course->status == STUDENT ) {
+        if ($course->status == STUDENT) {
             $tools .= '<a href="user_information.php?action=unsubscribe&course_code='.$course->code.'&user_id='.$user['user_id'].'">'.Display::return_icon('delete.png', get_lang('Delete')).'</a>';
-
         }
         $row[] = $tools;
         $data[] = $row;
     }
     echo Display::page_subheader(get_lang('Courses'));
-    Display :: display_sortable_table($header, $data, array (), array (), array ('user_id' => intval($_GET['user_id'])));
+    Display :: display_sortable_table(
+        $header,
+        $data,
+        array (),
+        array (),
+        array ('user_id' => intval($_GET['user_id']))
+    );
 } else {
     echo '<p>'.get_lang('NoCoursesForThisUser').'</p>';
 }
@@ -198,7 +242,13 @@ if (api_is_multiple_url_enabled()) {
             $data[] = $row;
         }
         echo '<p><b>'.get_lang('URLList').'</b></p>';
-        Display :: display_sortable_table($header, $data, array (), array (), array ('user_id' => intval($_GET['user_id'])));
+        Display :: display_sortable_table(
+            $header,
+            $data,
+            array (),
+            array (),
+            array ('user_id' => intval($_GET['user_id']))
+        );
     } else {
         echo '<p>'.get_lang('NoUrlForThisUser').'</p>';
     }

+ 205 - 205
main/inc/lib/classmanager.lib.php

@@ -1,227 +1,227 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
-* This is the class library for this application.
-* @package	 chamilo.library
+* This is the static class library for this application.
+* @package     chamilo.library
 */
 /**
  * Code
  */
 class ClassManager
 {
-	/**
-	 * Get class information
-	 * note: This function can't be named get_class() because that's a standard
-	 * php-function.
-	 */
-	function get_class_info($class_id) {
+    /**
+     * Get class information
+     * note: This function can't be named get_class() because that's a standard
+     * php-function.
+     */
+    public static function get_class_info($class_id) {
         $class_id = intval($class_id);        
-		$table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
-		$sql = "SELECT * FROM $table_class WHERE id='".$class_id."'";
-		$res = Database::query($sql);
-		return Database::fetch_array($res, 'ASSOC');
-	}
-	/**
-	 * Change the name of a class
-	 * @param string $name The new name
-	 * @param int $class_id The class id
-	 */
-	function set_name($name, $class_id) {
+        $table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
+        $sql = "SELECT * FROM $table_class WHERE id='".$class_id."'";
+        $res = Database::query($sql);
+        return Database::fetch_array($res, 'ASSOC');
+    }
+    /**
+     * Change the name of a class
+     * @param string $name The new name
+     * @param int $class_id The class id
+     */
+    public static function set_name($name, $class_id) {
         $class_id = intval($class_id);        
-		$table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
-		$sql = "UPDATE $table_class SET name='".Database::escape_string($name)."' WHERE id='".$class_id."'";
-		$res = Database::query($sql);
-	}
-	/**
-	 * Create a class
-	 * @param string $name
-	 */
-	function create_class($name) {
-		$table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
-		$sql = "INSERT INTO $table_class SET name='".Database::escape_string($name)."'";
-		Database::query($sql);
-		return Database::affected_rows() == 1;
-	}
-	/**
-	 * Check if a classname is allready in use
-	 * @param string $name
-	 */
-	function class_name_exists($name) {
-		$table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
-		$sql = "SELECT * FROM $table_class WHERE name='".Database::escape_string($name)."'";
-		$res = Database::query($sql);
-		return Database::num_rows($res) != 0;
-	}
-	/**
-	 * Delete a class
-	 * @param int $class_id
-	 * @todo Add option to unsubscribe class-members from the courses where the
-	 * class was subscibed to
-	 */
-	function delete_class($class_id) {
+        $table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
+        $sql = "UPDATE $table_class SET name='".Database::escape_string($name)."' WHERE id='".$class_id."'";
+        $res = Database::query($sql);
+    }
+    /**
+     * Create a class
+     * @param string $name
+     */
+    public static function create_class($name) {
+        $table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
+        $sql = "INSERT INTO $table_class SET name='".Database::escape_string($name)."'";
+        Database::query($sql);
+        return Database::affected_rows() == 1;
+    }
+    /**
+     * Check if a classname is allready in use
+     * @param string $name
+     */
+    public static function class_name_exists($name) {
+        $table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
+        $sql = "SELECT * FROM $table_class WHERE name='".Database::escape_string($name)."'";
+        $res = Database::query($sql);
+        return Database::num_rows($res) != 0;
+    }
+    /**
+     * Delete a class
+     * @param int $class_id
+     * @todo Add option to unsubscribe class-members from the courses where the
+     * class was subscibed to
+     */
+    public static function delete_class($class_id) {
         $class_id = intval($class_id);        
-		$table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
-		$table_class_course = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
-		$table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
-		$sql = "DELETE FROM $table_class_user WHERE class_id = '".$class_id."'";
-		Database::query($sql);
-		$sql = "DELETE FROM $table_class_course WHERE class_id = '".$class_id."'";
-		Database::query($sql);
-		$sql = "DELETE FROM $table_class WHERE id = '".$class_id."'";
-		Database::query($sql);
-	}
-	/**
-	 * Get all users from a class
-	 * @param int $class_id
-	 * @return array
-	 */
-	function get_users($class_id) {        
+        $table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
+        $table_class_course = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
+        $table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
+        $sql = "DELETE FROM $table_class_user WHERE class_id = '".$class_id."'";
+        Database::query($sql);
+        $sql = "DELETE FROM $table_class_course WHERE class_id = '".$class_id."'";
+        Database::query($sql);
+        $sql = "DELETE FROM $table_class WHERE id = '".$class_id."'";
+        Database::query($sql);
+    }
+    /**
+     * Get all users from a class
+     * @param int $class_id
+     * @return array
+     */
+    public static function get_users($class_id) {
         $class_id = intval($class_id);        
-		$table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
-		$table_user = Database :: get_main_table(TABLE_MAIN_USER);
-		$sql = "SELECT * FROM $table_class_user cu, $table_user u WHERE cu.class_id = '".$class_id."' AND cu.user_id = u.user_id";
-		$res = Database::query($sql);
-		$users = array ();
-		while ($user = Database::fetch_array($res, 'ASSOC')) {
-			$users[] = $user;
-		}
-		return $users;
-	}
-	/**
-	 * Add a user to a class. If the class is subscribed to a course, the new
-	 * user will also be subscribed to that course.
-	 * @param int $user_id The user id
-	 * @param int $class_id The class id
-	 */
-	function add_user($user_id, $class_id) {
-		$table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
+        $table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
+        $table_user = Database :: get_main_table(TABLE_MAIN_USER);
+        $sql = "SELECT * FROM $table_class_user cu, $table_user u WHERE cu.class_id = '".$class_id."' AND cu.user_id = u.user_id";
+        $res = Database::query($sql);
+        $users = array ();
+        while ($user = Database::fetch_array($res, 'ASSOC')) {
+            $users[] = $user;
+        }
+        return $users;
+    }
+    /**
+     * Add a user to a class. If the class is subscribed to a course, the new
+     * user will also be subscribed to that course.
+     * @param int $user_id The user id
+     * @param int $class_id The class id
+     */
+    public static function add_user($user_id, $class_id) {
+        $table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
         $user_id  = intval($user_id);
         $class_id = intval($class_id);
-		$sql = "INSERT IGNORE INTO $table_class_user SET user_id = '".$user_id."', class_id='".$class_id."'";
-		Database::query($sql);
-		$courses = ClassManager :: get_courses($class_id);
-		foreach ($courses as $index => $course) {
-			CourseManager :: subscribe_user($user_id, $course['course_code']);
-		}
-	}
-	/**
-	 * Unsubscribe a user from a class. If the class is also subscribed in a
-	 * course, the user will be unsubscribed from that course
-	 * @param int $user_id The user id
-	 * @param int $class_id The class id
-	 */
-	function unsubscribe_user($user_id, $class_id) {
+        $sql = "INSERT IGNORE INTO $table_class_user SET user_id = '".$user_id."', class_id='".$class_id."'";
+        Database::query($sql);
+        $courses = ClassManager :: get_courses($class_id);
+        foreach ($courses as $index => $course) {
+            CourseManager :: subscribe_user($user_id, $course['course_code']);
+        }
+    }
+    /**
+     * Unsubscribe a user from a class. If the class is also subscribed in a
+     * course, the user will be unsubscribed from that course
+     * @param int $user_id The user id
+     * @param int $class_id The class id
+     */
+    public static function unsubscribe_user($user_id, $class_id) {
         $class_id = intval($class_id);        
         $user_id  = intval($user_id);
         
-		$table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
-		$table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
-		$courses = ClassManager :: get_courses($class_id);
-		if (count($courses) != 0) {
-			$course_codes = array ();
-			foreach ($courses as $index => $course) {
-				$course_codes[] = $course['course_code'];
-				$sql = "SELECT DISTINCT user_id FROM $table_class_user t1, $table_course_class t2 WHERE t1.class_id=t2.class_id AND course_code = '".$course['course_code']."' AND user_id = $user_id AND t2.class_id<>'$class_id'";
-				$res = Database::query($sql);
-				if (Database::num_rows($res) == 0 && CourseManager :: get_user_in_course_status($user_id, $course['course_code']) == STUDENT)
-				{
-					CourseManager :: unsubscribe_user($user_id, $course['course_code']);
-				}
-			}
-		}
-		$sql = "DELETE FROM $table_class_user WHERE user_id='".$user_id."' AND class_id = '".$class_id."'";
-		Database::query($sql);
-	}
-	/**
-	 * Get all courses in which a class is subscribed
-	 * @param int $class_id
-	 * @return array
-	 */
-	function get_courses($class_id) {
+        $table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
+        $table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
+        $courses = ClassManager :: get_courses($class_id);
+        if (count($courses) != 0) {
+            $course_codes = array ();
+            foreach ($courses as $index => $course) {
+                $course_codes[] = $course['course_code'];
+                $sql = "SELECT DISTINCT user_id FROM $table_class_user t1, $table_course_class t2 WHERE t1.class_id=t2.class_id AND course_code = '".$course['course_code']."' AND user_id = $user_id AND t2.class_id<>'$class_id'";
+                $res = Database::query($sql);
+                if (Database::num_rows($res) == 0 && CourseManager :: get_user_in_course_status($user_id, $course['course_code']) == STUDENT)
+                {
+                    CourseManager :: unsubscribe_user($user_id, $course['course_code']);
+                }
+            }
+        }
+        $sql = "DELETE FROM $table_class_user WHERE user_id='".$user_id."' AND class_id = '".$class_id."'";
+        Database::query($sql);
+    }
+    /**
+     * Get all courses in which a class is subscribed
+     * @param int $class_id
+     * @return array
+     */
+    public static function get_courses($class_id) {
         $class_id = intval($class_id);       
-		$table_class_course = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
-		$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
-		$sql = "SELECT * FROM $table_class_course cc, $table_course c WHERE cc.class_id = '".$class_id."' AND cc.course_code = c.code";
-		$res = Database::query($sql);
-		$courses = array ();
-		while ($course = Database::fetch_array($res, 'ASSOC')) {
-			$courses[] = $course;
-		}
-		return $courses;
-	}
-	/**
-	 * Subscribe all members of a class to a course
-	 * @param  int $class_id The class id
-	 * @param string $course_code The course code
-	 */
-	function subscribe_to_course($class_id, $course_code) {
-		$tbl_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
-		$tbl_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
-		$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
-		$sql = "INSERT IGNORE INTO $tbl_course_class SET course_code = '".Database::escape_string($course_code)."', class_id = '".Database::escape_string($class_id)."'";
-		Database::query($sql);
-		$sql = "SELECT user_id FROM $tbl_class_user WHERE class_id = '".Database::escape_string($class_id)."'";
-		$res = Database::query($sql);
-		while ($user = Database::fetch_object($res)) {
-			CourseManager :: subscribe_user($user->user_id, $course_code);
-		}
-	}
-	/**
-	 * Unsubscribe a class from a course.
-	 * Only students are unsubscribed. If a user is member of 2 classes which
-	 * are both subscribed to the course, the user stays in the course.
-	 * @param int $class_id The class id
-	 * @param string $course_code The course code
-	 */
-	function unsubscribe_from_course($class_id, $course_code)
-	{
-		$tbl_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
-		$tbl_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
-		$sql = "SELECT cu.user_id,COUNT(cc.class_id) FROM $tbl_course_class cc, $tbl_class_user cu WHERE  cc.class_id = cu.class_id AND cc.course_code = '".Database::escape_string($course_code)."' GROUP BY cu.user_id HAVING COUNT(cc.class_id) = 1";
-		$single_class_users = Database::query($sql);
-		while ($single_class_user = Database::fetch_object($single_class_users))
-		{
-			$sql = "SELECT * FROM $tbl_class_user WHERE class_id = '".Database::escape_string($class_id)."' AND user_id = '".Database::escape_string($single_class_user->user_id)."'";
-			$res = Database::query($sql);
-			if (Database::num_rows($res) > 0)
-			{
-				if (CourseManager :: get_user_in_course_status($single_class_user->user_id, $course_code) == STUDENT)
-				{
-					CourseManager :: unsubscribe_user($single_class_user->user_id, $course_code);
-				}
-			}
-		}
-		$sql = "DELETE FROM $tbl_course_class WHERE course_code = '".Database::escape_string($course_code)."' AND class_id = '".Database::escape_string($class_id)."'";
-		Database::query($sql);
-	}
+        $table_class_course = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
+        $table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
+        $sql = "SELECT * FROM $table_class_course cc, $table_course c WHERE cc.class_id = '".$class_id."' AND cc.course_code = c.code";
+        $res = Database::query($sql);
+        $courses = array ();
+        while ($course = Database::fetch_array($res, 'ASSOC')) {
+            $courses[] = $course;
+        }
+        return $courses;
+    }
+    /**
+     * Subscribe all members of a class to a course
+     * @param  int $class_id The class id
+     * @param string $course_code The course code
+     */
+    public static function subscribe_to_course($class_id, $course_code) {
+        $tbl_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
+        $tbl_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
+        $tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
+        $sql = "INSERT IGNORE INTO $tbl_course_class SET course_code = '".Database::escape_string($course_code)."', class_id = '".Database::escape_string($class_id)."'";
+        Database::query($sql);
+        $sql = "SELECT user_id FROM $tbl_class_user WHERE class_id = '".Database::escape_string($class_id)."'";
+        $res = Database::query($sql);
+        while ($user = Database::fetch_object($res)) {
+            CourseManager :: subscribe_user($user->user_id, $course_code);
+        }
+    }
+    /**
+     * Unsubscribe a class from a course.
+     * Only students are unsubscribed. If a user is member of 2 classes which
+     * are both subscribed to the course, the user stays in the course.
+     * @param int $class_id The class id
+     * @param string $course_code The course code
+     */
+    public static function unsubscribe_from_course($class_id, $course_code)
+    {
+        $tbl_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
+        $tbl_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
+        $sql = "SELECT cu.user_id,COUNT(cc.class_id) FROM $tbl_course_class cc, $tbl_class_user cu WHERE  cc.class_id = cu.class_id AND cc.course_code = '".Database::escape_string($course_code)."' GROUP BY cu.user_id HAVING COUNT(cc.class_id) = 1";
+        $single_class_users = Database::query($sql);
+        while ($single_class_user = Database::fetch_object($single_class_users))
+        {
+            $sql = "SELECT * FROM $tbl_class_user WHERE class_id = '".Database::escape_string($class_id)."' AND user_id = '".Database::escape_string($single_class_user->user_id)."'";
+            $res = Database::query($sql);
+            if (Database::num_rows($res) > 0)
+            {
+                if (CourseManager :: get_user_in_course_status($single_class_user->user_id, $course_code) == STUDENT)
+                {
+                    CourseManager :: unsubscribe_user($single_class_user->user_id, $course_code);
+                }
+            }
+        }
+        $sql = "DELETE FROM $tbl_course_class WHERE course_code = '".Database::escape_string($course_code)."' AND class_id = '".Database::escape_string($class_id)."'";
+        Database::query($sql);
+    }
 
-	/**
-	 * Get the class-id
-	 * @param string $name The class name
-	 * @return int the ID of the class
-	 */
-	function get_class_id($name) {
+    /**
+     * Get the class-id
+     * @param string $name The class name
+     * @return int the ID of the class
+     */
+    public static function get_class_id($name) {
         $name = Database::escape_string($name);
-		$table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
-		$sql = "SELECT * FROM $table_class WHERE name='".$name."'";
-		$res = Database::query($sql);
-		$obj = Database::fetch_object($res);
-		return $obj->id;
-	}
-	/**
-	 * Get all classes subscribed in a course
-	 * @param string $course_code
-	 * @return array An array with all classes (keys: 'id','code','name')
-	 */
-	function get_classes_in_course($course_code) {
-		$table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
-		$table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
-		$sql = "SELECT cl.* FROM $table_class cl, $table_course_class cc WHERE cc.course_code = '".Database::escape_string($course_code)."' AND cc.class_id = cl.id";
-		$res = Database::query($sql);
-		$classes = array ();
-		while ($class = Database::fetch_array($res, 'ASSOC')) {
-			$classes[] = $class;
-		}
-		return $classes;
-	}
+        $table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
+        $sql = "SELECT * FROM $table_class WHERE name='".$name."'";
+        $res = Database::query($sql);
+        $obj = Database::fetch_object($res);
+        return $obj->id;
+    }
+    /**
+     * Get all classes subscribed in a course
+     * @param string $course_code
+     * @return array An array with all classes (keys: 'id','code','name')
+     */
+    public static function get_classes_in_course($course_code) {
+        $table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
+        $table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
+        $sql = "SELECT cl.* FROM $table_class cl, $table_course_class cc WHERE cc.course_code = '".Database::escape_string($course_code)."' AND cc.class_id = cl.id";
+        $res = Database::query($sql);
+        $classes = array ();
+        while ($class = Database::fetch_array($res, 'ASSOC')) {
+            $classes[] = $class;
+        }
+        return $classes;
+    }
 }

+ 177 - 102
main/inc/lib/database.mysqli.lib.php

@@ -4,7 +4,7 @@
  *	This is a special version of the main database library for Chamilo focused
  *  on using the MySQLi driver instead of the MySQL driver.
  * To use it, make a backup copy of your database.lib.php file and replace
- * database.lib.php by this file.
+ * database.lib.php by this file, then rename MySQLIDatabase into Database.
  *	Include/require it in your code to use its functionality.
  *   Because this library contains all the basic database calls, it could be
  *   replaced by another library for say, PostgreSQL, to actually use Chamilo
@@ -24,7 +24,7 @@ require_once 'database.constants.inc.php';
  *      The class and its methods
  *	@package chamilo.library
  */
-class Database {
+class MySQLIDatabase {
     
     /* Variable use only in the installation process to log errors. See the Database::query function */
     static $log_queries = false;
@@ -38,7 +38,8 @@ class Database {
     /**
      *	Returns the name of the main database.
      */
-    public static function get_main_database() {
+    public static function get_main_database()
+    {
         global $_configuration;
         return $_configuration['main_database'];
     }
@@ -46,7 +47,8 @@ class Database {
     /**
      *	Returns the name of the statistics database.
      */
-    public static function get_statistic_database() {
+    public static function get_statistic_database()
+    {
         global $_configuration;
         return $_configuration['statistics_database'];
     }
@@ -55,7 +57,8 @@ class Database {
      *	Returns the name of the SCORM database.
      *	@deprecated
      */
-    public static function get_scorm_database() {
+    public static function get_scorm_database()
+    {
         global $_configuration;
         return $_configuration['scorm_database'];
     }
@@ -63,7 +66,8 @@ class Database {
     /**
      *	Returns the name of the database where all the personal stuff of the user is stored
      */
-    public static function get_user_personal_database() {
+    public static function get_user_personal_database()
+    {
         global $_configuration;
         return $_configuration['user_personal_database'];
     }
@@ -72,7 +76,8 @@ class Database {
      *	Returns the name of the current course database.
      *  @return    mixed   Glued database name of false if undefined
      */
-    public static function get_current_course_database() {
+    public static function get_current_course_database()
+    {
         $course_info = api_get_course_info();
         if (empty($course_info['dbName'])) {
             return false;
@@ -84,7 +89,8 @@ class Database {
      *	Returns the glued name of the current course database.
      *  @return    mixed   Glued database name of false if undefined
      */
-    public static function get_current_course_glued_database() {
+    public static function get_current_course_glued_database()
+    {
         $course_info = api_get_course_info();
         if (empty($course_info['dbNameGlu'])) {
             return false;
@@ -99,7 +105,8 @@ class Database {
      *	there are multiple databases and the code can be written independent
      *	of the single / multiple database setting.
      */
-    public static function get_database_glue() {
+    public static function get_database_glue()
+    {
         global $_configuration;
         return $_configuration['db_glue'];
     }
@@ -111,7 +118,8 @@ class Database {
      *	TIP: This can be convenient e.g. if you have multiple system installations
      *	on the same physical server.
      */
-    public static function get_database_name_prefix() {
+    public static function get_database_name_prefix()
+    {
         global $_configuration;
         return $_configuration['db_prefix'];
     }
@@ -122,7 +130,8 @@ class Database {
      *	Do research.
      *	It's used in local.inc.php.
      */
-    public static function get_course_table_prefix() {
+    public static function get_course_table_prefix()
+    {
         global $_configuration;
         return $_configuration['table_prefix'];
     }
@@ -151,8 +160,10 @@ class Database {
      * instead of directly using magic words in your tool code.
      *
      * @param string $short_table_name, the name of the table
+     * @return string The full name of the requested table from the main DB
      */
-    public static function get_main_table($short_table_name) {
+    public static function get_main_table($short_table_name)
+    {
         return self::format_table_name(self::get_main_database(), $short_table_name);
     }
 
@@ -167,7 +178,8 @@ class Database {
      * @param string $database_name, optional, name of the course database
      * - if you don't specify this, you work on the current course.
      */
-    public static function get_course_table($short_table_name, $database_name = '') {
+    public static function get_course_table($short_table_name, $database_name = '')
+    {
         return self::format_glued_course_table_name(self::fix_database_parameter($database_name), $short_table_name);
     }
 
@@ -178,8 +190,10 @@ class Database {
      * instead of directly using magic words in your tool code.
      *
      * @param string $short_table_name, the name of the table
+     * @return string The full name of the requested stats table
      */
-    public static function get_statistic_table($short_table_name) {
+    public static function get_statistic_table($short_table_name)
+    {
         return self::format_table_name(self::get_statistic_database(), $short_table_name);
     }
 
@@ -191,11 +205,13 @@ class Database {
      *
      * @param string $short_table_name, the name of the table
      */
-    public static function get_user_personal_table($short_table_name) {
+    public static function get_user_personal_table($short_table_name)
+    {
         return self::format_table_name(self::get_user_personal_database(), $short_table_name);
     }
 
-    public static function get_course_chat_connected_table($database_name = '') {
+    public static function get_course_chat_connected_table($database_name = '')
+    {
         return self::format_glued_course_table_name(self::fix_database_parameter($database_name), TABLE_CHAT_CONNECTED);
     }
 
@@ -205,25 +221,30 @@ class Database {
     */
 
     /**
-     *	@return a list (array) of all courses.
-     * 	@todo shouldn't this be in the course.lib.php script?
+     * Returns a full list of the contents of the course table as a PHP table
+     * @return a list (array) of all courses.
+     * @todo shouldn't this be in the course.lib.php script?
      */
-    public static function get_course_list() {
+    public static function get_course_list()
+    {
         $table = self::get_main_table(TABLE_MAIN_COURSE);
         return self::store_result(self::query("SELECT * FROM $table"));
     }
 
     /**
-     *	Returns an array with all database fields for the specified course.
+     * Returns an array with all database fields for the specified course.
      *
-     *	@param the real (system) code of the course (ID from inside the main course table)
-     * 	@todo shouldn't this be in the course.lib.php script?
+     * @param string $course_code The real (system) code of the course (ID from inside the main course table)
+     * @return array Course info from the course table
+     * @todo shouldn't this be in the course.lib.php script?
      */
-    public static function get_course_info($course_code) {
+    public static function get_course_info($course_code)
+    {
         $course_code = self::escape_string($course_code);
         $table = self::get_main_table(TABLE_MAIN_COURSE);
         $result = self::generate_abstract_course_field_names(
-            self::fetch_array(self::query("SELECT * FROM $table WHERE `code` = '$course_code'")));
+            self::fetch_array(self::query("SELECT * FROM $table WHERE code = '$course_code'"))
+        );
         return $result === false ? array('db_name' => '') : $result;
     }
 
@@ -236,7 +257,8 @@ class Database {
      *	@desc find all the information about a specified user. Without parameter this is the current user.
      * 	@todo shouldn't this be in the user.lib.php script?
      */
-    public static function get_user_info_from_id($user_id = '') {
+    public static function get_user_info_from_id($user_id = '')
+    {
         if (empty($user_id)) {
             return $GLOBALS['_user'];
         }
@@ -252,7 +274,8 @@ class Database {
      * @return string  Course code
      * @todo move this function in a gradebook-related library
      */
-    public static function get_course_by_category($category_id) {
+    public static function get_course_by_category($category_id)
+    {
         $category_id = intval($category_id);
         $info = self::fetch_array(self::query('SELECT course_code FROM '.self::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY).' WHERE id='.$category_id), 'ASSOC');
         return $info ? $info['course_code'] : false;
@@ -272,7 +295,8 @@ class Database {
      * 		  There should be consistency in the variable names and the use throughout the scripts
      * 		  for the database name we should consistently use or db_name or database (db_name probably being the better one)
      */
-    public static function generate_abstract_course_field_names($result_array) {
+    public static function generate_abstract_course_field_names($result_array)
+    {
         $visual_code = isset($result_array['visual_code']) ? $result_array['visual_code'] : null;
         $code        = isset($result_array['code']) ? $result_array['code'] : null;
         $title       = isset($result_array['title']) ? $result_array['title'] : null;
@@ -323,7 +347,8 @@ class Database {
      * 	@todo what's the use of this function. I think this is better removed.
      * 		There should be consistency in the variable names and the use throughout the scripts
      */
-    public static function generate_abstract_user_field_names($result_array) {
+    public static function generate_abstract_user_field_names($result_array)
+    {
         $result_array['firstName'] 		= $result_array['firstname'];
         $result_array['lastName'] 		= $result_array['lastname'];
         $result_array['mail'] 			= $result_array['email'];
@@ -337,7 +362,8 @@ class Database {
      * @param string $table The table of which the rows should be counted
      * @return int The number of rows in the given table.
      */
-    public static function count_rows($table) {
+    public static function count_rows($table)
+    {
         $obj = self::fetch_object(self::query("SELECT COUNT(*) AS n FROM $table"));
         return $obj->n;
     }
@@ -348,10 +374,11 @@ class Database {
 
     /**
      * Returns the number of affected rows in the last database operation.
-     * @param resource $connection (optional)	The database server connection, for detailed description see the method query().
-     * @return int								Returns the number of affected rows on success, and -1 if the last query failed.
+     * @param resource $connection The database server connection, for detailed description see the method query().
+     * @return int Returns the number of affected rows on success, and -1 if the last query failed.
      */
-    public static function affected_rows($connection = null) {
+    public static function affected_rows($connection = null)
+    {
         global $database_connection;
         return $database_connection->affected_rows;
     }
@@ -361,7 +388,8 @@ class Database {
      * @param resource $connection (optional)	The database server connection, for detailed description see the method query().
      * @return bool								Returns TRUE on success or FALSE on failure.
      */
-    public static function close($connection = null) {
+    public static function close($connection = null)
+    {
         return self::use_default_connection($connection) ? mysqli::close() : mysqli::close($connection);
     }
 
@@ -376,7 +404,8 @@ class Database {
      * @link http://php.net/manual/en/function.mysql-connect.php
      * @link http://php.net/manual/en/function.mysql-pconnect.php
      */
-    public static function connect($parameters = array()) {
+    public static function connect($parameters = array())
+    {
         global $database_connection;
         // A MySQL-specific implementation.
         if (!isset($parameters['server'])) {
@@ -407,7 +436,8 @@ class Database {
      * @param resource $connection (optional)	The database server connection, for detailed description see the method query().
      * @return int								Returns the error number from the last database (operation, or 0 (zero) if no error occurred.
      */
-    public static function errno($connection = null) {
+    public static function errno($connection = null)
+    {
         return self::use_default_connection($connection) ? mysqli::mysqli_errno() : mysqli::mysqli_errno($connection);
     }
 
@@ -416,7 +446,8 @@ class Database {
      * @param resource $connection (optional)	The database server connection, for detailed description see the method query().
      * @return string							Returns the error text from the last database operation, or '' (empty string) if no error occurred.
      */
-    public static function error($connection = null) {
+    public static function error($connection = null)
+    {
         return self::use_default_connection($connection) ? mysqli::mysqli_error() : mysqli::mysqli_error($connection);
     }
 
@@ -428,7 +459,8 @@ class Database {
      * @author Yannick Warnier <yannick.warnier@dokeos.com>
      * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
      */
-    public static function escape_string($string, $connection = null) {
+    public static function escape_string($string, $connection = null)
+    {
         global $database_connection;
         return get_magic_quotes_gpc()
             ? ( $database_connection->escape_string(stripslashes($string)))
@@ -442,7 +474,8 @@ class Database {
      * @return array		Array of results as returned by php
      * @author Yannick Warnier <yannick.warnier@beeznest.com>
      */
-    public static function fetch_array($result, $option = 'BOTH') {
+    public static function fetch_array($result, $option = 'BOTH')
+    {
         return ($option == 'ASSOC') ? $result->fetch_array(MYSQLI_ASSOC) : ($option == 'NUM' ? $result->fetch_array(MYSQLI_NUM) : $result->fetch_array());
     }
 
@@ -452,19 +485,21 @@ class Database {
      * @param resource $result	The result from a call to sql_query (e.g. Database::query).
      * @return array			Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead.
      */
-    public static function fetch_assoc($result) {
+    public static function fetch_assoc($result)
+    {
         return $result->fetch_assoc();
     }
 
     /**
      * Gets the next row of the result of the SQL query (as returned by Database::query) in an object form
-     * @param	resource	The result from a call to sql_query (e.g. Database::query)
-     * @param	string		Optional class name to instanciate
-     * @param	array		Optional array of parameters
-     * @return	object		Object of class StdClass or the required class, containing the query result row
-     * @author	Yannick Warnier <yannick.warnier@dokeos.com>
+     * @param mysqli $result The result from a call to sql_query (e.g. Database::query)
+     * @param string $class Optional class name to instantiate
+     * @param array $params Optional array of parameters
+     * @return resource Object of class StdClass or the required class, containing the query result row
+     * @author Yannick Warnier <yannick.warnier@dokeos.com>
      */
-    public static function fetch_object($result, $class = null, $params = null) {
+    public static function fetch_object($result, $class = null, $params = null)
+    {
         return !empty($class) ? (is_array($params) ? $result->fetch_object($class, $params) : $result->fetch_object($class)) : $result->fetch_object();
     }
 
@@ -473,7 +508,8 @@ class Database {
      * @param resource		The result from a call to sql_query (see Database::query()).
      * @return array		Array of results as returned by php (mysql_fetch_row)
      */
-    public static function fetch_row($result) {
+    public static function fetch_row($result)
+    {
         return $result->fetch_row();
     }
 
@@ -483,28 +519,33 @@ class Database {
      * Notes: Use this method if you are concerned about how much memory is being used for queries that return large result sets.
      * Anyway, all associated result memory is automatically freed at the end of the script's execution.
      */
-    public static function free_result($result) {
+    public static function free_result($result)
+    {
         return $result->free_result();
     }
 
     /**
      * Returns the database client library version.
-     * @return strung		Returns a string that represents the client library version.
+     * @return string String that represents the client library version.
      */
-    public function get_client_info() {
+    public function get_client_info()
+    {
         return mysqli_get_client_info();
     }
 
     /**
      * Returns a list of databases created on the server. The list may contain all of the
      * available database names or filtered database names by using a pattern.
-     * @param string $pattern (optional)		A pattern for filtering database names as if it was needed for the SQL's LIKE clause, for example 'chamilo_%'.
-     * @param resource $connection (optional)	The database server connection, for detailed description see the method query().
-     * @return array							Returns in an array the retrieved list of database names.
+     * @param string $pattern A pattern for filtering database names as if it was needed for the SQL's LIKE clause, for example 'chamilo_%'.
+     * @param resource $connection The database server connection, for detailed description see the method query().
+     * @return array Returns in an array the retrieved list of database names.
      */
-    public static function get_databases($pattern = '', $connection = null) {
+    public static function get_databases($pattern = '', $connection = null)
+    {
         $result = array();
-        $query_result = Database::query(!empty($pattern) ? "SHOW DATABASES LIKE '".self::escape_string($pattern, $connection)."'" : "SHOW DATABASES", $connection);
+        $query_result = Database::query(!empty($pattern) ?
+                "SHOW DATABASES LIKE '".self::escape_string($pattern, $connection)."'" :
+                "SHOW DATABASES", $connection);
         while ($row = Database::fetch_row($query_result)) {
             $result[] = $row[0];
         }
@@ -515,14 +556,15 @@ class Database {
      * Returns a list of the fields that a given table contains. The list may contain all of the available field names or filtered field names by using a pattern.
      * By using a special option, this method is able to return an indexed list of fields' properties, where field names are keys.
      * @param string $table						This is the examined table.
-     * @param string $pattern (optional)		A pattern for filtering field names as if it was needed for the SQL's LIKE clause, for example 'column_%'.
-     * @param string $database (optional)		The name of the targeted database. If it is omited, the current database is assumed, see Database::select_db().
-     * @param bool $including_properties (optional)	When this option is true, the returned result has the followong format:
-     * 												array(field_name_1 => array(0 => property_1, 1 => property_2, ...), fieald_name_2 => array(0 => property_1, ...), ...)
+     * @param string $pattern (optional)		A pattern for filtering field names as if it was needed for the SQL LIKE clause, for example 'column_%'.
+     * @param string $database (optional)		The name of the targeted database. If it is omitted, the current database is assumed, see Database::select_db().
+     * @param bool $including_properties (optional)	When this option is true, the returned result has the following format:
+     * 												array(field_name_1 => array(0 => property_1, 1 => property_2, ...), field_name_2 => array(0 => property_1, ...), ...)
      * @param resource $connection (optional)	The database server connection, for detailed description see the method query().
      * @return array							Returns in an array the retrieved list of field names.
      */
-    public static function get_fields($table, $pattern = '', $database = '', $including_properties = false, $connection = null) {
+    public static function get_fields($table, $pattern = '', $database = '', $including_properties = false, $connection = null)
+    {
         $result = array();
         $query = "SHOW COLUMNS FROM `".self::escape_string($table, $connection)."`";
         if (!empty($database)) {
@@ -551,7 +593,8 @@ class Database {
      * @param resource $connection (optional)	The database server connection, for detailed description see the method query().
      * @return string/boolean					Returns string data on success or FALSE on failure.
      */
-    public function get_host_info($connection = null) {
+    public function get_host_info($connection = null)
+    {
         return self::use_default_connection($connection) ? mysqli::mysqli_get_host_info() : mysqli::mysqli_get_host_info($connection);
     }
 
@@ -560,7 +603,8 @@ class Database {
      * @param resource $connection (optional)	The database server connection, for detailed description see the method query().
      * @return int/boolean						Returns the protocol version on success or FALSE on failure.
      */
-    public function get_proto_info($connection = null) {
+    public function get_proto_info($connection = null)
+    {
         return self::use_default_connection($connection) ? mysqli::mysqli_get_proto_info() : mysqli::mysqli_get_proto_info($connection);
     }
 
@@ -569,19 +613,21 @@ class Database {
      * @param resource $connection (optional)	The database server connection, for detailed description see the method query().
      * @return string/boolean					Returns the MySQL server version on success or FALSE on failure.
      */
-    public function get_server_info($connection = null) {
+    public function get_server_info($connection = null)
+    {
         return self::use_default_connection($connection) ? mysqli::mysqli_get_server_info() : mysqli::mysqli_get_server_info($connection);
     }
 
     /**
      * Returns a list of tables within a database. The list may contain all of the
      * available table names or filtered table names by using a pattern.
-     * @param string $database (optional)		The name of the examined database. If it is omited, the current database is assumed, see Database::select_db().
-     * @param string $pattern (optional)		A pattern for filtering table names as if it was needed for the SQL's LIKE clause, for example 'access_%'.
+     * @param string $database (optional)		The name of the examined database. If it is omitted, the current database is assumed, see Database::select_db().
+     * @param string $pattern (optional)		A pattern for filtering table names as if it was needed for the SQL LIKE clause, for example 'access_%'.
      * @param resource $connection (optional)	The database server connection, for detailed description see the method query().
      * @return array							Returns in an array the retrieved list of table names.
      */
-    public static function get_tables($database = '', $pattern = '', $connection = null) {
+    public static function get_tables($database = '', $pattern = '', $connection = null)
+    {
         $result = array();
         $query = "SHOW TABLES";
         if (!empty($database)) {
@@ -603,7 +649,8 @@ class Database {
      * @return int								The last ID as returned by the DB function
      * @comment This should be updated to use ADODB at some point
      */
-    public static function insert_id($connection = null) {
+    public static function insert_id($connection = null)
+    {
         global $database_connection;
         return $database_connection->insert_id;
     }
@@ -612,9 +659,10 @@ class Database {
      * Gets the number of rows from the last query result - help achieving database independence
      * @param resource		The result
      * @return integer		The number of rows contained in this result
-     * @author Yannick Warnier <yannick.warnier@dokeos.com>
+     * @author Yannick Warnier <yannick.warnier@beeznest.com>
      **/
-    public static function num_rows($result) {
+    public static function num_rows($result)
+    {
         return is_a($result,'mysqli_result') ? $result->num_rows : false;
     }
 
@@ -626,7 +674,8 @@ class Database {
      * @param	string		Optional field name or number
      * @result	mixed		One cell of the result, or FALSE on error
      */
-    public static function result(&$resource, $row, $field = '') {
+    public static function result(&$resource, $row, $field = '')
+    {
         if (self::num_rows($resource) > 0) {
             if (!empty($field)) {
                 $r = mysqli_data_seek($resource, $row);
@@ -647,8 +696,8 @@ class Database {
      * 											If it is not specified, the connection opened by mysql_connect() is assumed.
      * 											If no connection is found, the server will try to create one as if mysql_connect() was called with no arguments.
      * 											If no connection is found or established, an E_WARNING level error is generated.
-     * @param string $file (optional)			On error it shows the file in which the error has been trigerred (use the "magic" constant __FILE__ as input parameter)
-     * @param string $line (optional)			On error it shows the line in which the error has been trigerred (use the "magic" constant __LINE__ as input parameter)
+     * @param string $file (optional)			On error it shows the file in which the error has been triggered (use the "magic" constant __FILE__ as input parameter)
+     * @param string $line (optional)			On error it shows the line in which the error has been triggered (use the "magic" constant __LINE__ as input parameter)
      * @return resource							The returned result from the query
      * Note: The parameter $connection could be skipped. Here are examples of this method usage:
      * Database::query($query);
@@ -661,7 +710,8 @@ class Database {
      * Database::query($query, $connection, __FILE__, __LINE__);
      * $result = Database::query($query, $connection, __FILE__, __LINE__);
      */
-    public static function query($query, $connection = null, $file = null, $line = null) {
+    public static function query($query, $connection = null, $file = null, $line = null)
+    {
         global $database_connection;
         
         $result = @$database_connection->query($query);
@@ -749,7 +799,8 @@ class Database {
      * @param resource $connection (optional)	The database server connection, for detailed description see the method query().
      * @return bool								Returns TRUE on success or FALSE on failure.
      */
-    public static function select_db($database_name, $connection = null) {
+    public static function select_db($database_name, $connection = null)
+    {
         global $database_connection;
         $database_connection->select_db($database_name);
         return !$database_connection->errno;
@@ -764,7 +815,8 @@ class Database {
      * @param  option BOTH, ASSOC, or NUM
      * @return array - the value returned by the query
      */
-    public static function store_result($result, $option = 'BOTH') {
+    public static function store_result($result, $option = 'BOTH')
+    {
         $array = array();
         if ($result !== false) { // For isolation from database engine's behaviour.
             while ($row = self::fetch_array($result, $option)) {
@@ -784,7 +836,8 @@ class Database {
      * @return bool				Returns a boolean value as a check-result.
      * @author Ivan Tcholakov
      */
-    public static function is_encoding_supported($encoding) {
+    public static function is_encoding_supported($encoding)
+    {
         static $supported = array();
         if (!isset($supported[$encoding])) {
             $supported[$encoding] = false;
@@ -806,7 +859,8 @@ class Database {
      * @return string						Returns the constructed SQL clause or empty string if $encoding is not correct or is not supported.
      * @author Ivan Tcholakov
      */
-    public static function make_charset_clause($encoding = null, $language = null) {
+    public static function make_charset_clause($encoding = null, $language = null)
+    {
         if (empty($encoding)) {
             $encoding = api_get_system_encoding();
         }
@@ -826,13 +880,14 @@ class Database {
     }
 
     /**
-     * Converts an encoding identificator to MySQL-specific encoding identifictor,
+     * Converts an encoding identificator to MySQL-specific encoding identifier,
      * i.e. 'UTF-8' --> 'utf8'.
-     * @param string $encoding	The conventional encoding identificator.
-     * @return string			Returns the corresponding MySQL-specific encoding identificator if any, otherwise returns NULL.
+     * @param string $encoding	The conventional encoding identifier.
+     * @return string			Returns the corresponding MySQL-specific encoding identifier if any, otherwise returns NULL.
      * @author Ivan Tcholakov
      */
-    public static function to_db_encoding($encoding) {
+    public static function to_db_encoding($encoding)
+    {
         static $result = array();
         if (!isset($result[$encoding])) {
             $result[$encoding] = null;
@@ -848,13 +903,14 @@ class Database {
     }
 
     /**
-     * Converts a MySQL-specific encoding identifictor to conventional encoding identificator,
+     * Converts a MySQL-specific encoding identifier to conventional encoding identifier,
      * i.e. 'utf8' --> 'UTF-8'.
-     * @param string $encoding	The MySQL-specific encoding identificator.
-     * @return string			Returns the corresponding conventional encoding identificator if any, otherwise returns NULL.
+     * @param string $encoding	The MySQL-specific encoding identifier.
+     * @return string			Returns the corresponding conventional encoding identifier if any, otherwise returns NULL.
      * @author Ivan Tcholakov
      */
-    public static function from_db_encoding($db_encoding) {
+    public static function from_db_encoding($db_encoding)
+    {
         static $result = array();
         if (!isset($result[$db_encoding])) {
             $result[$db_encoding] = null;
@@ -876,7 +932,8 @@ class Database {
      * @return string						Returns a suitable default collation, for example 'utf8_general_ci', or NULL if collation was not found.
      * @author Ivan Tcholakov
      */
-    public static function to_db_collation($encoding, $language = null) {
+    public static function to_db_collation($encoding, $language = null)
+    {
         static $result = array();
         if (!isset($result[$encoding][$language])) {
             $result[$encoding][$language] = null;
@@ -913,7 +970,8 @@ class Database {
      *	Glues a course database.
      *	glue format from local.inc.php.
      */
-    private static function glue_course_database_name($database_name) {
+    private static function glue_course_database_name($database_name)
+    {
         return self::get_course_table_prefix().$database_name.self::get_database_glue();
     }
 
@@ -923,7 +981,8 @@ class Database {
      *	@return the glued parameter if it is not empty,
      *	or the current course database (glued) if the parameter is empty.
      */
-    private static function fix_database_parameter($database_name) {
+    private static function fix_database_parameter($database_name)
+    {
         if (empty($database_name)) {
             $course_info = api_get_course_info();
             return $course_info['dbNameGlu'];
@@ -936,7 +995,8 @@ class Database {
      *	for querying. The course database parameter is considered glued:
      *	e.g. COURSE001`.`
      */
-    private static function format_glued_course_table_name($database_name_with_glue, $table) {
+    private static function format_glued_course_table_name($database_name_with_glue, $table)
+    {
         return '`'.$database_name_with_glue.$table.'`';
     }
 
@@ -945,7 +1005,8 @@ class Database {
      *	for querying. The database parameter is considered not glued,
      *	just plain e.g. COURSE001
      */
-    private static function format_table_name($database, $table) {
+    private static function format_table_name($database, $table)
+    {
         return '`'.$database.'`.`'.$table.'`';
     }
 
@@ -958,7 +1019,8 @@ class Database {
      * @return boolean						TRUE means that calling method should use the default connection.
      * 										FALSE means that (valid) parameter $connection has been provided and it should be used.
      */
-    private static function use_default_connection($connection) {
+    private static function use_default_connection($connection)
+    {
         return !is_resource($connection) && $connection !== false;
     }
 
@@ -968,7 +1030,8 @@ class Database {
      * @param string	The input variable to be filtered from XSS, in this class it is expected to be a string.
      * @return string	Returns the filtered string as a result.
      */
-    private static function remove_XSS(& $var) {
+    private static function remove_XSS(& $var)
+    {
         return class_exists('Security') ? Security::remove_XSS($var) : @htmlspecialchars($var, ENT_QUOTES, api_get_system_encoding());
     }
 
@@ -977,7 +1040,8 @@ class Database {
      * conventional and MuSQL-specific encoding identificators.
      * @author Ivan Tcholakov
      */
-    private static function & get_db_encoding_map() {
+    private static function & get_db_encoding_map()
+    {
         static $encoding_map = array(
             'ARMSCII-8'    => 'armscii8',
             'BIG5'         => 'big5',
@@ -1013,7 +1077,8 @@ class Database {
      * A helper language id translation table for choosing some collations.
      * @author Ivan Tcholakov
      */
-    private static function & get_db_collation_map() {
+    private static function & get_db_collation_map()
+    {
         static $db_collation_map = array(
             'german' => 'german2',
             'simpl_chinese' => 'chinese',
@@ -1030,7 +1095,8 @@ class Database {
      * @return string				Returns a suitable default collation, for example 'utf8_general_ci', or NULL if collation was not found.
      * @author Ivan Tcholakov
      */
-    private static function check_db_collation($db_encoding, $language) {
+    private static function check_db_collation($db_encoding, $language)
+    {
         if (empty($db_encoding)) {
             return null;
         }
@@ -1056,7 +1122,8 @@ class Database {
      * Experimental useful database insert
      * @todo lot of stuff to do here
      */
-    public static function insert($table_name, $attributes) {
+    public static function insert($table_name, $attributes)
+    {
         if (empty($attributes) || empty($table_name)) {
             return false;
         }
@@ -1079,7 +1146,8 @@ class Database {
      * @todo lot of stuff to do here
     */
 
-    public static function select($columns, $table_name,  $conditions = array(), $type_result = 'all', $option = 'ASSOC') {
+    public static function select($columns, $table_name,  $conditions = array(), $type_result = 'all', $option = 'ASSOC')
+    {
         $conditions = self::parse_conditions($conditions);
 
         //@todo we could do a describe here to check the columns ...
@@ -1119,7 +1187,8 @@ class Database {
      * @param   array
      * @todo lot of stuff to do here
     */
-    static function parse_conditions($conditions) {
+    static function parse_conditions($conditions)
+    {
         if (empty($conditions)) {
             return '';
         }
@@ -1128,6 +1197,7 @@ class Database {
             $type_condition = strtolower($type_condition);
              switch($type_condition) {
                 case 'where':
+                    $where_return = '';
                     foreach ($condition_data as $condition => $value_array) {
                         if (is_array($value_array)) {
                             $clean_values = array();
@@ -1208,7 +1278,8 @@ class Database {
         return $return_value;
     }
 
-    public static function parse_where_conditions($coditions){
+    public static function parse_where_conditions($coditions)
+    {
         return self::parse_conditions(array('where'=>$coditions));
     }
 
@@ -1216,7 +1287,8 @@ class Database {
      * Experimental useful database update
      * @todo lot of stuff to do here
      */
-    public static function delete($table_name, $where_conditions) {
+    public static function delete($table_name, $where_conditions)
+    {
         $result = false;
         $where_return = self::parse_where_conditions($where_conditions);
         $sql    = "DELETE FROM $table_name $where_return ";        
@@ -1231,7 +1303,8 @@ class Database {
      * Experimental useful database update
      * @todo lot of stuff to do here
      */
-    public static function update($table_name, $attributes, $where_conditions = array()) {
+    public static function update($table_name, $attributes, $where_conditions = array())
+    {
 
         if (!empty($table_name) && !empty($attributes)) {
             $update_sql = '';
@@ -1265,14 +1338,16 @@ class Database {
     /**
      * @deprecated Use api_get_language_isocode($language) instead.
      */
-    public static function get_language_isocode($language) {
+    public static function get_language_isocode($language)
+    {
         return api_get_language_isocode($language);
     }
 
     /**
      * @deprecated Use Database::insert_id() instead.
      */
-    public static function get_last_insert_id() {
+    public static function get_last_insert_id()
+    {
         global $database_connection;
         return $database_connection->insert_id($database_connection);
     }

+ 7 - 3
main/inc/lib/main_api.lib.php

@@ -930,12 +930,13 @@ function api_protect_course_script($print_headers = false, $allow_session_admins
  * The function blocks access when the user has no platform admin rights with an error message printed on default output
  * @param bool Whether to allow session admins as well
  * @param bool Whether to allow HR directors as well
+ * @param string An optional message (already passed through get_lang)
  * @return bool True if user is allowed, false otherwise. The function also outputs an error message in case not allowed
  * @author Roan Embrechts (original author)
  */
-function api_protect_admin_script($allow_sessions_admins = false, $allow_drh = false) {
+function api_protect_admin_script($allow_sessions_admins = false, $allow_drh = false, $message = null) {
     if (!api_is_platform_admin($allow_sessions_admins, $allow_drh)) {
-        api_not_allowed(true);
+        api_not_allowed(true, $message);
         return false;
     }
     return true;
@@ -1155,6 +1156,9 @@ function _api_format_user($user, $add_password = false) {
         $result['password'] = $user['password'];
     }
 
+    $result['creator_id'] = $user['creator_id'];
+    $result['registration_date'] = $user['registration_date'];
+
     return $result;
 }
 
@@ -2963,7 +2967,7 @@ function api_not_allowed($print_headers = false, $message = null) {
         exit;
     }
 
-    if (!empty($_SERVER['REQUEST_URI']) && (!empty($_GET['cidReq']) || $this_section == SECTION_MYPROFILE)) {
+    if (!empty($_SERVER['REQUEST_URI']) && (!empty($_GET['cidReq']) || $this_section == SECTION_MYPROFILE || $this_section == SECTION_PLATFORM_ADMIN)) {
 
         //only display form and return to the previous URL if there was a course ID included
         if ($user_id != 0 && !api_is_anonymous()) {

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

@@ -2355,9 +2355,13 @@ class SessionManager
      * @param $course_code
      * @param $session_id
      * @return int
+     * @assert (null,null,null) === false
      */
     public static function get_user_status_in_session($user_id, $course_code, $session_id)
     {
+        if (empty($user_id) or empty($course_code) or empty($session_id)) {
+            return false;
+        }
         $tbl_session_rel_course_rel_user    = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
         $tbl_user                           = Database::get_main_table(TABLE_MAIN_USER);
         $sql = "SELECT session_rcru.status

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

@@ -2,6 +2,8 @@
 /*
 for more information: see languages.txt in the lang folder.
 */
+$CreatedByXYOnZ = "Create by <a href=\"%s\">%s</a> on %s";
+$LoginWithExternalAccount = "Login without an institutional account";
 $NumberOfGroupsToCreate = "Number of groups to create";
 $CoachesSubscribedAsATeacherInCourseX = "Coaches subscribed as teachers in course %s";
 $EnrollStudentsFromExistingSessions = "Enroll students from existing sessions";

+ 1 - 1
main/lang/french/admin.inc.php

@@ -1288,7 +1288,7 @@ $ShowLinkBugNotificationTitle = "Lien de rapport d'erreur";
 $ShowLinkBugNotificationComment = "Montrer un lien dans l'en-tête qui mène directement vers notre plateforme de support (http://support.chamilo.org). Lorsque l'utilisateur clique sur ce lien, il est envoyé sur notre plateforme de support, vers une page qui lui expliquera comment rapporter un bug.";
 $DataFiller = "Remplisseur de données";
 $GradebookActivateScoreDisplayCustom = "Activer la libellisation des niveaux de compétences personnalisés pour les scores";
-$GradebookScoreDisplayCustomValues = "Valeurs personnalisées de niveaux de compétences";
+$GradebookScoreDisplayCustomValues = "Valeurs personnalisées de niveaux de notes";
 $GradebookNumberDecimals = "Nombre de décimales";
 $GradebookNumberDecimalsComment = "Permet de configurer le nombre de décimales autorisées dans les scores";
 $EditExtraFieldOptions = "Modifier les options de champs";

+ 2 - 2
main/lang/french/exercice.inc.php

@@ -419,9 +419,9 @@ $ExerciseEditionNotAvailableInSession = "Édition d'exercice de cours interdite
 $UniqueAnswerNoOption = "Rép. unique avec ne-sais-pas";
 $MultipleAnswerTrueFalse = "Rép. multiples vrai/faux/ne-sais-pas";
 $MultipleAnswerCombinationTrueFalse = "C. exacte vrai/faux/ne-sais-pas";
-$DontKnow = "Ne sais pas";
+$DontKnow = "Ne sait pas";
 $False = "Faux";
-$DoubtScore = "Ne sais pas";
+$DoubtScore = "Ne sait pas";
 $HotSpotDelineation = "Délinéation sur image";
 $PropagateNegativeResults = "Propager les résultats négatifs entre les questions";
 $InsertALinkToThisQuestionInTheExercise = "Insérer cette question dans l'exercice comme un lien (pas une copie)";

+ 1 - 1
main/lang/french/forum.inc.php

@@ -122,7 +122,7 @@ $NotifyMe = "M'alerter";
 $ConfirmUserQualification = "Confirmer cote apprenant";
 $NotChanged = "Non modifié";
 $TitleColumnGradebook = "Titre de colonne dans le rapport";
-$QualifyThreadGradebook = "Noter ce fil de discussion dans le rapport de compétences";
+$QualifyThreadGradebook = "Noter ce fil de discussion dans le cahier de notes";
 $QualifyWeight = "Pondération de la note";
 $QualifyNumeric = "Score maximum";
 $AlterQualifyThread = "Changer la cotation du fil de discussion";

+ 1 - 0
main/lang/french/install.inc.php

@@ -2,6 +2,7 @@
 /*
 for more information: see languages.txt in the lang folder.
 */
+$DateTimezoneSettingNotSet = "Votre installation de PHP ne définit pas le paramètre date.timezone. Ce paramètre est important pour l'installation de Chamilo.<br/>Avant de continuer nous vous conseillons vivement de vérifiez ce paramètre dans votre fichier php.ini.<br/>L'installation peut ne pas s'achever correctement le cas échéant.";
 $langStatDB = "Base pour le tracking.  Utile uniquement si vous séparez les bases centrale et tracking";
 $langEnableTracking = "Activer le Tracking";
 $langInstituteShortName = "Nom abrégé de l'organisation";

+ 4 - 1
main/lang/french/trad4all.inc.php

@@ -2,6 +2,10 @@
 /*
 for more information: see languages.txt in the lang folder.
 */
+$CreatedByXYOnZ = "Créé(e) par <a href=\"%s\">%s</a>, le %s";
+$LoginWithExternalAccount = "S'authentifier avec un compte extérieur à l'établissement";
+$CasDirectCourseAccess = "Accèder au cours avec l'authentification CAS";
+$SelectAnOption = "Sélectionner une option";
 $YourPasswordCannotBeTheSameAsYourUsername = "Votre mot de passe ne peut être identique à votre nom d'utilisateur";
 $CheckEasyPasswords = "Vérifier mots de passe trop simples";
 $PasswordVeryStrong = "Très fort";
@@ -1433,5 +1437,4 @@ $DataTableSearch = "Recherche";
 $HideColumn = "Cacher la colonne";
 $DisplayColumn = "Montrer la colonne";
 $LegalAgreementAccepted = "Conditions légales acceptées";
-$SelectAnOption = "Sélectionner une option";
 ?>

+ 5 - 4
main/lang/french/work.inc.php

@@ -2,6 +2,7 @@
 /*
 for more information: see languages.txt in the lang folder.
 */
+$FolderDoesntExistsInFileSystem = "Le dossier de destination est introuvable sur le serveur.";
 $HandedOutDate = "Date de réception";
 $HandedOut = "Remis";
 $HandOutDateLimit = "Date limite de remise";
@@ -28,7 +29,7 @@ $langMustBeRegisteredUser = "Seuls les utilisateurs enregistrés de ce cours peu
 $langListDel = "Supprimer la liste";
 $langNameDir = "Nom du nouveau répertoire";
 $langFileExists = "Impossible d'effectuer cette opération.<br />Un fichier portant ce nom existe déjà.";
-$CreateDirectory = "Créer un répertoire";
+$CreateDirectory = "Enregistrer le travail";
 $langCurrentDir = "répertoire courant";
 $UploadADocument = "Envoyer un document";
 $EditToolOptions = "Éditer les options des travaux";
@@ -39,9 +40,9 @@ $ValidateChanges = "Valider les changements";
 $FolderUpdated = "Dosier mis à jour";
 $EndsAt = "Envoi impossible à partir du";
 $QualificationOfAssignment = "Évaluation de la tâche";
-$MakeQualifiable = "Activer l'évaluation";
+$MakeQualifiable = "Activer dans le cahier de notes";
 $QualificationNumberOver = "Évaluation sur...";
-$WeightInTheGradebook = "Pondération dans le rapport de compétences";
+$WeightInTheGradebook = "Pondération dans le cahier de notes";
 $DatesAvailables = "Dates disponibles";
 $ExpiresAt = "Expire le";
 $AddToCalendar = "Ajouter au calendrier";
@@ -62,7 +63,7 @@ $ExpiryDateAlreadyPassed = "La date d'expiration est déjà passée";
 $EndDateAlreadyPassed = "La date de fin est déjà passée";
 $MoveXTo = "Déplacer %s vers";
 $QualificationMustNotBeMoreThanQualificationOver = "La cote ne peut pas être supérieure à la qualification maximale";
-$ModifyDirectory = "Modifier le répertoire";
+$ModifyDirectory = "Modifier le travail";
 $DeleteAllFiles = "Supprimer tous les travaux";
 $BackToWorksList = "Retour à la liste de travaux";
 $EditMedia = "Éditer et coter le travail";

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

@@ -2,6 +2,7 @@
 /*
 for more information: see languages.txt in the lang folder.
 */
+$CreatedByXYOnZ = "Creado/a por <a href=\"%s\">%s</a> el %s";
 $NumberOfGroupsToCreate = "Cantidad de grupos a crear";
 $CoachesSubscribedAsATeacherInCourseX = "Tutores inscritos como profesores en curso %s";
 $EnrollStudentsFromExistingSessions = "Suscribir estudiantes de sesiones existentes";