-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-2.22.0' into master
- Loading branch information
Showing
16 changed files
with
885 additions
and
193 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
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 |
---|---|---|
@@ -1,68 +1,73 @@ | ||
<?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) 2020 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); | ||
* | ||
* | ||
*/ | ||
|
||
// !!!TODO - should be to rely on the taoTest extension | ||
// to supply the API to manage the provider registration and management instead of directly write into the registry | ||
declare(strict_types=1); | ||
|
||
namespace oat\taoQtiTestPreviewer\scripts\install; | ||
|
||
use common_Exception as Exception; | ||
use common_report_Report as Report; | ||
use oat\oatbox\extension\InstallAction; | ||
use oat\tao\model\ClientLibConfigRegistry; | ||
use oat\tao\model\modules\DynamicModule; | ||
use common_exception_InconsistentData as InconsistentData; | ||
use oat\oatbox\service\exception\InvalidServiceManagerException; | ||
use oat\taoTests\models\preview\TestPreviewerRegistryServiceInterface; | ||
|
||
/** | ||
* Class RegisterTestPreviewer | ||
* | ||
* @package oat\taoQtiTestPreviewer\scripts\install | ||
*/ | ||
class RegisterTestPreviewer extends InstallAction | ||
{ | ||
/** | ||
* Sets the test previewer. | ||
* @param array $params | ||
* | ||
* @param $params | ||
* @throws InconsistentData | ||
* @throws InvalidServiceManagerException | ||
* @throws Exception | ||
* | ||
* @return \common_report_Report | ||
* @return Report | ||
*/ | ||
public function __invoke($params) | ||
{ | ||
ClientLibConfigRegistry::getRegistry()->register( | ||
'taoTests/previewer/factory', array( | ||
'previewers' => array( | ||
'taoQtiTestPreviewer/previewer/adapter/test/qtiTest' => array( | ||
'id' => 'qtiTest', | ||
'module' => 'taoQtiTestPreviewer/previewer/adapter/test/qtiTest', | ||
'bundle' => 'taoQtiTestPreviewer/loader/qtiPreviewer.min', | ||
'position' => null, | ||
'name' => 'QTI Test Previewer', | ||
'description' => 'QTI implementation of the test previewer', | ||
'category' => 'previewer', | ||
'active' => true, | ||
'tags' => array( | ||
'core', | ||
'qti', | ||
'previewer' | ||
) | ||
) | ||
) | ||
) | ||
/** @var TestPreviewerRegistryServiceInterface $testPreviewerService */ | ||
$testPreviewerService = $this->getServiceManager()->get( | ||
TestPreviewerRegistryServiceInterface::SERVICE_ID | ||
); | ||
$testPreviewerService->registerAdapter(DynamicModule::fromArray([ | ||
'id' => 'qtiTest', | ||
'module' => 'taoQtiTestPreviewer/previewer/adapter/test/qtiTest', | ||
'bundle' => 'taoQtiTestPreviewer/loader/qtiPreviewer.min', | ||
'position' => null, | ||
'name' => 'QTI Test Previewer', | ||
'description' => 'QTI implementation of the test previewer', | ||
'category' => 'previewer', | ||
'active' => true, | ||
'tags' => [ | ||
'core', | ||
'qti', | ||
'previewer', | ||
], | ||
])); | ||
|
||
return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, 'The QTI Test Previewer is registered'); | ||
return Report::createSuccess('The QTI Test Previewer is registered'); | ||
} | ||
} | ||
} |
Oops, something went wrong.