Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 22 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| ExcludedBrowsers | |
0.00% |
0 / 22 |
|
0.00% |
0 / 2 |
30 | |
0.00% |
0 / 1 |
| editInstance | |
0.00% |
0 / 19 |
|
0.00% |
0 / 1 |
12 | |||
| getClassService | |
0.00% |
0 / 3 |
|
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) 2021-2023 (original work) Open Assessment Technologies SA. |
| 19 | */ |
| 20 | |
| 21 | declare(strict_types=1); |
| 22 | |
| 23 | namespace oat\taoClientDiagnostic\controller; |
| 24 | |
| 25 | use oat\taoClientDiagnostic\model\exclusionList\ExcludedBrowserService; |
| 26 | |
| 27 | /** |
| 28 | * |
| 29 | * @package oat\taoClientDiagnostic\controller |
| 30 | */ |
| 31 | class ExcludedBrowsers extends \tao_actions_SaSModule |
| 32 | { |
| 33 | public function editInstance(): void |
| 34 | { |
| 35 | $instance = $this->getCurrentInstance(); |
| 36 | $myFormContainer = new \tao_actions_form_Instance($this->getCurrentClass(), $instance); |
| 37 | |
| 38 | $myForm = $myFormContainer->getForm(); |
| 39 | $nameElement = $myForm->getElement(\tao_helpers_Uri::encode(ExcludedBrowserService::EXCLUDED_NAME)); |
| 40 | $versionElement = $myForm->getElement(\tao_helpers_Uri::encode(ExcludedBrowserService::EXCLUDED_VERSION)); |
| 41 | $nameElement->addClass('select2'); |
| 42 | |
| 43 | // phpcs:disable |
| 44 | $versionElement->setHelp( |
| 45 | "<span class=\"icon-help tooltipstered\" data-tooltip=\".exclusion-list-form .excluded-version-tooltip-content\" data-tooltip-theme=\"info\"></span>" |
| 46 | ); |
| 47 | // phpcs:enable |
| 48 | |
| 49 | if ($myForm->isSubmited() && $myForm->isValid()) { |
| 50 | $values = $myForm->getValues(); |
| 51 | // save properties |
| 52 | $binder = new \tao_models_classes_dataBinding_GenerisFormDataBinder($instance); |
| 53 | $binder->bind($values); |
| 54 | $message = __('Instance saved'); |
| 55 | |
| 56 | $this->setData('message', $message); |
| 57 | $this->setData('reload', true); |
| 58 | } |
| 59 | |
| 60 | $this->setData('formTitle', __('Edit Excluded Browser')); |
| 61 | $this->setData('myForm', $myForm->render()); |
| 62 | $this->setView('exclusionList/form.tpl'); |
| 63 | } |
| 64 | |
| 65 | protected function getClassService(): ExcludedBrowserService |
| 66 | { |
| 67 | if (is_null($this->service)) { |
| 68 | $this->service = $this->getServiceLocator()->get(ExcludedBrowserService::SERVICE_ID); |
| 69 | } |
| 70 | return $this->service; |
| 71 | } |
| 72 | } |