Browse Source

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

Angel Fernando Quiroz Campos 6 years ago
parent
commit
84f4d38ee9
41 changed files with 305 additions and 275 deletions
  1. 25 0
      app/Resources/public/css/dialog.css
  2. 1 0
      composer.json
  3. 11 13
      main/admin/user_information.php
  4. 1 1
      main/document/add_link.php
  5. 1 1
      main/document/create_document.php
  6. 1 1
      main/document/document_quota.php
  7. 2 2
      main/document/edit_document.php
  8. 32 20
      main/document/showinframes.php
  9. 6 2
      main/exercise/result.php
  10. 28 25
      main/group/group_creation.php
  11. 20 2
      main/inc/lib/display.lib.php
  12. 14 12
      main/inc/lib/document.lib.php
  13. 16 23
      main/inc/lib/exercise.lib.php
  14. 2 2
      main/inc/lib/glossary.lib.php
  15. 2 2
      main/inc/lib/groupmanager.lib.php
  16. 6 6
      main/inc/lib/message.lib.php
  17. 6 6
      main/inc/lib/notification.lib.php
  18. 3 29
      main/inc/lib/sessionmanager.lib.php
  19. 6 7
      main/inc/lib/social.lib.php
  20. 5 7
      main/inc/lib/usermanager.lib.php
  21. 4 5
      main/lp/learnpath.class.php
  22. 1 2
      main/lp/lp_view.php
  23. 1 1
      main/lp/lp_view_item.php
  24. 32 29
      main/session/add_users_to_session_course.php
  25. 1 1
      main/social/profile.php
  26. 2 2
      main/survey/surveyUtil.class.php
  27. 1 1
      main/template/default/admin/questions.tpl
  28. 1 1
      main/template/default/forum/list.tpl
  29. 1 1
      main/template/default/forum/posts.tpl
  30. 6 4
      main/template/default/glossary/glossary_manual.js.tpl
  31. 1 1
      main/template/default/layout/layout_2_col.tpl
  32. 1 1
      main/template/default/layout/modals.tpl
  33. 36 38
      main/template/default/learnpath/scorm_list.tpl
  34. 1 1
      main/template/default/social/personal_data.tpl
  35. 4 2
      main/template/default/social/skills_block.tpl
  36. 1 1
      main/template/default/social/terms.tpl
  37. 1 1
      main/template/default/user_portal/classic_courses_with_category.tpl
  38. 6 7
      main/work/work.lib.php
  39. 12 6
      plugin/questionoptionsevaluation/QuestionOptionsEvaluationPlugin.php
  40. 2 7
      plugin/questionoptionsevaluation/evaluation.php
  41. 2 2
      plugin/surveyexportcsv/export.php

+ 25 - 0
app/Resources/public/css/dialog.css

@@ -0,0 +1,25 @@
+.ui-dialog .ui-dialog-content{
+    font-size: 12px;
+    line-height: 22px;
+}
+.ui-draggable .ui-dialog-titlebar {
+    cursor: move;
+    background: #e5e5e5;
+    border: none;
+    padding: 2px 10px;
+}
+.ui-dialog .ui-dialog-title{
+    margin: 0;
+    font-size: 14px;
+    padding-left: 8px;
+}
+.ui-dialog{
+    padding: 0;
+}
+.ui-widget-content {
+    border: 1px solid #ddd;
+}
+.ui-dialog .ui-dialog-titlebar {
+    padding: 0 5px;
+    position: relative;
+}

+ 1 - 0
composer.json

@@ -44,6 +44,7 @@
         "ext-mbstring": "*",
         "ext-libxml": "*",
         "ext-dom": "*",
+        "ext-fileinfo": "*",
         "twig/twig": "1.*",
         "twig/extensions": "~1.0",
         "doctrine/orm": "~2.4",

+ 11 - 13
main/admin/user_information.php

@@ -17,10 +17,12 @@ $this_section = SECTION_PLATFORM_ADMIN;
 require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
 require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
 
-if (!isset($_GET['user_id'])) {
+$userId = isset($_GET['user_id']) ? (int) $_GET['user_id'] : 0;
+
+if (empty($userId)) {
     api_not_allowed(true);
 }
-$user = api_get_user_info($_GET['user_id'], true);
+$user = api_get_user_info($userId, true);
 
 if (empty($user)) {
     api_not_allowed(true);
@@ -39,8 +41,8 @@ if (!api_is_student_boss()) {
     }
 }
 
-$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
-$interbreadcrumb[] = ["url" => 'user_list.php', "name" => get_lang('UserList')];
+$interbreadcrumb[] = ["url" => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ["url" => 'user_list.php', 'name' => get_lang('UserList')];
 
 $userId = $user['user_id'];
 
@@ -61,7 +63,7 @@ $actions = [
             ICON_SIZE_MEDIUM
         ),
         api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?'.http_build_query([
-            'student' => intval($_GET['user_id']),
+            'student' => $userId,
         ]),
         ['title' => get_lang('Reporting')]
     ),
