Update from 1.11.x

pull/3016/head
Julio 7 years ago
parent 4d7dee9891
commit f1de3a0ddb
  1. 8
      main/inc/lib/formvalidator/FormValidator.class.php
  2. 3
      main/inc/lib/pear/HTML/QuickForm/textarea.php
  3. 2
      main/inc/lib/sessionmanager.lib.php
  4. 2
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php
  5. 11
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php
  6. 7
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php
  7. 2
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php
  8. 2
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/FAQ.php
  9. 1
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/Forum.php
  10. 2
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/ForumStudent.php
  11. 4
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/Glossary.php
  12. 4
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/Messages.php
  13. 4
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/Profile.php
  14. 4
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/Project.php
  15. 4
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectComment.php
  16. 2
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectCommentStudent.php
  17. 4
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectStudent.php
  18. 4
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/Register.php
  19. 2
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/Survey.php
  20. 2
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswer.php
  21. 5
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/TestMatching.php
  22. 2
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiStudent.php
  23. 4
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiTask.php
  24. 4
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/Work.php
  25. 38
      src/CoreBundle/Component/Editor/Driver/CourseDriver.php
  26. 28
      src/CoreBundle/Component/Utils/ChamiloApi.php
  27. 5
      src/CourseBundle/Component/CourseCopy/Course.php
  28. 13
      src/CourseBundle/Component/CourseCopy/CourseArchiver.php
  29. 96
      src/CourseBundle/Component/CourseCopy/CourseBuilder.php
  30. 94
      src/CourseBundle/Component/CourseCopy/CourseRecycler.php
  31. 79
      src/CourseBundle/Component/CourseCopy/CourseRestorer.php
  32. 21
      src/CourseBundle/Component/CourseCopy/CourseSelectForm.php
  33. 6
      src/CourseBundle/Component/CourseCopy/Resources/LearnPathCategory.php
  34. 8
      src/CourseBundle/Component/CourseCopy/Resources/Survey.php

@ -1019,6 +1019,7 @@ EOT;
$config = [],
$attributes = []
) {
$attributes = [];
$attributes['rows'] = isset($config['rows']) ? $config['rows'] : 15;
$attributes['cols'] = isset($config['cols']) ? $config['cols'] : 80;
$attributes['cols-size'] = isset($config['cols-size']) ? $config['cols-size'] : [];
@ -1032,7 +1033,6 @@ EOT;
/** @var HtmlEditor $element */
$element = $this->getElement($name);
$config['style'] = false;
if ($fullPage) {
$config['fullPage'] = true;
@ -1174,10 +1174,8 @@ EOT;
// @todo improve UI
$returnValue .= '<br />
<div id="loading_div_'.$id.'" class="loading_div" style="display:none;height:50vh;">
<div id="main-spinner">
<span class="spinner"></span>
</div>
<div id="loading_div_'.$id.'" class="loading_div" style="display:none;margin-left:40%; margin-top:10px; height:50px;">
<div class="wobblebar-loader"></div>
</div>
';
}

@ -204,9 +204,6 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
{
$size = $this->getColumnsSize();
$custom = $this->getAttributes();
$this->removeAttribute('cols-size');
if (empty($size)) {

@ -7769,7 +7769,7 @@ SQL;
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
if (empty($sessionId)) {
$sessions = SessionManager::formatSessionsAdminForGrid();
$sessions = self::formatSessionsAdminForGrid();
$sessionList = [];
$sessionList[] = '';
foreach ($sessions as $session) {

@ -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'],
];

@ -65,6 +65,13 @@ class Basic extends Toolbar
'xml',
];
/**
* Plugins this toolbar.
*
* @var array
*/
public $plugins = [];
/**
* {@inheritdoc}
*/
@ -127,7 +134,7 @@ class Basic extends Toolbar
$plugins[] = 'scayt';
}
$this->defaultPlugins = array_merge($this->defaultPlugins, $plugins);
$this->defaultPlugins = array_unique(array_merge($this->defaultPlugins, $plugins));
parent::__construct($router, $toolbar, $config, $prefix);
}
@ -170,7 +177,7 @@ class Basic extends Toolbar
'wordLimit' => 'unlimited'
);*/
$config['skin'] = 'bootstrapck';
$config['skin'] = 'moono-lisa';
$config['image2_chamilo_alignClasses'] = [
'pull-left',

@ -18,6 +18,7 @@ class Documents extends Basic
public function getConfig()
{
$config = [];
if (api_get_setting('more_buttons_maximized_mode') !== 'true') {
$config['toolbar'] = $this->getNormalToolbar();
} else {
@ -75,12 +76,13 @@ class Documents extends Basic
'NumberedList',
'BulletedList',
'-',
api_get_configuration_value('translate_html') ? 'Language' : '',
api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : '',
],
'/',
['Styles', 'Format', 'Font', 'FontSize'],
['Bold', 'Italic', 'Underline'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
['Source'],
];
@ -108,7 +110,7 @@ class Documents extends Basic
'Asciisvg',
],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
['Styles',
'Format',
'Font',
@ -120,6 +122,7 @@ class Documents extends Basic
'BGColor',
],
[
api_get_configuration_value('translate_html') ? 'Language' : '',
'ShowBlocks',
'Source',
],

@ -148,7 +148,7 @@ class DocumentsStudent extends Basic
'Asciisvg',
],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
[
'Format',
'Font',

@ -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'],
];

