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(), api_get_user_id(),
$course_data['code'], $course_data['code'],
$session_id, $session_id,
'Lp.publicatedOn ASC', 'lp.publicatedOn ASC',
true true
); );
$lp_list = $list->get_flat_list(); $lp_list = $list->get_flat_list();

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

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

Loading…
Cancel
Save