@@ -253,10 +255,7 @@ if (api_get_setting('allow_social_tool') === 'true') {
     $count = SocialManager::get_message_number_invitation_by_user_id($user['user_id']);
     $data[] = [get_lang('InvitationReceived'), $count];
 
-    $socialInformation = Display::return_sortable_table(
-        '',
-        $data
-    );
+    $socialInformation = Display::return_sortable_table('', $data);
 }
 
 /**
@@ -379,7 +378,7 @@ if (count($sessions) > 0) {
             $data,
             [],
             [],
-            ['user_id' => intval($_GET['user_id'])]
+            ['user_id' => $userId]
         );
         $sessionInformation .= $courseToolInformationTotal;
     }
@@ -477,7 +476,7 @@ if (Database::num_rows($res) > 0) {
         $data,
         [],
         [],
-        ['user_id' => intval($_GET['user_id'])]
+        ['user_id' => $userId]
     );
     $courseInformation .= $courseToolInformationTotal;
 } else {
@@ -510,7 +509,7 @@ if (api_is_multiple_url_enabled()) {
             $data,
             [],
             [],
-            ['user_id' => intval($_GET['user_id'])]
+            ['user_id' => $userId]
         );
     } else {
         $urlInformation = '<p>'.get_lang('NoUrlForThisUser').'</p>';
@@ -561,7 +560,6 @@ if (isset($_GET['action'])) {
             exit;
             break;
         case 'unsubscribe_session_course':
-            $userId = empty($_GET['user_id']) ? 0 : intval($_GET['user_id']);
             $courseId = !empty($_GET['course_id']) ? (int) $_GET['course_id'] : 0;
             $sessionId = !empty($_GET['id_session']) ? (int) $_GET['id_session'] : 0;
 

+ 1 - 1
main/document/add_link.php

@@ -175,7 +175,7 @@ echo DocumentManager::build_directory_selector(
 
 // Add tooltip and correctly parse its inner HTML
 echo '<script>
-$(document).ready(function() {
+$(function() {
     $("[data-toggle=\'tooltip\']").tooltip({
         content: 
             function() {

+ 1 - 1
main/document/create_document.php

@@ -17,7 +17,7 @@ $this_section = SECTION_COURSES;
 $groupRights = Session::read('group_member_with_upload_rights');
 $htmlHeadXtra[] = '
 <script>
-$(document).ready(function() {
+$(function() {
     $(".scrollbar-light").scrollbar();
 
     expandColumnToogle("#hide_bar_template", {

+ 1 - 1
main/document/document_quota.php

@@ -125,7 +125,7 @@ $session[] = [
 $quota_data = json_encode($session);
 
 $htmlHeadXtra[] = "<script>
-$(document).ready(function() {
+$(function() {
     var data = ".$quota_data.";
     var plot1 = jQuery.jqplot('chart1', [data], {
         seriesDefaults: {

+ 2 - 2
main/document/edit_document.php

@@ -34,7 +34,7 @@ $groupRights = Session::read('group_member_with_upload_rights');
 // Template's javascript
 $htmlHeadXtra[] = '
 <script>
-$(document).ready(function() {
+$(function() {
     $(".scrollbar-light").scrollbar();
     
     expandColumnToogle("#hide_bar_template", {
@@ -533,7 +533,7 @@ if ($owner_id == api_get_user_id() ||
     } else {
         // Add tooltip and correctly parse its inner HTML
         echo '<script>
-        $(document).ready(function() {
+        $(function() {
             $("[data-toggle=\'tooltip\']").tooltip(
                 {
                     content: 

+ 32 - 20
main/document/showinframes.php

@@ -103,7 +103,7 @@ if (!$is_allowed_to_edit && !$is_visible) {
 }
 
 $pathinfo = pathinfo($header_file);
-$playerSupportedFiles = ['mp4', 'ogv', 'flv', 'm4v', 'webm'];
+$playerSupportedFiles = ['mp3', 'mp4', 'ogv', 'flv', 'm4v', 'webm'];
 $playerSupported = false;
 if (in_array(strtolower($pathinfo['extension']), $playerSupportedFiles)) {
     $playerSupported = true;
@@ -188,7 +188,7 @@ if (in_array(strtolower($pathinfo['extension']), $web_odf_supported_files)) {
             var topbarHeight = $("#topbar").height();
             $("#viewerJSContent").height((bodyHeight - topbarHeight));
         }
-        $(document).ready(function() {
+        $(function() {
             $(window).resize(resizeIframe());
         });
     </script>'
@@ -207,9 +207,7 @@ if (isset($document_data['parents']) && isset($document_data['parents'][0])) {
 if ($isChatFolder) {
     $htmlHeadXtra[] = api_get_js('highlight/highlight.pack.js');
     $htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'chat.css');
-    $htmlHeadXtra[] = api_get_css(
-        api_get_path(WEB_LIBRARY_PATH).'javascript/highlight/styles/github.css'
-    );
+    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/highlight/styles/github.css');
     $htmlHeadXtra[] = '
     <script>
         hljs.initHighlightingOnLoad();
@@ -258,15 +256,14 @@ if (!$playerSupported && $execute_iframe) {
 if ($originIsLearnpath) {
     Display::display_reduced_header();
 } else {
-    Display::display_header('');
+    Display::display_header();
 }
 
-echo '<div class="text-center">';
-
 $file_url = api_get_path(WEB_COURSE_PATH).$courseInfo['path'].'/document'.$header_file;
 $file_url_web = $file_url.'?'.api_get_cidreq();
 
 if ($show_web_odf) {
+    echo '<div class="text-center">';
     $browser = api_get_navigator();
     $pdfUrl = api_get_path(WEB_LIBRARY_PATH).'javascript/ViewerJS/index.html#'.$file_url;
     if ($browser['name'] == 'Mozilla' && preg_match('|.*\.pdf|i', $header_file)) {
@@ -277,12 +274,11 @@ if ($show_web_odf) {
             src="'.$pdfUrl.'">
         </iframe>';
     echo '</div>';
+    echo '</div>';
 }
 
-echo '</div>';
-
 if ($playerSupported) {
-    echo DocumentManager::generateVideoPreview($file_url_web, $extension);
+    echo DocumentManager::generateMediaPreview($file_url_web, $extension);
 }
 
 if ($is_freemind_available) {
@@ -355,14 +351,30 @@ if ($execute_iframe) {
         $content = Security::remove_XSS(file_get_contents($file_url_sys));
         echo $content;
     } else {
-        if (api_is_allowed_to_edit()) {
-            $parentId = $document_data['parent_id'];
-            $url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq().'&id='.$parentId;
-            $actionsLeft = Display::url(
-                Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM),
-                $url
-            );
+        $parentId = $document_data['parent_id'];
+        $url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq().'&id='.$parentId;
+        $actionsLeft = Display::url(
+            Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM),
+            $url
+        );
+
+        $groupMemberWithEditRights = false;
+        $groupId = api_get_group_id();
+        if (!empty($groupId)) {
+            $groupInfo = GroupManager::get_group_properties($groupId);
+            if ($groupInfo) {
+                $groupMemberWithEditRights = GroupManager::allowUploadEditDocument(
+                    api_get_user_id(),
+                    api_get_course_int_id(),
+                    $groupInfo,
+                        $document_data
+                );
+            }
+        }
+
+        $allowToEdit = api_is_allowed_to_edit(null, true) || $groupMemberWithEditRights;
 
+        if ($allowToEdit) {
             $actionsLeft .= Display::url(
                 Display::return_icon(
                     'edit.png',
@@ -398,10 +410,10 @@ if ($execute_iframe) {
                 api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq(
                 ).'&action=export_to_pdf&id='.$document_id
             );
-
-            echo $toolbar = Display::toolbarAction('actions-documents', [$actionsLeft]);
         }
 
+        echo $toolbar = Display::toolbarAction('actions-documents', [$actionsLeft]);
+
         echo '<iframe 
             id="mainFrame" 
             name="mainFrame" 

+ 6 - 2
main/exercise/result.php

@@ -39,11 +39,14 @@ $student_id = $track_exercise_info['exe_user_id'];
 $current_user_id = api_get_user_id();
 
 $objExercise = new Exercise();
-
 if (!empty($exercise_id)) {
     $objExercise->read($exercise_id);
 }
 
+if (empty($objExercise)) {
+    api_not_allowed($show_headers);
+}
+
 // Only users can see their own results
 if (!$is_allowedToEdit) {
     if ($student_id != $current_user_id) {
@@ -57,7 +60,7 @@ $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'annotation/
 
 if ($show_headers) {
     $interbreadcrumb[] = [
-        'url' => "exercise.php?".api_get_cidreq(),
+        'url' => 'exercise.php?'.api_get_cidreq(),
         'name' => get_lang('Exercises'),
     ];
     $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Result')];
@@ -72,6 +75,7 @@ if ($show_headers) {
 
 $message = Session::read('attempt_remaining');
 Session::erase('attempt_remaining');
+
 ExerciseLib::displayQuestionListByAttempt(
     $objExercise,
     $id,

+ 28 - 25
main/group/group_creation.php

@@ -18,7 +18,6 @@ if (!api_is_allowed_to_edit(false, true)) {
 $currentUrl = api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq();
 
 /*	Create the groups */