@ -56,6 +56,7 @@ class Forum extends Basic
'JustifyLeft',
'JustifyCenter',
'JustifyRight',
'JustifyBlock',
],
];
}

@ -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'],
];

@ -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'],
];

@ -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'],
];

@ -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'],
];

@ -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'],
];

@ -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'],
];

@ -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'],
];
}

@ -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'],
];

@ -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'],
];
}
}

@ -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'],
];

@ -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'],
];

@ -87,8 +87,7 @@ class TestMatching extends Basic
'Subscript',
'Superscript',
'ShowBlocks',
], ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
['Source'],
],
];
}
@ -104,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'],
];

@ -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'],

@ -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'],

@ -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'],
];

@ -98,16 +98,49 @@ class CourseDriver extends Driver implements DriverInterface
'hidden' => true,
'locked' => false,
],
[
'pattern' => '/^\/index.html$/',
'read' => false,
'write' => false,
'hidden' => true,
'locked' => false,
],
],
];
// admin/teachers can create dirs from ckeditor
if ($this->allowToEdit()) {
$config['attributes'][] = [
'pattern' => '/^\/learning_path$/', // block delete learning_path
'read' => true,
'write' => false,
'hidden' => false,
'locked' => true,
];
$config['attributes'][] = [
'pattern' => '/learning_path\/(.*)/', // allow edit/delete inside learning_path
'read' => true,
'write' => true,
'hidden' => false,
'locked' => false,
];
$defaultDisabled = $this->connector->getDefaultDriverSettings()['disabled'];
$defaultDisabled = array_flip($defaultDisabled);
unset($defaultDisabled['mkdir']);
$defaultDisabled = array_flip($defaultDisabled);
$config['disabled'] = $defaultDisabled;
} else {
$protectedFolders = \DocumentManager::getProtectedFolderFromStudent();
foreach ($protectedFolders as $folder) {
$config['attributes'][] = [
'pattern' => $folder.'/',
'read' => false,
'write' => false,
'hidden' => true,
'locked' => false,
];
}
}
$courseInfo = [
@ -347,6 +380,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;
}

@ -174,8 +174,8 @@ class ChamiloApi
/**
* Adds or Subtract a time in hh:mm:ss to a datetime.
*
* @param string $time Time in hh:mm:ss format
* @param string $datetime Datetime as accepted by the Datetime class constructor
* @param string $time Time to add or substract in hh:mm:ss format
* @param string $datetime Datetime to be modified as accepted by the Datetime class constructor
* @param bool $operation True for Add, False to Subtract
*
* @return string
@ -320,7 +320,8 @@ class ChamiloApi
}
if ($wrapInRGBA) {
foreach ($palette as $index => $color) {
$palette[$index] = 'rgba('.$palette[$index].')';
$color = trim($color);
$palette[$index] = 'rgba('.$color.')';
}
}
// If we want more colors, loop through existing colors
@ -333,4 +334,25 @@ class ChamiloApi
return $palette;
}
/**
* Get the local time for the midnight.
*
* @param string|null $utcTime Optional. The time to ve converted.
* See api_get_local_time.
*
* @throws \Exception
*
* @return \DateTime
*/
public static function getServerMidnightTime($utcTime = null)
{
$localTime = api_get_local_time($utcTime);
$localTimeZone = api_get_timezone();
$localMidnight = new \DateTime($localTime, new \DateTimeZone($localTimeZone));
$localMidnight->modify('midnight');
return $localMidnight;
}
}

