Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 17 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| PlatformAdmin | |
0.00% |
0 / 17 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
| initialize | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
2 | |||
| getClassService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getExtraValidationRules | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getValidationFactory | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 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) 2021-2022 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | */ |
| 20 | |
| 21 | namespace oat\taoLti\controller; |
| 22 | |
| 23 | use oat\generis\model\data\event\ResourceCreated; |
| 24 | use oat\generis\model\data\event\ResourceDeleted; |
| 25 | use oat\generis\model\data\event\ResourceUpdated; |
| 26 | use oat\oatbox\event\EventManager; |
| 27 | use oat\oatbox\validator\ValidatorInterface; |
| 28 | use oat\taoLti\models\classes\Platform\Service\UpdatePlatformRegistrationSnapshotListener; |
| 29 | use oat\taoLti\models\classes\Platform\Validation\ValidatorsFactory; |
| 30 | use oat\taoLti\models\classes\Platform\Repository\RdfLtiPlatformRepository; |
| 31 | use tao_actions_SaSModule; |
| 32 | |
| 33 | /** |
| 34 | * Admin interface for managing LTI 1.3 Platforms entries. |
| 35 | * |
| 36 | * @package taoLti |
| 37 | * @license GPLv2 http://www.opensource.org/licenses/gpl-2.0.php |
| 38 | */ |
| 39 | class PlatformAdmin extends tao_actions_SaSModule |
| 40 | { |
| 41 | /** |
| 42 | * @inheritDoc |
| 43 | */ |
| 44 | public function initialize() |
| 45 | { |
| 46 | parent::initialize(); |
| 47 | |
| 48 | /** @var EventManager $eventManager */ |
| 49 | $eventManager = $this->getPsrContainer()->get(EventManager::class); |
| 50 | |
| 51 | $eventManager->attach( |
| 52 | ResourceCreated::class, |
| 53 | [UpdatePlatformRegistrationSnapshotListener::class, 'whenResourceCreated'] |
| 54 | ); |
| 55 | |
| 56 | $eventManager->attach( |
| 57 | ResourceUpdated::class, |
| 58 | [UpdatePlatformRegistrationSnapshotListener::class, 'whenResourceUpdated'] |
| 59 | ); |
| 60 | |
| 61 | $eventManager->attach( |
| 62 | ResourceDeleted::class, |
| 63 | [UpdatePlatformRegistrationSnapshotListener::class, 'whenResourceDeleted'] |
| 64 | ); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * @inheritDoc |
| 69 | */ |
| 70 | protected function getClassService() |
| 71 | { |
| 72 | return $this->getServiceLocator()->get(RdfLtiPlatformRepository::class); |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * @return ValidatorInterface[][] |
| 77 | */ |
| 78 | protected function getExtraValidationRules(): array |
| 79 | { |
| 80 | return $this->getValidationFactory()->createFormValidators(); |
| 81 | } |
| 82 | |
| 83 | private function getValidationFactory(): ValidatorsFactory |
| 84 | { |
| 85 | return $this->getServiceLocator()->get(ValidatorsFactory::class); |
| 86 | } |
| 87 | } |