/php/component/newfolder.class.php

https://bitbucket.org/chamilo/chamilo-ext-repo-box-dev/ · PHP · 44 lines · 39 code · 5 blank · 0 comment · 2 complexity · e25f6afd310bef4b9384af68d327a15d MD5 · raw file

  1. <?php
  2. namespace common\extensions\external_repository_manager\implementation\box;
  3. use common\libraries\Path;
  4. use common\libraries\Redirect;
  5. use common\libraries\Translation;
  6. use common\libraries\Request;
  7. use common\libraries\Application;
  8. use common\extensions\external_repository_manager\ExternalRepositoryManager;
  9. require_once dirname(__FILE__) . '/../forms/box_external_repository_manager_form.class.php';
  10. class BoxExternalRepositoryManagerNewFolderComponent extends BoxExternalRepositoryManager
  11. {
  12. function run()
  13. {
  14. $form = new BoxExternalRepositoryManagerForm(BoxExternalRepositoryManagerForm :: TYPE_NEW_FOLDER, $this->get_url(), $this);
  15. if ($form->validate())
  16. {
  17. $id = $form->create_folder();
  18. if (! is_null($id))
  19. {
  20. $$parameters = $this->get_parameters();
  21. $parameters[ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_MANAGER_ACTION] = ExternalRepositoryManager :: ACTION_BROWSE_EXTERNAL_REPOSITORY;
  22. $this->redirect('Folder is created', false, $parameters);
  23. }
  24. else
  25. {
  26. $parameters = $this->get_parameters();
  27. $parameters[ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_MANAGER_ACTION] = ExternalRepositoryManager :: ACTION_NEW_FOLDER_EXTERNAL_REPOSITORY;
  28. $this->redirect('Folder is not created', true, $parameters);
  29. }
  30. }
  31. else
  32. {
  33. $this->display_header();
  34. $form->display();
  35. $this->display_footer();
  36. }
  37. }
  38. }
  39. ?>