Skip to content

Commit

Permalink
Merge pull request #629 from oat-sa/release-2.20.0
Browse files Browse the repository at this point in the history
Release 2.20.0
  • Loading branch information
llecaque committed Apr 4, 2016
2 parents aa91155 + eecd7d8 commit 86dd3f1
Show file tree
Hide file tree
Showing 33 changed files with 1,319 additions and 80 deletions.
8 changes: 0 additions & 8 deletions .htaccess

This file was deleted.

65 changes: 65 additions & 0 deletions config/default/simpleExporter.conf.php
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,
)
),
)
));
57 changes: 57 additions & 0 deletions install/scripts/createExportDirectory.php
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.');
}
}
8 changes: 5 additions & 3 deletions manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
'label' => 'QTI item model',
'description' => 'TAO QTI item model',
'license' => 'GPL-2.0',
'version' => '2.19.0',
'version' => '2.20.0',
'author' => 'Open Assessment Technologies',
'requires' => array(
'taoItems' => '>=2.6'
'taoItems' => '>=2.6',
'tao' => '>=2.17'
),
'models' => array(
'http://www.tao.lu/Ontologies/TAOItem.rdf'
Expand All @@ -48,7 +49,8 @@
dirname(__FILE__).'/install/local/addPortableContexts.php',
dirname(__FILE__).'/install/scripts/addPortableSharedLibraries.php',
dirname(__FILE__).'/install/scripts/setQtiRunnerConfig.php',
'oat\\taoQtiItem\\install\\scripts\\addValidationSettings'
'oat\\taoQtiItem\\install\\scripts\\addValidationSettings',
'oat\\taoQtiItem\\install\\scripts\\createExportDirectory',
)
),
'local' => array(
Expand Down
59 changes: 59 additions & 0 deletions model/flyExporter/ExporterAction.php
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");
}
}
}
66 changes: 66 additions & 0 deletions model/flyExporter/extractor/Extractor.php
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 index.php → ...Exporter/extractor/ExtractorException.php
100755 → 100644
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
{

}
Loading

0 comments on commit 86dd3f1

Please sign in to comment.