Format code

pull/2487/head
jmontoyaa 9 years ago
parent 68889a833c
commit b609a13494
  1. 2
      main/session/index.php
  2. 30
      src/Chamilo/CoreBundle/Component/Editor/Driver/CourseDriver.php
  3. 1
      src/Chamilo/CoreBundle/Component/Editor/Finder.php

@ -146,7 +146,7 @@ if (!empty($course_list)) {
api_get_user_id(),
$course_data['code'],
$session_id,
'Lp.publicatedOn ASC',
'lp.publicatedOn ASC',
true
);
$lp_list = $list->get_flat_list();

@ -33,7 +33,6 @@ class CourseDriver extends Driver implements DriverInterface
$this->coursePath = $baseDir;
// Creates shared folder
if (!file_exists($baseDir . '/shared_folder')) {
$title = get_lang('UserFolders');
$folderName = '/shared_folder';
@ -102,11 +101,15 @@ class CourseDriver extends Driver implements DriverInterface
)
);
$folders = \DocumentManager::get_all_document_folders($this->connector->course, null, false, true);
if (!empty($folders)) {
foreach ($folders as $folder) {
//$folder = str_replace('-', "", $folder);
//\/
$foldersToHide = \DocumentManager::get_all_document_folders(
$this->connector->course,
null,
false,
true
);
if (!empty($foldersToHide)) {
foreach ($foldersToHide as $folder) {
$config['attributes'][] = [
'pattern' => '!'.$folder.'!',
'read' => false,
@ -117,9 +120,7 @@ class CourseDriver extends Driver implements DriverInterface
}
}
// Blocking all groups
// hide all groups folders
// Hide all groups folders
$config['attributes'][] = [
'pattern' => '!_groupdocs_!',
'read' => false,
@ -128,13 +129,16 @@ class CourseDriver extends Driver implements DriverInterface
'locked' => false
];
// Allow only the groups I have access
$allGroups = \GroupManager::getAllGroupPerUserSubscription($userId);
if (!empty($allGroups)) {
foreach ($allGroups as $groupInfo) {
$groupId = $groupInfo['iid'];
if (\GroupManager::user_has_access($userId, $groupId, \GroupManager::GROUP_TOOL_DOCUMENTS)) {
if (\GroupManager::user_has_access(
$userId,
$groupId,
\GroupManager::GROUP_TOOL_DOCUMENTS
)) {
$config['attributes'][] = [
'pattern' => '!'.$groupInfo['secret_directory'].'!',
'read' => true,
@ -215,7 +219,6 @@ class CourseDriver extends Driver implements DriverInterface
$this->setConnectorFromPlugin();
if ($this->allowToEdit()) {
// upload file by elfinder.
$result = parent::upload($fp, $dst, $name, $tmpname);
$name = $result['name'];
@ -262,7 +265,6 @@ class CourseDriver extends Driver implements DriverInterface
$this->setConnectorFromPlugin();
if ($this->allowToEdit()) {
$path = $this->decode($hash);
$stat = $this->stat($path);
$stat['realpath'] = $path;
@ -292,12 +294,10 @@ class CourseDriver extends Driver implements DriverInterface
//if ($this->connector->security->isGranted('ROLE_ADMIN')) {
if (api_is_anonymous()) {
return false;
}
if (isset($this->connector->course) && !empty($this->connector->course)) {
return true;
}

@ -36,6 +36,7 @@ class Finder extends \elFinder
// setlocale and global locale regists to elFinder::locale
self::$locale = !empty($opts['locale']) ? $opts['locale'] : 'en_US.UTF-8';
if (false === @setlocale(LC_ALL, self::$locale)) {
self::$locale = setlocale(LC_ALL, '');
}

Loading…
Cancel
Save