public static function importDelivery(core_kernel_classes_Class $deliveryClass, $archiveFile) { $folder = tao_helpers_File::createTempDir(); $zip = new ZipArchive(); if ($zip->open($archiveFile) === true) { if ($zip->extractTo($folder)) { $returnValue = $folder; } $zip->close(); } $manifestPath = $folder . self::MANIFEST_FILE; if (!file_exists($manifestPath)) { return common_report_Report::createFailure(__('Manifest not found in assembly')); } $manifest = json_decode(file_get_contents($manifestPath), true); $label = $manifest['label']; $serviceCall = tao_models_classes_service_ServiceCall::fromString(base64_decode($manifest['runtime'])); $dirs = $manifest['dir']; $resultServer = taoResultServer_models_classes_ResultServerAuthoringService::singleton()->getDefaultResultServer(); try { foreach ($dirs as $id => $relPath) { tao_models_classes_service_FileStorage::singleton()->import($id, $folder . $relPath); } $delivery = $deliveryClass->createInstanceWithProperties(array(RDFS_LABEL => $label, PROPERTY_COMPILEDDELIVERY_DIRECTORY => array_keys($dirs), PROPERTY_COMPILEDDELIVERY_TIME => time(), PROPERTY_COMPILEDDELIVERY_RUNTIME => $serviceCall->toOntology(), TAO_DELIVERY_RESULTSERVER_PROP => $resultServer)); $report = common_report_Report::createSuccess(__('Delivery "%s" successfully imported', $label), $delivery); } catch (Exception $e) { if (isset($delivery) && $delivery instanceof core_kernel_classes_Resource) { $delivery->delete(); } $report = common_report_Report::createFailure(__('Unkown error during impoort')); } return $report; }
protected function importDeliveryResource(core_kernel_classes_Class $deliveryClass, $manifest) { $label = $manifest['label']; $dirs = $manifest['dir']; $serviceCall = tao_models_classes_service_ServiceCall::fromString(base64_decode($manifest['runtime'])); $resultServer = taoResultServer_models_classes_ResultServerAuthoringService::singleton()->getDefaultResultServer(); $delivery = $deliveryClass->createInstanceWithProperties(array(RDFS_LABEL => $label, PROPERTY_COMPILEDDELIVERY_DIRECTORY => array_keys($dirs), PROPERTY_COMPILEDDELIVERY_TIME => time(), PROPERTY_COMPILEDDELIVERY_RUNTIME => $serviceCall->toOntology(), TAO_DELIVERY_RESULTSERVER_PROP => $resultServer)); return $delivery; }
public function createAssemblyFromServiceCall(core_kernel_classes_Class $deliveryClass, tao_models_classes_service_ServiceCall $serviceCall, $properties = array()) { $properties[PROPERTY_COMPILEDDELIVERY_TIME] = time(); $properties[PROPERTY_COMPILEDDELIVERY_RUNTIME] = $serviceCall->toOntology(); if (!isset($properties[TAO_DELIVERY_RESULTSERVER_PROP])) { $properties[TAO_DELIVERY_RESULTSERVER_PROP] = taoResultServer_models_classes_ResultServerAuthoringService::singleton()->getDefaultResultServer(); } $compilationInstance = $deliveryClass->createInstanceWithProperties($properties); return $compilationInstance; }
public function run() { taoUpdate_helpers_ExtensionConfigUpdater::update('taoQtiTest', ROOT_PATH . 'taoQtiTest/includes/config.php'); taoUpdate_helpers_ExtensionConfigUpdater::update('taoItems', ROOT_PATH . 'taoItems/includes/config.php'); taoUpdate_helpers_ExtensionConfigUpdater::update('tao', ROOT_PATH . 'tao/includes/config.php'); taoQtiTest_models_classes_QtiTestService::singleton()->setQtiTestAcceptableLatency('PT5S'); taoDelivery_models_classes_execution_ServiceProxy::singleton()->setImplementation('taoDelivery_models_classes_execution_OntologyService'); $resultServer = new core_kernel_classes_Resource('http://www.tao.lu/Ontologies/TAOResult.rdf#taoResultServer'); taoResultServer_models_classes_ResultServerAuthoringService::singleton()->setDefaultResultServer($resultServer); }
/** * constructor: initialize the service and the default data * @return Delivery */ public function __construct() { parent::__construct(); $this->service = taoResultServer_models_classes_ResultServerAuthoringService::singleton(); $this->defaultData(); }
/** * (non-PHPdoc) * * @see tao_models_classes_CrudService::getClassService() */ protected function getClassService() { return taoResultServer_models_classes_ResultServerAuthoringService::singleton(); }
<?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) 2014 (original work) Open Assessment Technologies SA; * * */ $resultServer = new core_kernel_classes_Resource('http://www.tao.lu/Ontologies/taoOutcomeRds.rdf#RdsResultStorage'); taoResultServer_models_classes_ResultServerAuthoringService::singleton()->setDefaultResultServer($resultServer);
<?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 (under the project TAO-PRODUCT); * * */ $service = taoResultServer_models_classes_ResultServerAuthoringService::singleton(); // replace default result server if it is void if ($service->getDefaultResultServer()->getUri() == TAO_VOID_RESULT_SERVER) { $service->setDefaultResultServer(new core_kernel_classes_Resource('http://www.tao.lu/Ontologies/taoOutcomeRds.rdf#RdsResultStorage')); }