@ -379,7 +379,10 @@ class Course
if (extension_loaded('igbinary')) {
$unserialized = igbinary_unserialize($course);
} else {
$unserialized = unserialize($course);
$unserialized = \UnserializeApi::unserialize(
'course',
$course
);
}
return $unserialized;

@ -251,7 +251,7 @@ class CourseArchiver
*/
public static function importUploadedFile($file)
{
$new_filename = uniqid('').'.zip';
$new_filename = uniqid('import_file', true).'.zip';
$new_dir = self::getBackupDir();
if (!is_dir($new_dir)) {
$fs = new Filesystem();
@ -293,7 +293,13 @@ class CourseArchiver
// unzip the archive
$zip = new \PclZip($unzip_dir.'/backup.zip');
@chdir($unzip_dir);
$zip->extract(PCLZIP_OPT_TEMP_FILE_ON);
$zip->extract(
PCLZIP_OPT_TEMP_FILE_ON,
PCLZIP_CB_PRE_EXTRACT,
'clean_up_files_in_zip'
);
// remove the archive-file
if ($delete) {
@unlink($filePath);
@ -337,7 +343,8 @@ class CourseArchiver
class_alias('Chamilo\CourseBundle\Component\CourseCopy\Resources\Wiki', 'Wiki');
class_alias('Chamilo\CourseBundle\Component\CourseCopy\Resources\Work', 'Work');
$course = unserialize(base64_decode($contents));
/** @var Course $course */
$course = \UnserializeApi::unserialize('course', base64_decode($contents));
if (!in_array(
get_class($course),

@ -102,6 +102,7 @@ class CourseBuilder
/* With this array you can filter wich elements of the tools are going
to be added in the course obj (only works with LPs) */
public $specific_id_list = [];
public $documentsAddedInText = [];
/**
* Create a new CourseBuilder.
@ -126,6 +127,68 @@ class CourseBuilder
$this->course->info = $_course;
}
/**
* @param array $list
*/
public function addDocumentList($list)
{
foreach ($list as $item) {
if (!in_array($item[0], $this->documentsAddedInText)) {
$this->documentsAddedInText[$item[0]] = $item;
}
}
}
/**
* @param string $text
*/
public function findAndSetDocumentsInText($text)
{
$documentList = \DocumentManager::get_resources_from_source_html($text);
$this->addDocumentList($documentList);
}
/**
* Parse documents added in the documentsAddedInText variable.
*/
public function restoreDocumentsFromList()
{
if (!empty($this->documentsAddedInText)) {
$list = [];
$courseInfo = api_get_course_info();
foreach ($this->documentsAddedInText as $item) {
// Get information about source url
$url = $item[0]; // url
$scope = $item[1]; // scope (local, remote)
$type = $item[2]; // type (rel, abs, url)
$origParseUrl = parse_url($url);
$realOrigPath = isset($origParseUrl['path']) ? $origParseUrl['path'] : null;
if ($scope == 'local') {
if ($type == 'abs' || $type == 'rel') {
$documentFile = strstr($realOrigPath, 'document');
if (strpos($realOrigPath, $documentFile) !== false) {
$documentFile = str_replace('document', '', $documentFile);
$itemDocumentId = \DocumentManager::get_document_id($courseInfo, $documentFile);
// Document found! Add it to the list
if ($itemDocumentId) {
$list[] = $itemDocumentId;
}
}
}
}
}
$this->build_documents(
api_get_session_id(),
api_get_course_int_id(),
true,
$list
);
}
}
/**
* @param array $array
*/
@ -302,7 +365,7 @@ class CourseBuilder
}
if (!empty($this->course->type) && $this->course->type == 'partial') {
$sql = "SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size
$sql = "SELECT d.iid, d.path, d.comment, d.title, d.filetype, d.size
FROM $table_doc d
INNER JOIN $table_prop p
ON (p.ref = d.id AND d.c_id = p.c_id)
@ -317,7 +380,7 @@ class CourseBuilder
$session_condition
ORDER BY path";
} else {
$sql = "SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size
$sql = "SELECT d.iid, d.path, d.comment, d.title, d.filetype, d.size
FROM $table_doc d
INNER JOIN $table_prop p
ON (p.ref = d.id AND d.c_id = p.c_id)
@ -334,7 +397,7 @@ class CourseBuilder
$db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result)) {
$doc = new Document(
$obj->id,
$obj->iid,
$obj->path,
$obj->comment,
$obj->title,
@ -345,7 +408,7 @@ class CourseBuilder
}
} else {
if (!empty($this->course->type) && $this->course->type == 'partial') {
$sql = "SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size
$sql = "SELECT d.iid, d.path, d.comment, d.title, d.filetype, d.size
FROM $table_doc d
INNER JOIN $table_prop p
ON (p.ref = d.id AND d.c_id = p.c_id)
@ -360,7 +423,7 @@ class CourseBuilder
(d.session_id = 0 OR d.session_id IS NULL)
ORDER BY path";
} else {
$sql = "SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size
$sql = "SELECT d.iid, d.path, d.comment, d.title, d.filetype, d.size
FROM $table_doc d
INNER JOIN $table_prop p
ON (p.ref = d.id AND d.c_id = p.c_id)
@ -378,7 +441,7 @@ class CourseBuilder
$result = Database::query($sql);
while ($obj = Database::fetch_object($result)) {
$doc = new Document(
$obj->id,
$obj->iid,
$obj->path,
$obj->comment,
$obj->title,
@ -732,6 +795,7 @@ class CourseBuilder
$doc = Database::fetch_object($res);
$obj->sound = $doc->id;
}
$this->findAndSetDocumentsInText($obj->description);
$quiz = new Quiz($obj);
$sql = 'SELECT * FROM '.$table_rel.'
@ -780,6 +844,8 @@ class CourseBuilder
$courseId
);
$this->findAndSetDocumentsInText($obj->description);
// build the backup resource question object
$question = new QuizQuestion(
$obj->id,
@ -809,6 +875,10 @@ class CourseBuilder
$obj2->hotspot_coordinates,
$obj2->hotspot_type
);
$this->findAndSetDocumentsInText($obj2->answer);
$this->findAndSetDocumentsInText($obj2->comment);
if ($obj->type == MULTIPLE_ANSWER_TRUE_FALSE) {
$table_options = Database::get_course_table(TABLE_QUIZ_QUESTION_OPTION);
$sql = 'SELECT * FROM '.$table_options.'
@ -1013,6 +1083,8 @@ class CourseBuilder
// get all test category in course
$categories = TestCategory::getCategoryListInfo('', $courseId);
foreach ($categories as $category) {
$this->findAndSetDocumentsInText($category->description);
/** @var TestCategory $category */
$courseCopyTestCategory = new CourseCopyTestCategory(
$category->id,
@ -1072,7 +1144,9 @@ class CourseBuilder
$obj->invited,
$obj->answered,
$obj->invite_mail,
$obj->reminder_mail
$obj->reminder_mail,
$obj->one_question_per_page,
$obj->shuffle
);
$sql = 'SELECT * FROM '.$table_question.'
WHERE c_id = '.$courseId.' AND survey_id = '.$obj->survey_id;
@ -1096,8 +1170,14 @@ class CourseBuilder
$table_opt = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$courseId = (int) $courseId;
$idList = isset($this->specific_id_list['surveys']) ? $this->specific_id_list['surveys'] : [];
$sql = 'SELECT * FROM '.$table_que.' WHERE c_id = '.$courseId.' ';
if (!empty($idList)) {
$sql .= " AND survey_id IN (".implode(', ', $idList).")";
}
$db_result = Database::query($sql);
$is_required = 0;
while ($obj = Database::fetch_object($db_result)) {
@ -1382,7 +1462,7 @@ class CourseBuilder
WHERE c_id = '$courseId' AND lp_id = ".$obj->id;
$resultItem = Database::query($sql);
while ($obj_item = Database::fetch_object($resultItem)) {
$item['id'] = $obj_item->id;
$item['id'] = $obj_item->iid;
$item['item_type'] = $obj_item->item_type;
$item['ref'] = $obj_item->ref;
$item['title'] = $obj_item->title;

@ -66,6 +66,7 @@ class CourseRecycler
$this->recycle_test_category();
$this->recycle_surveys();
$this->recycle_learnpaths();
$this->recycle_learnpath_categories();
$this->recycle_cours_description();
$this->recycle_wiki();
$this->recycle_glossary();
@ -305,49 +306,56 @@ class CourseRecycler
}
/**
* Delete forum-categories
* Deletes all forum-categories from current course without forums.
* Deletes all forum-categories without forum from the current course.
* Categories with forums in it are dealt with by recycle_forums()
* This requires a check on the status of the forum item in c_item_property.
*/
public function recycle_forum_categories()
{
$table_forum = Database::get_course_table(TABLE_FORUM);
$table_forumcat = Database::get_course_table(TABLE_FORUM_CATEGORY);
$sql = "SELECT fc.cat_id FROM ".$table_forumcat." fc
LEFT JOIN ".$table_forum." f
ON
fc.cat_id=f.forum_category AND
fc.c_id = ".$this->course_id." AND
f.c_id = ".$this->course_id."
WHERE f.forum_id IS NULL";
$res = Database::query($sql);
while ($obj = Database::fetch_object($res)) {
$sql = "DELETE FROM ".$table_forumcat."
WHERE c_id = ".$this->course_id." AND cat_id = ".$obj->cat_id;
Database::query($sql);
}
$forumTable = Database::get_course_table(TABLE_FORUM);
$forumCategoryTable = Database::get_course_table(TABLE_FORUM_CATEGORY);
$itemPropertyTable = Database::get_course_table(TABLE_ITEM_PROPERTY);
$courseId = $this->course_id;
// c_forum_forum.forum_category points to c_forum_category.cat_id and
// has to be queried *with* the c_id to ensure a match
$subQuery = "SELECT distinct(f.forum_category) as categoryId
FROM $forumTable f, $itemPropertyTable i
WHERE
f.c_id = $courseId AND
i.c_id = f.c_id AND
i.tool = 'forum' AND
f.iid = i.ref AND
i.visibility = 1";
$sql = "DELETE FROM $forumCategoryTable
WHERE c_id = $courseId AND cat_id NOT IN ($subQuery)";
Database::query($sql);
}
/**
* Delete link-categories
* Deletes all empty link-categories (=without links) from current course.
* Links are already dealt with by recycle_links() but if recycle is called
* on categories and not on link, then non-empty categories will survive
* the recycling.
*/
public function recycle_link_categories()
{
$link_cat_table = Database::get_course_table(TABLE_LINK_CATEGORY);
$link_table = Database::get_course_table(TABLE_LINK);
$sql = "SELECT lc.id FROM $link_cat_table lc
LEFT JOIN ".$link_table." l
ON
lc.id=l.category_id AND
lc.c_id = ".$this->course_id." AND
l.c_id = ".$this->course_id."
WHERE l.id IS NULL";
$res = Database::query($sql);
while ($obj = Database::fetch_object($res)) {
$sql = "DELETE FROM ".$link_cat_table."
WHERE c_id = ".$this->course_id." AND id = ".$obj->id;
Database::query($sql);
}
$linkCategoryTable = Database::get_course_table(TABLE_LINK_CATEGORY);
$linkTable = Database::get_course_table(TABLE_LINK);
$itemPropertyTable = Database::get_course_table(TABLE_ITEM_PROPERTY);
$courseId = $this->course_id;
// c_link.category_id points to c_link_category.id and
// has to be queried *with* the c_id to ensure a match
$subQuery = "SELECT distinct(l.category_id) as categoryId
FROM $linkTable l, $itemPropertyTable i
WHERE
l.c_id = $courseId AND
i.c_id = l.c_id AND
i.tool = 'link' AND
l.iid = i.ref AND
i.visibility = 1";
$sql = "DELETE FROM $linkCategoryTable
WHERE c_id = $courseId AND id NOT IN ($subQuery)";
Database::query($sql);
}
/**
@ -603,6 +611,26 @@ class CourseRecycler
}
}
/**
* Recycle selected learning path categories and dissociate learning paths
* that are associated with it.
*/
public function recycle_learnpath_categories()
{
$learningPathTable = Database::get_course_table(TABLE_LP_MAIN);
$learningPathCategoryTable = Database::get_course_table(TABLE_LP_CATEGORY);
if (isset($this->course->resources[RESOURCE_LEARNPATH_CATEGORY])) {
foreach ($this->course->resources[RESOURCE_LEARNPATH_CATEGORY] as $id => $learnpathCategory) {
$categoryId = $learnpathCategory->object->getId();
// Dissociate learning paths from categories that will be deleted
$sql = "UPDATE $learningPathTable SET category_id = 0 WHERE category_id = ".$categoryId;
Database::query($sql);
$sql = "DELETE FROM $learningPathCategoryTable WHERE iid = ".$categoryId;
Database::query($sql);
}
}
}
/**
* Delete course description.
*/

@ -153,9 +153,7 @@ class CourseRestorer
$this->destination_course_id = $course_info['real_id'];
// Getting first teacher (for the forums)
$teacher_list = CourseManager::get_teacher_list_from_course_code(
$course_info['code']
);
$teacher_list = CourseManager::get_teacher_list_from_course_code($course_info['code']);
$this->first_teacher_id = api_get_user_id();
if (!empty($teacher_list)) {
@ -1810,7 +1808,7 @@ class CourseRestorer
$this->course->resources[RESOURCE_DOCUMENT][$quiz->sound]->is_restored()) {
$sql = "SELECT path FROM $table_doc
WHERE
c_id = ".$this->destination_course_id." AND
c_id = ".$this->destination_course_id." AND
id = ".$resources[RESOURCE_DOCUMENT][$quiz->sound]->destination_id;
$doc = Database::query($sql);
$doc = Database::fetch_object($doc);
@ -1868,7 +1866,7 @@ class CourseRestorer
$allow = api_get_configuration_value('allow_notification_setting_per_exercise');
if ($allow) {
$params['notifications'] = $quiz->notifications;
$params['notifications'] = isset($quiz->notifications) ? $quiz->notifications : '';
}
if ($respect_base_content) {
@ -1972,6 +1970,8 @@ class CourseRestorer
if ($new_id) {
$sql = "UPDATE $table_que SET id = iid WHERE iid = $new_id";
Database::query($sql);
} else {
return 0;
}
$correctAnswers = [];
@ -2176,13 +2176,19 @@ class CourseRestorer
// Fix correct answers
if (in_array($question->quiz_type, [DRAGGABLE, MATCHING, MATCHING_DRAGGABLE])) {
$onlyAnswersFlip = array_flip($onlyAnswers);
foreach ($correctAnswers as $answer_id => $correct_answer) {
$params = [];
if (isset($allAnswers[$correct_answer]) &&
isset($onlyAnswersFlip[$allAnswers[$correct_answer]])
) {
$params['correct'] = $onlyAnswersFlip[$allAnswers[$correct_answer]];
if (isset($allAnswers[$correct_answer])) {
$correct = '';
foreach ($onlyAnswers as $key => $value) {
if ($value == $allAnswers[$correct_answer]) {
$correct = $key;
break;
}
}
$params['correct'] = $correct;
Database::update(
$table_ans,
$params,
@ -2355,14 +2361,16 @@ class CourseRestorer
'avail_till' => self::DBUTF8($survey->avail_till),
'is_shared' => self::DBUTF8($survey->is_shared),
'template' => self::DBUTF8($survey->template),
'intro' => ($survey->intro === false ? '' : self::DBUTF8($survey->intro)),
'surveythanks' => ($survey->surveythanks === false ? '' : self::DBUTF8($survey->surveythanks)),
'intro' => $survey->intro === false ? '' : self::DBUTF8($survey->intro),
'surveythanks' => $survey->surveythanks === false ? '' : self::DBUTF8($survey->surveythanks),
'creation_date' => self::DBUTF8($survey->creation_date),
'invited' => '0',
'answered' => '0',
'invite_mail' => self::DBUTF8($survey->invite_mail),
'reminder_mail' => self::DBUTF8($survey->reminder_mail),
'session_id' => $sessionId,
'one_question_per_page' => isset($survey->one_question_per_page) ? $survey->one_question_per_page : 0,
'shuffle' => isset($survey->suffle) ? $survey->suffle : 0,
];
// An existing survey exists with the same code and the same language
@ -2590,13 +2598,16 @@ class CourseRestorer
foreach ($resources[RESOURCE_LEARNPATH_CATEGORY] as $id => $item) {
/** @var CLpCategory $lpCategory */
$lpCategory = $item->object;
$values = [
'c_id' => $this->destination_course_id,
'name' => $lpCategory->getName(),
];
$categoryId = \learnpath::createCategory($values);
if ($categoryId) {
$this->course->resources[RESOURCE_LEARNPATH_CATEGORY][$id]->destination_id = $categoryId;
if ($lpCategory) {
$values = [
'c_id' => $this->destination_course_id,
'name' => $lpCategory->getName(),
];
$categoryId = \learnpath::createCategory($values);
if ($categoryId) {
$this->course->resources[RESOURCE_LEARNPATH_CATEGORY][$id]->destination_id = $categoryId;
}
}
}
}
@ -2711,8 +2722,8 @@ class CourseRestorer
'preview_image' => self::DBUTF8($lp->preview_image),
'use_max_score' => self::DBUTF8($lp->use_max_score),
'autolaunch' => self::DBUTF8(isset($lp->autolaunch) ? $lp->autolaunch : ''),
'created_on' => self::DBUTF8($lp->created_on),
'modified_on' => self::DBUTF8($lp->modified_on),
'created_on' => empty($lp->created_on) ? api_get_utc_datetime() : self::DBUTF8($lp->created_on),
'modified_on' => empty($lp->modified_on) ? api_get_utc_datetime() : self::DBUTF8($lp->modified_on),
'publicated_on' => empty($lp->publicated_on) ? api_get_utc_datetime() : self::DBUTF8($lp->publicated_on),
'expired_on' => self::DBUTF8($lp->expired_on),
'debug' => self::DBUTF8($lp->debug),
@ -2873,7 +2884,7 @@ class CourseRestorer
// Updating prerequisites
foreach ($old_prerequisite as $key => $my_old_prerequisite) {
if ($my_old_prerequisite != '') {
$sql = "UPDATE ".$table_item." SET prerequisite = '".$my_old_prerequisite."'
$sql = "UPDATE $table_item SET prerequisite = '".$my_old_prerequisite."'
WHERE c_id = ".$this->destination_course_id." AND id = '".$key."' ";
Database::query($sql);
}
@ -2882,49 +2893,53 @@ class CourseRestorer
// Updating refs
foreach ($old_refs as $key => $my_old_ref) {
if ($my_old_ref != '') {
$sql = "UPDATE ".$table_item." SET ref = '".$my_old_ref."'
$sql = "UPDATE $table_item SET ref = '".$my_old_ref."'
WHERE c_id = ".$this->destination_course_id." AND id = '".$key."' ";
Database::query($sql);
}
}
foreach ($parent_item_ids as $new_item_id => $parent_item_old_id) {
$new_item_id = (int) $new_item_id;
$parent_new_id = 0;
if ($parent_item_old_id != 0) {
$parent_new_id = $new_item_ids[$parent_item_old_id];
$parent_new_id = isset($new_item_ids[$parent_item_old_id]) ? $new_item_ids[$parent_item_old_id] : 0;
}
$sql = "UPDATE ".$table_item." SET parent_item_id = '".$parent_new_id."'
WHERE c_id = ".$this->destination_course_id." AND id = '".$new_item_id."'";
$sql = "UPDATE $table_item SET parent_item_id = '$parent_new_id'
WHERE c_id = ".$this->destination_course_id." AND id = $new_item_id";
Database::query($sql);
}
foreach ($previous_item_ids as $new_item_id => $previous_item_old_id) {
$new_item_id = (int) $new_item_id;
$previous_new_id = 0;
if ($previous_item_old_id != 0) {
$previous_new_id = isset($new_item_ids[$previous_item_old_id]) ? $new_item_ids[$previous_item_old_id] : '';
$previous_new_id = isset($new_item_ids[$previous_item_old_id]) ? $new_item_ids[$previous_item_old_id] : 0;
}
$sql = "UPDATE ".$table_item." SET previous_item_id = '".$previous_new_id."'
$sql = "UPDATE $table_item SET previous_item_id = $previous_new_id
WHERE c_id = ".$this->destination_course_id." AND id = '".$new_item_id."'";
Database::query($sql);
}
foreach ($next_item_ids as $new_item_id => $next_item_old_id) {
$new_item_id = (int) $new_item_id;
$next_new_id = 0;
if ($next_item_old_id != 0) {
$next_new_id = $new_item_ids[$next_item_old_id];
$next_new_id = isset($new_item_ids[$next_item_old_id]) ? $new_item_ids[$next_item_old_id] : 0;
}
$sql = "UPDATE ".$table_item." SET next_item_id = '".$next_new_id."'
$sql = "UPDATE $table_item SET next_item_id = $next_new_id
WHERE c_id = ".$this->destination_course_id." AND id = '".$new_item_id."'";
Database::query($sql);
}
foreach ($prerequisite_ids as $new_item_id => $prerequisite_old_id) {
$new_item_id = (int) $new_item_id;
$prerequisite_new_id = 0;
if ($prerequisite_old_id != 0) {
$prerequisite_new_id = $new_item_ids[$prerequisite_old_id];
}
$sql = "UPDATE ".$table_item." SET prerequisite = '".$prerequisite_new_id."'
WHERE c_id = ".$this->destination_course_id." AND id = '".$new_item_id."'";
$sql = "UPDATE $table_item SET prerequisite = $prerequisite_new_id
WHERE c_id = ".$this->destination_course_id." AND id = $new_item_id";
Database::query($sql);
}
$this->course->resources[RESOURCE_LEARNPATH][$id]->destination_id = $new_lp_id;

@ -37,6 +37,7 @@ class CourseSelectForm
$list[RESOURCE_QUIZ] = get_lang('Tests');
$list[RESOURCE_TEST_CATEGORY] = get_lang('QuestionCategory');
$list[RESOURCE_LEARNPATH] = get_lang('ToolLearnpath');
$list[RESOURCE_LEARNPATH_CATEGORY] = get_lang('LearnpathCategory');
$list[RESOURCE_SCORM] = 'SCORM';
$list[RESOURCE_TOOL_INTRO] = get_lang('ToolIntro');
$list[RESOURCE_SURVEY] = get_lang('Survey');
@ -444,7 +445,7 @@ class CourseSelectForm
{
if (is_array($course->resources)) {
foreach ($course->resources as $type => $resources) {
if (count($resources) > 0) {
if (!empty($resources) && count($resources) > 0) {
switch ($type) {
case RESOURCE_QUIZQUESTION:
foreach ($resources as $id => $resource) {
@ -467,7 +468,7 @@ class CourseSelectForm
{
if (is_array($course->resources)) {
foreach ($course->resources as $type => $resources) {
if (count($resources) > 0) {
if (!empty($resources) && count($resources) > 0) {
switch ($type) {
case RESOURCE_SCORM:
foreach ($resources as $id => $resource) {
@ -497,13 +498,11 @@ class CourseSelectForm
*/
public static function get_posted_course($from = '', $session_id = 0, $course_code = '', $postedCourse = null)
{
$course = null;
if (isset($_POST['course'])) {
$course = Course::unserialize(base64_decode($_POST['course']));
}
if ($postedCourse) {
$course = $postedCourse;
$course = $postedCourse;
if (empty($postedCourse)) {
$cb = new CourseBuilder();
$postResource = isset($_POST['resource']) ? $_POST['resource'] : [];
$course = $cb->build(0, null, false, array_keys($postResource), $postResource);
}
if (empty($course)) {
@ -527,7 +526,7 @@ class CourseSelectForm
foreach ($resource as $resource_item) {
$conditionSession = '';
if (!empty($session_id)) {
$session_id = intval($session_id);
$session_id = (int) $session_id;
$conditionSession = ' AND d.session_id ='.$session_id;
}
@ -645,7 +644,7 @@ class CourseSelectForm
$documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null;
if (!empty($resources) && is_array($resources)) {
foreach ($resources as $id => $obj) {
if (isset($obj->file_type) && $obj->file_type == 'folder' &&
if (isset($obj->file_type) && $obj->file_type === 'folder' &&
!isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) &&
is_array($documents)
) {

@ -21,10 +21,8 @@ class LearnPathCategory extends Resource
* @param int $id
* @param string $object
*/
public function __construct(
$id,
$object
) {
public function __construct($id, $object)
{
parent::__construct($id, RESOURCE_LEARNPATH_CATEGORY);
$this->object = $object;
}

@ -92,6 +92,8 @@ class Survey extends Resource
* @param int $answered
* @param string $invite_mail
* @param string $reminder_mail
* @param int $oneQuestionPerPage
* @param int $shuffle
*/
public function __construct(
$id,
@ -110,7 +112,9 @@ class Survey extends Resource
$invited,
$answered,
$invite_mail,
$reminder_mail
$reminder_mail,
$oneQuestionPerPage,
$shuffle
) {
parent::__construct($id, RESOURCE_SURVEY);
$this->code = $code;
@ -131,6 +135,8 @@ class Survey extends Resource
$this->reminder_mail = $reminder_mail;
$this->question_ids = [];
$this->invitation_ids = [];
$this->one_question_per_page = $oneQuestionPerPage;
$this->shuffle = $shuffle;
}
/**

Loading…
Cancel
Save