-
Notifications
You must be signed in to change notification settings - Fork 13
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 #629 from oat-sa/release-2.20.0
Release 2.20.0
- Loading branch information
Showing
33 changed files
with
1,319 additions
and
80 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,65 @@ | ||
<?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) 2015 (original work) Open Assessment Technologies SA; | ||
* | ||
* | ||
*/ | ||
|
||
return new oat\taoQtiItem\model\flyExporter\simpleExporter\ItemExporter(array( | ||
'fileSystem' => 'taoQtiItem', | ||
'fileLocation' => 'export' . DIRECTORY_SEPARATOR . 'export.csv', | ||
'extractors' => array ( | ||
'OntologyExtractor' => new \oat\taoQtiItem\model\flyExporter\extractor\OntologyExtractor(), | ||
'QtiExtractor' => new \oat\taoQtiItem\model\flyExporter\extractor\QtiExtractor() | ||
), | ||
'columns' => array ( | ||
'label' => array ( | ||
'extractor' => 'OntologyExtractor', | ||
'parameters' => array ( | ||
'property' => RDFS_LABEL | ||
) | ||
), | ||
'type' => array ( | ||
'extractor' => 'QtiExtractor', | ||
'parameters' => array ( | ||
'callback' => 'getInteractionType' | ||
) | ||
), | ||
'nb choice' => array ( | ||
'extractor' => 'QtiExtractor', | ||
'parameters' => array ( | ||
'callback' => 'getNumberOfChoices' | ||
) | ||
), | ||
'BR' => array ( | ||
'extractor' => 'QtiExtractor', | ||
'parameters' => array ( | ||
'callback' => 'getRightAnswer', | ||
'callbackParameters' => array( | ||
'delimiter' => '|' | ||
) | ||
) | ||
), | ||
'choiceInteraction' => array ( | ||
'extractor' => 'QtiExtractor', | ||
'parameters' => array ( | ||
'callback' => 'getChoices', | ||
'valuesAsColumns' => true, | ||
) | ||
), | ||
) | ||
)); |
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,57 @@ | ||
<?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) 2015 (original work) Open Assessment Technologies SA; | ||
* | ||
* | ||
*/ | ||
|
||
namespace oat\taoQtiItem\install\scripts; | ||
|
||
use oat\oatbox\filesystem\FileSystemService; | ||
use oat\oatbox\service\ServiceManager; | ||
use oat\taoQtiItem\model\flyExporter\simpleExporter\ItemExporter; | ||
|
||
/** | ||
* Create export directory | ||
* | ||
* Class createExportDirectory | ||
* @package oat\taoQtiItem\install\scripts | ||
*/ | ||
class createExportDirectory extends \common_ext_action_InstallAction | ||
{ | ||
/** | ||
* Create filesystem for ItemExporter service | ||
* | ||
* @param $params | ||
* @return \common_report_Report | ||
*/ | ||
public function __invoke($params) | ||
{ | ||
try { | ||
|
||
$serviceManager = ServiceManager::getServiceManager(); | ||
$fsService = $serviceManager->get(FileSystemService::SERVICE_ID); | ||
$fsService->createLocalFileSystem(ItemExporter::EXPORT_FILESYSTEM); | ||
$serviceManager->register(FileSystemService::SERVICE_ID, $fsService); | ||
|
||
} catch (\Exception $e) { | ||
return new \common_report_Report(\common_report_Report::TYPE_ERROR, 'Fail to create export directory.'); | ||
} | ||
|
||
return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, 'Export directory created.'); | ||
} | ||
} |
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,59 @@ | ||
<?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) 2015 (original work) Open Assessment Technologies SA; | ||
* | ||
* | ||
*/ | ||
|
||
namespace oat\taoQtiItem\model\flyExporter; | ||
|
||
use oat\oatbox\action\Action; | ||
use oat\oatbox\service\ConfigurableService; | ||
use oat\taoQtiItem\model\flyExporter\simpleExporter\SimpleExporter; | ||
|
||
/** | ||
* Command line entry to generate item export | ||
* | ||
* Class ExporterAction | ||
* @package oat\taoQtiItem\model\simpleExporter | ||
*/ | ||
class ExporterAction extends ConfigurableService implements Action | ||
{ | ||
/** | ||
* Call to launch export method of exporter | ||
* | ||
* php index.php 'oat\taoQtiItem\model\flyExporter\ExporterAction' $uri | ||
* | ||
* @param $params $params[0] is optional uri parameter | ||
* @return \common_report_Report | ||
*/ | ||
public function __invoke($params) | ||
{ | ||
try { | ||
$exporterService = $this->getServiceManager()->get(SimpleExporter::SERVICE_ID); | ||
|
||
$uri = isset($params[0]) ? $params[0] : null; | ||
$filename = $exporterService->export($uri); | ||
|
||
return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, | ||
"\nExport end.\nCSV export is located at: " . $filename . "\n"); | ||
} catch (\Exception $e) { | ||
\common_Logger::w('Error during item metadata export: ' . $e->getMessage()); | ||
return new \common_report_Report(\common_report_Report::TYPE_ERROR, "\n" . $e->getMessage() . "\n"); | ||
} | ||
} | ||
} |
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,66 @@ | ||
<?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) 2015 (original work) Open Assessment Technologies SA; | ||
* | ||
* | ||
*/ | ||
|
||
namespace oat\taoQtiItem\model\flyExporter\extractor; | ||
|
||
use oat\oatbox\PhpSerializable; | ||
|
||
/** | ||
* Extractor of item data | ||
* | ||
* Interface Extractor | ||
* @package oat\taoQtiItem\model\simpleExporter | ||
*/ | ||
interface Extractor extends PhpSerializable | ||
{ | ||
const DEFAULT_PROPERTY_DELIMITER = '|'; | ||
|
||
/** | ||
* Item to export, could load relative info like xml | ||
* | ||
* @param \core_kernel_classes_Resource $item | ||
* @return mixed | ||
*/ | ||
public function setItem(\core_kernel_classes_Resource $item); | ||
|
||
/** | ||
* Add column to extract with associate config | ||
* | ||
* @param $column | ||
* @param array $config | ||
* @return mixed | ||
*/ | ||
public function addColumn($column, array $config); | ||
|
||
/** | ||
* Run process by extracting data following columns | ||
* | ||
* @return mixed | ||
*/ | ||
public function run(); | ||
|
||
/** | ||
* Return generated data | ||
* | ||
* @return mixed | ||
*/ | ||
public function getData(); | ||
} |
32 changes: 14 additions & 18 deletions
32
index.php → ...Exporter/extractor/ExtractorException.php
100755 → 100644
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,32 +1,28 @@ | ||
<?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) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); | ||
* | ||
* | ||
* | ||
* Copyright (c) 2015 (original work) Open Assessment Technologies SA; | ||
* | ||
* | ||
*/ | ||
?> | ||
<?php | ||
/* | ||
* @author CRP Henri Tudor - TAO Team - {@link http://www.tao.lu} | ||
* @license GPLv2 http://www.opensource.org/licenses/gpl-2.0.php | ||
*/ | ||
require_once dirname(__FILE__). '/../tao/includes/class.Bootstrap.php'; | ||
|
||
$bootStrap = new BootStrap('taoQtiItem'); | ||
$bootStrap->start(); | ||
$bootStrap->dispatch(); | ||
?> | ||
namespace oat\taoQtiItem\model\flyExporter\extractor; | ||
|
||
|
||
class ExtractorException extends \Exception | ||
{ | ||
|
||
} |
Oops, something went wrong.