Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| Main | |
0.00% |
0 / 15 |
|
0.00% |
0 / 2 |
42 | |
0.00% |
0 / 1 |
| index | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
20 | |||
| rootEntry | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2014-2018 (original work) Open Assessment Technologies SA; |
| 19 | */ |
| 20 | |
| 21 | namespace oat\taoCe\actions; |
| 22 | |
| 23 | use common_session_SessionManager; |
| 24 | use oat\tao\helpers\TaoCe; |
| 25 | use oat\tao\model\mvc\DefaultUrlService; |
| 26 | use tao_actions_Main; |
| 27 | use tao_models_classes_UserService; |
| 28 | |
| 29 | /** |
| 30 | * Just to override the paths and load the specific client side code |
| 31 | * |
| 32 | * @author Bertrand Chevrier <bertrand@taotesting.com> |
| 33 | * |
| 34 | * @package taoCe |
| 35 | |
| 36 | * |
| 37 | * @license GPL-2.0 |
| 38 | */ |
| 39 | class Main extends tao_actions_Main |
| 40 | { |
| 41 | /** |
| 42 | * Wrapper to the main action: update the first time property and redirect |
| 43 | * |
| 44 | * @return void |
| 45 | */ |
| 46 | public function index() |
| 47 | { |
| 48 | $this->defaultData(); |
| 49 | //redirect to the usual tao/Main/index |
| 50 | if ($this->hasRequestParameter('ext') || $this->hasRequestParameter('structure')) { |
| 51 | //but before update the first time property |
| 52 | |
| 53 | $user = $this->getServiceLocator()->get(tao_models_classes_UserService::SERVICE_ID)->getCurrentUser(); |
| 54 | |
| 55 | if ($this->hasRequestParameter('nosplash')) { |
| 56 | TaoCe::becomeVeteran(); |
| 57 | } |
| 58 | |
| 59 | //@todo use forward on cross-extension forward is supported |
| 60 | $this->redirect(_url('index', 'Main', 'tao', [ |
| 61 | 'ext' => $this->getRequestParameter('ext'), |
| 62 | 'structure' => $this->getRequestParameter('structure'), |
| 63 | ])); |
| 64 | } else { |
| 65 | //render the index but with the taoCe URL used by client side routes |
| 66 | parent::index(); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Action used to redirect request made to root of tao. |
| 72 | */ |
| 73 | public function rootEntry() |
| 74 | { |
| 75 | $this->defaultData(); |
| 76 | |
| 77 | if (common_session_SessionManager::isAnonymous()) { |
| 78 | /* @var $urlRouteService DefaultUrlService */ |
| 79 | $urlRouteService = $this->getServiceLocator()->get(DefaultUrlService::SERVICE_ID); |
| 80 | $this->redirect($urlRouteService->getLoginUrl()); |
| 81 | } else { |
| 82 | $this->redirect(_url('entry', 'Main', 'tao')); |
| 83 | } |
| 84 | } |
| 85 | } |