connectorAction.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use Chamilo\CoreBundle\Component\Editor\Connector;
  4. use Chamilo\CoreBundle\Component\Editor\Finder;
  5. require_once __DIR__.'/../../global.inc.php';
  6. error_reporting(-1);
  7. /** @var Connector $connector */
  8. $connector = new Connector();
  9. // Check driver list in configuration
  10. $driverList = api_get_configuration_value('editor_driver_list');
  11. if (empty($driverList)) {
  12. $driverList = [
  13. 'PersonalDriver',
  14. 'CourseDriver',
  15. //'CourseUserDriver',
  16. //'HomeDriver'
  17. ];
  18. $block = api_get_configuration_value('block_editor_file_manager_for_students');
  19. $newDriverList = [];
  20. if ($block && !api_is_allowed_to_edit()) {
  21. foreach ($driverList as $driver) {
  22. if ($driver === 'CourseDriver') {
  23. continue;
  24. }
  25. $newDriverList[] = $driver;
  26. }
  27. $driverList = $newDriverList;
  28. }
  29. }
  30. $connector->setDriverList($driverList);
  31. $operations = $connector->getOperations();
  32. // Run elFinder
  33. $finder = new Finder($operations);
  34. $elFinderConnector = new \elFinderConnector($finder);
  35. $elFinderConnector->run();