PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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