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

remotes/angel/1.11.x
Yannick Warnier 8 years ago
commit 99ea04106e
  1. 2
      composer.json
  2. 14
      main/document/document.php
  3. 2
      main/inc/ajax/admin.ajax.php
  4. 10
      main/inc/lib/course_home.lib.php
  5. 21
      main/inc/lib/database.lib.php
  6. 12
      main/inc/lib/document.lib.php
  7. 9
      main/inc/lib/message.lib.php
  8. 26
      main/inc/lib/webservices/Rest.php

@ -55,7 +55,7 @@
"doctrine/migrations": "~1.0@dev",
"symfony/doctrine-bridge": "~2.8",
"symfony/validator": "2.6.4",
"symfony/validator": "~2.8",
"symfony/filesystem": "~2.8",
"symfony/security": "~2.8",
"doctrine/data-fixtures": "~1.0@dev",

@ -1019,7 +1019,9 @@ if ($is_allowed_to_edit ||
$folders = DocumentManager::get_all_document_folders(
$courseInfo,
$groupIid,
$is_allowed_to_edit || $group_member_with_upload_rights
$is_allowed_to_edit || $group_member_with_upload_rights,
false,
$curdirpath
);
// filter if is my shared folder. TODO: move this code to build_move_to_selector function
@ -1547,14 +1549,18 @@ if ($groupId != 0) {
$folders = DocumentManager::get_all_document_folders(
$courseInfo,
$groupIid,
$is_allowed_to_edit || $group_member_with_upload_rights
$is_allowed_to_edit || $group_member_with_upload_rights,
false,
$curdirpath
);
}
} else {
$folders = DocumentManager::get_all_document_folders(
$courseInfo,
$groupIid,
$is_allowed_to_edit || $group_member_with_upload_rights
0,
$is_allowed_to_edit || $group_member_with_upload_rights,
false,
$curdirpath
);
}

