/php/component/uploader.class.php
https://bitbucket.org/chamilo/chamilo-ext-repo-box-dev/ · PHP · 55 lines · 48 code · 7 blank · 0 comment · 3 complexity · 2183c74386b87d5b15c28a1b52cc315c MD5 · raw file
- <?php
- namespace common\extensions\external_repository_manager\implementation\box;
-
- use common\libraries\Path;
- use common\libraries\Redirect;
- use common\libraries\Request;
- use common\libraries\application;
- use common\libraries\Translation;
-
- use common\extensions\external_repository_manager\ExternalRepositoryManager;
-
- require_once dirname(__FILE__) . '/../forms/box_external_repository_manager_form.class.php';
-
- class BoxExternalRepositoryManagerUploaderComponent extends BoxExternalRepositoryManager
- {
-
- function run()
- {
- $form = new BoxExternalRepositoryManagerForm(BoxExternalRepositoryManagerForm :: TYPE_CREATE, $this->get_url(), $this);
-
- if ($form->validate())
- {
- $id = $form->upload_file();
- if ($id)
- {
- $parameters = $this->get_parameters();
- $parameters[ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_MANAGER_ACTION] = ExternalRepositoryManager :: ACTION_VIEW_EXTERNAL_REPOSITORY;
- $parameters[ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_ID] = $id;
-
- if ($this->is_stand_alone())
- {
- Redirect :: web_link(Path :: get(WEB_PATH) . 'common/launcher/index.php', $parameters);
- }
- else
- {
- Redirect :: web_link(Path :: get(WEB_PATH) . 'index.php', $parameters);
- }
- }
- else
- {
- Request :: set_get(Application :: PARAM_ERROR_MESSAGE, Translation :: get('BoxUploadProblem'));
- $this->display_header();
- $form->display();
- $this->display_footer();
- }
- }
- else
- {
- $this->display_header();
- $form->display();
- $this->display_footer();
- }
- }
- }
- ?>