Explorar el Código

Minor - flint fixes

jmontoyaa hace 6 años
padre
commit
027ee6b955
Se han modificado 2 ficheros con 126 adiciones y 115 borrados
  1. 59 53
      main/extra/userInfo.php
  2. 67 62
      main/extra/userInfoLib.php

+ 59 - 53
main/extra/userInfo.php

@@ -9,7 +9,7 @@ if (empty($allow)) {
     exit;
 }
 
-$TABLECALHORAIRE  = Database :: get_course_table(cal_horaire);
+$TABLECALHORAIRE = Database :: get_course_table(cal_horaire);
 $htmlHeadXtra[] = '<script>
 function show_image(image,width,height) {
 	width = parseInt(width) + 20;
@@ -34,15 +34,15 @@ if (api_is_anonymous()) {
 $TBL_USERINFO_DEF = Database:: get_course_table(userinfo_def);
 $TBL_USERINFO_CONTENT = Database:: get_course_table(userinfo_content);
 
-if ($tool_info['visibility'] == 1 ) {
-    $interbreadcrumb[] = array ('url' => 'user.php', 'name' => get_lang('Users'));
+if ($tool_info['visibility'] == 1) {
+    $interbreadcrumb[] = ['url' => 'user.php', 'name' => get_lang('Users')];
 }
 
 if ($origin != 'learnpath') { //so we are not in learnpath tool
     Display :: display_header($nameTools, "User");
     $origin = Security::remove_XSS($_GET['origin']);
 } else {
-    ?> <link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CODE_PATH);?>css/default.css" /> <?php
+    ?> <link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CODE_PATH); ?>css/default.css" /> <?php
 }
 
 $currentCourse = api_get_course_id();
@@ -59,9 +59,8 @@ $current_session_id = api_get_session_id();
 $userIdViewed = Security::remove_XSS($_REQUEST['uInfo']);
 
 /**
- * Connection layer between Chamilo and the current script
+ * Connection layer between Chamilo and the current script.
  */
-
 $courseCode = api_get_course_id();
 $tbl_coursUser = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
 $userIdViewer = api_get_user_id(); // id fo the user currently online
@@ -166,8 +165,8 @@ if (api_is_allowed_to_edit(null, true)) {
                 ).get_lang('ViewUser').'</a>';
         }
     }
