Browse Source

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

Alex Aragon 8 years ago
parent
commit
6408592c62
55 changed files with 971 additions and 727 deletions
  1. 24 5
      app/Resources/public/css/base.css
  2. 3 3
      composer.json
  3. 16 2
      documentation/changelog.html
  4. 21 25
      main/coursecopy/classes/CourseRestorer.class.php
  5. 81 48
      main/forum/forumfunction.inc.php
  6. 1 1
      main/forum/index.php
  7. 10 11
      main/forum/newthread.php
  8. 22 43
      main/forum/reply.php
  9. 1 1
      main/gradebook/gradebook_display_summary.php
  10. 1 1
      main/gradebook/index.php
  11. 1 1
      main/gradebook/lib/GradebookUtils.php
  12. 24 25
      main/inc/lib/course.lib.php
  13. 4 4
      main/inc/lib/course_description.lib.php
  14. 11 12
      main/inc/lib/display.lib.php
  15. 14 12
      main/inc/lib/exercise.lib.php
  16. 3 3
      main/inc/lib/message.lib.php
  17. 8 8
      main/inc/lib/sessionmanager.lib.php
  18. 5 6
      main/inc/lib/surveymanager.lib.php
  19. 38 26
      main/inc/lib/userportal.lib.php
  20. 2 1
      main/lang/english/trad4all.inc.php
  21. 2 1
      main/lang/french/trad4all.inc.php
  22. 1 0
      main/lang/spanish/trad4all.inc.php
  23. 7 3
      main/newscorm/learnpath.class.php
  24. 1 1
      main/newscorm/lp_final_item.php
  25. 11 18
      main/survey/preview.php
  26. 9 8
      main/survey/reporting.php
  27. 173 120
      main/survey/survey.lib.php
  28. 2 4
      main/survey/survey.php
  29. 1 4
      main/survey/survey_list.php
  30. 4 0
      main/template/default/auth/session_catalog.tpl
  31. 91 0
      main/template/default/user_portal/grid_session.tpl
  32. 0 3
      main/template/default/user_portal/index.tpl
  33. 0 5
      main/template/default/user_portal/index_grid.tpl
  34. 57 53
      main/template/default/user_portal/session.tpl
  35. 191 160
      main/webservices/registration.soap.php
  36. 1 1
      plugin/ticket/src/categories.php
  37. 5 2
      src/Chamilo/CoreBundle/Entity/Repository/SkillRepository.php
  38. 12 11
      src/Chamilo/CoreBundle/Entity/Skill.php
  39. 10 11
      src/Chamilo/CoreBundle/Entity/SkillProfile.php
  40. 10 11
      src/Chamilo/CoreBundle/Entity/SkillRelGradebook.php
  41. 9 10
      src/Chamilo/CoreBundle/Entity/SkillRelProfile.php
  42. 10 11
      src/Chamilo/CoreBundle/Entity/SkillRelSkill.php
  43. 43 37
      src/Chamilo/CoreBundle/Entity/SkillRelUser.php
  44. 14 13
      src/Chamilo/CoreBundle/Entity/SkillRelUserComment.php
  45. 1 0
      src/Chamilo/CoreBundle/Entity/SpecificFieldValues.php
  46. 1 0
      src/Chamilo/CoreBundle/Entity/SysCalendar.php
  47. 1 0
      src/Chamilo/CoreBundle/Entity/Tag.php
  48. 1 0
      src/Chamilo/CoreBundle/Entity/Templates.php
  49. 1 0
      src/Chamilo/CoreBundle/Entity/TrackCourseRanking.php
  50. 1 0
      src/Chamilo/CoreBundle/Entity/TrackEAccess.php
  51. 1 0
      src/Chamilo/CoreBundle/Entity/TrackEAttempt.php
  52. 1 0
      src/Chamilo/CoreBundle/Entity/TrackEAttemptCoeff.php
  53. 1 0
      src/Chamilo/CoreBundle/Entity/TrackECourseAccess.php
  54. 7 1
      src/Chamilo/SkillBundle/Entity/Level.php
  55. 1 1
      src/Chamilo/SkillBundle/Entity/Profile.php

+ 24 - 5
app/Resources/public/css/base.css

@@ -4705,7 +4705,21 @@ div#chat-remote-video video {
     display: inline-block;
 }
 /* list my course user*/
-
+.session .info-session{
+    margin-bottom: 10px;
+    font-size: 12px;
+}
+.session .info-session span{
+    margin-right: 10px;
+}
+.session .teachers{
+    font-size: 12px;
+}
+.session .sessions-items .courses{
+    padding-bottom: 10px;
+    padding-top: 10px;
+    border-bottom: 1px solid #ECF0F1;
+}
 .grid-courses .items{
     /* position: relative; */
     vertical-align: top;
@@ -4723,18 +4737,22 @@ div#chat-remote-video video {
 }
 .grid-courses .items .title{
     line-height: 1.4;
-    font-size: 13px;
-    min-height: 40px;
+    font-size: 14px;
     padding: 0px;
     margin: 5px;
 }
 .grid-courses .items .toolbar{
     text-align: right;
 }
