Forráskód Böngészése

Partial merge with 1.11.x see BT#15952

Julio Montoya 5 éve
szülő
commit
c3dd56162c
38 módosított fájl, 549 hozzáadás és 128 törlés
  1. 5 2
      .codeclimate.yml
  2. 1 0
      .php_cs.dist
  3. 5 1
      .scrutinizer.yml
  4. 9 8
      index.php
  5. 1 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php
  6. 12 5
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php
  7. 1 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/FAQ.php
  8. 2 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Forum.php
  9. 1 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ForumStudent.php
  10. 2 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Glossary.php
  11. 1 3
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathAuthor.php
  12. 2 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Messages.php
  13. 2 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Profile.php
  14. 2 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Project.php
  15. 2 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectComment.php
  16. 1 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectCommentStudent.php
  17. 2 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectStudent.php
  18. 2 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Register.php
  19. 1 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Survey.php
  20. 1 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswer.php
  21. 1 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestMatching.php
  22. 1 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiStudent.php
  23. 2 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiTask.php
  24. 2 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Work.php
  25. 5 0
      src/Chamilo/CoreBundle/Component/Editor/Driver/CourseDriver.php
  26. 3 3
      src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php
  27. 1 0
      src/Chamilo/CoreBundle/Entity/ExtraField.php
  28. 112 0
      src/Chamilo/CoreBundle/Entity/GradebookEvaluation.php
  29. 112 0
      src/Chamilo/CoreBundle/Entity/GradebookLink.php
  30. 3 3
      src/Chamilo/CoreBundle/Entity/Message.php
  31. 186 0
      src/Chamilo/CoreBundle/Entity/MessageFeedback.php
  32. 21 72
      src/Chamilo/CourseBundle/Component/CourseCopy/Course.php
  33. 2 2
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php
  34. 1 1
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/QuizQuestion.php
  35. 7 0
      src/Chamilo/CourseBundle/Entity/CQuiz.php
  36. 2 0
      src/Chamilo/CourseBundle/Entity/CQuizCategory.php
  37. 1 1
      src/Chamilo/PageBundle/Entity/User.php
  38. 32 0
      user_portal.php

+ 5 - 2
.codeclimate.yml

@@ -22,7 +22,7 @@ checks:
 
 plugins:
   phan:
-    enabled: true
+    enabled: false
     config:
       file_extensions: "php"
 
@@ -45,7 +45,6 @@ plugins:
         enabled: false
       Squiz Strings ConcatenationSpacing PaddingFound:
         enabled: false
-
   phpmd:
     enabled: true
     config:
@@ -95,12 +94,15 @@ exclude_patterns:
 - main/inc/lib/phpseclib/
 - main/inc/lib/svg-edit/
 - main/inc/lib/swfobject/
+- main/inc/lib/mediaplayer
+- main/inc/lib/mxgraph/
 - main/inc/lib/wami-recorder/
 - main/inc/lib/xajax/
 - main/lp/packaging/
 - main/template/
 - main/img/
 - main/lang/
+- plugin/buycourses/resources/js/
 - plugin/buycourses/src/Culqi/
 - plugin/buycourses/src/Requests/
 - plugin/buycourses/src/Requests.php
@@ -108,6 +110,7 @@ exclude_patterns:
 - plugin/vchamilo/cli/
 - plugin/kannelsms/vendor/
 - plugin/clockworksms/vendor/
+- plugin/tour/intro.js
 - plugin/pens/lib
 - plugin/bbb/lib/bbb_api.php
 - plugin/ims_lti/OAuthSimple.php

+ 1 - 0
.php_cs.dist