-
 if (isset($_POST['action'])) {
     switch ($_POST['action']) {
         case 'create_groups':
@@ -56,7 +55,7 @@ if (isset($_POST['action'])) {
                 );
             }
             Display::addFlash(Display::return_message(get_lang('GroupsAdded')));
-            header("Location: ".$currentUrl);
+            header('Location: '.$currentUrl);
             exit;
             break;
         case 'create_subgroups':
@@ -65,13 +64,13 @@ if (isset($_POST['action'])) {
                 $_POST['number_of_groups']
             );
             Display::addFlash(Display::return_message(get_lang('GroupsAdded')));
-            header("Location: ".$currentUrl);
+            header('Location: '.$currentUrl);
             exit;
             break;
         case 'create_class_groups':
-            $ids = GroupManager::create_class_groups($_POST['group_category']);
+            GroupManager::create_class_groups($_POST['group_category']);
             Display::addFlash(Display::return_message(get_lang('GroupsAdded')));
-            header("Location: ".$currentUrl);
+            header('Location: '.$currentUrl);
             exit;
             break;
     }
@@ -82,7 +81,7 @@ $interbreadcrumb[] = [
     'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
     'name' => get_lang('Groups'),
 ];
-Display :: display_header($nameTools, 'Group');
+Display::display_header($nameTools, 'Group');
 
 if (isset($_POST['number_of_groups'])) {
     if (!is_numeric($_POST['number_of_groups']) || intval($_POST['number_of_groups']) < 1) {
@@ -274,7 +273,7 @@ EOT;
             $group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, ['size' => 3]);
             $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom'));
             $group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options);
-            $group_el[] = $create_subgroups_form->createElement('button', 'submit', get_lang('Ok'));
+            $group_el[] = $create_subgroups_form->addButtonSave(get_lang('Ok'), 'submit', true);
             $create_subgroups_form->addGroup($group_el, 'create_groups', null, null, false);
             $defaults = [];
             $defaults['action'] = 'create_subgroups';
@@ -286,41 +285,45 @@ EOT;
     /*
      * Show form to generate groups from classes subscribed to the course
      */
-    $options['where'] = [" usergroup.course_id = ? " => api_get_course_int_id()];
+    $options['where'] = [' usergroup.course_id = ? ' => api_get_course_int_id()];
     $obj = new UserGroup();
     $classes = $obj->getUserGroupInCourse($options);
     if (count($classes) > 0) {
-        echo '<b>'.get_lang('GroupsFromClasses').'</b>';
-        echo '<blockquote>';
-        echo '<p>'.get_lang('GroupsFromClassesInfo').'</p>';
-        echo '<ul>';
+        $description = '<p>'.get_lang('GroupsFromClassesInfo').'</p>';
+        $description .= '<ul>';
         foreach ($classes as $index => $class) {
             $number_of_users = count($obj->get_users_by_usergroup($class['id']));
-            echo '<li>';
-            echo $class['name'];
-            echo ' ('.$number_of_users.' '.get_lang('Users').')';
-            echo '</li>';
+            $description .= '<li>';
+            $description .= $class['name'];
+            $description .= ' ('.$number_of_users.' '.get_lang('Users').')';
+            $description .= '</li>';
         }
-        echo '</ul>';
+        $description .= '</ul>';
+
+        $classForm = new FormValidator(
+            'create_class_groups_form',
+            'post',
+            api_get_self().'?'.api_get_cidreq()
+        );
+        $classForm->addHeader(get_lang('GroupsFromClasses'));
 
-        $create_class_groups_form = new FormValidator('create_class_groups_form', 'post', api_get_self().'?'.api_get_cidreq());
-        $create_class_groups_form->addElement('hidden', 'action');
+        $classForm->addHtml($description);
+        $classForm->addElement('hidden', 'action');
         if (api_get_setting('allow_group_categories') === 'true') {
             $group_categories = GroupManager :: get_categories();
             $cat_options = [];
             foreach ($group_categories as $index => $category) {
                 $cat_options[$category['id']] = $category['title'];
             }
-            $create_class_groups_form->addElement('select', 'group_category', null, $cat_options);
+            $classForm->addElement('select', 'group_category', null, $cat_options);
         } else {
-            $create_class_groups_form->addElement('hidden', 'group_category');
+            $classForm->addElement('hidden', 'group_category');
         }
-        $create_class_groups_form->addElement('submit', 'submit', get_lang('Ok'));
+        $classForm->addButtonSave(get_lang('Ok'));
         $defaults['group_category'] = GroupManager::DEFAULT_GROUP_CATEGORY;
         $defaults['action'] = 'create_class_groups';
-        $create_class_groups_form->setDefaults($defaults);
-        $create_class_groups_form->display();
-        echo '</blockquote>';
+        $classForm->setDefaults($defaults);
+        $classForm->display();
     }
 }
 

+ 20 - 2
main/inc/lib/display.lib.php

@@ -2806,12 +2806,16 @@ HTML;
     {
         $defaultFeatures = ['playpause', 'current', 'progress', 'duration', 'tracks', 'volume', 'fullscreen', 'vrview'];
         $features = api_get_configuration_value('video_features');
+        $bowerJsFiles = [];
+        $bowerCSSFiles = [];
         if (!empty($features) && isset($features['features'])) {
             foreach ($features['features'] as $feature) {
                 if ($feature === 'vrview') {
                     continue;
                 }
                 $defaultFeatures[] = $feature;
+                $bowerJsFiles[] = "mediaelement/plugins/$feature/$feature.js";
+                $bowerCSSFiles[] = "mediaelement/plugins/$feature/$feature.css";
             }
         }
 
@@ -2821,11 +2825,23 @@ HTML;
             $translateHtml = '{type:"script", id:"_fr4", src:"'.api_get_path(WEB_AJAX_PATH).'lang.ajax.php?a=translate_html&'.api_get_cidreq().'"},';
         }
 