-.grid-courses .session-date{
+.grid-courses .items .toolbar .info{
+    float: left;
+    font-size: 12px;
+}
+.grid-courses .session-date,
+.grid-courses .session-info{
     color: #fff;
     font-size: 12px;
-    padding: 10px;
+    padding: 5px 10px;
 }
 .grid-courses .items .image{
     position: relative;
@@ -4838,6 +4856,7 @@ div#chat-remote-video video {
     color: #fff;
 }
 /* Catalog session */
+
 .search-session{
     margin-bottom: 30px;
     margin-top: 25px;

+ 3 - 3
composer.json

@@ -86,7 +86,7 @@
         "sonata-project/cache": "~1.0@dev",
         "sonata-project/page-bundle": "dev-master",
         "sonata-project/core-bundle": "3.x-dev as 2.4",
-        "sonata-project/formatter-bundle": "~2.4@dev",
+        "sonata-project/formatter-bundle": "2.x-dev as 2.2",
 
         "sonata-project/datagrid-bundle": "~2.2@dev",
         "sonata-project/exporter": "~1.3@dev",
@@ -103,12 +103,12 @@
         "toin0u/digitalocean": "dev-master",
 
         "mopa/bootstrap-bundle": "~3.0",
-        "egeloen/ckeditor-bundle": "~3.0",
+        "egeloen/ckeditor-bundle": "~2",
         "helios-ag/fm-elfinder-bundle": "~6.0",
         "friendsofsymfony/jsrouting-bundle": "~1.5",
 
         "michelf/php-markdown": "~1.4",
-        "knplabs/knp-markdown-bundle": "~1.3",
+        "knplabs/knp-markdown-bundle": "~1.2",
 
         "sabre/vobject": "~3.1",
 

+ 16 - 2
documentation/changelog.html

@@ -49,7 +49,7 @@
 
     <a name="1.10.6"></a>
 
-    <h1>Chamilo 1.10.6 - Zacatecas, 23rd of May 2016</h1>
+    <h1>Chamilo 1.10.6 - Zacatecas, 24th of May 2016</h1>
     <h3>Release notes - summary</h3>
     <p>Chamilo 1.10.6 is a minor, bugfix release of the 1.10.x branch, with a few new features and bugfixes on top of 1.10.4.</p>
     <h3>Release name</h3>
@@ -61,7 +61,6 @@
     <h3>Notable new Features</h3>
     <h4>For end-users, teachers and Chamilo admins</h4>
     <ul>
-        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/700d3516f86c441460f30d5feb64916465d1d545">700d3516</a> - <a href="https://task.beeznest.com/issues/11186">BT#11186</a>) Fix random questions</li>
         <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/dd051695d71cb7e69969d6b3644a5b1ee79bedfb">dd051695</a>) Add option to show right answers only during the last exercise attempt (RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT)</li>
         <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/1c76446ff2967542afc9f1ec963f6444593b3c5e">1c76446f</a>) Add course setting "bbb_enable_conference_in_groups" to allow for conferences through course groups (requires the BigBlueButton plugin)</li>
         <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/88842fd706130a593d2a5e95cd37784a4d0de389">88842fd7</a> - <a href="https://task.beeznest.com/issues/11141">BT#11141</a>) Allow platform admins to manage all sessions</li>
@@ -86,6 +85,21 @@
     </ul>
     <h3>Improvements (minor features) and debug</h3>
     <ul>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/700d3516f86c441460f30d5feb64916465d1d545">700d3516</a> - <a href="https://task.beeznest.com/issues/11186">BT#11186</a>) Fix random questions</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/c7dc81a679f944f868c0243b8bb66a545cd6d783">c7dc81a6</a> - <a href="https://task.beeznest.com/issues/11202">BT#11202</a>) Fix option  RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT BT#11202</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/397c9dcfd1bccc648b78ba423b132ccacc5aae2a">397c9dcf</a>) Update version to 1.10.6 in main/install/version.php</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/0ad4eaee3cfa47acbc8bbab2bf70f55d92ed49bc">0ad4eaee</a> - <a href="https://support.chamilo.org/issues/1170">#1170</a>) Scrutinizer Auto-Fixes (#1170)</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/8f76ee8d0cf33a8c52313b19067c2d7566e823e6">8f76ee8d</a> - <a href="https://support.chamilo.org/issues/8237">#8237</a>) Save calculated answer without correct answer</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/6b3e77efabf6750a7aeec266eb7ad1fa8b3fbed0">6b3e77ef</a> - <a href="https://support.chamilo.org/issues/8237">#8237</a>) Fix read question of calculated answer type</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/aafde67b9c4e1dca98e2064bd3d4774979e045ca">aafde67b</a> - <a href="https://support.chamilo.org/issues/8237">#8237</a>) Order code + showw CALCULATED_ANSWER questions</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/dfaa4f873da912c58dbc9b8a588b56e3c83d159d">dfaa4f87</a> - <a href="https://task.beeznest.com/issues/11202">BT#11202</a>) Fix hotspot question result by a new parameter</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/73a570bfd0163e84361856f78dec57a2d9ea953e">73a570bf</a>) Update gitlog to better ignore language terms messages</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/a82e76b76648e86490c2f6481e1febd0ed7ea6b8">a82e76b7</a> - <a href="https://support.chamilo.org/issues/8237">#8237</a>) Revert "Fix CALCULATED_ANSWER</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/d3a5c1e8db761f738dcfe98181a473a87084759e">d3a5c1e8</a> - <a href="https://support.chamilo.org/issues/8237">#8237</a>) Revert "Fix questions list with calculated questions</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/ee763e840555125e82549213e040178961934525">ee763e84</a> - <a href="https://support.chamilo.org/issues/8237">#8237</a>) Revert "Fix showing resuls for calculated answers</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/ee874accf2a186902a8815a5e45244bf381f2b98">ee874acc</a> - <a href="https://support.chamilo.org/issues/8237">#8237</a>) Revert "Fix questions list for calculated answers</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/9cb2a9214cba10f5a3b40465211bc084d7e4bf69">9cb2a921</a> - <a href="https://support.chamilo.org/issues/8237">#8237</a>) Revert "Fix conflict</li>
+        <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/6096b797f6c210fa8444d34ff7a3d95487fd4d63">6096b797</a> - <a href="https://support.chamilo.org/issues/8237">#8237</a>) Revert "Save the calculated answer without whished anser</li>
         <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/6b51fae1a37d3c7b3f7c656e3631cb2eb50d028e">6b51fae1</a> - <a href="https://task.beeznest.com/issues/10052">BT#10052</a>) Add function needed for exercises categories</li>
         <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/1eac339bacb87237413064b9f20f6047d4093dad">1eac339b</a>) Fix the update of API keys when no key exists previously (update_api_key())</li>
         <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/f40efabc34cbffb840a47f44495e0fa59fc476e9">f40efabc</a>) Fix - Enable/disable tickets plugin from menu, display blank screen</li>

+ 21 - 25
main/coursecopy/classes/CourseRestorer.class.php

@@ -77,7 +77,6 @@ class CourseRestorer
 
     /**
      * If true adds the text "copy" in the title of an item (only for LPs right now)
-     *
      **/
     public $add_text_in_items = false;
     public $destination_course_id;
@@ -2433,8 +2432,7 @@ class CourseRestorer
 			$destination_path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/upload/learning_path/images/';
 
 			foreach ($resources[RESOURCE_LEARNPATH] as $id => $lp) {
-
-				$condition_session = "";
+				$condition_session = '';
 				if (!empty($session_id)) {
                     if ($respect_base_content) {
                         $my_session_id = $lp->session_id;
@@ -2453,7 +2451,6 @@ class CourseRestorer
 					$new_filename = uniqid('').substr($lp->preview_image,strlen($lp->preview_image)-7, strlen($lp->preview_image));
 					if (file_exists($origin_path.$lp->preview_image) && !is_dir($origin_path.$lp->preview_image)) {
 						$copy_result = copy($origin_path.$lp->preview_image, $destination_path.$new_filename);
-						//$copy_result = true;
 						if ($copy_result) {
 							$lp->preview_image = $new_filename;
 						} else {
@@ -2738,20 +2735,20 @@ class CourseRestorer
 			$new_id = Database::insert($work_table, $folder);
 
             if ($new_id) {
-                //query in item property
+                // query in item property
                 $sql = 'SELECT
-                        tool,
-                        insert_user_id,
-                        insert_date,
-                        lastedit_date,
-                        ref,
-                        lastedit_type,
-                        lastedit_user_id,
-                        to_group_id,
-                        to_user_id,
-                        visibility,
-                        start_visible,
-                        end_visible
+                            tool,
+                            insert_user_id,
+                            insert_date,
+                            lastedit_date,
+                            ref,
+                            lastedit_type,
+                            lastedit_user_id,
+                            to_group_id,
+                            to_user_id,
+                            visibility,
+                            start_visible,
+                            end_visible
                         FROM '.$item_property_table.' ip
                         INNER JOIN '.$work_table.' sp
                         ON ip.ref=sp.id
@@ -2828,7 +2825,7 @@ class CourseRestorer
                     } elseif(is_dir($path)) {
                         if (!is_dir($dest . '/' . $file))
                         mkdir($dest . '/' . $file);
-                       self:: allow_create_all_directory($path, $dest . '/' . $file, $overwrite);
+                        self:: allow_create_all_directory($path, $dest . '/' . $file, $overwrite);
                     }
                 }
             }
@@ -2845,7 +2842,6 @@ class CourseRestorer
     public function get_new_id($tool, $ref)
     {
         // Check if the value exist in the current array.
-
         if ($tool == 'hotpotatoes') {
             $tool = 'document';
         }
@@ -2859,6 +2855,7 @@ class CourseRestorer
 
         // Check if the course is the same (last hope).
         if ($this->course_origin_id == $this->destination_course_id) {
+
             return $ref;
         }
 
@@ -2905,7 +2902,7 @@ class CourseRestorer
                         $this->destination_course_info,
                         TOOL_GLOSSARY,
                         $my_id,
-                        "GlossaryAdded",
+                        'GlossaryAdded',
                         api_get_user_id()
                     );
 
@@ -2973,7 +2970,6 @@ class CourseRestorer
 				$new_id = Database::insert($table_wiki, $params);
 
                 if ($new_id) {
-
                     $sql = "UPDATE $table_wiki SET page_id = '$new_id', id = iid
                             WHERE c_id = ".$this->destination_course_id." AND iid = '$new_id'";
                     Database::query($sql);
@@ -2996,7 +2992,7 @@ class CourseRestorer
                         'max_version' => 0,
                         'startdate_assig' => null,
                         'enddate_assig' => null,
-                        'delayedsubmit' => 0,
+                        'delayedsubmit' => 0
                     ];
 
                     Database::insert($table_wiki_conf, $params);
@@ -3052,6 +3048,7 @@ class CourseRestorer
 						$thematic_advance['attendance_id'] = 0;
 						$thematic_advance['thematic_id'] = $last_id;
 						$thematic_advance['c_id']  = $this->destination_course_id;
+
                         $my_id = Database::insert(
                             $table_thematic_advance,
                             $thematic_advance,
@@ -3067,7 +3064,7 @@ class CourseRestorer
                                 $this->destination_course_info,
                                 'thematic_advance',
                                 $my_id,
-                                "ThematicAdvanceAdded",
+                                'ThematicAdvanceAdded',
                                 api_get_user_id()
                             );
 						}
@@ -3089,7 +3086,7 @@ class CourseRestorer
                                 $this->destination_course_info,
                                 'thematic_plan',
                                 $my_id,
-                                "ThematicPlanAdded",
+                                'ThematicPlanAdded',
                                 api_get_user_id()
                             );
 						}
@@ -3222,7 +3219,6 @@ class CourseRestorer
                                 $row = Database::fetch_assoc($result);
                             }
 
-                            //$obj->params['qualification'] = empty($row['enable_qualification']) ? true : false;
                             $obj->params['enableExpiryDate'] = empty($row['expires_on']) ? false : true;
                             $obj->params['enableEndDate'] = empty($row['ends_on']) ? false : true;
                             $obj->params['expires_on'] = $row['expires_on'];

+ 81 - 48
main/forum/forumfunction.inc.php

@@ -2386,14 +2386,14 @@ function updateThread($values)
  * @param array $values
  * @param array $courseInfo
  * @param bool $showMessage
- * @return void HTML
+ * @return int
  *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  * @version february 2006, dokeos 1.8
  */
 function store_thread($current_forum, $values, $courseInfo = array(), $showMessage = true)
 {
-    $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo ;
+    $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo;
     $_user = api_get_user_info();
     $course_id = $courseInfo['real_id'];
     $courseCode = $courseInfo['code'];
@@ -2411,7 +2411,6 @@ function store_thread($current_forum, $values, $courseInfo = array(), $showMessa
     }
 
     if ($upload_ok) {
-
         $post_date = api_get_utc_datetime();
 
         if ($current_forum['approval_direct_post'] == '1' && !api_is_allowed_to_edit(null, true)) {
@@ -2547,7 +2546,7 @@ function store_thread($current_forum, $values, $courseInfo = array(), $showMessa
                 editAttachedFile(
                     array(
                         'comment' => $_POST['file_comments'][$key],
-                        'post_id' => $last_post_id,
+                        'post_id' => $last_post_id
                     ),
                     $id
                 );
@@ -2592,10 +2591,13 @@ function store_thread($current_forum, $values, $courseInfo = array(), $showMessa
 
         if ($current_forum['approval_direct_post'] == '1' && !api_is_allowed_to_edit(null, true)) {
             $message .= get_lang('MessageHasToBeApproved').'<br />';
-            $message .= get_lang('ReturnTo').' <a href="viewforum.php?'.api_get_cidreq().'&forum='.$values['forum_id'].'">'.get_lang('Forum').'</a><br />';
+            $message .= get_lang('ReturnTo').' <a href="viewforum.php?'.api_get_cidreq().'&forum='.$values['forum_id'].'">'.
+                get_lang('Forum').'</a><br />';
         } else {
-            $message .= get_lang('ReturnTo').' <a href="viewforum.php?'.api_get_cidreq().'&forum='.$values['forum_id'].'">'.get_lang('Forum').'</a><br />';
-            $message .= get_lang('ReturnTo').' <a href="viewthread.php?'.api_get_cidreq().'&forum='.$values['forum_id'].'&gradebook='.$gradebook.'&thread='.$last_thread_id.'">'.get_lang('Message').'</a>';
+            $message .= get_lang('ReturnTo').' <a href="viewforum.php?'.api_get_cidreq().'&forum='.$values['forum_id'].'">'.
+                get_lang('Forum').'</a><br />';
+            $message .= get_lang('ReturnTo').' <a href="viewthread.php?'.api_get_cidreq().'&forum='.$values['forum_id'].'&gradebook='.$gradebook.'&thread='.$last_thread_id.'">'.
+                get_lang('Message').'</a>';
         }
         $reply_info['new_post_id'] = $last_post_id;
         $my_post_notification = isset($values['post_notification']) ? $values['post_notification'] : null;
@@ -2611,13 +2613,12 @@ function store_thread($current_forum, $values, $courseInfo = array(), $showMessa
         Session::erase('breadcrumbs');
         Session::erase('addedresource');
         Session::erase('addedresourceid');
-        if ($showMessage) {
-            Display:: display_confirmation_message($message, false);
-        }
+
+        Display::addFlash(Display::return_message($message, 'success', false));
+        return $last_thread_id;
+
     } else {
-        if ($showMessage) {
-            Display::display_error_message(get_lang('UplNoFileUploaded'));
-        }
+        Display::addFlash(Display::return_message(get_lang('UplNoFileUploaded'), 'error', false));
     }
 }
 
@@ -2632,8 +2633,6 @@ function store_thread($current_forum, $values, $courseInfo = array(), $showMessa
  */
 function showUpdateThreadForm($currentForum, $forumSetting, $formValues = '')
 {
-    $userInfo = api_get_user_info();
-
     $myThread = isset($_GET['thread']) ? intval($_GET['thread']) : '';
     $myForum = isset($_GET['forum']) ? intval($_GET['forum']) : '';
     $myGradebook = isset($_GET['gradebook']) ? Security::remove_XSS($_GET['gradebook']) : '';
@@ -2763,35 +2762,40 @@ function showUpdateThreadForm($currentForum, $forumSetting, $formValues = '')
  *  2. replythread: Replying to a thread ($action = replythread) => I-frame with the complete thread (if enabled)
  *  3. replymessage: Replying to a message ($action =replymessage) => I-frame with the complete thread (if enabled) (I first thought to put and I-frame with the message only)
  *  4. quote: Quoting a message ($action= quotemessage) => I-frame with the complete thread (if enabled). The message will be in the reply. (I first thought not to put an I-frame here)
- * @return void HMTL
+ * @return FormValidator
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  * @version february 2006, dokeos 1.8
  */
-function show_add_post_form($current_forum, $forum_setting, $action = '', $id = '', $form_values = '')
+function show_add_post_form($current_forum, $forum_setting, $action, $id = '', $form_values = '')
 {
     $_user = api_get_user_info();
-    $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
-    $myThread = isset($_GET['thread']) ? $_GET['thread'] : '';
-    $my_forum = isset($_GET['forum']) ? $_GET['forum'] : '';
-    $my_post = isset($_GET['post']) ? $_GET['post'] : '';
+    $action = isset($action) ? Security::remove_XSS($action) : '';
+    $myThread = isset($_GET['thread']) ? (int) $_GET['thread'] : '';
+    $forumId = isset($_GET['forum']) ? (int) $_GET['forum'] : '';
+    $my_post = isset($_GET['post']) ? (int) $_GET['post'] : '';
     $my_gradebook = isset($_GET['gradebook']) ? Security::remove_XSS($_GET['gradebook']) : '';
+
+    $url = api_get_self() . '?' . http_build_query([
+        'action' => $action,
+        'forum' => $forumId,
+        'gradebook' => $my_gradebook,
+        'thread' => $myThread,
+        'post' => $my_post
+    ]) . '&' . api_get_cidreq();
+
     $form = new FormValidator(
         'thread',
         'post',
-        api_get_self() . '?' . http_build_query([
-            'forum' => intval($my_forum),
-            'gradebook' => $my_gradebook,
-            'thread' => intval($myThread),
-            'post' => intval($my_post),
-            'action' => $action,
-        ]) . '&' . api_get_cidreq()
+        $url
     );
+
     $form->setConstants(array('forum' => '5'));
 
     // Setting the form elements.
-    $form->addElement('hidden', 'forum_id', intval($my_forum));
-    $form->addElement('hidden', 'thread_id', intval($myThread));
+    $form->addElement('hidden', 'forum_id', $forumId);
+    $form->addElement('hidden', 'thread_id', $myThread);
     $form->addElement('hidden', 'gradebook', $my_gradebook);
+    $form->addElement('hidden', 'action', $action);
 
     // If anonymous posts are allowed we also display a form to allow the user to put his name or username in.
     if ($current_forum['allow_anonymous'] == 1 && !isset($_user['user_id'])) {
@@ -2813,7 +2817,7 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
             'ToolbarSet' => 'ForumStudent',
             'Width' => '100%',
             'Height' => '300',
-            'UserStatus' => 'student',
+            'UserStatus' => 'student'
         )
     );
 
@@ -2821,7 +2825,7 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
     $iframe = null;
     $myThread = Security::remove_XSS($myThread);
     if ($forum_setting['show_thread_iframe_on_reply'] && $action != 'newthread' && !empty($myThread)) {
-        $iframe = "<iframe style=\"border: 1px solid black\" src=\"iframe_thread.php?".api_get_cidreq()."&forum=".Security::remove_XSS($my_forum)."&thread=".$myThread."#".Security::remove_XSS($my_post)."\" width=\"100%\"></iframe>";
+        $iframe = "<iframe style=\"border: 1px solid black\" src=\"iframe_thread.php?".api_get_cidreq()."&forum=".Security::remove_XSS($forumId)."&thread=".$myThread."#".Security::remove_XSS($my_post)."\" width=\"100%\"></iframe>";
     }
     if (!empty($iframe)) {
         $form->addElement('label', get_lang('Thread'), $iframe);
@@ -2882,10 +2886,6 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
         $form->addElement('checkbox', 'thread_sticky', '', get_lang('StickyPost'));
     }
 
-    if ($current_forum['allow_attachments'] == '1' || api_is_allowed_to_edit(null, true)) {
-        $values = $form->exportValues();
-    }
-
     $form->addElement('html', '</div>');
 
     if (in_array($action, ['quote', 'replymessage'])) {
@@ -2926,23 +2926,37 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
 
     // If we are quoting a message we have to retrieve the information of the post we are quoting so that
     // we can add this as default to the textarea.
-
     if (($action == 'quote' || $action == 'replymessage') && isset($my_post)) {
         // We also need to put the parent_id of the post in a hidden form when
         // we are quoting or replying to a message (<> reply to a thread !!!)
-        $form->addElement('hidden', 'post_parent_id', intval($my_post));
+        $form->addHidden('post_parent_id', intval($my_post));
 
         // If we are replying or are quoting then we display a default title.
         $values = get_post_information($my_post);
+        $posterInfo = api_get_user_info($values['poster_id']);
+        $posterName = '';
+        if ($posterInfo) {
+            $posterName = $posterInfo['complete_name'];
+        }
         $defaults['post_title'] = get_lang('ReplyShort').api_html_entity_decode($values['post_title'], ENT_QUOTES);
         // When we are quoting a message then we have to put that message into the wysiwyg editor.
         // Note: The style has to be hardcoded here because using class="quote" didn't work.
         if ($action == 'quote') {
-            $defaults['post_text'] = '<div>&nbsp;</div><div style="margin: 5px;"><div style="font-size: 90%; font-style: italic;">'.get_lang('Quoting').' '.api_get_person_name($values['firstname'], $values['lastname']).':</div><div style="color: #006600; font-size: 90%;  font-style: italic; background-color: #FAFAFA; border: #D1D7DC 1px solid; padding: 3px;">'.prepare4display($values['post_text']).'</div></div><div>&nbsp;</div><div>&nbsp;</div>';
+            $defaults['post_text'] = '<div>&nbsp;</div>
+                <div style="margin: 5px;">
+                    <div style="font-size: 90%; font-style: italic;">'.
+                        get_lang('Quoting').' '.$posterName.':</div>
+                        <div style="color: #006600; font-size: 90%;  font-style: italic; background-color: #FAFAFA; border: #D1D7DC 1px solid; padding: 3px;">'.
+                            prepare4display($values['post_text']).'
+                        </div>
+                    </div>
+                <div>&nbsp;</div>
+                <div>&nbsp;</div>
+            ';
         }
     }
 
-    $form->setDefaults(isset($defaults) ? $defaults : null);
+    $form->setDefaults(isset($defaults) ? $defaults : []);
 
     // The course admin can make a thread sticky (=appears with special icon and always on top).
     $form->addRule('post_title', get_lang('ThisFieldIsRequired'), 'required');
@@ -2969,9 +2983,29 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
 
                 return false;
             }
-            Security::clear_token();
 
-            return $values;
+            switch ($action) {
+                case 'newthread':
+                    $myThread = store_thread($current_forum, $values);
+                    break;
+                case 'quote':
+                case 'replythread':
+                case 'replymessage':
+                    store_reply($current_forum, $values);
+
+                    break;
+            }
+
+            $url = api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.api_get_cidreq().'&'.http_build_query(
+                [
+                    'forum' => $forumId,
+                    'thread' => $myThread
+                ]
+            );
+
+            Security::clear_token();
+            header('Location: '.$url);
+            exit;
         }
     } else {
         $token = Security::get_token();
@@ -2986,7 +3020,7 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
         $ajaxHtml = $attachmentAjaxTable;
         $form->addElement('html', $ajaxHtml);
 
-        $form->display();
+        return $form;
     }
 }
 
@@ -5125,9 +5159,8 @@ function send_notifications($forum_id = 0, $thread_id = 0, $post_id = 0)
 
     if (is_array($users_to_be_notified)) {
         foreach ($users_to_be_notified as $value) {
-
             $user_info = api_get_user_info($value['user_id']);
-            $email_body = get_lang('Dear').' '.api_get_person_name($user_info['firstname'], $user_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS).", <br />\n\r";
+            $email_body = get_lang('Dear').' '.$user_info['complete_name'].", <br />\n\r";
             $email_body .= get_lang('NewForumPost').": ".$current_forum['forum_title'].' - '.$current_thread['thread_title']." <br />\n";
             $email_body .= get_lang('Course').': '.$_course['name'].' - ['.$_course['official_code']."]  <br />\n";
             $email_body .= get_lang('YouWantedToStayInformed')."<br />\n";
@@ -5588,7 +5621,7 @@ function editAttachedFile($array, $id, $courseId = null) {
  *
  * @return string The Forum Attachments Ajax Table
  */
-function getAttachmentsAjaxTable($postId = null)
+function getAttachmentsAjaxTable($postId = 0)
 {
     // Init variables
     $postId = intval($postId);
@@ -5607,7 +5640,7 @@ function getAttachmentsAjaxTable($postId = null)
             }
         }
     }
-    
+
     // Get data to fill into attachment files table
     if (!empty($_SESSION['forum']['upload_file'][$courseId]) &&
         is_array($_SESSION['forum']['upload_file'][$courseId])
@@ -5662,7 +5695,7 @@ function getAttachmentsAjaxTable($postId = null)
  *
  * @return array
  */
-function getAttachedFiles($forumId, $threadId, $postId = null, $attachId = null, $courseId = null)
+function getAttachedFiles($forumId, $threadId, $postId = 0, $attachId = 0, $courseId = 0)
 {
     $forumId = intval($forumId);
     $courseId = intval($courseId);

+ 1 - 1
main/forum/index.php

@@ -469,7 +469,7 @@ if (is_array($forumCategories)) {
                         }
                         $forum['forum_of_group'] == 0 ? $groupid = '' : $groupid = $forum['forum_of_group'];
 
-                        $number_threads = isset($forum['number_of_threads']) ? $forum['number_of_threads'] : 0;
+                        $number_threads = isset($forum['number_of_threads']) ? (int) $forum['number_of_threads'] : 0;
                         $number_posts = isset($forum['number_of_posts']) ? $forum['number_of_posts'] : 0;
 
                         $html .= '<div class="row">';

+ 10 - 11
main/forum/newthread.php

@@ -151,6 +151,14 @@ $htmlHeadXtra[] = <<<JS
     </script>
 JS;
 
+$form = show_add_post_form(
+    $current_forum,
+    $forum_setting,
+    'newthread',
+    '',
+    isset($_SESSION['formelements']) ? $_SESSION['formelements'] : null
+);
+
 if ($origin == 'learnpath') {
     Display::display_reduced_header();
 } else {
@@ -168,18 +176,9 @@ echo '</div>';
 // Set forum attachment data into $_SESSION
 getAttachedFiles($current_forum['forum_id'], 0, 0);
 
-$values = show_add_post_form(
-    $current_forum,
-    $forum_setting,
-    'newthread',
-    '',
-    isset($_SESSION['formelements']) ? $_SESSION['formelements'] : null
-);
 
-if (!empty($values) && isset($values['SubmitPost'])) {
-    // Add new thread in table forum_thread.
-    store_thread($current_forum, $values);
-}
+
+$form->display();
 
 if (isset($origin) && $origin == 'learnpath') {
     Display::display_reduced_footer();

+ 22 - 43
main/forum/reply.php

@@ -20,7 +20,6 @@
 
 require_once '../inc/global.inc.php';
 
-// The section (tabs).
 $this_section = SECTION_COURSES;
 
 // Notification for unauthorized people.
@@ -38,13 +37,16 @@ if (isset($_GET['origin'])) {
 require_once 'forumconfig.inc.php';
 require_once 'forumfunction.inc.php';
 
+$forumId = isset($_GET['forum']) ? (int)$_GET['forum'] : 0;
+$threadId = isset($_GET['thread']) ? (int)$_GET['thread'] : 0;
+
 /* MAIN DISPLAY SECTION */
 
 /* Retrieving forum and forum categorie information */
 // We are getting all the information about the current forum and forum category.
 // Note pcool: I tried to use only one sql statement (and function) for this,
 // but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table.
-$current_thread	= get_thread_information($_GET['thread']); // Note: This has to be validated that it is an existing thread.
+$current_thread	= get_thread_information($threadId); // Note: This has to be validated that it is an existing thread.
 $current_forum	= get_forum_information($current_thread['forum_id']); // Note: This has to be validated that it is an existing forum.
 $current_forum_category = get_forumcategory_information(Security::remove_XSS($current_forum['forum_category']));
 
@@ -55,19 +57,18 @@ $current_forum_category = get_forumcategory_information(Security::remove_XSS($cu
 // 3. if anonymous posts are not allowed
 // The only exception is the course manager
 // I have split this is several pieces for clarity.
-//if (!api_is_allowed_to_edit() AND (($current_forum_category['visibility'] == 0 OR $current_forum['visibility'] == 0) OR ($current_forum_category['locked'] <> 0 OR $current_forum['locked'] <> 0 OR $current_thread['locked'] <> 0))) {
 if (!api_is_allowed_to_edit(false, true) &&
     (($current_forum_category && $current_forum_category['visibility'] == 0) || $current_forum['visibility'] == 0)
 ) {
-    api_not_allowed();
+    api_not_allowed(true);
 }
 if (!api_is_allowed_to_edit(false, true) &&
     (($current_forum_category && $current_forum_category['locked'] <> 0) || $current_forum['locked'] <> 0 || $current_thread['locked'] <> 0)
 ) {
-    api_not_allowed();
+    api_not_allowed(true);
 }
 if (!$_user['user_id'] && $current_forum['allow_anonymous'] == 0) {
-    api_not_allowed();
+    api_not_allowed(true);
 }
 
 if ($current_forum['forum_of_group'] != 0) {
@@ -97,7 +98,7 @@ if (!empty($gradebook) && $gradebook == 'view') {
 
 if ($origin == 'group') {
     $_clean['toolgroup'] = api_get_group_id();
-    $group_properties  = GroupManager :: get_group_properties($_clean['toolgroup']);
+    $group_properties = GroupManager :: get_group_properties($_clean['toolgroup']);
     $interbreadcrumb[] = array(
         'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
         'name' => get_lang('Groups'),
@@ -105,16 +106,16 @@ if ($origin == 'group') {
 
     $interbreadcrumb[] = array(
         'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
-        'name' => get_lang('GroupSpace').' '.$group_properties['name'],
+        'name' => get_lang('GroupSpace').' '.$group_properties['name']
     );
 
     $interbreadcrumb[] = array(
-        'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?origin='.$origin.'&forum='.intval($_GET['forum']).'&'.api_get_cidreq(),
-        'name' => $current_forum['forum_title'],
+        'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?origin='.$origin.'&forum='.$forumId.'&'.api_get_cidreq(),
+        'name' => $current_forum['forum_title']
     );
     $interbreadcrumb[] = array(
-        'url' => api_get_path(WEB_CODE_PATH).'forum/viewthread.php?origin='.$origin.'&gradebook='.$gradebook.'&forum='.intval($_GET['forum']).'&thread='.intval($_GET['thread']).'&'.api_get_cidreq(),
-        'name' => $current_thread['thread_title'],
+        'url' => api_get_path(WEB_CODE_PATH).'forum/viewthread.php?origin='.$origin.'&gradebook='.$gradebook.'&forum='.$forumId.'&thread='.$threadId.'&'.api_get_cidreq(),
+        'name' => $current_thread['thread_title']
     );
 
     $interbreadcrumb[] = array(
@@ -124,19 +125,19 @@ if ($origin == 'group') {
 } else {
     $interbreadcrumb[] = array(
         'url' => 'index.php?gradebook='.$gradebook,
-        'name' => $nameTools,
+        'name' => $nameTools
     );
     $interbreadcrumb[] = array(
         'url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?forumcategory='.$current_forum_category['cat_id'].'&'.api_get_cidreq(),
-        'name' => $current_forum_category['cat_title'],
+        'name' => $current_forum_category['cat_title']
     );
     $interbreadcrumb[] = array(
-        'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?origin='.$origin.'&forum='.intval($_GET['forum']).'&'.api_get_cidreq(),
-        'name' => $current_forum['forum_title'],
+        'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?origin='.$origin.'&forum='.$forumId.'&'.api_get_cidreq(),
+        'name' => $current_forum['forum_title']
     );
     $interbreadcrumb[] = array(
-        'url' => api_get_path(WEB_CODE_PATH).'forum/viewthread.php?origin='.$origin.'&gradebook='.$gradebook.'&forum='.intval($_GET['forum']).'&thread='.intval($_GET['thread']).'&'.api_get_cidreq(),
-        'name' => $current_thread['thread_title'],
+        'url' => api_get_path(WEB_CODE_PATH).'forum/viewthread.php?origin='.$origin.'&gradebook='.$gradebook.'&forum='.$forumId.'&thread='.$threadId.'&'.api_get_cidreq(),
+        'name' => $current_thread['thread_title']
     );
     $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Reply'));
 }
@@ -174,35 +175,13 @@ $my_action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : ''
 $my_post = isset($_GET['post']) ? Security::remove_XSS($_GET['post']) : '';
 $my_elements = isset($_SESSION['formelements']) ? $_SESSION['formelements'] : '';
 
-$values = show_add_post_form(
+$form = show_add_post_form(
     $current_forum,
     $forum_setting,
     $my_action,
     $my_post,
     $my_elements
 );
-$form = '';
-if (is_object($values)) {
-    $form = $values->returnForm();
-} else {
-    if (!empty($values) && isset($_POST['SubmitPost'])) {
-        store_reply($current_forum, $values);
-        //@todo split the show_add_post_form function
-        $origin = isset($_GET['origin']) && $_GET['origin'] === 'learnpath' ? 'learnpath' : null;
-
-        $url = api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.http_build_query(
-            [
-                'forum' => $current_thread['forum_id'],
-                'gradebook' => $gradebook,
-                'thread' => intval($_GET['thread']),
-                'gidReq' => api_get_group_id(),
-                'origin' => $origin
-            ]
-        );
-        header('Location: '.$url);
-        exit;
-    }
-}
 
 if ($origin == 'learnpath') {
     Display::display_reduced_header();
@@ -215,7 +194,7 @@ if ($origin == 'learnpath') {
 if ($origin != 'learnpath') {
     echo '<div class="actions">';
     echo '<span style="float:right;">'.search_link().'</span>';
-    echo '<a href="viewthread.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']).'&gradebook='.$gradebook.'&thread='.Security::remove_XSS($_GET['thread']).'&origin='.$origin.'">'.
+    echo '<a href="viewthread.php?'.api_get_cidreq().'&forum='.$forumId.'&gradebook='.$gradebook.'&thread='.$threadId.'&origin='.$origin.'">'.
         Display::return_icon('back.png', get_lang('BackToThread'), '', ICON_SIZE_MEDIUM).'</a>';
     echo '</div>';
 }
@@ -227,7 +206,7 @@ echo '<h1><a href="viewforum.php?&origin='.$origin.'&forum='.$current_forum['for
 echo '<p class="forum_description">'.prepare4display($current_forum['forum_comment']).'</p>';
 echo '</div>';
 
-echo $form;
+$form->display();
 
 if ($origin == 'learnpath') {
     Display::display_reduced_footer();

+ 1 - 1
main/gradebook/gradebook_display_summary.php

@@ -57,7 +57,7 @@ switch ($action) {
 
         $courseInfo = api_get_course_info();
         $params = array(
-            'pdf_title' => sprintf(get_lang('GradeFromX'), $courseInfo['department_name']),
+            'pdf_title' => sprintf(get_lang('GradeFromX'), $courseInfo['name']),
             'session_info' => '',
             'course_info' => '',
             'pdf_date' => '',

+ 1 - 1
main/gradebook/index.php

@@ -949,7 +949,7 @@ if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
                     $sessionName = api_get_session_name(api_get_session_id());
                     $sessionName = !empty($sessionName) ? " - $sessionName" : '';
                     $params = array(
-                        'pdf_title' => sprintf(get_lang('GradeFromX'), $courseInfo['department_name']),
+                        'pdf_title' => sprintf(get_lang('GradeFromX'), $courseInfo['name']),
                         'course_code' => api_get_course_id(),
                         'session_info' => '',
                         'course_info' => '',

+ 1 - 1
main/gradebook/lib/GradebookUtils.php

@@ -1395,7 +1395,7 @@ class GradebookUtils
         $sessionName = !empty($sessionName) ? " - $sessionName" : '';
 
         $params = array(
-            'pdf_title' => sprintf(get_lang('GradeFromX'), $courseInfo['department_name']),
+            'pdf_title' => sprintf(get_lang('GradeFromX'), $courseInfo['name']),
             'session_info' => '',
             'course_info' => '',
             'pdf_date' => '',

+ 24 - 25
main/inc/lib/course.lib.php

@@ -2852,7 +2852,7 @@ class CourseManager
             'variable' => $variable,
             'value' => $value
         ];
-        $extraFieldValues->save($params);
+        return $extraFieldValues->save($params);
     }
 
     /**
@@ -3936,9 +3936,11 @@ class CourseManager
         $params = array();
         $params['icon'] = Display::return_icon(
             'blackboard_blue.png',
-            api_htmlentities($course_info['name']),
+            null,
             array(),
-            ICON_SIZE_LARGE
+            ICON_SIZE_LARGE,
+            null,
+            true  
         );
 
         // Display the "what's new" icons
@@ -3965,7 +3967,7 @@ class CourseManager
 
                 if ($user_in_course_status == COURSEMANAGER || $sessionCourseAvailable) {
                     $session_url = $course_info['course_public_url'] . '?id_session=' . $course_info['id_session'];
-                    $session_title = '<h4><a href="' . $session_url. '">'. $course_info['name'] . '</a>'.$notifications.'</h4>';
+                    $session_title = '<a href="' . $session_url. '">'. $course_info['name'] . '</a>'.$notifications;
                 } else {
                     $session_title = $course_info['name'];
                 }
@@ -3977,37 +3979,33 @@ class CourseManager
         } else {
             $session_title = $course_info['name'];
         }
-
+        
         $showCustomIcon = api_get_setting('course_images_in_courses_list');
         $iconName = basename($course_info['course_image']);
         if ($showCustomIcon === 'true' && $iconName != 'course.png') {
-            $params['icon'] = Display::img(
-                $course_info['course_image'],
-                api_htmlentities($course_info['name']),
-                array()
-            );
+            $params['icon'] = $course_info['course_image_large'];
         }
 
         $params['link'] = $session_url;
         $params['title'] = $session_title;
-        $params['right_actions'] = '';
-
+        $params['edit_actions'] = '';
+        $params['document'] = '';
+        
         if ($course_visibility != COURSE_VISIBILITY_CLOSED &&
             $course_visibility != COURSE_VISIBILITY_HIDDEN
         ) {
+            if (api_is_platform_admin()) {
+                $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course_info['code'];
             if ($load_dirs) {
-                $params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_' . $course_info['id_session'] . '" class="document_preview" href="javascript:void(0);">' .
-                    Display::return_icon('folder.png',
-                        get_lang('Documents'),
-                        array('align' => 'absmiddle'),
-                        ICON_SIZE_SMALL
-                    ) . '</a>';
-                $params['right_actions'] .= Display::div('', array(
+                $params['document'] .= '<a id="document_preview_' . $course_info['real_id'] . '_' . $course_info['id_session'] . '" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' .
+                    Display::returnFontAwesomeIcon('folder-open') . '</a>';
+                $params['document'] .= Display::div('', array(
                     'id' => 'document_result_' . $course_info['real_id'] . '_' . $course_info['id_session'],
                     'class' => 'document_preview_container'
                 ));
             }
         }
+        }
 
         if (api_get_setting('display_coursecode_in_courselist') == 'true') {
             $session_title .= ' (' . $course_info['visual_code'] . ') ';
@@ -4015,23 +4013,24 @@ class CourseManager
 
         if (api_get_setting('display_teacher_in_courselist') === 'true') {
 
-            $teacher_list = CourseManager::get_teacher_list_from_course_code_to_string(
-                $course_info['code'],
-                self::USER_SEPARATOR,
-                true
+            $teacher_list = CourseManager::getTeachersFromCourseByCode(
+                $course_info['code']
             );
+            
             $course_coachs = self::get_coachs_from_course(
                 $course_info['id_session'],
                 $course_info['real_id']
             );
 
-            if ($course_info['status'] == COURSEMANAGER ||
+            /* if ($course_info['status'] == COURSEMANAGER ||
                 ($course_info['status'] == STUDENT && empty($course_info['id_session'])) ||
                 empty($course_info['status'])
             ) {
                 $params['teachers'] = $teacher_list;
             }
-
+            */
+            $params['teachers'] = $teacher_list;
+            
             if (($course_info['status'] == STUDENT && !empty($course_info['id_session'])) ||
                 ($is_coach && $course_info['status'] != COURSEMANAGER)
             ) {

+ 4 - 4
main/inc/lib/course_description.lib.php

@@ -227,7 +227,7 @@ class CourseDescription
             );
         }
 
-        return 1;
+        return ($last_id > 0)?1:0;
     }
 
     /**
@@ -261,9 +261,9 @@ class CourseDescription
             'session_id' => $this->session_id,
         ];
 
-        Database::insert($tbl_stats_item_property, $params);
+        $result = Database::insert($tbl_stats_item_property, $params);
 
-        return 1;
+        return $result ? 1 : 0;
     }
 
     /**
@@ -288,7 +288,7 @@ class CourseDescription
                 'id = ? AND session_id = ? AND c_id = ?' => [
                     $this->id,
                     $this->session_id,
-                    api_get_course_int_id(),
+                    $this->course_id ? $this->course_id : api_get_course_int_id(),
                 ],
             ]
         );

+ 11 - 12
main/inc/lib/display.lib.php

@@ -1523,9 +1523,11 @@ class Display
             $rs = Database::query($sql);
             $session_info = Database::store_result($rs, 'ASSOC');
             $session_info = $session_info[0];
-
+            
             $session = array();
+            $session['category_id'] = $session_info['session_category_id'];
             $session['title'] = $session_info['name'];
+            $session['id_coach'] = $session_info['id_coach'];
             $session['coach'] = '';
             $session['dates'] =  '';
 
@@ -1578,14 +1580,11 @@ class Display
                     $session_info['access_end_date'] = $session_info['access_end_date'];
                 }
                 if ($start && $stop) {
-                    $session['dates'] = Display::tag(
-                        'em',
-                        sprintf(
+                    $session['dates'] = sprintf(
                             get_lang('FromDateXToDateY'),
                             api_format_date($start_buffer),
                             api_format_date($stop_buffer)
-                        )
-                    );
+                        );
                 } else {
                     $start_buffer = $stop_buffer = null;
 
@@ -1603,14 +1602,12 @@ class Display
                         );
                     }
 
-                    $session['dates'] = Display::tag(
-                        'em',
-                        "$start_buffer $stop_buffer"
-                    );
+                    $session['dates'] = $start_buffer . " " . $stop_buffer;
+                   
                 }
 
                 if ( api_get_setting('show_session_coach') === 'true' ) {
-                    $session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name(
+                    $session['coach'] = api_get_person_name(
                         $session_info['firstname'],
                         $session_info['lastname']
                     );
@@ -1619,7 +1616,9 @@ class Display
             }
             $session['active'] = $active;
             $session['session_category_id'] = $session_info['session_category_id'];
-
+            $session['visibility'] = $session_info['visibility'];
+            $session['num_users'] = $session_info['nbr_users'];
+            $session['num_courses'] = $session_info['nbr_courses'];
             $session['description'] = $session_info['description'];
             $session['show_description'] = $session_info['show_description'];
 

+ 14 - 12
main/inc/lib/exercise.lib.php

@@ -3466,8 +3466,7 @@ HOTSPOT;
         $objExercise,
         $exe_id,
         $save_user_result = false
-    )
-    {
+    ) {
         global $origin;
 
         // Getting attempt info
@@ -3537,16 +3536,19 @@ HOTSPOT;
 
                 if ($attempts) {
                     $numberAttempts = count($attempts);
-                    if ($save_user_result) {
-                        $numberAttempts++;
-                    }
-                    if ($numberAttempts >= $objExercise->attempts) {
-                        $show_results = true;
-                        $show_only_score = false;
-                        $show_total_score_and_user_choices = false;
-                    } else {
-                        $show_total_score_and_user_choices = true;
-                    }
+                } else {
+                    $numberAttempts = 0;
+                }
+
+                if ($save_user_result) {
+                    $numberAttempts++;
+                }
+                if ($numberAttempts >= $objExercise->attempts) {
+                    $show_results = true;
+                    $show_only_score = false;
+                    $show_total_score_and_user_choices = false;
+                } else {
+                    $show_total_score_and_user_choices = true;
                 }
             }
         }

+ 3 - 3
main/inc/lib/message.lib.php

@@ -201,14 +201,14 @@ class MessageManager
     /**
      * Sends a message to a user/group
      *
-     * @param int 	   $receiver_user_id
+     * @param int 	  $receiver_user_id
      * @param string  $subject
      * @param string  $content
      * @param array   $file_attachments files array($_FILES) (optional)
      * @param array   $file_comments about attachment files (optional)
      * @param int     $group_id (optional)
      * @param int     $parent_id (optional)
-     * @param int 	   $edit_message_id id for updating the message (optional)
+     * @param int 	  $edit_message_id id for updating the message (optional)
      * @param int     $topic_id (optional) the default value is the current user_id
      * @param int     $sender_id
      * @param bool $directMessage
@@ -253,7 +253,7 @@ class MessageManager
         $total_filesize = 0;
         if (is_array($file_attachments)) {
             foreach ($file_attachments as $file_attach) {
-                $total_filesize += $file_attach['size'];
+                $total_filesize += isset($file_attach['size']) && is_int($file_attach['size']) ? $file_attach['size'] : 0;
             }
         }
 

+ 8 - 8
main/inc/lib/sessionmanager.lib.php

@@ -65,7 +65,7 @@ class SessionManager
      * @param   int     $showDescription Optional. Whether show the session description
      * @param   array   $extraFields
      * @param   int     $sessionAdminId Optional. If this sessions was created by a session admin, assign it to him
-     * @param boolean $sendSubscritionNotification Optional.
+     * @param boolean $sendSubscriptionNotification Optional.
      *          Whether send a mail notification to users being subscribed
      * @todo use an array to replace all this parameters or use the model.lib.php ...
      * @return mixed       Session ID on success, error message otherwise
@@ -87,7 +87,7 @@ class SessionManager
         $showDescription = 0,
         $extraFields = array(),
         $sessionAdminId = 0,
-        $sendSubscritionNotification = false
+        $sendSubscriptionNotification = false
     ) {
         global $_configuration;
 
@@ -160,7 +160,7 @@ class SessionManager
                     'visibility' => $visibility,
                     'description' => $description,
                     'show_description' => intval($showDescription),
-                    'send_subscription_notification' => $sendSubscritionNotification
+                    'send_subscription_notification' => (int) $sendSubscriptionNotification
                 );
 
                 if (!empty($startDate)) {
@@ -1375,11 +1375,11 @@ class SessionManager
             Display::return_message(get_lang('CoachIsRequired'), 'warning');
 
             return false;
-        } elseif (!empty($startDate) && !api_is_valid_date($startDate, 'Y-m-d H:i')) {
+        } elseif (!empty($startDate) && !api_is_valid_date($startDate, 'Y-m-d H:i') && !api_is_valid_date($startDate, 'Y-m-d H:i:s')) {
             Display::return_message(get_lang('InvalidStartDate'), 'warning');
 
             return false;
-        } elseif (!empty($endDate) && !api_is_valid_date($endDate, 'Y-m-d H:i')) {
+        } elseif (!empty($endDate) && !api_is_valid_date($endDate, 'Y-m-d H:i') && !api_is_valid_date($endDate, 'Y-m-d H:i:s')) {
             Display::return_message(get_lang('InvalidEndDate'), 'warning');
 
             return false;
@@ -2223,8 +2223,8 @@ class SessionManager
                 }
 
                 // If the course isn't subscribed yet
-                $sql = "INSERT INTO $tbl_session_rel_course (session_id, c_id)
-                        VALUES ($sessionId, $courseId)";
+                $sql = "INSERT INTO $tbl_session_rel_course (session_id, c_id, nbr_users, position)
+                        VALUES ($sessionId, $courseId, 0, 0)";
                 Database::query($sql);
 
                 Event::addEvent(
@@ -2366,7 +2366,7 @@ class SessionManager
             'variable' => $variable,
             'value' => $value,
         ];
-        $extraFieldValue->save($params);
+        return $extraFieldValue->save($params);
     }
 
     /**

+ 5 - 6
main/inc/lib/surveymanager.lib.php

@@ -19,7 +19,7 @@ class SurveyTree
     {
         // Database table definitions
         $table_survey = Database :: get_course_table(TABLE_SURVEY);
-        $table_survey_question 	= Database :: get_course_table(TABLE_SURVEY_QUESTION);
+        $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
         $table_user = Database :: get_main_table(TABLE_MAIN_USER);
 
         // searching
@@ -39,18 +39,17 @@ class SurveyTree
 				LEFT JOIN $table_survey_question  survey_question
 				ON survey.survey_id = survey_question.survey_id , $table_user user
 				WHERE
-					survey.c_id 			=  $course_id AND
-					survey_question.c_id 	=  $course_id AND
-					survey.author 			= user.user_id
+					survey.c_id =  $course_id AND
+					survey_question.c_id = $course_id AND
+					survey.author = user.user_id
 				GROUP BY survey.survey_id";
 
         $res = Database::query($sql);
-        $surveys_parents = array ();
         $refs = array();
         $list = array();
         $plain_array=array();
 
-        while ($survey = Database::fetch_array($res,'ASSOC')) {
+        while ($survey = Database::fetch_array($res, 'ASSOC')) {
             $plain_array[$survey['survey_id']]=$survey;
             $surveys_parents[]=$survey['survey_version'];
             $thisref = &$refs[ $survey['survey_id'] ];

+ 38 - 26
main/inc/lib/userportal.lib.php

@@ -1205,29 +1205,35 @@ class IndexManager
                             );
                             $session_box = Display::get_session_title_box($session_id);
 
-                            $extra_info = !empty($session_box['coach']) ? $session_box['coach'] : null;
-                            $extra_info .= !empty($session_box['coach'])
-                                ? ' - ' . $session_box['dates']
-                                : $session_box['dates'];
-                            $extra_info .= isset($session_box['duration'])
-                                ? ' ' . $session_box['duration']
-                                : null;
-
-                            $params['extra_fields'] = $session_box['extra_fields'];
-                            $params['course_list_session_style'] = $coursesListSessionStyle;
-
-                            $params['title'] = $session_box['title'];
-                            $params['subtitle'] = $extra_info;
-                            $params['show_actions'] = api_is_platform_admin() ? true : false;
-
-                            if (api_get_setting('hide_courses_in_sessions') == 'false') {
-                                // $params['extra'] .=  $html_courses_session;
+                            $actions = null;
+                            if (api_is_platform_admin()) {
+                                $actions = api_get_path(WEB_CODE_PATH) .'session/resume_session.php?id_session='.$session_id;
                             }
-
-                            $params['description'] = $session_box['description'];
+                            
+                            $coachId = $session_box['id_coach'];
+                            $extraFieldValue = new ExtraFieldValue('session');
+                            $imageField = $extraFieldValue->get_values_by_handler_and_field_variable($session_id, 'image');
+                            
+                            $params['category_id'] = $session_box['category_id'];
+                            $params['title'] = $session_box['title'];
+                            //$params['subtitle'] = $extra_info;
+                            $params['id_coach'] = $coachId;
+                            $params['coach_url'] = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $coachId;
+                            $params['coach_name'] = !empty($session_box['coach']) ? $session_box['coach'] : null;
+                            $params['coach_avatar'] =UserManager::getUserPicture($coachId, USER_IMAGE_SIZE_SMALL);
+                            $params['date'] =  $session_box['dates'];
+                            $params['image'] = isset($imageField['value']) ? $imageField['value'] : null;
+                            $params['duration'] = isset($session_box['duration']) ? ' ' . $session_box['duration'] : null;
+                            $params['edit_actions'] = $actions;
                             $params['show_description'] = $session_box['show_description'];
-                            $params['courses'] = $html_courses_session;
+                            $params['description'] = $session_box['description'];   
+                            $params['visibility'] = $session_box['visibility'];
                             $params['show_simple_session_info'] = false;
+                            $params['course_list_session_style'] = $coursesListSessionStyle;                          
+                            $params['num_users'] = $session_box['num_users'];
+                            $params['num_courses'] = $session_box['num_courses'];
+                            $params['courses'] = $html_courses_session;
+                            //$params['extra_fields'] = $session_box['extra_fields'];
 
                             if (
                                 isset($_configuration['show_simple_session_info']) &&
@@ -1241,14 +1247,20 @@ class IndexManager
                                 $params['progress'] = GamificationUtils::getSessionProgress($params['id'], $this->user_id);
                                 $params['points'] = GamificationUtils::getSessionPoints($params['id'], $this->user_id);
                             }
-
-                            $this->tpl->assign('session', $params);
+                            $listSession[] = $params;
+                            $this->tpl->assign('session', $listSession);
+                            $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false));
                             $this->tpl->assign('gamification_mode', $gamificationModeIsActive);
 
-                            $sessions_with_no_category .= $this->tpl->fetch(
-                                $this->tpl->get_template('/user_portal/session.tpl')
-                            );
-
+                            if (api_get_configuration_value('view_grid_courses')){
+                                $sessions_with_no_category = $this->tpl->fetch(
+                                    $this->tpl->get_template('/user_portal/grid_session.tpl')
+                                );
+                            } else {
+                                $sessions_with_no_category = $this->tpl->fetch(
+                                    $this->tpl->get_template('/user_portal/session.tpl')
+                                );
+                            }
                             $sessionCount++;
                         }
                     }

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

@@ -7664,4 +7664,5 @@ $RecordAudio = "Record audio";
 $StartRecordingAudio = "Start recording";
 $StopRecordingAudio = "Stop recording";
 $SaveRecordedAudio = "Save recorded audio";
-?>
+$GradeFromX = "Grade for course: %s";
+?>

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

@@ -7651,4 +7651,5 @@ $RecordAudio = "Enregistrement audio";
 $StartRecordingAudio = "Lancer l'enregistrement";
 $StopRecordingAudio = "Arrêter l'enregistrement";
 $SaveRecordedAudio = "Sauvegarder l'audio enregistré";
-?>
+$GradeFromX = "Bulletin pour le cours: %s";
+?>

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

@@ -7681,4 +7681,5 @@ $RecordAudio = "Grabar audio";
 $StartRecordingAudio = "Lanzar la grabación";
 $StopRecordingAudio = "Finalizar la grabación";
 $SaveRecordedAudio = "Guardar el audio grabado";
+$GradeFromX = "Notas para el curso: %s";
 ?>

+ 7 - 3
main/newscorm/learnpath.class.php

@@ -1676,9 +1676,10 @@ class learnpath
 
     /**
      * Gets the number of items currently completed
+     * @param bool $failedStatusException flag to determine the failed status is not considered progressed
      * @return integer The number of items currently completed
      */
-    public function get_complete_items_count()
+    public function get_complete_items_count($failedStatusException = false)
     {
         if ($this->debug > 0) {
             error_log('New LP - In learnpath::get_complete_items_count()', 0);
@@ -1688,10 +1689,13 @@ class learnpath
             'completed',
             'passed',
             'succeeded',
-            'browsed',
-            'failed'
+            'browsed'
         );
 
+        if (!$failedStatusException) {
+            $completedStatusList[] = 'failed';
+        }
+
         foreach ($this->items as $id => $dummy) {
             // Trying failed and browsed considered "progressed" as well.
             if ($this->items[$id]->status_is($completedStatusList) &&

+ 1 - 1
main/newscorm/lp_final_item.php

@@ -35,7 +35,7 @@ $finalItemTemplate = '';
 // Check prerequisites and total completion of the learning path
 $lp = new Learnpath($courseCode, $lpId, $userId);
 $count = $lp->get_total_items_count_without_chapters();
-$completed = $lp->get_complete_items_count();
+$completed = $lp->get_complete_items_count(true);
 $currentItemId = $lp->get_current_item_id();
 $currentItem = $lp->items[$currentItemId];
 $currentItemStatus = $currentItem->get_status();

+ 11 - 18
main/survey/preview.php

@@ -42,10 +42,8 @@ if (Database::num_rows($result) > 0) {
 }
 
 // We exit here if there is no valid $_GET parameter
-if (!isset($_GET['survey_id']) || !is_numeric($_GET['survey_id'])){
-	Display::display_header(get_lang('SurveyPreview'));
-	Display::display_error_message(get_lang('InvallidSurvey'), false);
-	Display::display_footer();
+if (!isset($_GET['survey_id']) || !is_numeric($_GET['survey_id'])) {
+    api_not_allowed(true, Display::return_message(get_lang('InvallidSurvey'), 'error', false));
 	exit;
 }
 
@@ -54,17 +52,21 @@ $survey_id = intval($_GET['survey_id']);
 $survey_data = SurveyManager::get_survey($survey_id);
 
 if (empty($survey_data)) {
-	Display::display_header(get_lang('SurveyPreview'));
-	Display::display_error_message(get_lang('InvallidSurvey'), false);
-	Display::display_footer();
+    api_not_allowed(true, Display::return_message(get_lang('InvallidSurvey'), 'error', false));
 	exit;
 }
 
 $urlname = strip_tags($survey_data['title']);
 if (api_is_allowed_to_edit()) {
 	// Breadcrumbs
-	$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php', 'name' => get_lang('SurveyList'));
-	$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id, 'name' => $urlname);
+	$interbreadcrumb[] = array(
+        'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq(),
+        'name' => get_lang('SurveyList')
+    );
+    $interbreadcrumb[] = array(
+        'url' => api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&'.api_get_cidreq(),
+        'name' => $urlname,
+    );
 }
 $courseCode = isset($_GET['cidReq']) ? $_GET['cidReq'] : null;
 $surveyAnonymous = SurveyManager::get_survey($survey_id, 0, $courseCode);
@@ -81,14 +83,6 @@ Display :: display_header(get_lang('SurveyPreview'));
 
 // We exit here is the first or last question is a pagebreak (which causes errors)
 SurveyUtil::check_first_last_question($survey_id, false);
-
-// Only a course admin is allowed to preview a survey: you are NOT a course admin => error message
-
-/*
-if (!api_is_allowed_to_edit(false, true)) {
-	Display :: display_error_message(get_lang('NotAllowed'), false);
-}*/
-
 $counter_question = 0;
 // Only a course admin is allowed to preview a survey: you are a course admin
 if (api_is_course_admin() ||
@@ -235,5 +229,4 @@ if (api_is_course_admin() ||
 	Display :: display_error_message(get_lang('NotAllowed'), false);
 }
 
-// Footer
 Display :: display_footer();

+ 9 - 8
main/survey/reporting.php

@@ -24,19 +24,21 @@ $survey_data = SurveyManager::get_survey($survey_id);
 if (isset($_POST['export_report']) && $_POST['export_report']) {
     switch ($_POST['export_format']) {
         case 'xls':
+            $userId = isset($_GET['user_id']) ? $_GET['user_id'] : 0;
             $filename = 'survey_results_'.$survey_id.'.xls';
             $data = SurveyUtil::export_complete_report_xls(
                 $survey_data,
                 $filename,
-                $_GET['user_id']
+                $userId
             );
             exit;
             break;
         case 'csv':
         default:
+            $userId = isset($_GET['user_id']) ? $_GET['user_id'] : 0;
             $data = SurveyUtil::export_complete_report(
                 $survey_data,
-                $_GET['user_id']
+                $userId
             );
             $filename = 'survey_results_'.$survey_id.'.csv';
 
@@ -158,17 +160,16 @@ if (!isset($_GET['action']) ||
     $_GET['action'] == 'overview'
 ) {
     $myweb_survey_id = $survey_id;
-    echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&amp;survey_id='.$myweb_survey_id.'&amp;'.$cidReq.'&amp;single_page=1">'.
+    echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&survey_id='.$myweb_survey_id.'&'.$cidReq.'&single_page=1">'.
         Display::return_icon('survey_reporting_overall.png',get_lang('QuestionsOverallReport')).' '.get_lang('QuestionsOverallReport').'</a></div><div class="sectioncomment">'.get_lang('QuestionsOverallReportDetail').' </div>';
-    echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&amp;survey_id='.$myweb_survey_id.'&'.$cidReq.'">'.
+    echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&survey_id='.$myweb_survey_id.'&'.$cidReq.'">'.
         Display::return_icon('survey_reporting_question.gif',get_lang('DetailedReportByQuestion')).' '.get_lang('DetailedReportByQuestion').'</a></div><div class="sectioncomment">'.get_lang('DetailedReportByQuestionDetail').' </div>';
-    echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&amp;survey_id='.$myweb_survey_id.'&'.$cidReq.'">'.
+    echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&survey_id='.$myweb_survey_id.'&'.$cidReq.'">'.
         Display::return_icon('survey_reporting_user.gif',get_lang('DetailedReportByUser')).' '.get_lang('DetailedReportByUser').'</a></div><div class="sectioncomment">'.get_lang('DetailedReportByUserDetail').'.</div>';
-    echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=comparativereport&amp;survey_id='.$myweb_survey_id.'&'.$cidReq.'">'.
+    echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=comparativereport&survey_id='.$myweb_survey_id.'&'.$cidReq.'">'.
         Display::return_icon('survey_reporting_comparative.gif',get_lang('ComparativeReport')).' '.get_lang('ComparativeReport').'</a></div><div class="sectioncomment">'.get_lang('ComparativeReportDetail').'.</div>';
-    echo '<div class="sectiontitle"><a href="reporting.php?action=completereport&amp;survey_id='.$myweb_survey_id.'&'.$cidReq.'">'.
+    echo '<div class="sectiontitle"><a href="reporting.php?action=completereport&survey_id='.$myweb_survey_id.'&'.$cidReq.'">'.
         Display::return_icon('survey_reporting_complete.gif',get_lang('CompleteReport')).' '.get_lang('CompleteReport').'</a></div><div class="sectioncomment">'.get_lang('CompleteReportDetail').'</div>';
 }
 
-// Footer
 Display :: display_footer();

+ 173 - 120
main/survey/survey.lib.php

@@ -1516,6 +1516,7 @@ class SurveyManager
 
         // Deleting the options of the survey questions
         Database::query($sql);
+
         return true;
     }
 
@@ -1524,7 +1525,7 @@ class SurveyManager
      *
      * @param int $survey_id
      * @param int $question_id
-     * @param int $shared
+     * @param bool $shared
      *
      * @return bool
      *
@@ -1655,6 +1656,9 @@ class SurveyManager
         return $return;
     }
 
+    /**
+     * @return bool
+     */
     public static function survey_generation_hash_available()
     {
         if (extension_loaded('mcrypt')) {
@@ -1663,12 +1667,28 @@ class SurveyManager
         return false;
     }
 
+    /**
+     * @param int $survey_id
+     * @param int $course_id
+     * @param int $session_id
+     * @param int $group_id
+     * @return string
+     */
     public static function generate_survey_hash($survey_id, $course_id, $session_id, $group_id)
     {
         $hash = hash('sha512', api_get_security_key().'_'.$course_id.'_'.$session_id.'_'.$group_id.'_'.$survey_id);
         return $hash;
     }
 
+    /**
+     * @param int $survey_id
+     * @param int $course_id
+     * @param int $session_id
+     * @param int $group_id
+     * @param string $hash
+     *
+     * @return bool
+     */
     public static function validate_survey_hash($survey_id, $course_id, $session_id, $group_id, $hash)
     {
         $survey_generated_hash = self::generate_survey_hash($survey_id, $course_id, $session_id, $group_id);
@@ -1678,6 +1698,14 @@ class SurveyManager
         return false;
     }
 
+    /**
+     * @param int $survey_id
+     * @param int $course_id
+     * @param int $session_id
+     * @param int $group_id
+     *
+     * @return string
+     */
     public static function generate_survey_link($survey_id, $course_id, $session_id, $group_id)
     {
         $code = self::generate_survey_hash($survey_id, $course_id, $session_id, $group_id);
@@ -1699,7 +1727,7 @@ class SurveyUtil
      * @param	boolean	Optional. Whether to continue the current process or exit when breaking condition found. Defaults to true (do not break).
      * @return	void
      */
-    static function check_first_last_question($survey_id, $continue = true)
+    public static function check_first_last_question($survey_id, $continue = true)
     {
         // Table definitions
         $tbl_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
@@ -1743,7 +1771,7 @@ class SurveyUtil
      * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
      * @version January 2007
      */
-    static function remove_answer($user, $survey_id, $question_id, $course_id) {
+    public static function remove_answer($user, $survey_id, $question_id, $course_id) {
         $course_id = intval($course_id);
         // table definition
         $table_survey_answer 		= Database :: get_course_table(TABLE_SURVEY_ANSWER);
@@ -1769,7 +1797,7 @@ class SurveyUtil
      * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
      * @version January 2007
      */
-    static function store_answer($user, $survey_id, $question_id, $option_id, $option_value, $survey_data)
+    public static function store_answer($user, $survey_id, $question_id, $option_id, $option_value, $survey_data)
     {
         // Table definition
         $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER);
@@ -1808,7 +1836,7 @@ class SurveyUtil
      * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
      * @version February 2007
      */
-    static function check_parameters($people_filled)
+    public static function check_parameters($people_filled)
     {
         $error = false;
 
@@ -1911,17 +1939,17 @@ class SurveyUtil
 
     /**
      * This function deletes the report of an user who wants to retake the survey
-     * @param integer survey_id
-     * @param integer user_id
+     * @param integer $survey_id
+     * @param integer $user_id
      * @return void
      * @author Christian Fasanando Flores <christian.fasanando@dokeos.com>
      * @version November 2008
      */
-    function delete_user_report($survey_id, $user_id)
+    public static function delete_user_report($survey_id, $user_id)
     {
-        $table_survey_answer 		= Database :: get_course_table(TABLE_SURVEY_ANSWER);
-        $table_survey_invitation 	= Database :: get_course_table(TABLE_SURVEY_INVITATION);
-        $table_survey 				= Database :: get_course_table(TABLE_SURVEY);
+        $table_survey_answer = Database:: get_course_table(TABLE_SURVEY_ANSWER);
+        $table_survey_invitation = Database:: get_course_table(TABLE_SURVEY_INVITATION);
+        $table_survey = Database:: get_course_table(TABLE_SURVEY);
 
         $course_id = api_get_course_int_id();
 
@@ -1967,14 +1995,16 @@ class SurveyUtil
         $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
         $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER);
 
+        $surveyId = isset($_GET['survey_id']) ? (int) $_GET['survey_id'] : 0;
+
         // Actions bar
         echo '<div class="actions">';
-        echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'">'.
+        echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'.
             Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>';
         if (isset($_GET['user'])) {
             if (api_is_allowed_to_edit()) {
                 // The delete link
-                echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=deleteuserreport&survey_id='.Security::remove_XSS($_GET['survey_id']).'&user='.Security::remove_XSS($_GET['user']).'" >'.
+                echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=deleteuserreport&survey_id='.$surveyId.'&'.api_get_cidreq().'&user='.Security::remove_XSS($_GET['user']).'" >'.
                     Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_MEDIUM).'</a>';
             }
 
@@ -1983,15 +2013,15 @@ class SurveyUtil
                 Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> ';
             echo '<a href="javascript: void(0);" onclick="document.form1b.submit();">'.
                 Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> ';
-            echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&user_id='.Security::remove_XSS($_GET['user']).'">';
+            echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'&user_id='.Security::remove_XSS($_GET['user']).'">';
             echo '<input type="hidden" name="export_report" value="export_report">';
             echo '<input type="hidden" name="export_format" value="csv">';
             echo '</form>';
-            echo '<form id="form1b" name="form1b" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&user_id='.Security::remove_XSS($_GET['user']).'">';
+            echo '<form id="form1b" name="form1b" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'&user_id='.Security::remove_XSS($_GET['user']).'">';
             echo '<input type="hidden" name="export_report" value="export_report">';
             echo '<input type="hidden" name="export_format" value="xls">';
             echo '</form>';
-            echo '<form id="form2" name="form2" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'">';
+            echo '<form id="form2" name="form2" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'">';
         }
         echo '</div>';
 
@@ -2145,9 +2175,9 @@ class SurveyUtil
         $singlePage = isset($_GET['single_page']) ? intval($_GET['single_page']) : 0;
         $course_id = api_get_course_int_id();
         // Database table definitions
-        $table_survey_question 			= Database :: get_course_table(TABLE_SURVEY_QUESTION);
-        $table_survey_question_option 	= Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
-        $table_survey_answer 			= Database :: get_course_table(TABLE_SURVEY_ANSWER);
+        $table_survey_question = Database:: get_course_table(TABLE_SURVEY_QUESTION);
+        $table_survey_question_option = Database:: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
+        $table_survey_answer = Database:: get_course_table(TABLE_SURVEY_ANSWER);
 
         // Determining the offset of the sql statement (the n-th question of the survey)
         $offset = !isset($_GET['question']) ? 0 : intval($_GET['question']);
@@ -2165,8 +2195,6 @@ class SurveyUtil
             $limitStatement = null;
             if (!$singlePage) {
                 echo '<div id="question_report_questionnumbers" class="pagination">';
-                /* echo '<ul><li class="disabled"><a href="#">'.get_lang('Question').'</a></li>'; */
-
                 if ($currentQuestion != 0) {
                     echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($offset - 1) . '">' . get_lang('PreviousQuestion') . '</a></li>';
                 }
@@ -2177,9 +2205,6 @@ class SurveyUtil
                     } else {
                         echo '<li class="disabled"s><a href="#">' . $i . '</a></li>';
                     }
-                    /*if ($i < $survey_data['number_of_questions']) {
-                        echo ' | ';
-                    }*/
                 }
                 if ($currentQuestion < ($survey_data['number_of_questions'] - 1)) {
                     echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($offset + 1) . '">' . get_lang('NextQuestion') . '</li></a>';
@@ -2203,20 +2228,6 @@ class SurveyUtil
             while ($row = Database::fetch_array($result)) {
                 $questions[$row['question_id']] = $row;
             }
-
-            // Navigate through the questions (next and previous)
-            /*if ($currentQuestion != 0 ) {
-                echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.Security::remove_XSS($_GET['action']).'&'.api_get_cidreq().'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&question='.Security::remove_XSS($offset-1).'">'.
-                    Display::return_icon('action_prev.png', get_lang('PreviousQuestion'), array('align' => 'middle')).' '.get_lang('PreviousQuestion').'</a>  ';
-            } else {
-                echo Display::return_icon('action_prev.png', get_lang('PreviousQuestion'), array('align' => 'middle')).' '.get_lang('PreviousQuestion').' ';
-            }
-            echo ' | ';
-            if ($currentQuestion < ($survey_data['number_of_questions'] - 1)) {
-                echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.Security::remove_XSS($_GET['action']).'&'.api_get_cidreq().'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&question='.Security::remove_XSS($offset+1).'">'.get_lang('NextQuestion').' '.Display::return_icon('action_next.png', get_lang('NextQuestion'), array('align' => 'middle')).'</a>';
-            } else {
-                echo get_lang('NextQuestion').' '.Display::return_icon('action_next.png', get_lang('NextQuestion'), array('align' => 'middle'));
-            }*/
         }
 
         foreach ($questions as $question) {
@@ -2302,6 +2313,7 @@ class SurveyUtil
                         if ($question['type'] == 'percentage' && empty($absolute_number)) {
                             continue;
                         }
+                        $number_of_answers[$option['question_id']] = isset($number_of_answers[$option['question_id']]) ? $number_of_answers[$option['question_id']] : 0;
                         if ($number_of_answers[$option['question_id']] == 0) {
                             $answers_number = 0;
                         } else {
@@ -2483,6 +2495,8 @@ class SurveyUtil
         $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
         $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER);
 
+        $surveyId = isset($_GET['survey_id']) ? intval($_GET['survey_id']) : 0;
+
         // Actions bar
         echo '<div class="actions">';
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'">
@@ -2494,24 +2508,26 @@ class SurveyUtil
         echo '</div>';
 
         // The form
-        echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'">';
+        echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'">';
         echo '<input type="hidden" name="export_report" value="export_report">';
         echo '<input type="hidden" name="export_format" value="csv">';
         echo '</form>';
-        echo '<form id="form1b" name="form1b" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'">';
+        echo '<form id="form1b" name="form1b" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'">';
         echo '<input type="hidden" name="export_report" value="export_report">';
         echo '<input type="hidden" name="export_format" value="xls">';
         echo '</form>';
 
-        echo '<form id="form2" name="form2" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'">';
+        echo '<form id="form2" name="form2" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'">';
 
         // The table
         echo '<br /><table class="data_table" border="1">';
         // Getting the number of options per question
         echo '	<tr>';
         echo '		<th>';
-        if (isset($_POST['submit_question_filter']) && $_POST['submit_question_filter'] ||
-            isset($_POST['export_report']) && $_POST['export_report']) {
+        if (
+            (isset($_POST['submit_question_filter']) && $_POST['submit_question_filter']) ||
+            (isset($_POST['export_report']) && $_POST['export_report'])
+        ) {
             echo '<button class="cancel" type="submit" name="reset_question_filter" value="'.get_lang('ResetQuestionFilter').'">'.get_lang('ResetQuestionFilter').'</button>';
         }
         echo '<button class="save" type="submit" name="submit_question_filter" value="'.get_lang('SubmitQuestionFilter').'">'.get_lang('SubmitQuestionFilter').'</button>';
@@ -2534,16 +2550,6 @@ class SurveyUtil
         }
 
         $course_id = api_get_course_int_id();
-
-        // Get all the questions ordered by the "sort" column
-        // <hub> modify the query to display open questions too
-        //		$sql = "SELECT q.question_id, q.type, q.survey_question, count(o.question_option_id) as number_of_options
-        //				FROM $table_survey_question q LEFT JOIN $table_survey_question_option o
-        //				ON q.question_id = o.question_id
-        //				WHERE q.question_id = o.question_id
-        //				AND q.survey_id = '".Database::escape_string($_GET['survey_id'])."'
-        //				GROUP BY q.question_id
-        //				ORDER BY q.sort ASC";
         $sql = "SELECT q.question_id, q.type, q.survey_question, count(o.question_option_id) as number_of_options
 				FROM $table_survey_question q LEFT JOIN $table_survey_question_option o
 				ON q.question_id = o.question_id
@@ -2552,16 +2558,14 @@ class SurveyUtil
 				o.c_id = $course_id
 				GROUP BY q.question_id
 				ORDER BY q.sort ASC";
-        // </hub>
         $result = Database::query($sql);
         while ($row = Database::fetch_array($result)) {
             // We show the questions if
             // 1. there is no question filter and the export button has not been clicked
             // 2. there is a quesiton filter but the question is selected for display
-            //if (!($_POST['submit_question_filter'] || $_POST['export_report']) || in_array($row['question_id'], $_POST['questions_filter'])) {
             if (!(isset($_POST['submit_question_filter']) && $_POST['submit_question_filter']) ||
-                (is_array($_POST['questions_filter']) &&
-                    in_array($row['question_id'], $_POST['questions_filter']))) {
+                (is_array($_POST['questions_filter']) && in_array($row['question_id'], $_POST['questions_filter']))
+            ) {
                 // We do not show comment and pagebreak question types
                 if ($row['type'] != 'comment' && $row['type'] != 'pagebreak') {
                     echo ' <th';
@@ -2595,15 +2599,16 @@ class SurveyUtil
         }
 
         // cells with option (none for open question)
-        $sql = "SELECT 	sq.question_id, sq.survey_id,
-						sq.survey_question, sq.display,
-						sq.sort, sq.type, sqo.question_option_id,
-						sqo.option_text, sqo.sort as option_sort
+        $sql = "SELECT 	
+                    sq.question_id, sq.survey_id,
+                    sq.survey_question, sq.display,
+                    sq.sort, sq.type, sqo.question_option_id,
+                    sqo.option_text, sqo.sort as option_sort
 				FROM $table_survey_question sq
 				LEFT JOIN $table_survey_question_option sqo
 				ON sq.question_id = sqo.question_id
 				WHERE
-				    sq.survey_id = '".Database::escape_string($_GET['survey_id'])."' AND
+				    sq.survey_id = '".intval($_GET['survey_id'])."' AND
                     sq.c_id = $course_id AND
                     sqo.c_id = $course_id
 				ORDER BY sq.sort ASC, sqo.sort ASC";
@@ -2707,7 +2712,7 @@ class SurveyUtil
      * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
      * @version February 2007 - Updated March 2008
      */
-    static function display_complete_report_row(
+    public static function display_complete_report_row(
         $survey_data,
         $possible_options,
         $answers_of_user,
@@ -2820,8 +2825,9 @@ class SurveyUtil
             // We show the questions if
             // 1. there is no question filter and the export button has not been clicked
             // 2. there is a quesiton filter but the question is selected for display
-            if (!($_POST['submit_question_filter']) ||
-                (is_array($_POST['questions_filter']) &&
+            if (!(isset($_POST['submit_question_filter'])) ||
+                (isset($_POST['submit_question_filter']) &&
+                    is_array($_POST['questions_filter']) &&
                     in_array($row['question_id'], $_POST['questions_filter']))
             ) {
                 // We do not show comment and pagebreak question types
@@ -2874,7 +2880,8 @@ class SurveyUtil
             // We show the options if
             // 1. there is no question filter and the export button has not been clicked
             // 2. there is a quesiton filter but the question is selected for display
-            if (!($_POST['submit_question_filter']) || (is_array($_POST['questions_filter']) &&
+            if (!($_POST['submit_question_filter']) || (
+                is_array($_POST['questions_filter']) &&
                 in_array($row['question_id'], $_POST['questions_filter']))
             ) {
                 // We do not show comment and pagebreak question types
@@ -2943,7 +2950,7 @@ class SurveyUtil
      * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
      * @version February 2007
      */
-    static function export_complete_report_row(
+    public static function export_complete_report_row(
         $survey_data,
         $possible_options,
         $answers_of_user,
@@ -3009,7 +3016,7 @@ class SurveyUtil
      * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
      * @version February 2007
      */
-    static function export_complete_report_xls($survey_data, $filename, $user_id = 0)
+    public static function export_complete_report_xls($survey_data, $filename, $user_id = 0)
     {
         $spreadsheet = new PHPExcel();
         $spreadsheet->setActiveSheetIndex(0);
@@ -3055,7 +3062,7 @@ class SurveyUtil
             // We show the questions if
             // 1. there is no question filter and the export button has not been clicked
             // 2. there is a quesiton filter but the question is selected for display
-            if (!($_POST['submit_question_filter']) || (is_array($_POST['questions_filter']) &&
+            if (!(isset($_POST['submit_question_filter'])) || (isset($_POST['submit_question_filter']) && is_array($_POST['questions_filter']) &&
                 in_array($row['question_id'], $_POST['questions_filter']))
             ) {
                 // We do not show comment and pagebreak question types
@@ -3104,13 +3111,21 @@ class SurveyUtil
 
         // Getting all the questions and options (second line)
         $sql = "SELECT
-                    survey_question.question_id, survey_question.survey_id, survey_question.survey_question, survey_question.display, survey_question.sort, survey_question.type,
-                    survey_question_option.question_option_id, survey_question_option.option_text, survey_question_option.sort as option_sort
+                    survey_question.question_id, 
+                    survey_question.survey_id, 
+                    survey_question.survey_question, 
+                    survey_question.display, 
+                    survey_question.sort, 
+                    survey_question.type,
+                    survey_question_option.question_option_id, 
+                    survey_question_option.option_text, 
+                    survey_question_option.sort as option_sort
 				FROM $table_survey_question survey_question
 				LEFT JOIN $table_survey_question_option survey_question_option
 				ON survey_question.question_id = survey_question_option.question_id AND survey_question_option.c_id = $course_id
-				WHERE survey_question.survey_id = '".intval($_GET['survey_id'])."' AND
-				survey_question.c_id = $course_id
+				WHERE 
+				    survey_question.survey_id = '".intval($_GET['survey_id'])."' AND
+				    survey_question.c_id = $course_id
 				ORDER BY survey_question.sort ASC, survey_question_option.sort ASC";
         $result = Database::query($sql);
         $possible_answers = array();
@@ -3119,8 +3134,8 @@ class SurveyUtil
             // We show the options if
             // 1. there is no question filter and the export button has not been clicked
             // 2. there is a quesiton filter but the question is selected for display
-            if (!($_POST['submit_question_filter']) ||
-                (is_array($_POST['questions_filter']) && in_array($row['question_id'], $_POST['questions_filter']))
+            if (!isset($_POST['submit_question_filter']) ||
+                (isset($_POST['questions_filter']) && is_array($_POST['questions_filter']) && in_array($row['question_id'], $_POST['questions_filter']))
             ) {
                 // We do not show comment and pagebreak question types
                 if ($row['type'] != 'comment' && $row['type'] != 'pagebreak') {
@@ -3240,7 +3255,7 @@ class SurveyUtil
         if ($display_extra_user_fields) {
             //show user fields data, if any, for this user
             $user_fields_values = UserManager::get_extra_user_data(intval($user),false,false, false, true);
-            foreach($user_fields_values as $value) {
+            foreach ($user_fields_values as $value) {
                 $return[] = api_html_entity_decode(strip_tags($value), ENT_QUOTES);
             }
         }
@@ -3249,12 +3264,11 @@ class SurveyUtil
             foreach ($possible_options as $question_id => & $possible_option) {
                 if (is_array($possible_option) && count($possible_option) > 0) {
                     foreach ($possible_option as $option_id => & $value) {
-                        $my_answers_of_user = ($answers_of_user[$question_id]==null) ? array() : $answers_of_user[$question_id];
+                        $my_answers_of_user = isset($answers_of_user[$question_id]) ? $answers_of_user[$question_id] : [];
                         $key = array_keys($my_answers_of_user);
-                        if (substr($key[0], 0, 4) == 'open') {
+                        if (isset($key[0]) && substr($key[0], 0, 4) == 'open') {
                             $return[] = api_html_entity_decode(strip_tags($answers_of_user[$question_id][$key[0]]['option_id']), ENT_QUOTES);
                         } elseif (!empty($answers_of_user[$question_id][$option_id])) {
-                            //$return .= 'v';
                             if ($answers_of_user[$question_id][$option_id]['value'] != 0) {
                                 $return[] = $answers_of_user[$question_id][$option_id]['value'];
                             } else {
@@ -3290,15 +3304,17 @@ class SurveyUtil
             'multipleresponse',
             'dropdown',
             'percentage',
-            'score',
+            'score'
         );
 
+        $surveyId = isset($_GET['survey_id']) ? (int) $_GET['survey_id'] : 0;
+
         // Getting all the questions
-        $questions = SurveyManager::get_questions($_GET['survey_id']);
+        $questions = SurveyManager::get_questions($surveyId);
 
         // Actions bar
         echo '<div class="actions">';
-        echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.intval($_GET['survey_id']).'">'.
+        echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'.
                 Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>';
         echo '</div>';
 
@@ -3306,10 +3322,10 @@ class SurveyUtil
         Display::display_normal_message(get_lang('OnlyQuestionsWithPredefinedAnswers'), false);
 
         // The form for selecting the axis of the table
-        echo '<form id="form1" name="form1" method="get" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.intval($_GET['survey_id']).'&xaxis='.Security::remove_XSS($_GET['xaxis']).'&y='.Security::remove_XSS($_GET['yaxis']).'">';
+        echo '<form id="form1" name="form1" method="get" action="'.api_get_self().'?'.api_get_cidreq().'&action='.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&xaxis='.Security::remove_XSS($_GET['xaxis']).'&y='.Security::remove_XSS($_GET['yaxis']).'">';
         // Survey_id
         echo '<input type="hidden" name="action" value="'.Security::remove_XSS($_GET['action']).'"/>';
-        echo '<input type="hidden" name="survey_id" value="'.Security::remove_XSS($_GET['survey_id']).'"/>';
+        echo '<input type="hidden" name="survey_id" value="'.$surveyId.'"/>';
         // X axis
         echo get_lang('SelectXAxis').': ';
         echo '<select name="xaxis">';
@@ -3356,8 +3372,8 @@ class SurveyUtil
 
         if (isset($_GET['xaxis']) && is_numeric($_GET['xaxis']) && isset($_GET['yaxis']) && is_numeric($_GET['yaxis'])) {
             // Getting the answers of the two questions
-            $answers_x = SurveyUtil::get_answers_of_question_by_user($_GET['survey_id'], $_GET['xaxis']);
-            $answers_y = SurveyUtil::get_answers_of_question_by_user($_GET['survey_id'], $_GET['yaxis']);
+            $answers_x = SurveyUtil::get_answers_of_question_by_user($surveyId, $_GET['xaxis']);
+            $answers_y = SurveyUtil::get_answers_of_question_by_user($surveyId, $_GET['yaxis']);
 
             // Displaying the table
             $tableHtml = '<table border="1" class="data_table">';
@@ -3461,7 +3477,14 @@ class SurveyUtil
                                     break;
                                 } else {
                                     $tableHtml .=  '		<td align="center">';
-                                    $votes =  SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)], $x, 0);
+                                    $votes =  SurveyUtil::comparative_check(
+                                        $answers_x,
+                                        $answers_y,
+                                        $question_x['answersid'][($ii-1)],
+                                        $question_y['answersid'][($ij)],
+                                        $x,
+                                        0
+                                    );
                                     $tableHtml .= $votes;
                                     array_push(
                                         $chartData,
@@ -3524,6 +3547,7 @@ class SurveyUtil
                 AND question_id='".intval($question_id)."'
                 ORDER BY USER ASC";
         $result = Database::query($sql);
+        $return = [];
         while ($row = Database::fetch_array($result)) {
             if ($row['value'] == 0) {
                 $return[$row['user']][] = $row['option_id'];
@@ -3531,6 +3555,7 @@ class SurveyUtil
                 $return[$row['user']][] = $row['option_id'].'*'.$row['value'];
             }
         }
+
         return $return;
     }
 
@@ -4331,7 +4356,7 @@ class SurveyUtil
     public static function get_number_of_surveys_for_coach()
     {
         $survey_tree = new SurveyTree();
-        return count($survey_tree->get_last_children_from_branch($survey_tree->surveylist));
+        return count($survey_tree->surveylist);
     }
 
     /**
@@ -4438,10 +4463,18 @@ class SurveyUtil
         return $surveys;
     }
 
+    /**
+     * @param $from
+     * @param $number_of_items
+     * @param $column
+     * @param $direction
+     * @return array
+     */
     public static function get_survey_data_for_coach($from, $number_of_items, $column, $direction)
     {
         $survey_tree = new SurveyTree();
-        $last_version_surveys = $survey_tree->get_last_children_from_branch($survey_tree->surveylist);
+        //$last_version_surveys = $survey_tree->get_last_children_from_branch($survey_tree->surveylist);
+        $last_version_surveys = $survey_tree->surveylist;
         $list = array();
         foreach ($last_version_surveys as & $survey) {
             $list[]=$survey['id'];
@@ -4465,22 +4498,22 @@ class SurveyUtil
 
         $course_id = api_get_course_int_id();
 
-        $sql = "SELECT ".
-            "survey.survey_id							AS col0, ".
-            "survey.title	                            AS col1, ".
-            "survey.code									AS col2, ".
-            "count(survey_question.question_id)			AS col3, ".
-            (api_is_western_name_order() ? "CONCAT(user.firstname, ' ', user.lastname)" : "CONCAT(user.lastname, ' ', user.firstname)")."	AS col4, ".
-            "survey.avail_from							AS col5, ".
-            "survey.avail_till							AS col6, ".
-            "CONCAT('<a href=\"survey_invitation.php?view=answered&survey_id=',survey.survey_id,'\">',survey.answered,'</a> / <a href=\"survey_invitation.php?view=invited&survey_id=',survey.survey_id,'\">',survey.invited, '</a>')	AS col7, ".
-            "survey.anonymous							AS col8, ".
-            "survey.survey_id							AS col9  ".
-            "FROM $table_survey survey ".
-            "LEFT JOIN $table_survey_question survey_question
-             ON (survey.survey_id = survey_question.survey_id AND survey.c_id = survey_question.c_id) ".
-            ", $table_user user
-               WHERE survey.author = user.user_id AND survey.c_id = $course_id $list_condition ";
+        $sql = "SELECT 
+            survey.survey_id							AS col0, 
+            survey.title AS col1, 
+            survey.code AS col2, 
+            count(survey_question.question_id)			AS col3, 
+            ".(api_is_western_name_order() ? "CONCAT(user.firstname, ' ', user.lastname)" : "CONCAT(user.lastname, ' ', user.firstname)")."	AS col4,
+            survey.avail_from AS col5,
+            survey.avail_till AS col6,
+            CONCAT('<a href=\"survey_invitation.php?view=answered&survey_id=',survey.survey_id,'\">',survey.answered,'</a> / <a href=\"survey_invitation.php?view=invited&survey_id=',survey.survey_id,'\">',survey.invited, '</a>') AS col7,
+            survey.anonymous AS col8,
+            survey.survey_id AS col9
+            FROM $table_survey survey
+            LEFT JOIN $table_survey_question survey_question
+            ON (survey.survey_id = survey_question.survey_id AND survey.c_id = survey_question.c_id),
+            $table_user user
+            WHERE survey.author = user.user_id AND survey.c_id = $course_id $list_condition ";
         $sql .= " GROUP BY survey.survey_id";
         $sql .= " ORDER BY col$column $direction ";
         $sql .= " LIMIT $from,$number_of_items";
@@ -4752,15 +4785,17 @@ class SurveyUtil
     /**
      * @author Isaac Flores Paz <florespaz@bidsoftperu.com>
      * @param int $user_id - User ID
+     * @param string $survey_code
      * @param int $user_id_answer - User in survey answer table (user id or anonymus)
+     *
      * @return boolean
      */
     public static function show_link_available($user_id, $survey_code, $user_answer)
     {
-        $table_survey             = Database :: get_course_table(TABLE_SURVEY);
-        $table_survey_invitation  = Database :: get_course_table(TABLE_SURVEY_INVITATION);
-        $table_survey_answer      = Database :: get_course_table(TABLE_SURVEY_ANSWER);
-        $table_survey_question    = Database :: get_course_table(TABLE_SURVEY_QUESTION);
+        $table_survey = Database:: get_course_table(TABLE_SURVEY);
+        $table_survey_invitation = Database:: get_course_table(TABLE_SURVEY_INVITATION);
+        $table_survey_answer = Database:: get_course_table(TABLE_SURVEY_ANSWER);
+        $table_survey_question = Database:: get_course_table(TABLE_SURVEY_QUESTION);
 
         $survey_code = Database::escape_string($survey_code);
         $user_id = intval($user_id);
@@ -4770,14 +4805,29 @@ class SurveyUtil
 
         $sql = 'SELECT COUNT(*) as count
                 FROM '.$table_survey_invitation.'
-		        WHERE user='.$user_id.' AND survey_code="'.$survey_code.'" AND answered="1" AND c_id = '.$course_id.' ';
-
-        $sql2 = 'SELECT COUNT(*) as count FROM '.$table_survey.' s INNER JOIN '.$table_survey_question.' q ON s.survey_id=q.survey_id
-				 WHERE s.code="'.$survey_code.'" AND q.type NOT IN("pagebreak","comment") AND s.c_id = '.$course_id.' AND q.c_id = '.$course_id.' ';
-
-        $sql3 = 'SELECT COUNT(DISTINCT question_id) as count FROM '.$table_survey_answer.'
-				 WHERE survey_id=(SELECT survey_id FROM '.$table_survey.'
-				 WHERE code="'.$survey_code.'" AND c_id = '.$course_id.' ) AND user="'.$user_answer.'" AND c_id = '.$course_id.' ';
+		        WHERE
+		            user='.$user_id.' AND
+		            survey_code="'.$survey_code.'" AND 
+		            answered="1" AND 
+		            c_id = '.$course_id;
+
+        $sql2 = 'SELECT COUNT(*) as count FROM '.$table_survey.' s 
+                 INNER JOIN '.$table_survey_question.' q 
+                 ON s.survey_id=q.survey_id
+				 WHERE 
+				    s.code="'.$survey_code.'" AND 
+				    q.type NOT IN("pagebreak","comment") AND s.c_id = '.$course_id.' AND q.c_id = '.$course_id.' ';
+
+        $sql3 = 'SELECT COUNT(DISTINCT question_id) as count 
+                 FROM '.$table_survey_answer.'
+				 WHERE survey_id=(
+				    SELECT survey_id FROM '.$table_survey.'
+				    WHERE 
+				        code = "'.$survey_code.'" AND 
+				        c_id = '.$course_id.' 
+                    )  AND 
+                user="'.$user_answer.'" AND 
+                c_id = '.$course_id;
 
         $result  = Database::query($sql);
         $result2 = Database::query($sql2);
@@ -4788,6 +4838,7 @@ class SurveyUtil
         $row3 = Database::fetch_array($result3, 'ASSOC');
 
         if ($row['count'] == 1 && $row3['count'] != $row2['count']) {
+
             return true;
         } else {
             return false;
@@ -4796,9 +4847,10 @@ class SurveyUtil
 
     /**
      * Display survey question chart
-     * @param	array	Chart data
-     * @param	boolean	Tells if the chart has a serie. False by default
-     * @return	void 	(direct output)
+     * @param   array	$chartData
+     * @param   boolean	$hasSerie Tells if the chart has a serie. False by default
+     * @param   string $chartContainerId
+     * @return	string 	(direct output)
      */
     public static function drawChart($chartData, $hasSerie = false, $chartContainerId = 'chartContainer')
     {
@@ -4853,6 +4905,7 @@ class SurveyUtil
             $htmlChart .= 'myChart.draw();
                 </script>';
         }
+
         return $htmlChart;
     }
 

+ 2 - 4
main/survey/survey.php

@@ -30,10 +30,8 @@ if ($isDrhOfCourse) {
 }
 if (!api_is_allowed_to_edit(false, true) ||
     (api_is_course_coach() && $extend_rights_for_coachs == 'false')
-) {
-	Display :: display_header(get_lang('ToolSurvey'));
-	Display :: display_error_message(get_lang('NotAllowed'), false);
-	Display :: display_footer();
+) {    
+    api_not_allowed(true);
 	exit;
 }
 

+ 1 - 4
main/survey/survey_list.php

@@ -175,8 +175,7 @@ if (api_is_course_coach() && $extend_rights_for_coachs == 'false') {
     SurveyUtil::display_survey_list();
 }
 
-// Footer
-Display :: display_footer();
+Display::display_footer();
 
 /* Bypass functions to make direct use from SortableTable possible */
 
@@ -223,5 +222,3 @@ function get_survey_data_drh($from, $number_of_items, $column, $direction)
 {
     return SurveyUtil::get_survey_data($from, $number_of_items, $column, $direction, true);
 }
-
-

+ 4 - 0
main/template/default/auth/session_catalog.tpl

@@ -99,6 +99,10 @@
                         </a>
                     </h4>
                     <div class="toolbar">
+                        <div class="info">
+                            <span><i class="fa fa-book" aria-hidden="true"></i> {{ item.nbr_courses }} {{ 'Courses'|get_lang }}</span>
+                            <span><i class="fa fa-user" aria-hidden="true"></i> {{ item.nbr_users }} {{ 'NbUsers'|get_lang }} </span>
+                        </div>
                         {% if not _u.logged %}
                             &nbsp;
                         {% else %}

+ 91 - 0
main/template/default/user_portal/grid_session.tpl

@@ -0,0 +1,91 @@
+{% for row in session %}
+<div id="session-{{ item.id }}" class="session panel panel-default">
+    <div class="panel-heading">
+        <img id="session_img_{{ row.id }}" src="{{ "window_list.png"|icon(32) }}" width="32" height="32" alt="{{ row.title }}" title="{{ row.title }}" /> {{ row.title }}
+        
+        {% if row.edit_actions != '' %}
+        <div class="pull-right">
+            <a class="btn btn-default btn-sm" href="{{ row.edit_actions }}">
+                <i class="fa fa-pencil" aria-hidden="true"></i>
+            </a>
+        </div>
+        {% endif %}
+    </div>
+    <div class="panel-body">
+        {% if row.description != '' %}
+            {{ row.description }}
+        {% endif %}
+        <div class="info-session">
+            <span><i class="fa fa-user" aria-hidden="true"></i>
+            {{ row.coach_name }}
+            </span>
+            <span><i class="fa fa-calendar" aria-hidden="true"></i>
+            {{ row.date }}
+            </span>
+        </div>
+        <div class="grid-courses">
+            <div class="row">
+            {% for item in row.courses %}
+            <div class="col-md-4 col-sm-4 col-xs-6">
+                <div class="items">
+                    <div class="image">
+                        <img src="{{ item.icon }}" class="img-responsive">
+                        {% if item.category != '' %}
+                        <span class="category">{{ item.category }}</span>
+                        <div class="cribbon"></div>
+                        {% endif %}
+                        <div class="black-shadow">
+                            <div class="author-card">  
+                            {% for teacher in item.teachers %}
+                                {% set counter = counter + 1 %}
+                                {% if counter <= 3 %}
+                                <a href="{{ teacher.url }}" class="ajax" data-title="{{ teacher.firstname }} {{ teacher.lastname }}">
+                                    <img src="{{ teacher.avatar }}"/>
+                                </a>
+                                <div class="teachers-details">
+                                     <h5>
+                                        <a href="{{ teacher.url }}" class="ajax" data-title="{{ teacher.firstname }} {{ teacher.lastname }}">
+                                            {{ teacher.firstname }} {{ teacher.lastname }}
+                                        </a>
+                                     </h5>
+                                </div>       
+                                {% endif %}
+                            {% endfor %}
+                            </div>
+                        </div>
+                        {% if item.edit_actions != '' %}
+                            <div class="admin-actions">
+                                {% if item.document == '' %}
+                                    <a class="btn btn-default btn-sm" href="{{ item.edit_actions }}">
+                                        <i class="fa fa-pencil" aria-hidden="true"></i>
+                                    </a>
+                                {% else %}
+                                    <div class="btn-group" role="group">
+                                        <a class="btn btn-default btn-sm" href="{{ item.edit_actions }}">
+                                            <i class="fa fa-pencil" aria-hidden="true"></i>
+                                        </a>
+                                        {{ item.document }}
+                                    </div> 
+                                {% endif %}
+                            </div>
+                        {% endif %}
+                    </div>
+                    <div class="description">
+                        <h4 class="title">
+                            {% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %}
+                                {{ item.title }} {{ item.code_course }}
+                            {% else %}
+                                <a href="{{ item.link }}">{{ item.title }} {{ item.code_course }}</a>
+                            {% endif %}
+                        </h4>
+                        <div class="notifications">{{ item.notifications }}</div>
+
+                    </div>
+                </div>
+            </div>
+        {% endfor %}
+        </div>
+        </div>
+    </div>
+</div>
+{% endfor %}

+ 0 - 3
main/template/default/user_portal/index.tpl

@@ -1,3 +0,0 @@
-{% for item in items %}
-    {{ item }}
-{% endfor %}

+ 0 - 5
main/template/default/user_portal/index_grid.tpl

@@ -1,5 +0,0 @@
-{% for item in items %}
-    <div class="well">
-        {{ item }}
-    </div>
-{% endfor %}

+ 57 - 53
main/template/default/user_portal/session.tpl

@@ -1,30 +1,30 @@
-
+{% for row in session %}
 <div class="panel panel-default">
-    {% if not session.show_simple_session_info %}
+    {% if not row.show_simple_session_info %}
         {% set collapsable = '' %}
         <div class="panel-heading">
-        {% if session.course_list_session_style == 1 %}
+        {% if row.course_list_session_style == 1 %}
             {# Classic #}
-                <a href="{{ _p.web_main ~ 'session/index.php?session_id=' ~ session.id }}">
-                <img id="session_img_{{ session.id }}" src="{{ "window_list.png"|icon(32) }}" width="32" height="32" alt="{{ session.title }}" title="{{ session.title }}" />
-                    {{ session.title }}
+                <a href="{{ _p.web_main ~ 'session/index.php?session_id=' ~ row.id }}">
+                <img id="session_img_{{ row.id }}" src="{{ "window_list.png"|icon(32) }}" width="32" height="32" alt="{{ row.title }}" title="{{ row.title }}" />
+                    {{ row.title }}
                 </a>
-        {% elseif session.course_list_session_style == 2 %}
+        {% elseif row.course_list_session_style == 2 %}
             {# No link #}
-            <img id="session_img_{{ session.id }}" src="{{ "window_list.png"|icon(32) }}" width="32" height="32" alt="{{ session.title }}" title="{{ session.title }}" />
-                {{ session.title }}
-        {% elseif session.course_list_session_style == 3 %}
+            <img id="session_img_{{ row.id }}" src="{{ "window_list.png"|icon(32) }}" width="32" height="32" alt="{{ row.title }}" title="{{ row.title }}" />
+                {{ row.title }}
+        {% elseif row.course_list_session_style == 3 %}
             {# Foldable #}
-            <a role="button" data-toggle="collapse" data-parent="#page-content" href="#collapse_{{ session.id }}" aria-expanded="false" >
-                <img id="session_img_{{ session.id }}" src="{{ "window_list.png"|icon(32) }}" width="32" height="32" alt="{{ session.title }}" title="{{ session.title }}" />
-                {{ session.title }}
+            <a role="button" data-toggle="collapse" data-parent="#page-content" href="#collapse_{{ row.id }}" aria-expanded="false" >
+                <img id="session_img_{{ row.id }}" src="{{ "window_list.png"|icon(32) }}" width="32" height="32" alt="{{ row.title }}" title="{{ row.title }}" />
+                {{ row.title }}
             </a>
             {% set collapsable = 'collapse' %}
             {% endif %}
 
-            {% if session.show_actions %}
+            {% if row.show_actions %}
                 <div class="pull-right">
-                    <a href="{{ _p.web_main ~ "session/resume_session.php?id_session=" ~ session.id }}">
+                    <a href="{{ _p.web_main ~ "session/resume_session.php?id_session=" ~ row.id }}">
                     <img src="{{ "edit.png"|icon(22) }}" width="22" height="22" alt="{{ "Edit"|get_lang }}" title="{{ "Edit"|get_lang }}" />
                     </a>
                 </div>
@@ -32,35 +32,30 @@
         </div>
     {% endif %}
 
-    <div class="sessions panel-body {{ collapsable }}" id="collapse_{{ session.id }}">
-    {% if session.show_simple_session_info %}
+    <div class="session panel-body {{ collapsable }}" id="collapse_{{ row.id }}">
+    {% if row.show_simple_session_info %}
         <div class="row">
             <div class="col-md-7">
-                <h3>
-                    {{ session.title ~ session.notifications }}
-                </h3>
-                {% if session.show_description %}
-                    <div>
-                        {{ session.description }}
-                    </div>
-                {% endif %}
-
-                {% if session.subtitle %}
-                    <small>{{ session.subtitle }}</small>
-                {% endif %}
-
-                {% if session.teachers %}
-                    <h5 class="teacher-name">{{ "teacher.png"|icon(16) ~ session.teachers }}</h5>
+                {% if row.description != '' %}
+                    {{ row.description }}
                 {% endif %}
+                <div class="info-session">
+                    <span><i class="fa fa-user" aria-hidden="true"></i>
+                    {{ row.coach_name }}
+                    </span>
+                    <span><i class="fa fa-calendar" aria-hidden="true"></i>
+                    {{ row.date }}
+                    </span>
+                </div>
 
-                {% if session.coaches %}
-                    <h5 class="teacher-name">{{ "teacher.png"|icon(16) ~ session.coaches }}</h5>
+                {% if row.coaches %}
+                    <h5 class="teacher-name">{{ "teacher.png"|icon(16) ~ row.coaches }}</h5>
                 {% endif %}
             </div>
 
-            {% if session.show_actions %}
+            {% if row.show_actions %}
                 <div class="col-md-5 text-right">
-                    <a href="{{ _p.web_main ~ "session/resume_session.php?id_session=" ~ session.id }}">
+                    <a href="{{ _p.web_main ~ "session/resume_session.php?id_session=" ~ row.id }}">
                         <img src="{{ "edit.png"|icon(22) }}" width="22" height="22" alt="{{ "Edit"|get_lang }}" title="{{ "Edit"|get_lang }}">
                     </a>
                 </div>
@@ -69,39 +64,47 @@
     {% else %}
         <div class="row">
             <div class="col-md-12">
-                {% if session.subtitle %}
-                    <div class="subtitle-session">
-                        <em class="fa fa-clock-o"></em> {{ session.subtitle }}
-                    </div>
-                {% endif %}
-                {% if session.show_description %}
-                    <div class="description-session">
-                        {{ session.description }}
-                    </div>
+                {% if row.description != '' %}
+                    {{ row.description }}
                 {% endif %}
-                <div class="sessions-items">
-                    {% for item in session.courses %}
+                <div class="info-session">
+                    <span><i class="fa fa-user" aria-hidden="true"></i>
+                    {{ row.coach_name }}
+                    </span>
+                    <span><i class="fa fa-calendar" aria-hidden="true"></i>
+                    {{ row.date }}
+                    </span>
+                </div>
+                <div class="sessions-items"> 
+                    {% for item in row.courses %}
+                    <div class="courses">
                         <div class="row">
                             <div class="col-md-2">
                                 {% if item.link %}
-                                    <a href="{{ item.link }}" class="thumbnail">{{ item.icon }}</a>
+                                    <a href="{{ item.link }}" class="thumbnail">
+                                        <img class="img-responsive" src="{{ item.icon }}">
+                                    </a>
                                 {% else %}
-                                    {{ item.icon }}
+                                    {{ 'blackboard.png' | img(48, item.title ) }}
                                 {% endif %}
                             </div>
                             <div class="col-md-10">
-                                {{ item.title }}
-                                {% if item.coaches|length > 0 %}
+                                <h4>{{ item.title }}</h4>
+                                <div class="teachers">
+                                {% if item.teachers|length > 0 %}
                                     <img src="{{ 'teacher.png'|icon(16) }}" width="16" height="16">
-                                    {% for coach in item.coaches %}
+                                    {% for coach in item.teachers %}
                                         {{ loop.index > 1 ? ' | ' }}
                                         <a href="{{ _p.web_ajax ~ 'user_manager.ajax.php?' ~ {'a': 'get_user_popup', 'user_id': coach.user_id}|url_encode() }}" data-title="{{ coach.full_name }}" class="ajax">
-                                            {{ coach.full_name }}
+                                            {{ coach.firstname }},
+                                            {{ coach.lastname }}
                                         </a>
                                     {% endfor %}
                                 {% endif %}
+                                </div>
                             </div>
                         </div>
+                    </div>
                     {% endfor %}
                 </div>
             </div>
@@ -109,3 +112,4 @@
     {% endif %}
     </div>
 </div>
+{% endfor %}

File diff suppressed because it is too large
+ 191 - 160
main/webservices/registration.soap.php


+ 1 - 1
plugin/ticket/src/categories.php

@@ -147,7 +147,7 @@ Display::display_header($toolName);
 $items = [
     [
         'url' => 'categories.php?action=add',
-        'content' => Display::return_icon('new_folder.png', null, null, ICON_SIZE_MEDIUM),
+        'content' => Display::return_icon('new_folder.png', null, null, ICON_SIZE_MEDIUM)
     ]
 ];
 

+ 5 - 2
src/Chamilo/CoreBundle/Entity/Repository/SkillRepository.php

@@ -1,7 +1,9 @@
 <?php
 /* For licensing terms, see /license.txt */
+
 namespace Chamilo\CoreBundle\Entity\Repository;
 
+use Chamilo\CoreBundle\Entity\Skill;
 use \Doctrine\ORM\EntityRepository;
 use \Chamilo\UserBundle\Entity\User;
 use \Chamilo\CoreBundle\Entity\Course;
@@ -13,13 +15,14 @@ use \Doctrine\ORM\Query\Expr\Join;
  *
  * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
  */
-class SkillRepository extends EntityRepository{
-
+class SkillRepository extends EntityRepository
+{
     /**
      * Get the last acquired skill by a user on course and/or session
      * @param User $user The user
      * @param Course $course The course
      * @param Session $session The session
+     *
      * @return Skill
      */
     public function getLastByUser(User $user, Course $course = null, Session $session = null)

+ 12 - 11
src/Chamilo/CoreBundle/Entity/Skill.php

@@ -1,5 +1,4 @@
 <?php
-
 /* For licensing terms, see /license.txt */
 
 /**
@@ -10,6 +9,8 @@
 
 namespace Chamilo\CoreBundle\Entity;
 
+use Chamilo\SkillBundle\Entity\Profile;
+use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\ORM\Mapping as ORM;
 
 /**
@@ -23,6 +24,15 @@ class Skill
     const STATUS_DISABLED = 0;
     const STATUS_ENABLED = 1;
 
+    /**
+     * @var integer
+     *
+     * @ORM\Column(name="id", type="integer")
+     * @ORM\Id
+     * @ORM\GeneratedValue
+     */
+    private $id;
+
     /**
      * @var string
      *
@@ -79,15 +89,6 @@ class Skill
      */
     private $updatedAt;
 
-    /**
-     * @var integer
-     *
-     * @ORM\Column(name="id", type="integer")
-     * @ORM\Id
-     * @ORM\GeneratedValue(strategy="IDENTITY")
-     */
-    private $id;
-
     /**
      * @ORM\ManyToOne(targetEntity="Chamilo\SkillBundle\Entity\Profile", inversedBy="skills")
      * @ORM\JoinColumn(name="profile_id", referencedColumnName="id")
@@ -341,11 +342,11 @@ class Skill
 
     /**
      * Get issuedSkills
+     *
      * @return ArrayCollection
      */
     public function getIssuedSkills()
     {
         return $this->issuedSkills;
     }
-
 }

+ 10 - 11
src/Chamilo/CoreBundle/Entity/SkillProfile.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Chamilo\CoreBundle\Entity;
 
@@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
  */
 class SkillProfile
 {
+    /**
+     * @var integer
+     *
+     * @ORM\Column(name="id", type="integer")
+     * @ORM\Id
+     * @ORM\GeneratedValue
+     */
+    private $id;
+
     /**
      * @var string
      *
@@ -26,17 +36,6 @@ class SkillProfile
      */
     private $description;
 
-    /**
-     * @var integer
-     *
-     * @ORM\Column(name="id", type="integer")
-     * @ORM\Id
-     * @ORM\GeneratedValue(strategy="IDENTITY")
-     */
-    private $id;
-
-
-
     /**
      * Set name
      *

+ 10 - 11
src/Chamilo/CoreBundle/Entity/SkillRelGradebook.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Chamilo\CoreBundle\Entity;
 
@@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
  */
 class SkillRelGradebook
 {
+    /**
+     * @var integer
+     *
+     * @ORM\Column(name="id", type="integer")
+     * @ORM\Id
+     * @ORM\GeneratedValue
+     */
+    private $id;
+
     /**
      * @var integer
      *
@@ -33,17 +43,6 @@ class SkillRelGradebook
      */
     private $type;
 
-    /**
-     * @var integer
-     *
-     * @ORM\Column(name="id", type="integer")
-     * @ORM\Id
-     * @ORM\GeneratedValue(strategy="IDENTITY")
-     */
-    private $id;
-
-
-
     /**
      * Set gradebookId
      *

+ 9 - 10
src/Chamilo/CoreBundle/Entity/SkillRelProfile.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Chamilo\CoreBundle\Entity;
 
@@ -15,27 +16,25 @@ class SkillRelProfile
     /**
      * @var integer
      *
-     * @ORM\Column(name="skill_id", type="integer", nullable=false)
+     * @ORM\Column(name="id", type="integer")
+     * @ORM\Id
+     * @ORM\GeneratedValue
      */
-    private $skillId;
+    private $id;
 
     /**
      * @var integer
      *
-     * @ORM\Column(name="profile_id", type="integer", nullable=false)
+     * @ORM\Column(name="skill_id", type="integer", nullable=false)
      */
-    private $profileId;
+    private $skillId;
 
     /**
      * @var integer
      *
-     * @ORM\Column(name="id", type="integer")
-     * @ORM\Id
-     * @ORM\GeneratedValue(strategy="IDENTITY")
+     * @ORM\Column(name="profile_id", type="integer", nullable=false)
      */
-    private $id;
-
-
+    private $profileId;
 
     /**
      * Set skillId

+ 10 - 11
src/Chamilo/CoreBundle/Entity/SkillRelSkill.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Chamilo\CoreBundle\Entity;
 
@@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
  */
 class SkillRelSkill
 {
+    /**
+     * @var integer
+     *
+     * @ORM\Column(name="id", type="integer")
+     * @ORM\Id
+     * @ORM\GeneratedValue
+     */
+    private $id;
+
     /**
      * @var integer
      *
@@ -40,17 +50,6 @@ class SkillRelSkill
      */
     private $level;
 
-    /**
-     * @var integer
-     *
-     * @ORM\Column(name="id", type="integer")
-     * @ORM\Id
-     * @ORM\GeneratedValue(strategy="IDENTITY")
-     */
-    private $id;
-
-
-
     /**
      * Set skillId
      *

+ 43 - 37
src/Chamilo/CoreBundle/Entity/SkillRelUser.php

@@ -1,16 +1,15 @@
 <?php
-
 /* For licensing terms, see /license.txt */
 
-/**
- * SkillRelUser Entity
- *
- * @package chamilo.skill
- */
-
 namespace Chamilo\CoreBundle\Entity;
 
+use Chamilo\SkillBundle\Entity\Level;
 use Doctrine\ORM\Mapping as ORM;
+use Chamilo\UserBundle\Entity\User;
+use Doctrine\Common\Collections\ArrayCollection;
+use Chamilo\CoreBundle\Entity\Skill;
+use Chamilo\CoreBundle\Entity\Course;
+use Chamilo\CoreBundle\Entity\Session;
 
 /**
  * SkillRelUser
@@ -27,6 +26,15 @@ use Doctrine\ORM\Mapping as ORM;
  */
 class SkillRelUser
 {
+    /**
+     * @var integer
+     *
+     * @ORM\Column(name="id", type="integer")
+     * @ORM\Id
+     * @ORM\GeneratedValue
+     */
+    private $id;
+
     /**
      * @var integer
      *
@@ -87,20 +95,13 @@ class SkillRelUser
     private $course;
 
     /**
+     * @var Session
+     *
      * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session", inversedBy="issuedSkills", cascade={"persist"})
      * @ORM\JoinColumn(name="session_id", referencedColumnName="id")
      */
     private $session;
 
-    /**
-     * @var integer
-     *
-     * @ORM\Column(name="id", type="integer")
-     * @ORM\Id
-     * @ORM\GeneratedValue(strategy="IDENTITY")
-     */
-    private $id;
-
     /**
      * @var Level
      *
@@ -128,9 +129,12 @@ class SkillRelUser
      */
     protected $comments;
 
+    /**
+     * SkillRelUser constructor.
+     */
     public function __construct()
     {
-        $this->comments = new \Doctrine\Common\Collections\ArrayCollection();
+        $this->comments = new ArrayCollection();
     }
 
     /**
@@ -181,10 +185,10 @@ class SkillRelUser
 
     /**
      * Set user
-     * @param \Chamilo\UserBundle\Entity\User $user
-     * @return \Chamilo\CoreBundle\Entity\SkillRelUser
+     * @param User $user
+     * @return SkillRelUser
      */
-    public function setUser(\Chamilo\UserBundle\Entity\User $user)
+    public function setUser(User $user)
     {
         $this->user = $user;
 
@@ -193,7 +197,7 @@ class SkillRelUser
 
     /**
      * Get user
-     * @return \Chamilo\UserBundle\Entity\User
+     * @return \User
      */
     public function getUser()
     {
@@ -202,8 +206,8 @@ class SkillRelUser
 
     /**
      * Set skill
-     * @param \Chamilo\CoreBundle\Entity\Skill $skill
-     * @return \Chamilo\CoreBundle\Entity\SkillRelUser
+     * @param Skill $skill
+     * @return SkillRelUser
      */
     public function setSkill(Skill $skill)
     {
@@ -214,7 +218,7 @@ class SkillRelUser
 
     /**
      * Get skill
-     * @return \Chamilo\CoreBundle\Entity\Skill
+     * @return Skill
      */
     public function getSkill()
     {
@@ -223,8 +227,8 @@ class SkillRelUser
 
     /**
      * Set course
-     * @param \Chamilo\CoreBundle\Entity\Course $course
-     * @return \Chamilo\CoreBundle\Entity\SkillRelUser
+     * @param Course $course
+     * @return SkillRelUser
      */
     public function setCourse(Course $course)
     {
@@ -235,7 +239,7 @@ class SkillRelUser
 
     /**
      * Get course
-     * @return \Chamilo\CoreBundle\Entity\Course
+     * @return Course
      */
     public function getCourse()
     {
@@ -244,8 +248,8 @@ class SkillRelUser
 
     /**
      * Set session
-     * @param \Chamilo\CoreBundle\Entity\Session $session
-     * @return \Chamilo\CoreBundle\Entity\SkillRelUser
+     * @param Session $session
+     * @return SkillRelUser
      */
     public function setSession(Session $session)
     {
@@ -256,7 +260,7 @@ class SkillRelUser
 
     /**
      * Get session
-     * @return \Chamilo\CoreBundle\Entity\Session
+     * @return Session
      */
     public function getSession()
     {
@@ -368,8 +372,9 @@ class SkillRelUser
 
     /**
      * Set acquiredLevel
-     * @param \Chamilo\SkillBundle\Entity\Level $acquiredLevel
-     * @return \Chamilo\CoreBundle\Entity\SkillRelUser
+     * @param Level $acquiredLevel
+     *
+     * @return SkillRelUser
      */
     public function setAcquiredLevel($acquiredLevel)
     {
@@ -380,7 +385,7 @@ class SkillRelUser
 
     /**
      * Get acquiredLevel
-     * @return \Chamilo\SkillBundle\Entity\Level
+     * @return Level
      */
     public function getAcquiredLevel()
     {
@@ -389,8 +394,8 @@ class SkillRelUser
 
     /**
      * Set argumentationAuthorId
-     * @param integer $argumentationAuthorId
-     * @return \Chamilo\CoreBundle\Entity\SkillRelUser
+     * @param int $argumentationAuthorId
+     * @return SkillRelUser
      */
     public function setArgumentationAuthorId($argumentationAuthorId)
     {
@@ -411,7 +416,8 @@ class SkillRelUser
     /**
      * Set argumentation
      * @param string $argumentation
-     * @return \Chamilo\CoreBundle\Entity\SkillRelUser
+     *
+     * @return SkillRelUser
      */
     public function setArgumentation($argumentation)
     {
@@ -506,7 +512,7 @@ class SkillRelUser
 
     /**
      * Calculate the average value from the feedback comments
-     * @return type
+     * @return int
      */
     public function getAverage()
     {

+ 14 - 13
src/Chamilo/CoreBundle/Entity/SkillRelUserComment.php

@@ -1,5 +1,4 @@
 <?php
-
 /* For licensing terms, see /license.txt */
 
 /**
@@ -10,6 +9,7 @@
 
 namespace Chamilo\CoreBundle\Entity;
 
+use Chamilo\UserBundle\Entity\User;
 use Doctrine\ORM\Mapping as ORM;
 
 /**
@@ -21,7 +21,7 @@ use Doctrine\ORM\Mapping as ORM;
  *      @ORM\Index(name="idx_select_su_giver", columns={"skill_rel_user_id", "feedback_giver_id"})
  *  }
  * )
- * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\SkillRelUserCommentRepository")
+ * @ORM\Entity
  */
 class SkillRelUserComment
 {
@@ -30,7 +30,7 @@ class SkillRelUserComment
      *
      * @ORM\Column(name="id", type="integer")
      * @ORM\Id
-     * @ORM\GeneratedValue(strategy="IDENTITY")
+     * @ORM\GeneratedValue
      */
     private $id;
 
@@ -78,7 +78,7 @@ class SkillRelUserComment
 
     /**
      * Get skillRelUser
-     * @return Chamilo\CoreBundle\Entity\SkillRelUser
+     * @return SkillRelUser
      */
     public function getSkillRelUser()
     {
@@ -87,7 +87,7 @@ class SkillRelUserComment
 
     /**
      * Get feedbackGiver
-     * @return Chamilo\UserBundle\Entity\User
+     * @return User
      */
     public function getFeedbackGiver()
     {
@@ -123,8 +123,8 @@ class SkillRelUserComment
 
     /**
      * Set skillRelUser
-     * @param \Chamilo\CoreBundle\Entity\SkillRelUser $skillRelUser
-     * @return \Chamilo\CoreBundle\Entity\SkillRelUserComment
+     * @param SkillRelUser $skillRelUser
+     * @return SkillRelUserComment
      */
     public function setSkillRelUser(SkillRelUser $skillRelUser)
     {
@@ -135,10 +135,10 @@ class SkillRelUserComment
 
     /**
      * Set feedbackGiver
-     * @param \Chamilo\UserBundle\Entity\User $feedbackGiver
-     * @return \Chamilo\CoreBundle\Entity\SkillRelUserComment
+     * @param User $feedbackGiver
+     * @return SkillRelUserComment
      */
-    public function setFeedbackGiver(\Chamilo\UserBundle\Entity\User $feedbackGiver)
+    public function setFeedbackGiver(User $feedbackGiver)
     {
         $this->feedbackGiver = $feedbackGiver;
 
@@ -148,7 +148,7 @@ class SkillRelUserComment
     /**
      * Set feedbackText
      * @param string $feedbackText
-     * @return \Chamilo\CoreBundle\Entity\SkillRelUserComment
+     * @return SkillRelUserComment
      */
     public function setFeedbackText($feedbackText)
     {
@@ -160,7 +160,7 @@ class SkillRelUserComment
     /**
      * Set feebackValue
      * @param int $feedbackValue
-     * @return \Chamilo\CoreBundle\Entity\SkillRelUserComment
+     * @return SkillRelUserComment
      */
     public function setFeedbackValue($feedbackValue)
     {
@@ -172,7 +172,8 @@ class SkillRelUserComment
     /**
      * Set feedbackDateTime
      * @param \DateTime $feedbackDateTime
-     * @return \Chamilo\CoreBundle\Entity\SkillRelUserComment
+     *
+     * @return SkillRelUserComment
      */
     public function setFeedbackDateTime(\DateTime $feedbackDateTime)
     {

+ 1 - 0
src/Chamilo/CoreBundle/Entity/SpecificFieldValues.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Chamilo\CoreBundle\Entity;
 

+ 1 - 0
src/Chamilo/CoreBundle/Entity/SysCalendar.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Chamilo\CoreBundle\Entity;
 

+ 1 - 0
src/Chamilo/CoreBundle/Entity/Tag.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Chamilo\CoreBundle\Entity;
 

+ 1 - 0
src/Chamilo/CoreBundle/Entity/Templates.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Chamilo\CoreBundle\Entity;
 

+ 1 - 0
src/Chamilo/CoreBundle/Entity/TrackCourseRanking.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Chamilo\CoreBundle\Entity;
 

+ 1 - 0
src/Chamilo/CoreBundle/Entity/TrackEAccess.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Chamilo\CoreBundle\Entity;
 

+ 1 - 0
src/Chamilo/CoreBundle/Entity/TrackEAttempt.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Chamilo\CoreBundle\Entity;
 

+ 1 - 0
src/Chamilo/CoreBundle/Entity/TrackEAttemptCoeff.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Chamilo\CoreBundle\Entity;
 

+ 1 - 0
src/Chamilo/CoreBundle/Entity/TrackECourseAccess.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace Chamilo\CoreBundle\Entity;
 

+ 7 - 1
src/Chamilo/SkillBundle/Entity/Level.php

@@ -1,6 +1,12 @@
 <?php
 /* For licensing terms, see /license.txt */
 
+/**
+ * Profile Level
+ *
+ * @package chamilo.skill
+ */
+
 namespace Chamilo\SkillBundle\Entity;
 
 use Gedmo\Mapping\Annotation as Gedmo;
@@ -10,7 +16,7 @@ use Doctrine\ORM\Mapping as ORM;
  * Level
  *
  * @ORM\Table(
- *  name="skill_level",
+ *  name="skill_level"
  * )
  * @ORM\Entity
  */

+ 1 - 1
src/Chamilo/SkillBundle/Entity/Profile.php

@@ -16,7 +16,7 @@ use Doctrine\ORM\Mapping as ORM;
  * Profile
  *
  * @ORM\Table(
- *  name="skill_level_profile",
+ *  name="skill_level_profile"
  * )
  * @ORM\Entity
  */

Some files were not shown because too many files changed in this diff