-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
343 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
composer.lock | ||
vendor/ | ||
.idea/ |
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 |
---|---|---|
|
@@ -21,38 +21,44 @@ | |
* | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\taoTestTaker\actions; | ||
|
||
use common_report_Report; | ||
use core_kernel_classes_Resource; | ||
use oat\generis\Helper\UserHashForEncryption; | ||
use oat\generis\model\GenerisRdf; | ||
use oat\taoTestTaker\models\CsvImporter; | ||
use oat\taoTestTaker\models\events\TestTakerImportedEvent; | ||
use oat\taoTestTaker\models\TestTakerSavePasswordInMemory; | ||
use tao_helpers_form_FormFactory; | ||
use oat\taoTestTaker\models\RdfImporter; | ||
use tao_actions_Import; | ||
use tao_models_classes_import_CsvImporter; | ||
use tao_models_classes_import_RdfImporter; | ||
|
||
/** | ||
* Extends the common Import class to exchange the generic | ||
* CsvImporter with a subject specific one | ||
* | ||
* @author Bertrand Chevrier, <[email protected]> | ||
*/ | ||
class Import extends \tao_actions_Import | ||
class Import extends tao_actions_Import | ||
{ | ||
/** | ||
* (non-PHPdoc) | ||
* @see tao_actions_Import::getAvailableImportHandlers() | ||
* @inheritDoc | ||
*/ | ||
public function getAvailableImportHandlers() | ||
{ | ||
$returnValue = parent::getAvailableImportHandlers(); | ||
|
||
foreach (array_keys($returnValue) as $key) { | ||
if ($returnValue[$key] instanceof \tao_models_classes_import_CsvImporter) { | ||
$importer = new CsvImporter(); | ||
$importer->setValidators($this->getValidators()); | ||
$returnValue[$key] = $importer; | ||
switch (get_class($returnValue[$key])) { | ||
case tao_models_classes_import_CsvImporter::class: | ||
$importer = new CsvImporter(); | ||
$importer->setValidators($this->getValidators()); | ||
$returnValue[$key] = $importer; | ||
|
||
break; | ||
case tao_models_classes_import_RdfImporter::class: | ||
$importer = new RdfImporter(); | ||
$returnValue[$key] = $importer; | ||
|
||
break; | ||
} | ||
} | ||
|
||
|
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,56 @@ | ||
<?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); | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\taoTestTaker\models; | ||
|
||
use core_kernel_classes_Resource; | ||
use oat\taoTestTaker\models\events\dispatcher\TestTakerImportEventDispatcher; | ||
use tao_models_classes_import_RdfImporter; | ||
|
||
class RdfImporter extends tao_models_classes_import_RdfImporter | ||
{ | ||
public function import($class, $form, $userId = null) | ||
{ | ||
$report = parent::import($class, $form); | ||
|
||
$this->getTestTakerImportEventDispatcher() | ||
->dispatch( | ||
$report, | ||
function ($resource) | ||
{ | ||
return $this->getProperties($resource); | ||
} | ||
); | ||
|
||
return $report; | ||
} | ||
|
||
protected function getProperties(core_kernel_classes_Resource $resource): array | ||
{ | ||
return []; | ||
} | ||
|
||
private function getTestTakerImportEventDispatcher(): TestTakerImportEventDispatcher | ||
{ | ||
return $this->getServiceLocator()->get(TestTakerImportEventDispatcher::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 |
---|---|---|
|
@@ -15,18 +15,41 @@ | |
* 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) 2016 (original work) Open Assessment Technologies SA; | ||
* Copyright (c) 2016-2020 (original work) Open Assessment Technologies SA; | ||
* | ||
* @author Ivan klimchuk <[email protected]> | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\taoTestTaker\models\events; | ||
|
||
use oat\tao\model\webhooks\WebhookSerializableEventInterface; | ||
|
||
/** | ||
* Class TestTakerCreatedEvent | ||
* @package oat\taoTestTaker\models\events | ||
*/ | ||
class TestTakerCreatedEvent extends AbstractTestTakerEvent | ||
class TestTakerCreatedEvent extends AbstractTestTakerEvent implements WebhookSerializableEventInterface | ||
{ | ||
private const WEBHOOK_EVENT_NAME = 'test-taker-created'; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getWebhookEventName() | ||
{ | ||
return self::WEBHOOK_EVENT_NAME; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function serializeForWebhook() | ||
{ | ||
return [ | ||
'testTakerUri' => $this->testTakerUri, | ||
'unit' => 1 | ||
]; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -15,18 +15,41 @@ | |
* 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) 2016 (original work) Open Assessment Technologies SA; | ||
* Copyright (c) 2016-2020 (original work) Open Assessment Technologies SA; | ||
* | ||
* @author Ivan klimchuk <[email protected]> | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\taoTestTaker\models\events; | ||
|
||
use oat\tao\model\webhooks\WebhookSerializableEventInterface; | ||
|
||
/** | ||
* Class TestTakerImportedEvent | ||
* @package oat\taoTestTaker\models\events | ||
*/ | ||
class TestTakerImportedEvent extends AbstractTestTakerEvent | ||
class TestTakerImportedEvent extends AbstractTestTakerEvent implements WebhookSerializableEventInterface | ||
{ | ||
private const WEBHOOK_EVENT_NAME = 'test-taker-imported'; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getWebhookEventName() | ||
{ | ||
return self::WEBHOOK_EVENT_NAME; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function serializeForWebhook() | ||
{ | ||
return [ | ||
'testTakerUri' => $this->testTakerUri, | ||
'unit' => 1 | ||
]; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -15,18 +15,42 @@ | |
* 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) 2016 (original work) Open Assessment Technologies SA; | ||
* Copyright (c) 2016-2020 (original work) Open Assessment Technologies SA; | ||
* | ||
* @author Ivan klimchuk <[email protected]> | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\taoTestTaker\models\events; | ||
|
||
use oat\tao\model\webhooks\WebhookSerializableEventInterface; | ||
|
||
/** | ||
* Class TestTakerRemovedEvent | ||
* @package oat\taoTestTaker\models\events | ||
*/ | ||
class TestTakerRemovedEvent extends AbstractTestTakerEvent | ||
class TestTakerRemovedEvent extends AbstractTestTakerEvent implements WebhookSerializableEventInterface | ||
{ | ||
const EVENT_NAME = __CLASS__; | ||
private const WEBHOOK_EVENT_NAME = 'test-taker-removed'; | ||
public const EVENT_NAME = __CLASS__; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getWebhookEventName() | ||
{ | ||
return self::WEBHOOK_EVENT_NAME; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function serializeForWebhook() | ||
{ | ||
return [ | ||
'testTakerUri' => $this->testTakerUri, | ||
'unit' => 1 | ||
]; | ||
} | ||
} |
Oops, something went wrong.