@ -171,7 +171,7 @@ function check_system_version()
$version_info = $version;
}
if (version_compare($system_version, $version_info, '<=')) {
if (version_compare($system_version, $version_info, '<')) {
$output = '<span style="color:red">' . get_lang('YourVersionNotUpToDate') .'<br />
'.get_lang('LatestVersionIs').' <b>Chamilo '.$version_info.'</b>. <br />
'.get_lang('YourVersionIs').' <b>Chamilo '.$system_version. '</b>. <br />'.str_replace('http://www.chamilo.org', '<a href="http://www.chamilo.org">http://www.chamilo.org</a>', get_lang('PleaseVisitOurWebsite')).'</span>';

@ -441,19 +441,21 @@ class CourseHome
/**
* Gets the tools of a certain category. Returns an array expected
* by show_tools_category()
* @param string $course_tool_category contains the category of tools to
* @param string $course_tool_category contains the category of tools to
* display: "toolauthoring", "toolinteraction", "tooladmin", "tooladminplatform", "toolplugin"
* @param int $courseId Optional
* @param int $sessionId Optional
* @return array
*/
public static function get_tools_category($course_tool_category)
public static function get_tools_category($course_tool_category, $courseId = 0, $sessionId = 0)
{
$course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$is_platform_admin = api_is_platform_admin();
$all_tools_list = array();
// Condition for the session
$session_id = api_get_session_id();
$course_id = api_get_course_int_id();
$session_id = $sessionId ?: api_get_session_id();
$course_id = $courseId ?: api_get_course_int_id();
$condition_session = api_get_session_condition($session_id, true, true, 't.session_id');
switch ($course_tool_category) {

@ -157,9 +157,24 @@ class Database
$sysPath = !empty($sysPath) ? $sysPath : api_get_path(SYS_PATH);
// Registering Constraints
AnnotationRegistry::registerAutoloadNamespace(
'Symfony\Component\Validator\Constraint',
$sysPath."vendor/symfony/validator"
/*AnnotationRegistry::registerAutoloadNamespace(
'Symfony\Component',
$sysPath."vendor/"
);*/
AnnotationRegistry::registerLoader(
function ($class) use ($sysPath) {
$file = str_replace("\\", DIRECTORY_SEPARATOR, $class).".php";
$file = str_replace('Symfony/Component/Validator', '', $file);
$file = $sysPath.'vendor/symfony/validator'.$file;
if (file_exists($file)) {
// file exists makes sure that the loader fails silently
require_once $file;
return true;
}
}
);
AnnotationRegistry::registerFile(

@ -744,6 +744,7 @@ class DocumentManager
* @param int $groupIid iid
* @param boolean $can_see_invisible
* @param boolean $getInvisibleList
* @param string $path current path
*
* @return array with paths
*/
@ -751,7 +752,8 @@ class DocumentManager
$_course,
$groupIid = 0,
$can_see_invisible = false,
$getInvisibleList = false
$getInvisibleList = false,
$path = ''
) {
$TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$TABLE_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
@ -763,8 +765,8 @@ class DocumentManager
api_get_session_id()
);
$conditionList = array();
if (!empty($students)) {
$conditionList = array();
foreach ($students as $studentId => $studentInfo) {
$conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id'];
}
@ -783,7 +785,11 @@ class DocumentManager
if ($can_see_invisible) {
// condition for the session
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id, true, false, 'docs.session_id');
//$condition_session = api_get_session_condition($session_id, true, false, 'docs.session_id');
$session_id = $session_id ?: api_get_session_id();
$condition_session = " AND (last.session_id = '$session_id' OR (last.session_id = '0' OR last.session_id IS NULL) )";
$condition_session .= self::getSessionFolderFilters($path, $session_id);
if ($groupIid <> 0) {
$sql = "SELECT DISTINCT docs.id, path

@ -209,7 +209,14 @@ class MessageManager
$total_filesize = 0;
if (is_array($file_attachments)) {
foreach ($file_attachments as $file_attach) {
$total_filesize += isset($file_attach['size']) && is_int($file_attach['size']) ? $file_attach['size'] : 0;
$fileSize = isset($file_attach['size']) ? $file_attach['size'] : 0;
if (is_array($fileSize)) {
foreach ($fileSize as $size) {
$total_filesize += $size;
}
} else {
$total_filesize += $fileSize;
}
}
}

@ -224,6 +224,11 @@ class Rest extends WebService
public function getCourseInfo()
{
$teachers = CourseManager::get_teacher_list_from_course_code_to_string($this->course->getCode());
$tools = CourseHome::get_tools_category(
'TOOL_STUDENT_VIEW',
$this->course->getId(),
$this->session ? $this->session->getId() : 0
);
return [
'id' => $this->course->getId(),
@ -231,7 +236,13 @@ class Rest extends WebService
'code' => $this->course->getCode(),
'directory' => $this->course->getDirectory(),
'urlPicture' => $this->course->getPicturePath(true),
'teachers' => $teachers
'teachers' => $teachers,
'tools' => array_map(
function ($tool) {
return ['type' => $tool['name']];
},
$tools
)
];
}
@ -872,21 +883,24 @@ class Rest extends WebService
foreach ($sessions['courses'] as $course) {
$courseInfo = api_get_course_info_by_id($course['real_id']);
$teachers = SessionManager::getCoachesByCourseSessionToString(
$sessions['session_id'],
$course['real_id']
);
$sessionCourses[] = [
'visibility' => $course['visibility'],
'status' => $course['status'],
'id' => $courseInfo['real_id'],
'title' => $courseInfo['title'],
'code' => $courseInfo['code'],
'directory' => $courseInfo['directory'],
'pictureUrl' => $courseInfo['course_image_large']
'pictureUrl' => $courseInfo['course_image_large'],
'teachers' => $teachers
];
}
$categorySessions[] = [
'session_name' => $sessions['session_name'],
'session_id' => $sessions['session_id'],
'name' => $sessions['session_name'],
'id' => $sessions['session_id'],
'accessStartDate' => api_format_date($sessions['access_start_date'], DATE_TIME_FORMAT_SHORT),
'accessEndDate' => api_format_date($sessions['access_end_date'], DATE_TIME_FORMAT_SHORT),
'courses' => $sessionCourses

Loading…
Cancel
Save