PageRenderTime 1459ms CodeModel.GetById 1456ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/php/component/adder_user_group.class.php

https://bitbucket.org/chamilo/chamilo-ext-repo-bitbucket-dev/
PHP | 42 lines | 37 code | 5 blank | 0 comment | 2 complexity | e793a406c169b8e1d0d47c6904dbf182 MD5 | raw file
 1<?php
 2namespace common\extensions\external_repository_manager\implementation\bitbucket;
 3
 4use common\extensions\external_repository_manager\ExternalRepositoryComponent;
 5use common\libraries\Request;
 6use common\libraries\Translation;
 7
 8require_once dirname(__FILE__) . '/../forms/add_user_to_group_form.class.php';
 9
10class BitbucketExternalRepositoryManagerAdderUserGroupComponent extends BitbucketExternalRepositoryManager
11{
12
13    function run()
14    {
15        $parameters = $this->get_parameters();
16        $parameters[BitbucketExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_GROUP] = Request :: get(BitbucketExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_GROUP);
17        $group_form = new AddUserToGroupForm($this->get_url($parameters), $this);
18        if ($group_form->validate())
19        {
20            $success = $group_form->add_user_to_group($group, $user);
21            $message = $success ? Translation :: get('UserAddedToGroup') : Translation :: get('UserNotAddedToGroup');
22            $parameters = $this->get_parameters();
23            if ($success)
24            {
25                $parameters[BitbucketExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_MANAGER_ACTION] = BitbucketExternalRepositoryManager :: ACTION_GROUPS_VIEWER;
26            }
27            else
28            {
29                $parameters[BitbucketExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_GROUP] = Request :: get(BitbucketExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_GROUP);
30            }
31            $this->redirect($message, ! $success, $parameters);
32        }
33        else
34        {
35            $this->display_header();
36            $group_form->display();
37            $this->display_footer();
38        }
39    }
40}
41
42?>