@@ -17,6 +17,7 @@ $rules = [
     'yoda_style' => false,
     'phpdoc_to_comment' => false,
     'phpdoc_no_package' => false,
+    'phpdoc_annotation_without_dot' => false,
     'increment_style' => ['style' => 'post'],
     'no_useless_else' => false,
     //'no_php4_constructor' => true,

+ 5 - 1
.scrutinizer.yml

@@ -60,12 +60,15 @@ filter:
         - 'main/inc/lib/phpseclib/*'
         - 'main/inc/lib/svg-edit/*'
         - 'main/inc/lib/swfobject/*'
+        - 'main/inc/lib/mediaplayer/*'
+        - 'main/inc/lib/mxgraph/*'
         - 'main/inc/lib/wami-recorder/*'
         - 'main/inc/lib/xajax/*'
         - 'main/lp/packaging/*'
         - 'main/template/*'
         - 'main/img/*'
         - 'main/lang/*'
+        - 'plugin/buycourses/resources/js/*'
         - 'plugin/buycourses/src/Culqi/*'
         - 'plugin/buycourses/src/Requests/*'
         - 'plugin/buycourses/src/paypalfunctions.php'
@@ -73,7 +76,8 @@ filter:
         - 'plugin/vchamilo/cli/*'
         - 'plugin/kannelsms/vendor/*'
         - 'plugin/clockworksms/vendor/*'
-        - 'plugin/pens/lib/'
+        - 'plugin/pens/lib/*'
+        - 'plugin/tour/intro.js'
         - 'plugin/bbb/lib/bbb_api.php'
         - 'plugin/ims_lti/OAuthSimple.php'
         - 'plugin/sepe/src/wsse/*'

+ 9 - 8
index.php

@@ -20,7 +20,7 @@ if ($allow) {
 }
 
 // The section (for the tabs).
-$this_section = SECTION_CAMPUS;
+$this_section = SECTION_CAMPUS; //rewritten below if including HTML file
 $includeFile = !empty($_GET['include']);
 if ($includeFile) {
     $this_section = SECTION_INCLUDE;
@@ -34,16 +34,13 @@ if (!api_is_anonymous()) {
 }
 
 $controller = new IndexManager($header_title);
-
 //Actions
 $loginFailed = isset($_GET['loginFailed']) ? true : isset($loginFailed);
-
 if (!empty($_GET['logout'])) {
     $redirect = !empty($_GET['no_redirect']) ? false : true;
     // pass $logoutInfo defined in local.inc.php
     $controller->logout($redirect, $logoutInfo);
 }
-
 /**
  * Registers in the track_e_default table (view in important activities in admin
  * interface) a possible attempted break in, sending auth data through get.
@@ -66,7 +63,6 @@ if (isset($_GET['submitAuth']) && $_GET['submitAuth'] == 1) {
     session_destroy();
     die();
 }
-
 // Delete session item necessary to check for legal terms
 if (api_get_setting('allow_terms_conditions') === 'true') {
     Session::erase('term_and_condition');
@@ -79,7 +75,6 @@ if (!api_user_is_login() && CustomPages::enabled()) {
         CustomPages::display(CustomPages::INDEX_UNLOGGED);
     }
 }
-
 /**
  * @todo This piece of code should probably move to local.inc.php where the
  * actual login procedure is handled.
@@ -122,8 +117,8 @@ if (api_get_setting('display_categories_on_homepage') === 'true') {
     $controller->tpl->assign('course_category_block', $controller->return_courses_in_categories());
 }
 $controller->set_login_form();
-
 //@todo move this inside the IndexManager
+
 if (!api_is_anonymous()) {
     $controller->tpl->assign('profile_block', $controller->return_profile_block());
     $controller->tpl->assign('user_image_block', $controller->return_user_image_block());
@@ -147,7 +142,7 @@ if ($useCookieValidation === 'true') {
         $controller->tpl->assign('displayCookieUsageWarning', true);
     }
 }
-
+// When loading a chamilo page do not include the hot courses and news
 if (!isset($_REQUEST['include'])) {
     if (api_get_setting('show_hot_courses') == 'true') {
         $hotCourses = $controller->return_hot_courses();
@@ -197,3 +192,9 @@ if (isset($_GET['firstpage'])) {
 
 $controller->setGradeBookDependencyBar(api_get_user_id());
 $controller->tpl->display_two_col_template();
+
+// Deleting the session_id.
+Session::erase('session_id');
+Session::erase('id_session');
+Session::erase('studentview');
+api_remove_in_gradebook();

+ 1 - 1
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php

@@ -132,7 +132,7 @@ class AgendaStudent extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
             ['Toolbarswitch'],
         ];

+ 12 - 5
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php

@@ -63,6 +63,7 @@ class Basic extends Toolbar
         'wordcount',
         'inserthtml',
         'xml',
+        'qmarkersrolls',
     ];
 
     /**
@@ -113,6 +114,11 @@ class Basic extends Toolbar
         }
 
         if (api_get_setting('enabled_wiris') == 'true') {
+            // New version of wiris needs this plugins before it's loaded
+            $plugins[] = 'mapping';
+            $plugins[] = 'widgetselection';
+            $plugins[] = 'panelbutton';
+
             // Commercial plugin
             $plugins[] = 'ckeditor_wiris';
         }
@@ -133,7 +139,8 @@ class Basic extends Toolbar
             $plugins[] = 'scayt';
         }
 
-        $this->defaultPlugins = array_merge($this->defaultPlugins, $plugins);
+        $this->defaultPlugins = array_unique(array_merge($this->defaultPlugins, $plugins));
+
         parent::__construct($toolbar, $config, $prefix);
     }
 
@@ -236,9 +243,9 @@ class Basic extends Toolbar
             ['Link', 'Image', 'Video', 'Oembed', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
             ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
-            ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
+            ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
             api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
-            ['Toolbarswitch'],
+            ['Toolbarswitch', 'Source'],
         ];
     }
 
@@ -275,9 +282,9 @@ class Basic extends Toolbar
             ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
             [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
             ['Styles', 'Format', 'Font', 'FontSize'],
-            ['PageBreak', 'ShowBlocks', 'Source'],
+            ['PageBreak', 'ShowBlocks'],
             api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
-            ['Toolbarswitch'],
+            ['Toolbarswitch', 'Source'],
         ];
     }
 }

+ 1 - 1
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/FAQ.php

@@ -88,7 +88,7 @@ class FAQ extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
             ['Toolbarswitch'],
         ];

+ 2 - 1
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Forum.php

@@ -56,6 +56,7 @@ class Forum extends Basic
                 'JustifyLeft',
                 'JustifyCenter',
                 'JustifyRight',
+                'JustifyBlock',
             ],
         ];
     }
@@ -72,7 +73,7 @@ class Forum extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Oembed', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
             ['Toolbarswitch'],
         ];

+ 1 - 1
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ForumStudent.php

@@ -99,7 +99,7 @@ class ForumStudent extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Oembed', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
             ['Toolbarswitch'],
         ];

+ 2 - 2
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Glossary.php

@@ -42,7 +42,7 @@ class Glossary extends Basic
             '/',
             ['Styles', 'Format', 'Font', 'FontSize'],
             ['Bold', 'Italic', 'Underline'],
-            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
         ];
     }
 
@@ -58,7 +58,7 @@ class Glossary extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
             ['Toolbarswitch'],
         ];

+ 1 - 3
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathAuthor.php

@@ -24,7 +24,7 @@ class LearningPathAuthor extends Basic
             $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
         }
 
-        $config['fullPage'] = true;
+        $config['fullPage'] = false;
 
         return $config;
     }
@@ -38,7 +38,6 @@ class LearningPathAuthor extends Basic
     {
         return [
             ['PageBreak', 'ShowBlocks', 'Source'],
-            ['Toolbarswitch'],
         ];
     }
 
@@ -63,7 +62,6 @@ class LearningPathAuthor extends Basic
     {
         return [
             ['Link', 'Unlink', 'Bold', 'Italic', 'TextColor', 'BGColor', 'Source'],
-            ['Toolbarswitch'],
         ];
     }
 }

+ 2 - 2
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Messages.php

@@ -85,7 +85,7 @@ class Messages extends Basic
             '/',
             ['Font', 'FontSize'],
             ['Bold', 'Italic', 'Underline'],
-            ['JustifyLeft', 'JustifyCenter', '-', 'NumberedList', 'BulletedList'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList'],
         ];
     }
 
@@ -101,7 +101,7 @@ class Messages extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
             ['Toolbarswitch'],
         ];

+ 2 - 2
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Profile.php

@@ -78,7 +78,7 @@ class Profile extends Basic
             '/',
             ['Font', 'FontSize'],
             ['Bold', 'Italic', 'Underline'],
-            ['JustifyLeft', 'JustifyCenter', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
             ['Source'],
         ];
     }
@@ -95,7 +95,7 @@ class Profile extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
             ['Toolbarswitch'],
         ];

+ 2 - 2
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Project.php

@@ -78,7 +78,7 @@ class Project extends Basic
             ['Table', 'leaflet'],
             ['Font', 'FontSize'],
             ['Bold', 'Italic', 'Underline'],
-            ['JustifyLeft', 'JustifyCenter', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
             ['Source'],
         ];
     }
@@ -95,7 +95,7 @@ class Project extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor', 'BGColor', 'Source'],
             ['Toolbarswitch'],
         ];

+ 2 - 2
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectComment.php

@@ -77,7 +77,7 @@ class ProjectComment extends Basic
             ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
             ['Table', 'leaflet'],
             ['Bold', 'Italic', 'Underline'],
-            ['JustifyLeft', 'JustifyCenter', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
             ['Source'],
         ];
     }
@@ -94,7 +94,7 @@ class ProjectComment extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'],
             ['Toolbarswitch'],
         ];

+ 1 - 1
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectCommentStudent.php

@@ -77,7 +77,7 @@ class ProjectCommentStudent extends Basic
             ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
             ['Table', 'leaflet'],
             ['Bold', 'Italic', 'Underline'],
-            ['JustifyLeft', 'JustifyCenter', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
             ['ShowBlocks'],
         ];
     }

+ 2 - 2
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectStudent.php

@@ -78,7 +78,7 @@ class ProjectStudent extends Basic
             ['Table', 'leaflet'],
             ['Font', 'FontSize'],
             ['Bold', 'Italic', 'Underline'],
-            ['JustifyLeft', 'JustifyCenter', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
             ['Source'],
         ];
     }
@@ -95,7 +95,7 @@ class ProjectStudent extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'],
             ['Toolbarswitch'],
         ];

+ 2 - 2
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Register.php

@@ -40,7 +40,7 @@ class Register extends Basic
             ['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
             ['Font', 'FontSize'],
             ['Bold', 'Italic', 'Underline'],
-            ['JustifyLeft', 'JustifyCenter', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
         ];
     }
 
@@ -55,7 +55,7 @@ class Register extends Basic
             ['Toolbarswitch', 'PasteFromWord', '-', 'Undo', 'Redo'],
             ['Font', 'FontSize'],
             ['Bold', 'Italic', 'Underline'],
-            ['JustifyLeft', 'JustifyCenter', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
         ];
     }
 }

+ 1 - 1
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Survey.php

@@ -96,7 +96,7 @@ class Survey extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
             ['Toolbarswitch'],
         ];

+ 1 - 1
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswer.php

@@ -105,7 +105,7 @@ class TestFreeAnswer extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
             ['Toolbarswitch'],
         ];

+ 1 - 1
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestMatching.php

@@ -103,7 +103,7 @@ class TestMatching extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
             ['Source', 'Toolbarswitch'],
         ];

+ 1 - 1
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiStudent.php

@@ -135,7 +135,7 @@ class WikiStudent extends Basic
             ['Undo', 'Redo'],
             ['Wikilink', 'Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
             api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
             ['Toolbarswitch'],

+ 2 - 2
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiTask.php

@@ -77,7 +77,7 @@ class WikiTask extends Basic
             ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
             ['Table'],
             ['Bold', 'Italic', 'Underline'],
-            ['JustifyLeft', 'JustifyCenter', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
             api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
             ['Source'],
         ];
@@ -95,7 +95,7 @@ class WikiTask extends Basic
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
-            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
             api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
             ['Toolbarswitch'],

+ 2 - 2
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Work.php

@@ -82,7 +82,7 @@ class Work extends Basic
             '/',
             ['Font', 'FontSize'],
             ['Bold', 'Italic', 'Underline'],
-            ['JustifyLeft', 'JustifyCenter', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
             ['Source'],
         ];
     }
@@ -98,7 +98,7 @@ class Work extends Basic
             $this->getNewPageBlock(),
             ['Undo', 'Redo'],
             ['Link', 'Image', 'Video', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath'],
-            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
             ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor', 'BGColor'],
             ['Toolbarswitch'],
         ];

+ 5 - 0
src/Chamilo/CoreBundle/Component/Editor/Driver/CourseDriver.php

@@ -340,6 +340,11 @@ class CourseDriver extends Driver implements DriverInterface
             return false;
         }
 
+        $block = api_get_configuration_value('block_editor_file_manager_for_students');
+        if ($block && !api_is_allowed_to_edit()) {
+            return false;
+        }
+
         if (isset($this->connector->course) && !empty($this->connector->course)) {
             return true;
         }

+ 3 - 3
src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php

@@ -364,6 +364,7 @@ class ChamiloApi
     public static function getQuizMarkersRollsJS()
     {
         $webCodePath = api_get_path(WEB_CODE_PATH);
+        $cidReq = api_get_cidreq(true, true, 'embeddable');
         $colorPalette = self::getColorPalette(false, true);
 
         return "
@@ -380,13 +381,12 @@ class ChamiloApi
                 instance.options.markersRolls = {};
 
                 qMarkersRolls.forEach(function (qMarkerRoll) {
-                    var url = '{$webCodePath}exercise/exercise_submit.php?{{ _p.web_cid_query }}&'
+                    var url = '{$webCodePath}exercise/exercise_submit.php?$cidReq&'
                         + $.param({
                             exerciseId: qMarkerRoll[1],
                             learnpath_id: 0,
                             learnpath_item_id: 0,
-                            learnpath_item_view_id: 0,
-                            origin: 'embeddable'
+                            learnpath_item_view_id: 0
                         });
 
                     instance.options.markersRolls[qMarkerRoll[0]] = url;

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

@@ -33,6 +33,7 @@ class ExtraField extends BaseAttribute
     const TERMS_AND_CONDITION_TYPE = 14;
     const FORUM_CATEGORY_TYPE = 15;
     const FORUM_POST_TYPE = 16;
+    const EXERCISE_FIELD_TYPE = 17;
 
     /**
      * @var int

+ 112 - 0
src/Chamilo/CoreBundle/Entity/GradebookEvaluation.php

@@ -99,6 +99,34 @@ class GradebookEvaluation
      */
     protected $locked;
 
+    /**
+     * @var float
+     *
+     * ORM\Column(name="best_score", type="float", precision=6, scale=2, nullable=true)
+     */
+    protected $bestScore;
+
+    /**
+     * @var float
+     *
+     * ORM\Column(name="average_score", type="float", precision=6, scale=2, nullable=true)
+     */
+    protected $averageScore;
+
+    /**
+     * @var float
+     *
+     * ORM\Column(name="score_weight", type="float", precision=6, scale=2, nullable=true)
+     */
+    protected $scoreWeight;
+
+    /**
+     * @var array
+     *
+     * ORM\Column(name="user_score_list", type="array", nullable=true)
+     */
+    protected $userScoreList;
+
     /**
      * Set name.
      *
@@ -372,4 +400,88 @@ class GradebookEvaluation
     {
         return $this->id;
     }
+
+    /**
+     * @return float
+     */
+    public function getBestScore()
+    {
+        return $this->bestScore;
+    }
+
+    /**
+     * @param float $bestScore
+     *
+     * @return GradebookEvaluation
+     */
+    public function setBestScore($bestScore)
+    {
+        $this->bestScore = $bestScore;
+
+        return $this;
+    }
+
+    /**
+     * @return float
+     */
+    public function getAverageScore()
+    {
+        return $this->averageScore;
+    }
+
+    /**
+     * @param float $averageScore
+     *
+     * @return GradebookEvaluation
+     */
+    public function setAverageScore($averageScore)
+    {
+        $this->averageScore = $averageScore;
+
+        return $this;
+    }
+
+    /**
+     * @return array
+     */
+    public function getUserScoreList()
+    {
+        if (empty($this->userScoreList)) {
+            return [];
+        }
+
+        return $this->userScoreList;
+    }
+
+    /**
+     * @param array $userScoreList
+     *
+     * @return GradebookEvaluation
+     */
+    public function setUserScoreList($userScoreList)
+    {
+        $this->userScoreList = $userScoreList;
+
+        return $this;
+    }
+
+    /**
+     * @return float
+     */
+    public function getScoreWeight()
+    {
+        return $this->scoreWeight;
+    }
+
+    /**
+     * @param float $scoreWeight
+     *
+     * @return GradebookEvaluation
+     */
+    public function setScoreWeight($scoreWeight)
+    {
+        $this->scoreWeight = $scoreWeight;
+
+        return $this;
+    }
 }

+ 112 - 0
src/Chamilo/CoreBundle/Entity/GradebookLink.php

@@ -85,6 +85,34 @@ class GradebookLink
      */
     protected $locked;
 
+    /**
+     * @var float
+     *
+     * ORM\Column(name="best_score", type="float", precision=6, scale=2, nullable=true)
+     */
+    protected $bestScore;
+
+    /**
+     * @var float
+     *
+     * ORM\Column(name="average_score", type="float", precision=6, scale=2, nullable=true)
+     */
+    protected $averageScore;
+
+    /**
+     * @var float
+     *
+     * ORM\Column(name="score_weight", type="float", precision=6, scale=2, nullable=true)
+     */
+    protected $scoreWeight;
+
+    /**
+     * @var array
+     *
+     * ORM\Column(name="user_score_list", type="array", nullable=true)
+     */
+    protected $userScoreList;
+
     /**
      * Set type.
      *
@@ -310,4 +338,88 @@ class GradebookLink
     {
         return $this->id;
     }
+
+    /**
+     * @return float
+     */
+    public function getBestScore()
+    {
+        return $this->bestScore;
+    }
+
+    /**
+     * @param float $bestScore
+     *
+     * @return GradebookLink
+     */
+    public function setBestScore($bestScore)
+    {
+        $this->bestScore = $bestScore;
+
+        return $this;
+    }
+
+    /**
+     * @return float
+     */
+    public function getAverageScore()
+    {
+        return $this->averageScore;
+    }
+
+    /**
+     * @param float $averageScore
+     *
+     * @return GradebookLink
+     */
+    public function setAverageScore($averageScore)
+    {
+        $this->averageScore = $averageScore;
+
+        return $this;
+    }
+
+    /**
+     * @return array
+     */
+    public function getUserScoreList()
+    {
+        if (empty($this->userScoreList)) {
+            return [];
+        }
+
+        return $this->userScoreList;
+    }
+
+    /**
+     * @param array $userScoreList
+     *
+     * @return GradebookLink
+     */
+    public function setUserScoreList($userScoreList)
+    {
+        $this->userScoreList = $userScoreList;
+
+        return $this;
+    }
+
+    /**
+     * @return float
+     */
+    public function getScoreWeight()
+    {
+        return $this->scoreWeight;
+    }
+
+    /**
+     * @param float $scoreWeight
+     *
+     * @return GradebookLink
+     */
+    public function setScoreWeight($scoreWeight)
+    {
+        $this->scoreWeight = $scoreWeight;
+
+        return $this;
+    }
 }