+        $counter = 10;
+        $extraMediaFiles = '';
+        foreach ($bowerJsFiles as $file) {
+            $extraMediaFiles .= '{type: "script", id: "media_'.$counter.'", src: "'.api_get_path(WEB_PUBLIC_PATH).'assets/'.$file.'"},';
+            $counter++;
+        }
+
+        foreach ($bowerCSSFiles as $file) {
+            $extraMediaFiles .= '{type: "stylesheet", id: "media_'.$counter.'", src: "'.api_get_path(WEB_PUBLIC_PATH).'assets/'.$file.'"},';
+            $counter++;
+        }
+
         $defaultFeatures = implode("','", $defaultFeatures);
         $frameReady = '
           $.frameReady(function() {
-            $(document).ready(function () {
-                $("video:not(.skip), audio:not(.skip)").mediaelementplayer({
+            $(function() {
+                $("video:not(.skip), audio:not(.skip)").mediaelementplayer({                    
                     pluginPath: "'.api_get_path(WEB_PUBLIC_PATH).'assets/mediaelement/build/",            
                     features: ["'.$defaultFeatures.'"],
                     success: function(mediaElement, originalNode, instance) {
@@ -2842,11 +2858,13 @@ HTML;
                 { type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_PUBLIC_PATH).'assets/jquery-ui/themes/smoothness/jquery-ui.min.css"},
                 { type:"stylesheet", id:"_fr6", src:"'.api_get_path(WEB_PUBLIC_PATH).'assets/jquery-ui/themes/smoothness/theme.css"},
                 { type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
+                { type:"stylesheet", id:"_fr7", src:"'.api_get_path(WEB_PUBLIC_PATH).'css/dialog.css"},
                 { type:"script", id:"_fr3", src:"'.api_get_path(WEB_CODE_PATH).'glossary/glossary.js.php?'.api_get_cidreq().'"},
                 {type: "script", id: "_media1", src: "'.api_get_path(WEB_PUBLIC_PATH).'assets/mediaelement/build/mediaelement-and-player.min.js"},
                 {type: "stylesheet", id: "_media2", src: "'.api_get_path(WEB_PUBLIC_PATH).'assets/mediaelement/build/mediaelementplayer.min.css"},                
                 {type: "stylesheet", id: "_media4", src: "'.api_get_path(WEB_PUBLIC_PATH).'assets/mediaelement/plugins/vrview/vrview.css"},
                 {type: "script", id: "_media4", src: "'.api_get_path(WEB_PUBLIC_PATH).'assets/mediaelement/plugins/vrview/vrview.js"},
+                '.$extraMediaFiles.'
                 '.$translateHtml.'
             ]
           });';

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

@@ -3212,19 +3212,21 @@ class DocumentManager
      *
      * @return string
      */
-    public static function generateVideoPreview($file, $extension)
+    public static function generateMediaPreview($file, $extension)
     {
-        $type = '';
-        /*if ($extension != 'flv') {
-
-        }*/
-        //$type = "video/$extension";
-        //$fileInfo = parse_url($file);
-        //$type = self::file_get_mime_type(basename($fileInfo['path']));
-
-        $html = '<video id="myvideo" controls>';
-        $html .= '<source src="'.$file.'" >';
-        $html .= '</video>';
+        $id = api_get_unique_id();
+        switch ($extension) {
+            case 'mp3':
+                $document_data['file_extension'] = $extension;
+                $html = '<div style="margin: 0; position: absolute; top: 50%; left: 35%;">';
+                $html .= '<audio id="'.$id.'" controls="controls" src="'.$file.'" type="audio/mp3" ></audio></div>';
+                break;
+            default:
+                $html = '<video id="'.$id.'" controls>';
+                $html .= '<source src="'.$file.'" >';
+                $html .= '</video>';
+                break;
+        }
 
         return $html;
     }

+ 16 - 23
main/inc/lib/exercise.lib.php

@@ -2846,7 +2846,6 @@ HOTSPOT;
             $weight = float_format($weight, 1, $decimalSeparator, $thousandSeparator);
         }
 
-        $html = '';
         if ($show_percentage) {
             $percentageSign = '%';
             if ($hidePercentageSign) {
@@ -3902,9 +3901,7 @@ EOT;
         $track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
         $courseUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
         $courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
-        $courseUserSession = Database::get_main_table(
-            TABLE_MAIN_SESSION_COURSE_USER
-        );
+        $courseUserSession = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
 
         $question_id = intval($question_id);
         $exercise_id = intval($exercise_id);
@@ -4000,15 +3997,13 @@ EOT;
         $courseUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
         $courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
 
-        $courseUserSession = Database::get_main_table(
-            TABLE_MAIN_SESSION_COURSE_USER
-        );
+        $courseUserSession = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
 
-        $question_id = intval($question_id);
-        $answer_id = intval($answer_id);
-        $exercise_id = intval($exercise_id);
+        $question_id = (int) $question_id;
+        $answer_id = (int) $answer_id;
+        $exercise_id = (int) $exercise_id;
         $course_code = Database::escape_string($course_code);
-        $session_id = intval($session_id);
+        $session_id = (int) $session_id;
 
         if (empty($session_id)) {
             $courseCondition = "
@@ -4075,26 +4070,24 @@ EOT;
         $track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
         $courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
         $courseUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
-        $courseUserSession = Database::get_main_table(
-            TABLE_MAIN_SESSION_COURSE_USER
-        );
+        $courseUserSession = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
 
-        $question_id = intval($question_id);
-        $answer_id = intval($answer_id);
-        $exercise_id = intval($exercise_id);
+        $question_id = (int) $question_id;
+        $answer_id = (int) $answer_id;
+        $exercise_id = (int) $exercise_id;
         $courseId = api_get_course_int_id($course_code);
-        $session_id = intval($session_id);
+        $session_id = (int) $session_id;
 
         switch ($question_type) {
             case FILL_IN_BLANKS:
-                $answer_condition = "";
+                $answer_condition = '';
                 $select_condition = " e.exe_id, answer ";
                 break;
             case MATCHING:
             case MATCHING_DRAGGABLE:
             default:
                 $answer_condition = " answer = $answer_id AND ";
-                $select_condition = " DISTINCT exe_user_id ";
+                $select_condition = ' DISTINCT exe_user_id ';
         }
 
         if (empty($session_id)) {
@@ -4106,7 +4099,7 @@ EOT;
             $courseCondition = "
             INNER JOIN $courseUserSession cu
             ON cu.c_id = a.c_id AND cu.user_id = exe_user_id";
-            $courseConditionWhere = " AND cu.status = 0 ";
+            $courseConditionWhere = ' AND cu.status = 0 ';
         }
 
         $sql = "SELECT $select_condition
@@ -4307,9 +4300,9 @@ EOT;
         $track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
         $track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
 
-        $exercise_id = intval($exercise_id);
+        $exercise_id = (int) $exercise_id;
         $course_code = Database::escape_string($course_code);
-        $session_id = intval($session_id);
+        $session_id = (int) $session_id;
 
         $sql = "SELECT DISTINCT exe_user_id
                 FROM $track_exercises e

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

@@ -813,9 +813,9 @@ class GlossaryManager
             return;
         }
 
-        $data = GlossaryManager::get_glossary_data(
+        $data = self::get_glossary_data(
             0,
-            GlossaryManager::get_number_glossary_terms(api_get_session_id()),
+            self::get_number_glossary_terms(api_get_session_id()),
             0,
             'ASC'
         );

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

@@ -3088,7 +3088,7 @@ class GroupManager
         }
 
         // Tutor can also make any change
-        $isTutor = GroupManager::is_tutor_of_group($userId, $groupInfo, $courseId);
+        $isTutor = self::is_tutor_of_group($userId, $groupInfo, $courseId);
 
         if ($isTutor) {
             return true;
@@ -3172,7 +3172,7 @@ class GroupManager
                 break;
             case self::DOCUMENT_MODE_COLLABORATION:
                 // Student can upload content, can modify another content.
-                $isMember = GroupManager::is_subscribed($userId, $groupInfo);
+                $isMember = self::is_subscribed($userId, $groupInfo);
                 if ($isMember) {
                     $result = true;
                 }

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

@@ -364,12 +364,12 @@ class MessageManager
      * @param int    $receiver_user_id
      * @param string $subject
      * @param string $content
-     * @param array  $attachments         files array($_FILES) (optional)
-     * @param array  $fileCommentList     about attachment files (optional)
-     * @param int    $group_id            (optional)
-     * @param int    $parent_id           (optional)
-     * @param int    $editMessageId       id for updating the message (optional)
-     * @param int    $topic_id            (optional) the default value is the current user_id
+     * @param array  $attachments                files array($_FILES) (optional)
+     * @param array  $fileCommentList            about attachment files (optional)
+     * @param int    $group_id                   (optional)
+     * @param int    $parent_id                  (optional)
+     * @param int    $editMessageId              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
      * @param int    $forwardId

+ 6 - 6
main/inc/lib/notification.lib.php

@@ -220,15 +220,15 @@ class Notification extends Model
     /**
      * Save message notification.
      *
-     * @param int    $type          message type
-     *                              NOTIFICATION_TYPE_MESSAGE,
-     *                              NOTIFICATION_TYPE_INVITATION,
-     *                              NOTIFICATION_TYPE_GROUP
+     * @param int    $type                       message type
+     *                                           NOTIFICATION_TYPE_MESSAGE,
+     *                                           NOTIFICATION_TYPE_INVITATION,
+     *                                           NOTIFICATION_TYPE_GROUP
      * @param int    $messageId
-     * @param array  $userList      recipients: user list of ids
+     * @param array  $userList                   recipients: user list of ids
      * @param string $title
      * @param string $content
-     * @param array  $senderInfo    result of api_get_user_info() or GroupPortalManager:get_group_data()
+     * @param array  $senderInfo                 result of api_get_user_info() or GroupPortalManager:get_group_data()
      * @param array  $attachments
      * @param array  $smsParameters
      * @param bool   $forceTitleWhenSendingEmail force the use of $title as subject instead of "You have a new message"

+ 3 - 29
main/inc/lib/sessionmanager.lib.php

@@ -1954,15 +1954,9 @@ class SessionManager
                     false
                 );
                 // Variables for default template
-                $tplContent->assign(
-                    'complete_name',
-                    stripslashes($user_info['complete_name'])
-                );
+                $tplContent->assign('complete_name', stripslashes($user_info['complete_name']));
                 $tplContent->assign('session_name', $session->getName());
-                $tplContent->assign(
-                    'session_coach',
-                    $session->getGeneralCoach()->getCompleteName()
-                );
+                $tplContent->assign('session_coach', $session->getGeneralCoach()->getCompleteName());
                 $layoutContent = $tplContent->get_template(
                     'mail/content_subscription_to_session_confirmation.tpl'
                 );
@@ -2005,27 +1999,7 @@ class SessionManager
                 if ($empty_users) {
                     foreach ($existingUsers as $existing_user) {
                         if (!in_array($existing_user, $userList)) {
-                            $sql = "DELETE FROM $tbl_session_rel_course_rel_user
-                                    WHERE
-                                        session_id = $sessionId AND
-                                        c_id = $courseId AND
-                                        user_id = $existing_user AND
-                                        status = 0 ";
-                            $result = Database::query($sql);
-
-                            Event::addEvent(
-                                LOG_SESSION_DELETE_USER_COURSE,
-                                LOG_USER_ID,
-                                $existing_user,
-                                api_get_utc_datetime(),
-                                api_get_user_id(),
-                                $courseId,
-                                $sessionId
-                            );
-
-                            if (Database::affected_rows($result)) {
-                                $nbr_users--;
-                            }
+                            self::unSubscribeUserFromCourseSession($existing_user, $courseId, $sessionId);
                         }
                     }
                 }

+ 6 - 7
main/inc/lib/social.lib.php

@@ -2544,11 +2544,12 @@ class SocialManager extends UserManager
     /**
      * Get HTML code block for user skills.
      *
-     * @param int $userId The user ID
+     * @param int    $userId      The user ID
+     * @param string $orientation
      *
      * @return string
      */
-    public static function getSkillBlock($userId)
+    public static function getSkillBlock($userId, $orientation = 'horizontal')
     {
         if (Skill::isAllowed($userId, false) === false) {
             return '';
@@ -2559,12 +2560,10 @@ class SocialManager extends UserManager
 
         $template = new Template(null, false, false, false, false, false);
         $template->assign('ranking', $ranking);
-        $template->assign('skills', $skill->getUserSkillsTable($userId, 0, 0, false)['table']);
+        $template->assign('orientation', $orientation);
+        $template->assign('skills', $skill->getUserSkillsTable($userId, 0, 0, false)['skills']);
         $template->assign('user_id', $userId);
-        $template->assign(
-            'show_skills_report_link',
-            api_is_student() || api_is_student_boss() || api_is_drh()
-        );
+        $template->assign('show_skills_report_link', api_is_student() || api_is_student_boss() || api_is_drh());
 
         $skillBlock = $template->get_template('social/skills_block.tpl');
 

+ 5 - 7
main/inc/lib/usermanager.lib.php

@@ -2663,14 +2663,12 @@ class UserManager
         $splitMultiple = false,
         $fieldFilter = null
     ) {
-        // A sanity check.
+        $user_id = (int) $user_id;
+
         if (empty($user_id)) {
-            $user_id = 0;
-        } else {
-            if ($user_id != strval(intval($user_id))) {
-                return [];
-            }
+            return [];
         }
+
         $extra_data = [];
         $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD);
         $t_ufv = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
@@ -2695,7 +2693,7 @@ class UserManager
             }
         }
 
-        $sql .= " ORDER BY f.field_order";
+        $sql .= ' ORDER BY f.field_order';
 
         $res = Database::query($sql);
         if (Database::num_rows($res) > 0) {

+ 4 - 5
main/lp/learnpath.class.php

@@ -2316,7 +2316,6 @@ class learnpath
             switch ($row['item_type']) {
                 case 'quiz':
                     $type_quiz = false;
-
                     foreach ($list as $toc) {
                         if ($toc['id'] == $_SESSION['oLP']->current) {
                             $type_quiz = true;
@@ -7432,8 +7431,8 @@ class learnpath
                     case TOOL_DOCUMENT:
                     case TOOL_READOUT_TEXT:
                         $tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
-                        $sql_doc = "SELECT path FROM ".$tbl_doc."
-                                    WHERE c_id = ".$course_id." AND iid = ".intval($row['path']);
+                        $sql_doc = "SELECT path FROM $tbl_doc
+                                    WHERE c_id = $course_id AND iid = ".intval($row['path']);
                         $result = Database::query($sql_doc);
                         $path_file = Database::result($result, 0, 0);
                         $path_parts = pathinfo($path_file);
@@ -13492,9 +13491,9 @@ EOD;
                 }
 
                 $documentPathInfo = pathinfo($document->getPath());
-                $jplayerSupportedFiles = ['mp4', 'ogv', 'flv', 'm4v'];
+                $mediaSupportedFiles = ['mp3', 'mp4', 'ogv', 'flv', 'm4v'];
                 $extension = isset($documentPathInfo['extension']) ? $documentPathInfo['extension'] : '';
-                $showDirectUrl = !in_array($extension, $jplayerSupportedFiles);
+                $showDirectUrl = !in_array($extension, $mediaSupportedFiles);
 
                 $openmethod = 2;
                 $officedoc = false;

+ 1 - 2
main/lp/lp_view.php

@@ -423,7 +423,7 @@ if (!api_is_invitee()) {
     $progress_bar = $lp->getProgressBar();
 }
 $navigation_bar = $lp->get_navigation_bar();
-$navigation_bar_bottom = $lp->get_navigation_bar("control-bottom", "display:none");
+$navigation_bar_bottom = $lp->get_navigation_bar('control-bottom', 'display:none');
 $mediaplayer = $lp->get_mediaplayer($lp->current, $autostart);
 
 $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
@@ -597,7 +597,6 @@ if (Tracking::minimunTimeAvailable(api_get_session_id(), api_get_course_int_id()
     $template->assign('hour', $hour);
     $template->assign('minute', date('i', $lpTime));
     $template->assign('second', date('s', $lpTime));
-
     $template->assign('hour_min', api_time_to_hms($timeLp * 60, '</div><div class="divider">:</div><div>'));
 }
 

+ 1 - 1
main/lp/lp_view_item.php

@@ -24,7 +24,7 @@ $lp = Session::read('oLP');
 
 if (isset($_GET['lp_item_id'])) {
     // Get parameter only came from lp_view.php.
-    $lp_item_id = intval($_GET['lp_item_id']);
+    $lp_item_id = (int) $_GET['lp_item_id'];
     if (is_object($lp)) {
         $src = $lp->get_link('http', $lp_item_id);
     }

+ 32 - 29
main/session/add_users_to_session_course.php

@@ -110,7 +110,7 @@ function search_users($needle, $type)
         if (api_is_session_admin()
             && api_get_setting('prevent_session_admins_to_manage_all_users') === 'true'
         ) {
-            $order_clause = " AND user.creator_id = ".api_get_user_id().$order_clause;
+            $order_clause = ' AND user.creator_id = '.api_get_user_id().$order_clause;
         }
 
         $cond_user_id = '';
@@ -118,7 +118,7 @@ function search_users($needle, $type)
         // Only for single & multiple
         if (in_array($type, ['single', 'multiple'])) {
             if (!empty($id_session)) {
-                $id_session = intval($id_session);
+                $id_session = (int) $id_session;
                 // check id_user from session_rel_user table
                 $sql = "
                     SELECT su.user_id 
@@ -153,10 +153,11 @@ function search_users($needle, $type)
                             username LIKE '$needle%'
                             OR lastname LIKE '$needle%'
                             OR firstname LIKE '$needle%'
-                        )
-                        AND user.status <> 6
-                        AND user.status <> ".DRH."
-                    $order_clause LIMIT 11
+                        ) AND 
+                      user.status <> 6 AND 
+                      user.status <> ".DRH."
+                    $order_clause 
+                    LIMIT 11
                 ";
                 break;
             case 'multiple':
@@ -164,9 +165,9 @@ function search_users($needle, $type)
                     SELECT user.id, username, lastname, firstname, official_code
                     FROM $tbl_user user
                     WHERE
-                        lastname LIKE '$needle%'
-                        AND user.status <> ".DRH."
-                        AND user.status <> 6 $cond_user_id
+                        lastname LIKE '$needle%' AND 
+                        user.status <> ".DRH." AND 
+                        user.status <> 6 $cond_user_id
                     $order_clause
                 ";
                 break;
@@ -174,11 +175,12 @@ function search_users($needle, $type)
                 $sql = "
                     SELECT DISTINCT user.id, username, lastname, firstname, official_code
                     FROM $tbl_user user
-                    LEFT OUTER JOIN $tbl_session_rel_user s ON (s.user_id = user.id)
+                    LEFT OUTER JOIN $tbl_session_rel_user s 
+                    ON (s.user_id = user.id)
                     WHERE
-                        s.user_id IS NULL
-                        AND user.status <> ".DRH."
-                        AND user.status <> 6 $cond_user_id
+                        s.user_id IS NULL AND 
+                        user.status <> ".DRH." AND 
+                        user.status <> 6 $cond_user_id
                     $order_clause
                 ";
                 break;
@@ -393,10 +395,10 @@ if ($ajax_search) {
         INNER JOIN $tbl_user u
         ON su.user_id = u.id
         WHERE 
-           su.session_id = ".intval($id_session)." AND
-           su.relation_type <> ".SESSION_RELATION_TYPE_RRHH." AND
-           sc.c_id = $courseId AND
-            u.status<>".DRH."  AND 
+            su.session_id = ".intval($id_session)." AND
+            su.relation_type <> ".SESSION_RELATION_TYPE_RRHH." AND
+            sc.c_id = $courseId AND
+            u.status<>".DRH." AND 
             u.status <> 6
         $order_clause
     ";
@@ -409,17 +411,19 @@ if ($ajax_search) {
                 SELECT u.id, u.lastname, u.firstname, u.username, su.session_id, u.official_code
                 FROM $tbl_user u
                 INNER JOIN $tbl_session_rel_user su
-                    ON su.user_id = u.id
-                    AND su.relation_type <> ".SESSION_RELATION_TYPE_RRHH."
-                    AND su.session_id = ".intval($id_session)."
+                ON 
+                    su.user_id = u.id AND 
+                    su.relation_type <> ".SESSION_RELATION_TYPE_RRHH." AND 
+                    su.session_id = ".intval($id_session)."
                 INNER JOIN $tbl_user_rel_access_url url_user 
                 ON (url_user.user_id = u.id)
                 INNER JOIN $tableRelSessionCourseUser sc
                 ON (sc.session_id = su.session_id AND su.user_id = sc.user_id)
-                WHERE access_url_id = $access_url_id
-                    sc.c_id = $courseId AND
-                    AND u.status <> ".DRH."
-                    AND u.status <> 6
+                WHERE 
+                    access_url_id = $access_url_id AND 
+                    sc.c_id = $courseId AND 
+                    u.status <> ".DRH." AND 
+                    u.status <> 6
                 $order_clause
             ";
         }
@@ -459,7 +463,7 @@ if ($ajax_search) {
                         $use_extra_fields = true;
                         if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
                             $extra_field_result[] = UserManager::get_extra_user_data_by_tags(
-                                intval($_POST['field_id']),
+                                $_POST['field_id'],
                                 $_POST[$varname]
                             );
                         } else {
@@ -610,9 +614,9 @@ if ($ajax_search) {
                 ON (sc.session_id = su.session_id AND su.user_id = sc.user_id)
                 WHERE 
                     sc.c_id = $courseId AND
-                    access_url_id = $access_url_id
-                    AND u.status <> ".DRH."
-                    AND u.status <> 6
+                    access_url_id = $access_url_id AND 
+                    u.status <> ".DRH." AND 
+                    u.status <> 6
                 $order_clause
             ";
         }
@@ -643,7 +647,6 @@ if ($add_type == 'multiple') {
         '<a href="'.api_get_self().'?course_id='.$courseId.'&id_session='.$id_session.'&amp;add='.$addProcess.'&amp;add_type=multiple">'
         .Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
 }
-
 ?>
     <div class="actions">
         <?php

+ 1 - 1
main/social/profile.php

@@ -470,7 +470,7 @@ $tpl->assign('social_post_wall_block', $posts);
 $tpl->assign('social_course_block', $social_course_block);
 $tpl->assign('social_group_info_block', $social_group_info_block);
 $tpl->assign('social_rss_block', $social_rss_block);
-$tpl->assign('social_skill_block', SocialManager::getSkillBlock($friendId));
+$tpl->assign('social_skill_block', SocialManager::getSkillBlock($friendId, 'vertical'));
 $tpl->assign('session_list', $social_session_block);
 $tpl->assign('invitations', $listInvitations);
 $tpl->assign('social_right_information', $socialRightInformation);

+ 2 - 2
main/survey/surveyUtil.class.php

@@ -3889,7 +3889,7 @@ class SurveyUtil
     }
 
     /**
-     * @param string $code invitation code
+     * @param string $code       invitation code
      * @param array  $courseInfo
      * @param int    $sessionId
      * @param string $surveyCode
@@ -3905,7 +3905,7 @@ class SurveyUtil
             return '';
         }
 
-        $params =  [
+        $params = [
             'invitationcode' => $code,
             'cidReq' => $courseInfo['code'],
             'course' => $courseInfo['code'],

+ 1 - 1
main/template/default/admin/questions.tpl

@@ -1,5 +1,5 @@
 {% extends 'layout/layout_1_col.tpl'|get_template %}
-{% import 'macro/macro.tpl'|get_template as display %}
+{% import 'default/macro/macro.tpl' as display %}
 
 {% block content %}
     {{ form }}

+ 1 - 1
main/template/default/forum/list.tpl

@@ -1,4 +1,4 @@
-{% import 'macro/macro.tpl'|get_template as display %}
+{% import 'default/macro/macro.tpl' as display %}
 {% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}

+ 1 - 1
main/template/default/forum/posts.tpl

@@ -1,4 +1,4 @@
-{% import 'macro/macro.tpl'|get_template as display %}
+{% import 'default/macro/macro.tpl' as display %}
 {% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}

+ 6 - 4
main/template/default/glossary/glossary_manual.js.tpl

@@ -11,15 +11,17 @@ $(document).ready(function() {
         div_show_id = "div_show_id";
         div_content_id = "div_content_id";
 
-        $(this).append("<div id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>");
-
         var $target = $(this);
+        var title = $target.text();
+
+        $(this).append("<div id="+div_show_id+" title="+title+" ><div id="+div_content_id+">&nbsp;</div></div>");
+
 
         //$("#"+div_show_id).dialog("destroy");
         $("#"+div_show_id).dialog({
             autoOpen: false,
-            width: 600,
-            height: 200,
+            width: 500,
+            height: 'auto',
             position:  { my: 'left top', at: 'right top', of: $target },
             close: function(){
                 $("div#"+div_show_id).remove();

+ 1 - 1
main/template/default/layout/layout_2_col.tpl

@@ -1,5 +1,5 @@
 {% extends 'layout/page.tpl'|get_template %}
-{% import 'macro/macro.tpl'|get_template as display %}
+{% import 'default/macro/macro.tpl' as display %}
 
 {% block body %}
     {% if plugin_main_top %}

+ 1 - 1
main/template/default/layout/modals.tpl

@@ -8,7 +8,7 @@
                 </button>
                 <h4 class="modal-title" id="global-modal-title">&nbsp;</h4>
             </div>
-            <div class="modal-body">
+            <div class="modal-body" id="global-modal-body">
             </div>
         </div>
     </div>

+ 36 - 38
main/template/default/learnpath/scorm_list.tpl

@@ -26,6 +26,7 @@
     </div>
 </div>
 {% endif %}
+
 {% if data_panel is not empty %}
 <div id="learning_path_toc" class="scorm-collapse">
     <div class="scorm-title">
@@ -52,48 +53,45 @@
         {% endif %}
 
         {% for item in data_panel.are_parents %}
-
-        <div class="panel panel-default {{ item.parent ? 'lower':'higher' }}" data-lp-id="{{ item.id }}"
-             {{ item.parent ? 'data-lp-parent="' ~ item.parent ~ '"' : '' }}>
-            <div class="status-heading">
-                <div class="panel-heading" role="tab" id="heading-{{ item.id }}">
-                    <h4>
-                        <a class="item-header" role="button" data-toggle="collapse"
-                            data-parent="#scorm-panel{{ item.parent ? '-' ~ item.parent : '' }}"
-                            href="#collapse-{{ item.id }}" aria-expanded="true"
-                            aria-controls="collapse-{{ item.id }}">
-                            {{ item.title }}
-                        </a>
-                    </h4>
+            <div class="panel panel-default {{ item.parent ? 'lower':'higher' }}" data-lp-id="{{ item.id }}"
+                 {{ item.parent ? 'data-lp-parent="' ~ item.parent ~ '"' : '' }}>
+                <div class="status-heading">
+                    <div class="panel-heading" role="tab" id="heading-{{ item.id }}">
+                        <h4>
+                            <a class="item-header" role="button" data-toggle="collapse"
+                                data-parent="#scorm-panel{{ item.parent ? '-' ~ item.parent : '' }}"
+                                href="#collapse-{{ item.id }}" aria-expanded="true"
+                                aria-controls="collapse-{{ item.id }}">
+                                {{ item.title }}
+                            </a>
+                        </h4>
+                    </div>
                 </div>
-            </div>
-            <div id="collapse-{{ item.id }}" class="panel-collapse collapse {{ item.parent_current }}"
-                 role="tabpanel" aria-labelledby="heading-{{ item.id }}">
-                <div class="panel-body">
-                    <ul class="list">
-                        {% set  counter = 0 %}
-                        {% set  final = item.children|length %}
-                        {% for subitem in item.children %}
-                        {% set  counter = counter + 1 %}
-                        <li id="toc_{{ subitem.id }}"
-                            class="{{ subitem.class }} {{ subitem.type }} {{ counter == final ? 'final':'' }}">
-                            <div class="sub-item item-{{ subitem.type }}">
-                                <a name="atoc_{{ subitem.id }}"></a>
-                                <a data-type="type-{{ subitem.type }}" class="item-action" href="#"
-                                   onclick="switch_item('{{ subitem.current_id }}','{{ subitem.id }}'); return false;">
-                                    <i class="fa fa-chevron-circle-right" aria-hidden="true"></i>
-                                    {{ subitem.title }}
-                                </a>
-                            </div>
-                        </li>
-
-                        {% endfor %}
-                    </ul>
+                <div id="collapse-{{ item.id }}" class="panel-collapse collapse {{ item.parent_current }}"
+                     role="tabpanel" aria-labelledby="heading-{{ item.id }}">
+                    <div class="panel-body">
+                        <ul class="list">
+                            {% set counter = 0 %}
+                            {% set final = item.children|length %}
+                            {% for subitem in item.children %}
+                            {% set counter = counter + 1 %}
+                            <li id="toc_{{ subitem.id }}"
+                                class="{{ subitem.class }} {{ subitem.type }} {{ counter == final ? 'final':'' }}">
+                                <div class="sub-item item-{{ subitem.type }}">
+                                    <a name="atoc_{{ subitem.id }}"></a>
+                                    <a data-type="type-{{ subitem.type }}" class="item-action" href="#"
+                                       onclick="switch_item('{{ subitem.current_id }}','{{ subitem.id }}'); return false;">
+                                        <i class="fa fa-chevron-circle-right" aria-hidden="true"></i>
+                                        {{ subitem.title }}
+                                    </a>
+                                </div>
+                            </li>
+                            {% endfor %}
+                        </ul>
+                    </div>
                 </div>
             </div>
-        </div>
         {% endfor %}
-
     </div>
 </div>
 {% endif %}

+ 1 - 1
main/template/default/social/personal_data.tpl

@@ -1,5 +1,5 @@
 {% extends 'layout/layout_1_col.tpl'|get_template %}
-{% import 'macro/macro.tpl'|get_template as display %}
+{% import 'default/macro/macro.tpl' as display %}
 
 {% block content %}
 <div class="row">

+ 4 - 2
main/template/default/social/skills_block.tpl

@@ -1,3 +1,4 @@
+{% import 'default/macro/macro.tpl' as display %}
 <script>
 $(function() {
     jQuery('.scrollbar-inner').scrollbar();
@@ -31,7 +32,7 @@ $(function() {
             </h4>
         </div>
         <div id="skillList" class="panel-collapse collapse in list-{{ orientation }}" role="tabpanel" aria-labelledby="headingOne">
-            <div class="panel-body">
+            {% set panel_content %}
                 {% if skills %}
                     <div class="list-skills">
                         {% for item in skills %}
@@ -55,7 +56,8 @@ $(function() {
                         <a href="{{ _p.web_main ~ 'social/skills_wheel.php' }}">{{ 'SkillsWheel'|get_lang }}</a>
                     </p>
                 {% endif %}
-            </div>
+            {% endset %}
+            {{ display.panel('', panel_content) }}
         </div>
     </div>
 </div>

+ 1 - 1
main/template/default/social/terms.tpl

@@ -1,5 +1,5 @@
 {% extends 'layout/layout_1_col.tpl'|get_template %}
-{% import 'macro/macro.tpl'|get_template as display %}
+{% import 'default/macro/macro.tpl' as display %}
 
 {% block content %}
 <div class="row">

+ 1 - 1
main/template/default/user_portal/classic_courses_with_category.tpl

@@ -1,4 +1,4 @@
-{% import 'macro/macro.tpl'|get_template as display %}
+{% import 'default/macro/macro.tpl' as display %}
 
 {% if not categories is empty %}
     <div class="classic-courses">

+ 6 - 7
main/work/work.lib.php

@@ -137,9 +137,11 @@ function get_work_data_by_id($id, $courseId = 0, $sessionId = 0)
         $work['show_url'] = $webCodePath.'work/show_file.php?id='.$work['id'].'&'.api_get_cidreq();
         $work['show_content'] = '';
         if ($work['contains_file']) {
-            $fileType = mime_content_type(
-                api_get_path(SYS_COURSE_PATH).$course->getDirectory().'/'.$work['url']
-            );
+            $fileType = '';
+            $file = api_get_path(SYS_COURSE_PATH).$course->getDirectory().'/'.$work['url'];
+            if (file_exists($file)) {
+                $fileType = mime_content_type($file);
+            }
 
             if (in_array($fileType, ['image/jpeg', 'image/jpg', 'image/png', 'image/gif'])) {
                 $work['show_content'] = Display::img($work['show_url'], $work['title']);
@@ -153,10 +155,7 @@ function get_work_data_by_id($id, $courseId = 0, $sessionId = 0)
         }
 
         $fieldValue = new ExtraFieldValue('work');
-        $work['extra'] = $fieldValue->getAllValuesForAnItem(
-            $id,
-            true
-        );
+        $work['extra'] = $fieldValue->getAllValuesForAnItem($id, true);
     }
 
     return $work;

+ 12 - 6
plugin/questionoptionsevaluation/QuestionOptionsEvaluationPlugin.php

@@ -74,12 +74,15 @@ class QuestionOptionsEvaluationPlugin extends Plugin
         return $this;
     }
 
+    /**
+     * Creates an extrafield.
+     */
     private function createExtraField()
     {
-        $qEf = new ExtraField('question');
+        $extraField = new ExtraField('question');
 
-        if (false === $qEf->get_handler_field_info_by_field_variable(self::EXTRAFIELD_FORMULA)) {
-            $qEf
+        if (false === $extraField->get_handler_field_info_by_field_variable(self::EXTRAFIELD_FORMULA)) {
+            $extraField
                 ->save(
                     [
                         'variable' => self::EXTRAFIELD_FORMULA,
@@ -92,13 +95,16 @@ class QuestionOptionsEvaluationPlugin extends Plugin
         }
     }
 
+    /**
+     * Removes the extrafield .
+     */
     private function removeExtraField()
     {
         $extraField = new ExtraField('question');
-        $qEf = $extraField->get_handler_field_info_by_field_variable(self::EXTRAFIELD_FORMULA);
+        $value = $extraField->get_handler_field_info_by_field_variable(self::EXTRAFIELD_FORMULA);
 
-        if (false !== $qEf) {
-            $extraField->delete($qEf['id']);
+        if (false !== $value) {
+            $extraField->delete($value['id']);
         }
     }
 }

+ 2 - 7
plugin/questionoptionsevaluation/evaluation.php

@@ -60,11 +60,9 @@ if ($form->validate()) {
 
         $questionAnswers = new Answer($questionId, 0, $exercise);
         $counts = array_count_values($questionAnswers->correct);
-
         $weighting = [];
-
         foreach ($questionAnswers->correct as $i => $correct) {
-            // successes
+            // Success
             if (1 == $correct) {
                 $weighting[$i] = 10 / $counts[1] / $nbrQuestions;
 
@@ -114,9 +112,7 @@ if ($form->validate()) {
         );
 
         $questionAnswers->save();
-        $question->updateWeighting(
-            array_sum($allowedWeights)
-        );
+        $question->updateWeighting(array_sum($allowedWeights));
         $question->save($exercise);
     }
 
@@ -127,7 +123,6 @@ if ($form->validate()) {
     header(
         'Location: '.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq()."&exerciseId=$exerciseId"
     );
-
     exit;
 }
 

+ 2 - 2
plugin/surveyexportcsv/export.php

@@ -97,8 +97,8 @@ function getSurveyAnswers($courseId, $surveyId)
     $surveyAnswers = Database::getManager()
         ->createQuery(
             'SELECT sa.user, MIN(sa.iid) AS id FROM ChamiloCourseBundle:CSurveyAnswer sa
-        WHERE sa.cId = :course AND sa.surveyId = :survey
-        GROUP BY sa.user ORDER BY id ASC'
+            WHERE sa.cId = :course AND sa.surveyId = :survey
+            GROUP BY sa.user ORDER BY id ASC'
         )
         ->setParameters(['course' => $courseId, 'survey' => $surveyId])
         ->getResult();