-	echo '<a href="../mySpace/myStudents.php?'.api_get_cidreq().'&origin=user_course&student='.$userIdViewed.'&details=true&course='.$_course['id'].'">'.Display::return_icon('stats.png',get_lang('UserStatistics'),'',ICON_SIZE_MEDIUM).get_lang('UserStatistics').'</a>';
-	echo '</div>';
+    echo '<a href="../mySpace/myStudents.php?'.api_get_cidreq().'&origin=user_course&student='.$userIdViewed.'&details=true&course='.$_course['id'].'">'.Display::return_icon('stats.png', get_lang('UserStatistics'), '', ICON_SIZE_MEDIUM).get_lang('UserStatistics').'</a>';
+    echo '</div>';
 } else {
     if ($tool_info['visibility'] == 1) {
         echo '<div class="actions">';
@@ -205,7 +204,7 @@ if ($displayMode == "viewDefEdit") {
     $edit_heading_form = new FormValidator('edit_heading_form');
     $edit_heading_form->addElement('hidden', 'id');
     $edit_heading_form->add_textfield('title', get_lang('Title'));
-    $edit_heading_form->addElement('textarea', 'comment', get_lang('Comment'), array('cols' => 60, 'rows' => 4));
+    $edit_heading_form->addElement('textarea', 'comment', get_lang('Comment'), ['cols' => 60, 'rows' => 4]);
     $possible_line_nrs[1] = '1 '.get_lang('Line');
     $possible_line_nrs[3] = '3 '.get_lang('Lines');
     $possible_line_nrs[5] = '5 '.get_lang('Lines');
@@ -215,7 +214,6 @@ if ($displayMode == "viewDefEdit") {
     $edit_heading_form->addElement('submit', 'submitDef', get_lang('Ok'));
     $edit_heading_form->setDefaults($catToEdit);
     $edit_heading_form->display();
-
 } elseif ($displayMode == "viewDefList") {
     $catList = get_cat_def_list();
     if ($catList) {
@@ -224,12 +222,12 @@ if ($displayMode == "viewDefEdit") {
             echo "<p>", "<b>".htmlize($thisCat['title'])."</b><br>\n", "<i>".htmlize($thisCat['comment'])."</i>\n", "</p>";
             // displays lines
             echo "<blockquote>\n", "<font color=\"gray\">\n";
-            for ($i = 1; $i <= $thisCat['nbline']; $i ++) {
+            for ($i = 1; $i <= $thisCat['nbline']; $i++) {
                 echo "<br>__________________________________________\n";
             }
             echo "</font>\n", "</blockquote>\n";
             // displays commands
-            echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&removeDef=", $thisCat['catId'], "\">", "<img src=\"../img/delete.gif\" border=\"0\" alt=\"".get_lang('Remove')."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset))."')) return false;\">", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&editDef=", $thisCat['catId'], "\">", "<img src=\"../img/edit.gif\" border=\"0\" alt=\"".get_lang('Edit')."\" />", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&moveUpDef=", $thisCat['catId'], "\">", "<img src=\"../img/up.gif\" border=\"0\" alt=\"".get_lang('MoveUp')."\">", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&moveDownDef=", $thisCat['catId'], "\">", "<img src=\"../img/down.gif\" border=\"0\" alt=\"".get_lang('MoveDown')."\">", "</a>\n";
+            echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&removeDef=", $thisCat['catId'], "\">", "<img src=\"../img/delete.gif\" border=\"0\" alt=\"".get_lang('Remove')."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset))."')) return false;\">", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&editDef=", $thisCat['catId'], "\">", "<img src=\"../img/edit.gif\" border=\"0\" alt=\"".get_lang('Edit')."\" />", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&moveUpDef=", $thisCat['catId'], "\">", "<img src=\"../img/up.gif\" border=\"0\" alt=\"".get_lang('MoveUp')."\">", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&moveDownDef=", $thisCat['catId'], "\">", "<img src=\"../img/down.gif\" border=\"0\" alt=\"".get_lang('MoveDown')."\">", "</a>\n";
         } // end for each
     } // end if ($catList)
 
@@ -247,13 +245,13 @@ if ($displayMode == "viewDefEdit") {
     $content_heading_form->addElement('hidden', 'uInfo');
     $content_heading_form->addElement('static', null, $catToEdit['title'], htmlize($catToEdit['comment']));
     if ($catToEdit['nbline'] == 1) {
-        $content_heading_form->addElement('text', 'content', null, array ('size' => 80));
+        $content_heading_form->addElement('text', 'content', null, ['size' => 80]);
     } else {
         $content_heading_form->addElement(
             'textarea',
             'content',
             null,
-            array('cols' => 60, 'rows' => $catToEdit['nbline'])
+            ['cols' => 60, 'rows' => $catToEdit['nbline']]
         );
     }
     $content_heading_form->addElement('submit', 'submitContent', get_lang('Ok'));
@@ -270,41 +268,39 @@ if ($displayMode == "viewDefEdit") {
         // get the path,width and height from original picture
         $big_image = $image_array['dir'].'big_'.$image_array['file'];
         $big_image_size = api_getimagesize($big_image);
-        $big_image_width= $big_image_size['width'];
-        $big_image_height= $big_image_size['height'];
+        $big_image_width = $big_image_size['width'];
+        $big_image_height = $big_image_size['height'];
         $url_big_image = $big_image.'?rnd='.time();
 
-        if ($image_array['file']=='unknown.jpg') {
+        if ($image_array['file'] == 'unknown.jpg') {
             echo '<img src="'.$image_array['dir'].$image_array['file'].'" border="1">';
         } else {
             echo '<input type="image" src="'.$image_array['dir'].$image_array['file'].'" onclick="return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
         }
 
-         echo "<form action=\"".api_get_self()."\" method=\"post\">\n",
-			"<input type=\"hidden\" name=\"submitMainUserInfo\" value=\"$userIdViewed\" />\n",
-			"<table width=\"80%\" border=\"0\">",
-			"<tr align=\"center\" bgcolor=\"#E6E6E6\">\n",
-			"<td align=\"left\">", get_lang('Name'), "</td>\n",
-			"<td width=\"100px\" align=\"left\">", get_lang('Horaire'), "</td>\n";
-			echo "</tr>\n",
-			"<tr align=\"center\">",
-			"<td align=\"left\"><b>", htmlize(api_get_person_name($mainUserInfo['firstName'], $mainUserInfo['lastName'])), "</b></td>\n",
-         "<td align=\"left\"><b>", $mainUserInfo['official_code'], "</td>" ;
+        echo "<form action=\"".api_get_self()."\" method=\"post\">\n",
+            "<input type=\"hidden\" name=\"submitMainUserInfo\" value=\"$userIdViewed\" />\n",
+            "<table width=\"80%\" border=\"0\">",
+            "<tr align=\"center\" bgcolor=\"#E6E6E6\">\n",
+            "<td align=\"left\">", get_lang('Name'), "</td>\n",
+            "<td width=\"100px\" align=\"left\">", get_lang('Horaire'), "</td>\n";
+        echo "</tr>\n",
+            "<tr align=\"center\">",
+            "<td align=\"left\"><b>", htmlize(api_get_person_name($mainUserInfo['firstName'], $mainUserInfo['lastName'])), "</b></td>\n",
+         "<td align=\"left\"><b>", $mainUserInfo['official_code'], "</td>";
         $course_id = $_course['real_id'];
-        //récupérer horaire de l'élève
-        ?>
+        //récupérer horaire de l'élève ?>
         <SELECT NAME='hor_name'>
-            <OPTION VALUE='<?php echo $mainUserInfo['official_code'] ?>'><?php echo get_lang('select_calendar_student'); ?></OPTION>
+            <OPTION VALUE='<?php echo $mainUserInfo['official_code']; ?>'><?php echo get_lang('select_calendar_student'); ?></OPTION>
             <?php
             $sql = "SELECT distinct name FROM $TABLECALHORAIRE
             where c_id = $course_id ";
-            $result2 = Database::query($sql);
-            while ($row = Database::fetch_array( $result2)) {
-                    $horaire_name = $row["name"]; ?>
+        $result2 = Database::query($sql);
+        while ($row = Database::fetch_array($result2)) {
+            $horaire_name = $row["name"]; ?>
                     <OPTION VALUE='<?php echo $horaire_name; ?>'><?php echo "$horaire_name "; ?></OPTION>
             <?php
-            }
-              ?>
+        } ?>
         </SELECT>
          <?php
          echo'<p></p>  ';
@@ -318,16 +314,21 @@ if ($displayMode == "viewDefEdit") {
         }
 
         if (api_get_setting('extended_profile') == 'true') {
-            if (!empty($mainUserInfo['competences']))
+            if (!empty($mainUserInfo['competences'])) {
                 echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyCompetences').'</strong></div><div>'.$mainUserInfo['competences'].'</div>';
-            if (!empty($mainUserInfo['diplomas']))
+            }
+            if (!empty($mainUserInfo['diplomas'])) {
                 echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div><div>'.$mainUserInfo['diplomas'].'</div>';
-            if (!empty($mainUserInfo['teach']))
+            }
+            if (!empty($mainUserInfo['teach'])) {
                 echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyTeach').'</strong></div><div>'.$mainUserInfo['teach'].'</div>';
-            if (!empty($mainUserInfo['openarea']))
+            }
+            if (!empty($mainUserInfo['openarea'])) {
                 echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div><div>'.$mainUserInfo['openarea'].'</div>';
-            if (!empty($mainUserInfo['competences']))
+            }
+            if (!empty($mainUserInfo['competences'])) {
                 echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyProductions').'</strong></div><div>'.UserManager::build_production_list($mainUserInfo['user_id']).'</div>';
+            }
         }
     } else {
         Display :: display_normal_message(get_lang('ThisStudentIsSubscribeThroughASession'));
@@ -335,30 +336,30 @@ if ($displayMode == "viewDefEdit") {
 } elseif ($displayMode == "viewContentList") {
     // default display
     $virtual_course_code = $_GET["virtual_course"];
-    if (isset ($virtual_course_code)) {
+    if (isset($virtual_course_code)) {
         $courseCode = $virtual_course_code;
         $allowedToEditDef = false;
     }
-	$mainUserInfo = api_get_user_info($userIdViewed);
+    $mainUserInfo = api_get_user_info($userIdViewed);
     if ($mainUserInfo) {
         $image_array = UserManager::get_user_picture_path_by_id($userIdViewed, 'web', false, true);
         // get the path,width and height from original picture
         $big_image = $image_array['dir'].'big_'.$image_array['file'];
         $big_image_size = api_getimagesize($big_image);
-        $big_image_width= $big_image_size['width'];
-        $big_image_height= $big_image_size['height'];
+        $big_image_width = $big_image_size['width'];
+        $big_image_height = $big_image_size['height'];
         $url_big_image = $big_image.'?rnd='.time();
 
-        if ($image_array['file']=='unknown.jpg') {
+        if ($image_array['file'] == 'unknown.jpg') {
             echo '<img src="'.$image_array['dir'].$image_array['file'].'" border="1">';
         } else {
             echo '<input type="image" src="'.$image_array['dir'].$image_array['file'].'" onclick="return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
         }
 
         // is the user online?
-        $online ='';
+        $online = '';
         if (user_is_online($userIdViewed)) {
-            $online = Display::return_icon('online.gif', get_lang('OnLine'), array('style' => 'with="8"; height="8"'));
+            $online = Display::return_icon('online.gif', get_lang('OnLine'), ['style' => 'with="8"; height="8"']);
         }
 
         // DISPLAY TABLE HEADING
@@ -370,7 +371,7 @@ if ($displayMode == "viewDefEdit") {
         echo "<table width=\"80%\" border=\"0\">",
         "<tr align=\"center\" bgcolor=\"#E6E6E6\">\n",
             "<td align=\"left\">".get_lang('Name')."</td>\n",
-				"<td width=\"20%\" align=\"left\">".get_lang('Description')."</td>\n",
+                "<td width=\"20%\" align=\"left\">".get_lang('Description')."</td>\n",
          "<td width=\"100px\" align=\"left\">", get_lang('OfficialCode'), "</td>\n";
 
         echo "</tr>\n",
@@ -396,16 +397,21 @@ if ($displayMode == "viewDefEdit") {
         }
 
         if (api_get_setting('extended_profile') == 'true') {
-            if (!empty($mainUserInfo['competences']))
+            if (!empty($mainUserInfo['competences'])) {
                 echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyCompetences').'</strong></div><div>'.$mainUserInfo['competences'].'</div>';
-            if (!empty($mainUserInfo['diplomas']))
+            }
+            if (!empty($mainUserInfo['diplomas'])) {
                 echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div><div>'.$mainUserInfo['diplomas'].'</div>';
-            if (!empty($mainUserInfo['teach']))
+            }
+            if (!empty($mainUserInfo['teach'])) {
                 echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyTeach').'</strong></div><div>'.$mainUserInfo['teach'].'</div>';
-            if (!empty($mainUserInfo['openarea']))
+            }
+            if (!empty($mainUserInfo['openarea'])) {
                 echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div><div>'.$mainUserInfo['openarea'].'</div>';
-            if (!empty($mainUserInfo['competences']))
+            }
+            if (!empty($mainUserInfo['competences'])) {
                 echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyProductions').'</strong></div><div>'.UserManager::build_production_list($mainUserInfo['user_id']).'</div>';
+            }
         }
     } else {
         Display::display_normal_message(get_lang('ThisStudentIsSubscribeThroughASession'));

+ 67 - 62
main/extra/userInfoLib.php

@@ -2,16 +2,16 @@
 /* For licensing terms, see /license.txt*/
 
 /**
- * create a new category definition for the user information
+ * create a new category definition for the user information.
  *
  * @author - Hugues peeters <peeters@ipm.ucl.ac.be>
  * @author - Christophe Gesch� <gesche@ipm.ucl.ac.be>
  *
- * @param  string $title   - category title
- * @param  string $comment - title comment
- * @param  int    $nbline  - lines number for the field the user will fill.
+ * @param string $title   - category title
+ * @param string $comment - title comment
+ * @param int    $nbline  - lines number for the field the user will fill
  *
- * @return boolean true if succeed, else bolean false
+ * @return bool true if succeed, else bolean false
  */
 function create_cat_def($title = "", $comment = "", $nbline = "5")
 {
@@ -21,7 +21,7 @@ function create_cat_def($title = "", $comment = "", $nbline = "5")
     $comment = Database::escape_string(trim($comment));
     $nbline = strval(intval($nbline));
 
-    if (0 == (int)$nbline || empty($title)) {
+    if (0 == (int) $nbline || empty($title)) {
         return false;
     }
 
@@ -46,19 +46,18 @@ function create_cat_def($title = "", $comment = "", $nbline = "5")
 }
 
 /**
- * modify the definition of a user information category
+ * modify the definition of a user information category.
  *
  * @author - Hugues peeters <peeters@ipm.ucl.ac.be>
  * @author - Christophe Gesch� <gesche@ipm.ucl.ac.be>
  *
- * @param  int    $id      - id of the category
- * @param  string $title   - category title
- * @param  string $comment - title comment
- * @param  int    $nbline  - lines number for the field the user will fill.
+ * @param int    $id      - id of the category
+ * @param string $title   - category title
+ * @param string $comment - title comment
+ * @param int    $nbline  - lines number for the field the user will fill
  *
  * @return - boolean true if succeed, else otherwise
  */
-
 function edit_cat_def($id, $title, $comment, $nbline)
 {
     global $TBL_USERINFO_DEF;
@@ -82,21 +81,20 @@ function edit_cat_def($id, $title, $comment, $nbline)
 }
 
 /**
- * remove a category from the category list
+ * remove a category from the category list.
  *
  * @author - Hugues peeters <peeters@ipm.ucl.ac.be>
  * @author - Christophe Gesche <gesche@ipm.ucl.ac.be>
  *
- * @param  int     $id        - id of the category
- *                            or "ALL" for all category
- * @param  boolean $force     - FALSE (default) : prevents removal if users have
- *                            already fill this category
- *                            TRUE : bypass user content existence check
- * @param  int     $nbline    - lines number for the field the user will fill.
+ * @param int  $id     - id of the category
+ *                     or "ALL" for all category
+ * @param bool $force  - FALSE (default) : prevents removal if users have
+ *                     already fill this category
+ *                     TRUE : bypass user content existence check
+ * @param int  $nbline - lines number for the field the user will fill
  *
- * @return boolean  - TRUE if succeed, ELSE otherwise
+ * @return bool - TRUE if succeed, ELSE otherwise
  */
-
 function remove_cat_def($id, $force = false)
 {
     $TBL_USERINFO_DEF = Database:: get_course_table(userinfo_def);
@@ -104,7 +102,7 @@ function remove_cat_def($id, $force = false)
 
     $id = strval(intval($id));
 
-    if ((0 == (int)$id || $id == "ALL") || !is_bool($force)) {
+    if ((0 == (int) $id || $id == "ALL") || !is_bool($force)) {
         return false;
     }
     $sqlCondition = " WHERE id = '$id'";
@@ -121,24 +119,24 @@ function remove_cat_def($id, $force = false)
 }
 
 /**
- * move a category in the category list
+ * move a category in the category list.
  *
  * @author - Hugues peeters <peeters@ipm.ucl.ac.be>
  * @author - Christophe Gesch� <gesche@ipm.ucl.ac.be>
  *
- * @param  int    $id         - id of the category
- * @param  string $direction  "up" or "down" :
- *                            "up"    decrease the rank of gived $id by switching rank with the just lower
- *                            "down"  increase the rank of gived $id by switching rank with the just upper
+ * @param int    $id        - id of the category
+ * @param string $direction "up" or "down" :
+ *                          "up"    decrease the rank of gived $id by switching rank with the just lower
+ *                          "down"  increase the rank of gived $id by switching rank with the just upper
  *
- * @return boolean true if succeed, else boolean false
+ * @return bool true if succeed, else boolean false
  */
 function move_cat_rank($id, $direction) // up & down.
 {
     $TBL_USERINFO_DEF = Database:: get_course_table(userinfo_def);
     $id = strval(intval($id));
 
-    if (0 == (int)$id || !($direction == "up" || $direction == "down")) {
+    if (0 == (int) $id || !($direction == "up" || $direction == "down")) {
         return false;
     }
 
@@ -151,27 +149,28 @@ function move_cat_rank($id, $direction) // up & down.
 
     $cat = Database::fetch_array($result);
     $rank = (int) $cat['rank'];
+
     return move_cat_rank_by_rank($rank, $direction);
 }
 
 /**
- * move a category in the category list
+ * move a category in the category list.
  *
  * @author - Hugues peeters <peeters@ipm.ucl.ac.be>
  * @author - Christophe Gesche <gesche@ipm.ucl.ac.be>
  *
- * @param  int    $rank      - actual rank of the category
- * @param  string $direction "up" or "down" :
- *                           "up"    decrease the rank of gived $rank by switching rank with the just lower
- *                           "down"  increase the rank of gived $rank by switching rank with the just upper
+ * @param int    $rank      - actual rank of the category
+ * @param string $direction "up" or "down" :
+ *                          "up"    decrease the rank of gived $rank by switching rank with the just lower
+ *                          "down"  increase the rank of gived $rank by switching rank with the just upper
  *
- * @return boolean true if succeed, else boolean false
+ * @return bool true if succeed, else boolean false
  */
 function move_cat_rank_by_rank($rank, $direction) // up & down.
 {
     $TBL_USERINFO_DEF = Database:: get_course_table(userinfo_def);
 
-    if (0 == (int)$rank || !($direction == "up" || $direction == "down")) {
+    if (0 == (int) $rank || !($direction == "up" || $direction == "down")) {
         return false;
     }
 
@@ -213,17 +212,17 @@ function move_cat_rank_by_rank($rank, $direction) // up & down.
 /**
  * @author Hugues Peeters - peeters@ipm.ucl.ac.be
  *
- * @param  int    $user_id
- * @param  string $course_code
- * @param  array  $properties - should contain 'role', 'status', 'tutor_id'
+ * @param int    $user_id
+ * @param string $course_code
+ * @param array  $properties  - should contain 'role', 'status', 'tutor_id'
  *
- * @return boolean true if succeed false otherwise
+ * @return bool true if succeed false otherwise
  */
 function update_user_course_properties($user_id, $course_code, $properties, $horaire_name, $course_id)
 {
     global $tbl_coursUser,$_user;
     $sqlChangeStatus = "";
-    $user_id = strval(intval($user_id));//filter integer
+    $user_id = strval(intval($user_id)); //filter integer
     $course_code = Database::escape_string($course_code);
     if ($user_id != $_user['user_id']) {
         $sqlChangeStatus = "status     = '".Database::escape_string($properties['status'])."',";
@@ -258,7 +257,7 @@ function update_user_course_properties($user_id, $course_code, $properties, $hor
         return false;
     }
 
-     //on efface ce qui est déjà inscrit
+    //on efface ce qui est déjà inscrit
     $sql4 = "DELETE FROM ".$tbl_personal_agenda."
          WHERE user = '".$user_id."' 
          AND text = 'Pour le calendrier, ne pas effacer'";
@@ -297,7 +296,7 @@ function update_user_course_properties($user_id, $course_code, $properties, $hor
 }
 
 /**
- * fill a bloc for information category
+ * fill a bloc for information category.
  *
  * @author - Hugues peeters <peeters@ipm.ucl.ac.be>
  * @author - Christophe Gesche <gesche@ipm.ucl.ac.be>
@@ -307,7 +306,7 @@ function update_user_course_properties($user_id, $course_code, $properties, $hor
  * @param   $user_ip
  * @param   $content
  *
- * @return  boolean true if succeed, else boolean false
+ * @return bool true if succeed, else boolean false
  */
 function fill_new_cat_content($definition_id, $user_id, $content = "", $user_ip = "")
 {
@@ -346,21 +345,22 @@ function fill_new_cat_content($definition_id, $user_id, $content = "", $user_ip
             edition_time    = now()";
 
     Database::query($sql);
+
     return true;
 }
 
 /**
- * Edit a bloc for information category
+ * Edit a bloc for information category.
  *
  * @author - Hugues peeters <peeters@ipm.ucl.ac.be>
  * @author - Christophe Gesche <gesche@ipm.ucl.ac.be>
  *
  * @param   $definition_id
  * @param   $user_id
- * @param   $user_ip        DEFAULT $REMOTE_ADDR
- * @param   $content        if empty call delete the bloc
+ * @param   $user_ip       DEFAULT $REMOTE_ADDR
+ * @param   $content       if empty call delete the bloc
  *
- * @return  boolean true if succeed, else boolean false
+ * @return bool true if succeed, else boolean false
  */
 function edit_cat_content($definition_id, $user_id, $content = "", $user_ip = "")
 {
@@ -393,7 +393,7 @@ function edit_cat_content($definition_id, $user_id, $content = "", $user_ip = ""
 }
 
 /**
- * clean the content of a bloc for information category
+ * clean the content of a bloc for information category.
  *
  * @author Hugues peeters <peeters@ipm.ucl.ac.be>
  * @author Christophe Gesche <gesche@ipm.ucl.ac.be>
@@ -401,7 +401,7 @@ function edit_cat_content($definition_id, $user_id, $content = "", $user_ip = ""
  * @param   $definition_id
  * @param   $user_id
  *
- * @return boolean true if succeed, else boolean false
+ * @return bool true if succeed, else boolean false
  */
 function cleanout_cat_content($user_id, $definition_id)
 {
@@ -422,14 +422,15 @@ function cleanout_cat_content($user_id, $definition_id)
 }
 
 /**
- * get the user info from the user id
+ * get the user info from the user id.
+ *
  * @author - Hugues Peeters <peeters@ipm.ucl.ac.be>
  * @author - Christophe Gesche <gesche@ipm.ucl.ac.be>
  *
- * @param  int $user_id user id as stored in the Dokeos main db
+ * @param int $user_id user id as stored in the Dokeos main db
  *
  * @return array containg user info sort by categories rank
- *           each rank contains 'title', 'comment', 'content', 'cat_id'
+ *               each rank contains 'title', 'comment', 'content', 'cat_id'
  */
 function get_course_user_info($user_id)
 {
@@ -456,11 +457,12 @@ function get_course_user_info($user_id)
 }
 
 /**
- * get the main user information
+ * get the main user information.
+ *
  * @author - Hugues Peeters <peeters@ipm.ucl.ac.be>
  * @author - Christophe Gesche <gesche@ipm.ucl.ac.be>
  *
- * @param  int $user_id user id as stored in the Dokeos main db
+ * @param int $user_id user id as stored in the Dokeos main db
  *
  * @return array containing user info as 'lastName', 'firstName', 'email', 'role'
  */
@@ -495,7 +497,8 @@ function get_main_user_info($user_id, $courseCode)
 }
 
 /**
- * get the user content of a categories plus the categories definition
+ * get the user content of a categories plus the categories definition.
+ *
  * @author - Hugues Peeters <peeters@ipm.ucl.ac.be>
  * @author - Christophe Gesche <gesche@ipm.ucl.ac.be>
  *
@@ -531,12 +534,12 @@ function get_cat_content($userId, $catId)
 }
 
 /**
- * get the definition of a category
+ * get the definition of a category.
  *
  * @author Christophe Gesche <gesche@ipm.ucl.ac.be>
  * @author Hugues Peeters <peeters@ipm.ucl.ac.be>
  *
- * @param  int $catId - id of the categories
+ * @param int $catId - id of the categories
  *
  * @return array containing 'id', 'title', 'comment', and 'nbline',
  */
@@ -560,13 +563,14 @@ function get_cat_def($catId)
 }
 
 /**
- * get list of all this course categories
+ * get list of all this course categories.
  *
  * @author Christophe Gesche <gesche@ipm.ucl.ac.be>
  * @author Hugues Peeters <peeters@ipm.ucl.ac.be>
+ *
  * @return array containing a list of arrays.
- *           And each of these arrays contains
- *           'catId', 'title', 'comment', and 'nbline',
+ *               And each of these arrays contains
+ *               'catId', 'title', 'comment', and 'nbline',
  */
 function get_cat_def_list()
 {
@@ -590,7 +594,8 @@ function get_cat_def_list()
 }
 
 /**
- * transform content in a html display
+ * transform content in a html display.
+ *
  * @author Hugues Peeters <peeters@ipm.ucl.ac.be>
  *
  * @param string $string string to htmlize