+ 3 - 3
src/Chamilo/CoreBundle/Entity/Message.php

@@ -47,7 +47,7 @@ class Message
     /**
      * @var bool
      *
-     * @ORM\Column(name="msg_status", type="smallint", nullable=false)
+     * @ORM\Column(name="msg_status", type="boolean", nullable=false)
      */
     protected $msgStatus;
 
@@ -103,8 +103,8 @@ class Message
     /**
      * @var ArrayCollection
      *
-     * Add @ to the next line if api_get_configuration_value('social_enable_likes_messages') is true
-     * ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\MessageLikes", mappedBy="message", orphanRemoval=true)
+     * Add @ to the next line if api_get_configuration_value('social_enable_messages_feedback') is true
+     * ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\MessageFeedback", mappedBy="message", orphanRemoval=true)
      */
     protected $likes;
 

+ 186 - 0
src/Chamilo/CoreBundle/Entity/MessageFeedback.php

@@ -0,0 +1,186 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+namespace Chamilo\CoreBundle\Entity;
+
+use Chamilo\UserBundle\Entity\User;
+use Doctrine\ORM\Mapping as ORM;
+use Doctrine\ORM\Mapping\Index;
+
+/**
+ * Class MessageFeedback.
+ *
+ * @package Chamilo\CoreBundle\Entity
+ *
+ * @ORM\Table(
+ *     name="message_feedback",
+ *     indexes={
+ *         @Index(name="idx_message_feedback_uid_mid", columns={"message_id", "user_id"})
+ *     }
+ * )
+ * Add @ to the next line if api_get_configuration_value('social_enable_messages_feedback') is true
+ * ORM\Entity()
+ */
+class MessageFeedback
+{
+    /**
+     * @var int
+     *
+     * @ORM\Column(name="id", type="bigint")
+     * @ORM\Id()
+     * @ORM\GeneratedValue()
+     */
+    private $id;
+    /**
+     * @var Message
+     *
+     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Message", inversedBy="likes")
+     * @ORM\JoinColumn(name="message_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
+     */
+    private $message;
+    /**
+     * @var User
+     *
+     * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User")
+     * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
+     */
+    private $user;
+    /**
+     * @var bool
+     *
+     * @ORM\Column(name="liked", type="boolean", options={"default": false})
+     */
+    private $liked;
+    /**
+     * @var bool
+     *
+     * @ORM\Column(name="disliked", type="boolean", options={"default": false})
+     */
+    private $disliked;
+    /**
+     * @var \DateTime
+     *
+     * @ORM\Column(name="updated_at", type="datetime", nullable=false)
+     */
+    private $updatedAt;
+
+    /**
+     * @return int
+     */
+    public function getId()
+    {
+        return $this->id;
+    }
+
+    /**
+     * @param int $id
+     *
+     * @return MessageFeedback
+     */
+    public function setId($id)
+    {
+        $this->id = $id;
+
+        return $this;
+    }
+
+    /**
+     * @return Message
+     */
+    public function getMessage()
+    {
+        return $this->message;
+    }
+
+    /**
+     * @param Message $message
+     *
+     * @return MessageFeedback
+     */
+    public function setMessage(Message $message)
+    {
+        $this->message = $message;
+
+        return $this;
+    }
+
+    /**
+     * @return User
+     */
+    public function getUser()
+    {
+        return $this->user;
+    }
+
+    /**
+     * @param User $user
+     *
+     * @return MessageFeedback
+     */
+    public function setUser(User $user)
+    {
+        $this->user = $user;
+
+        return $this;
+    }
+
+    /**
+     * @return bool
+     */
+    public function isLiked()
+    {
+        return $this->liked;
+    }
+
+    /**
+     * @param bool $liked
+     *
+     * @return MessageFeedback
+     */
+    public function setLiked($liked)
+    {
+        $this->liked = $liked;
+
+        return $this;
+    }
+
+    /**
+     * @return bool
+     */
+    public function isDisliked()
+    {
+        return $this->disliked;
+    }
+
+    /**
+     * @param bool $disliked
+     *
+     * @return MessageFeedback
+     */
+    public function setDisliked($disliked)
+    {
+        $this->disliked = $disliked;
+
+        return $this;
+    }
+
+    /**
+     * @return \DateTime
+     */
+    public function getUpdatedAt()
+    {
+        return $this->updatedAt;
+    }
+
+    /**
+     * @param \DateTime $updatedAt
+     *
+     * @return MessageFeedback
+     */
+    public function setUpdatedAt(\DateTime $updatedAt)
+    {
+        $this->updatedAt = $updatedAt;
+
+        return $this;
+    }
+}

