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

/php/component/editor.class.php

https://bitbucket.org/chamilo/chamilo-ext-repo-box-dev/
PHP | 49 lines | 40 code | 9 blank | 0 comment | 2 complexity | 5cacbfdf22db94e43c3b2d8507362054 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\Request;
 7use common\extensions\external_repository_manager\ExternalRepositoryManager;
 8
 9require_once dirname(__FILE__) . '/../forms/box_external_repository_manager_form.class.php';
10
11class BoxExternalRepositoryManagerEditorComponent extends BoxExternalRepositoryManager
12{
13
14    function run()
15    {
16        $id = Request :: get(ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_ID);
17        $form = new BoxExternalRepositoryManagerForm(BoxExternalRepositoryManagerForm :: TYPE_EDIT, $this->get_url(array(
18                ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_ID => $id)), $this);
19        
20        $object = $this->retrieve_external_repository_object($id);
21        
22        $form->set_external_repository_object($object);
23        
24        if ($form->validate())
25        {
26            $success = $form->update_file();
27            
28            $parameters = $this->get_parameters();
29            $parameters[ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_MANAGER_ACTION] = ExternalRepositoryManager :: ACTION_VIEW_EXTERNAL_REPOSITORY;
30            $parameters[ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_ID] = $object->get_id();
31            
32            if ($this->is_stand_alone())
33            {
34                Redirect :: web_link(Path :: get(WEB_PATH) . 'common/launcher/index.php', $parameters);
35            }
36            else
37            {
38                Redirect :: web_link(Path :: get(WEB_PATH) . 'index.php', $parameters);
39            }
40        }
41        else
42        {
43            $this->display_header($trail, false);
44            $form->display();
45            $this->display_footer();
46        }
47    }
48}
49?>