tao-test/app/taoClientDiagnostic/controller/ExcludedOS.php

67 lines
2.5 KiB
PHP
Raw Normal View History

2022-08-29 20:14:13 +02:00
<?php
/**
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2021 (original work) Open Assessment Technologies SA;
*/
declare(strict_types=1);
namespace oat\taoClientDiagnostic\controller;
use oat\taoClientDiagnostic\model\exclusionList\ExcludedOSService;
/**
*
* @package oat\taoClientDiagnostic\controller
*/
class ExcludedOS extends \tao_actions_SaSModule
{
public function editInstance(): void
{
$instance = $this->getCurrentInstance();
$myFormContainer = new \tao_actions_form_Instance($this->getCurrentClass(), $instance);
$myForm = $myFormContainer->getForm();
$nameElement = $myForm->getElement(\tao_helpers_Uri::encode(ExcludedOSService::EXCLUDED_NAME));
$versionElement = $myForm->getElement(\tao_helpers_Uri::encode(ExcludedOSService::EXCLUDED_VERSION));
$nameElement->addClass('select2');
$versionElement->setHelp(
"<span class=\"icon-help tooltipstered\" data-tooltip=\".exclusion-list-form .excluded-version-tooltip-content\" data-tooltip-theme=\"info\"></span>"
);
if ($myForm->isSubmited() && $myForm->isValid()) {
$values = $myForm->getValues();
// save properties
$binder = new \tao_models_classes_dataBinding_GenerisFormDataBinder($instance);
$binder->bind($values);
$message = __('Instance saved');
$this->setData('message', $message);
$this->setData('reload', true);
}
$this->setData('formTitle', __('Edit Excluded Operation System'));
$this->setData('myForm', $myForm->render());
$this->setView('exclusionList/form.tpl');
}
protected function getClassService(): ExcludedOSService
{
if (is_null($this->service)) {
$this->service = $this->getServiceLocator()->get(ExcludedOSService::SERVICE_ID);
}
return $this->service;
}
}