+ 21 - 72
src/Chamilo/CourseBundle/Component/CourseCopy/Course.php

@@ -70,18 +70,18 @@ class Course
     /**
      * Does this course has resources?
      *
-     * @param int $resource_type Check if this course has resources of the
-     *                           given type. If no type is given, check if course has resources of any
-     *                           type.
+     * @param int $type Check if this course has resources of the
+     *                  given type. If no type is given, check if course has resources of any
+     *                  type.
      *
      * @return bool
      */
-    public function has_resources($resource_type = null)
+    public function has_resources($type = null)
     {
-        if ($resource_type != null) {
+        if ($type != null) {
             return
-                isset($this->resources[$resource_type]) && is_array($this->resources[$resource_type]) && (
-                    count($this->resources[$resource_type]) > 0
+                isset($this->resources[$type]) && is_array($this->resources[$type]) && (
+                    count($this->resources[$type]) > 0
                 );
         }
 
@@ -109,6 +109,9 @@ class Course
                     $description = '';
                     switch ($type) {
                         case RESOURCE_ANNOUNCEMENT:
+                        case RESOURCE_EVENT:
+                        case RESOURCE_THEMATIC:
+                        case RESOURCE_WIKI:
                             $title = $resource->title;
                             $description = $resource->content;
                             break;
@@ -116,16 +119,13 @@ class Course
                             $title = $resource->title;
                             $description = $resource->comment;
                             break;
-                        case RESOURCE_EVENT:
-                            $title = $resource->title;
-                            $description = $resource->content;
-                            break;
                         case RESOURCE_FORUM:
-                            $title = $resource->title;
-                            $description = $resource->description;
-                            break;
-
                         case RESOURCE_FORUMCATEGORY:
+                        case RESOURCE_LINK:
+                        case RESOURCE_LINKCATEGORY:
+                        case RESOURCE_QUIZ:
+                        case RESOURCE_TEST_CATEGORY:
+                        case RESOURCE_WORK:
                             $title = $resource->title;
                             $description = $resource->description;
                             break;
@@ -133,13 +133,11 @@ class Course
                             $title = $resource->title;
                             $description = $resource->text;
                             break;
+                        case RESOURCE_SCORM:
                         case RESOURCE_FORUMTOPIC:
                             $title = $resource->title;
                             break;
                         case RESOURCE_GLOSSARY:
-                            $title = $resource->name;
-                            $description = $resource->description;
-                            break;
                         case RESOURCE_LEARNPATH:
                             $title = $resource->name;
                             $description = $resource->description;
@@ -147,29 +145,10 @@ class Course
                         case RESOURCE_LEARNPATH_CATEGORY:
                             $title = $resource->name;
                             break;
-                        case RESOURCE_LINK:
-                            $title = $resource->title;
-                            $description = $resource->description;
-                            break;
-                        case RESOURCE_LINKCATEGORY:
-                            $title = $resource->title;
-                            $description = $resource->description;
-                            break;
-                        case RESOURCE_QUIZ:
-                            $title = $resource->title;
-                            $description = $resource->description;
-                            break;
-                        case RESOURCE_TEST_CATEGORY:
-                            $title = $resource->title;
-                            $description = $resource->description;
-                            break;
                         case RESOURCE_QUIZQUESTION:
                             $title = $resource->question;
                             $description = $resource->description;
                             break;
-                        case RESOURCE_SCORM:
-                            $title = $resource->title;
-                            break;
                         case RESOURCE_SURVEY:
                             $title = $resource->title;
                             $description = $resource->subtitle;
@@ -181,22 +160,10 @@ class Course
                         case RESOURCE_TOOL_INTRO:
                             $description = $resource->intro_text;
                             break;
-                        case RESOURCE_WIKI:
-                            $title = $resource->title;
-                            $description = $resource->content;
-                            break;
-                        case RESOURCE_THEMATIC:
-                            $title = $resource->title;
-                            $description = $resource->content;
-                            break;
                         case RESOURCE_ATTENDANCE:
                             $title = $resource->params['name'];
                             $description = $resource->params['description'];
                             break;
-                        case RESOURCE_WORK:
-                            $title = $resource->title;
-                            $description = $resource->description;
-                            break;
                         default:
                             break;
                     }
@@ -234,6 +201,7 @@ class Course
                 foreach ($resources as &$resource) {
                     switch ($type) {
                         case RESOURCE_ANNOUNCEMENT:
+                        case RESOURCE_EVENT:
                             $resource->title = api_to_system_encoding($resource->title, $this->encoding);
                             $resource->content = api_to_system_encoding($resource->content, $this->encoding);
                             break;
@@ -241,15 +209,12 @@ class Course
                             $resource->title = api_to_system_encoding($resource->title, $this->encoding);
                             $resource->comment = api_to_system_encoding($resource->comment, $this->encoding);
                             break;
-                        case RESOURCE_EVENT:
-                            $resource->title = api_to_system_encoding($resource->title, $this->encoding);
-                            $resource->content = api_to_system_encoding($resource->content, $this->encoding);
-                            break;
                         case RESOURCE_FORUM:
-                            $resource->title = api_to_system_encoding($resource->title, $this->encoding);
-                            $resource->description = api_to_system_encoding($resource->description, $this->encoding);
-                            break;
+                        case RESOURCE_QUIZ:
                         case RESOURCE_FORUMCATEGORY:
+                        case RESOURCE_LINK:
+                        case RESOURCE_LINKCATEGORY:
+                        case RESOURCE_TEST_CATEGORY:
                             $resource->title = api_to_system_encoding($resource->title, $this->encoding);
                             $resource->description = api_to_system_encoding($resource->description, $this->encoding);
                             break;
@@ -273,18 +238,6 @@ class Course
                             $resource->content_maker = api_to_system_encoding($resource->content_maker, $this->encoding);
                             $resource->content_license = api_to_system_encoding($resource->content_license, $this->encoding);
                             break;
-                        case RESOURCE_LINK:
-                            $resource->title = api_to_system_encoding($resource->title, $this->encoding);
-                            $resource->description = api_to_system_encoding($resource->description, $this->encoding);
-                            break;
-                        case RESOURCE_LINKCATEGORY:
-                            $resource->title = api_to_system_encoding($resource->title, $this->encoding);
-                            $resource->description = api_to_system_encoding($resource->description, $this->encoding);
-                            break;
-                        case RESOURCE_QUIZ:
-                            $resource->title = api_to_system_encoding($resource->title, $this->encoding);
-                            $resource->description = api_to_system_encoding($resource->description, $this->encoding);
-                            break;
                         case RESOURCE_QUIZQUESTION:
                             $resource->question = api_to_system_encoding($resource->question, $this->encoding);
                             $resource->description = api_to_system_encoding($resource->description, $this->encoding);
@@ -295,10 +248,6 @@ class Course
                                 }
                             }
                             break;
-                        case RESOURCE_TEST_CATEGORY:
-                            $resource->title = api_to_system_encoding($resource->title, $this->encoding);
-                            $resource->description = api_to_system_encoding($resource->description, $this->encoding);
-                            break;
                         case RESOURCE_SCORM:
                             $resource->title = api_to_system_encoding($resource->title, $this->encoding);
                             break;

+ 2 - 2
src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php

@@ -3346,7 +3346,7 @@ class CourseRestorer
                             $this->destination_course_info['real_id']
                         );
                         if (!empty($workData)) {
-                            continue;
+                            break;
                         }
                         break;
                     case FILE_OVERWRITE:
@@ -3542,7 +3542,7 @@ class CourseRestorer
                 ) {
                     switch ($this->file_option) {
                         case FILE_SKIP:
-                            continue;
+                            break;
                         case FILE_OVERWRITE:
                             copy(
                                 $this->course->backup_path.'/'.$asset->path,

+ 1 - 1
src/Chamilo/CourseBundle/Component/CourseCopy/Resources/QuizQuestion.php

@@ -110,7 +110,7 @@ class QuizQuestion extends Resource
             $courseId = $courseInfo['real_id'];
             $courseCode = $courseInfo['code'];
             $questionId = $this->source_id;
-            $question = \Question::read($questionId, $courseId);
+            $question = \Question::read($questionId, $courseInfo);
             $pictureId = $question->getPictureId();
             // Add the picture document in the builder
             if (!empty($pictureId)) {

+ 7 - 0
src/Chamilo/CourseBundle/Entity/CQuiz.php

@@ -209,6 +209,13 @@ class CQuiz
      */
     protected $hideQuestionTitle;
 
+    /**
+     * @var int
+     *
+     * ORM\Column(name="exercise_category_id", type="integer", nullable=true)
+     */
+    protected $exerciseCategoryId;
+
     /**
      * CQuiz constructor.
      */

+ 2 - 0
src/Chamilo/CourseBundle/Entity/CQuizCategory.php

@@ -8,6 +8,8 @@ use Doctrine\ORM\Mapping as ORM;
 /**
  * CQuizCategory.
  *
+ * Manages quiz question categories inside an exercise.
+ *
  * @ORM\Table(name="c_quiz_rel_category")
  * @ORM\Entity
  */

+ 1 - 1
src/Chamilo/PageBundle/Entity/User.php

@@ -2282,7 +2282,7 @@ class User extends BaseUser
      */
     public function unserialize($serialized)
     {
-        $data = unserialize($serialized);
+        $data = \UnserializeApi::unserialize('not_allowed_classes', $serialized);
         // add a few extra elements in the array to ensure that we have enough keys when unserializing
         // older data which does not include all properties.
         $data = array_merge($data, array_fill(0, 2, null));

+ 32 - 0
user_portal.php

@@ -34,8 +34,39 @@ $this_section = SECTION_COURSES;
 
 api_block_anonymous_users(); // Only users who are logged in can proceed.
 
+$logInfo = [
+    'tool' => SECTION_COURSES,
+    'tool_id' => 0,
+    'tool_id_detail' => 0,
+    'action' => '',
+    'info' => '',
+];
+Event::registerLog($logInfo);
+
 $userId = api_get_user_id();
 
+$collapsable = api_get_configuration_value('allow_user_session_collapsable');
+if ($collapsable) {
+    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
+    $sessionId = isset($_REQUEST['session_id']) ? $_REQUEST['session_id'] : '';
+    $value = isset($_REQUEST['value']) ? (int) $_REQUEST['value'] : '';
+    switch ($action) {
+        case 'collapse_session':
+            if (!empty($sessionId)) {
+                $userRelSession = SessionManager::getUserSession($userId, $sessionId);
+                if ($userRelSession) {
+                    $table = Database::get_main_table(TABLE_MAIN_SESSION_USER);
+                    $sql = "UPDATE $table SET collapsed = $value WHERE id = ".$userRelSession['id'];
+                    Database::query($sql);
+                    Display::addFlash(Display::return_message(get_lang('Updated')));
+                }
+                header('Location: user_portal.php');
+                exit;
+            }
+            break;
+    }
+}
+
 /* Constants and CONFIGURATION parameters */
 $load_dirs = api_get_setting('show_documents_preview');
 $displayMyCourseViewBySessionLink = api_get_setting('my_courses_view_by_session') === 'true';
@@ -353,5 +384,6 @@ $controller->tpl->display_two_col_template();
 
 // Deleting the session_id.
 Session::erase('session_id');
+Session::erase('id_session');
 Session::erase('studentview');
 api_remove_in_gradebook();