-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #477 from oat-sa/feat/HKD-6/integration
Feat/hkd 6/integration
- Loading branch information
Showing
27 changed files
with
1,310 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\taoTests\migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use oat\oatbox\event\EventManager; | ||
use oat\oatbox\reporting\Report; | ||
use oat\tao\model\accessControl\func\AccessRule; | ||
use oat\tao\model\accessControl\func\AclProxy; | ||
use oat\tao\model\menu\SectionVisibilityFilter; | ||
use oat\tao\scripts\tools\migrations\AbstractMigration; | ||
use oat\tao\scripts\update\OntologyUpdater; | ||
use oat\taoTests\models\event\TestCreatedEvent; | ||
use oat\taoTests\models\Translation\Listener\TestCreatedEventListener; | ||
use oat\taoTests\models\user\TaoTestsRoles; | ||
|
||
final class Version202409060743452141_taoTests extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Add new Test Translator Role, sync models and add new listener'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
OntologyUpdater::syncModels(); | ||
|
||
AclProxy::applyRule($this->getRule()); | ||
|
||
$this->addReport(Report::createSuccess('Applied rules for role ' . TaoTestsRoles::TEST_TRANSLATOR)); | ||
|
||
/** @var SectionVisibilityFilter $sectionVisibilityFilter */ | ||
$sectionVisibilityFilter = $this->getServiceManager()->get(SectionVisibilityFilter::SERVICE_ID); | ||
|
||
$sectionVisibilityFilter->showSectionByFeatureFlag( | ||
$sectionVisibilityFilter->createSectionPath( | ||
[ | ||
'manage_tests', | ||
'test-translate' | ||
] | ||
), | ||
'FEATURE_FLAG_TRANSLATION_ENABLED' | ||
); | ||
$this->getServiceManager()->register(SectionVisibilityFilter::SERVICE_ID, $sectionVisibilityFilter); | ||
|
||
$this->addReport( | ||
Report::createSuccess('Hide test section for feature flag FEATURE_FLAG_TRANSLATION_ENABLED') | ||
); | ||
|
||
/** @var EventManager $eventManager */ | ||
$eventManager = $this->getServiceManager()->get(EventManager::SERVICE_ID); | ||
$eventManager->attach( | ||
TestCreatedEvent::class, | ||
[TestCreatedEventListener::class, 'populateTranslationProperties'] | ||
); | ||
$this->getServiceManager()->register(EventManager::SERVICE_ID, $eventManager); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
AclProxy::revokeRule($this->getRule()); | ||
|
||
/** @var EventManager $eventManager */ | ||
$eventManager = $this->getServiceManager()->get(EventManager::SERVICE_ID); | ||
$eventManager->detach( | ||
TestCreatedEvent::class, | ||
[TestCreatedEventListener::class, 'populateTranslationProperties'] | ||
); | ||
$this->getServiceManager()->register(EventManager::SERVICE_ID, $eventManager); | ||
} | ||
|
||
private function getRule(): AccessRule | ||
{ | ||
return new AccessRule( | ||
AccessRule::GRANT, | ||
TaoTestsRoles::TEST_TRANSLATOR, | ||
[ | ||
'ext' => 'tao', | ||
'mod' => 'Translation' | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\taoTests\migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use oat\tao\scripts\tools\migrations\AbstractMigration; | ||
use oat\tao\scripts\update\OntologyUpdater; | ||
|
||
/** | ||
* phpcs:disable Squiz.Classes.ValidClassName | ||
*/ | ||
final class Version202411111300542363_taoTests extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Sync models'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
OntologyUpdater::syncModels(); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
OntologyUpdater::syncModels(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?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) 2024 (original work) Open Assessment Technologies SA. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\taoTests\models\Form\Modifier; | ||
|
||
use oat\tao\model\form\Modifier\AbstractFormModifier; | ||
|
||
final class FormModifierProxy extends AbstractFormModifier | ||
{ | ||
} |
51 changes: 51 additions & 0 deletions
51
models/classes/Form/ServiceProvider/FormServiceProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?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) 2024 (original work) Open Assessment Technologies SA. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\taoTests\models\Form\ServiceProvider; | ||
|
||
use oat\generis\model\DependencyInjection\ContainerServiceProviderInterface; | ||
use oat\tao\model\form\Modifier\UniqueIdFormModifier; | ||
use oat\taoTests\models\Form\Modifier\FormModifierProxy; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
|
||
use function Symfony\Component\DependencyInjection\Loader\Configurator\service; | ||
|
||
class FormServiceProvider implements ContainerServiceProviderInterface | ||
{ | ||
public function __invoke(ContainerConfigurator $configurator): void | ||
{ | ||
$services = $configurator->services(); | ||
|
||
$services | ||
->set(FormModifierProxy::class, FormModifierProxy::class) | ||
->public(); | ||
|
||
$services | ||
->get(FormModifierProxy::class) | ||
->call( | ||
'addModifier', | ||
[ | ||
service(UniqueIdFormModifier::class), | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?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) 2024 (original work) Open Assessment Technologies SA. | ||
* | ||
* phpcs:disable Generic.Files.LineLength | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\taoTests\models; | ||
|
||
interface TaoTestOntology | ||
{ | ||
public const PROPERTY_TRANSLATION_COMPLETION = 'http://www.tao.lu/Ontologies/TAOTest.rdf#TranslationCompletion'; | ||
public const PROPERTY_VALUE_TRANSLATION_COMPLETION_MISSING_TRANSLATIONS = 'http://www.tao.lu/Ontologies/TAOTest.rdf#TranslationCompletionStatusMissingTranslations'; | ||
public const PROPERTY_VALUE_TRANSLATION_COMPLETION_TRANSLATED = 'http://www.tao.lu/Ontologies/TAOTest.rdf#TranslationCompletionStatusTranslated'; | ||
} |
Oops, something went wrong.