getClass(taoItems_models_classes_itemModel::CLASS_URI_MODELS); $itemModels = $itemModelClass->getInstances(); foreach ($itemModels as $model) { $impl = taoItems_models_classes_ItemsService::singleton()->getItemModelImplementation($model); if (in_array('tao_models_classes_export_ExportProvider', class_implements($impl), true)) { foreach ($impl->getExportHandlers() as $handler) { array_unshift($returnValue, $handler); } } } $instances = $this->getClassInstances(); if (!count($instances)) { $returnValue = array_filter($returnValue, static function (tao_models_classes_export_ExportHandler $handler) { return $handler instanceof tao_models_classes_export_RdfExporter; }); } return $returnValue; } public function getClassInstances(): array { $instances = []; $classUri = $this->hasPostParameter('classUri') ? $this->getPostParameter('classUri') : ''; if ($classUri) { $class = $this->getClass(tao_helpers_Uri::decode($classUri)); $instances = $class->getInstances(true); } return $instances; } protected function getFormFactory( array $handlers, tao_models_classes_export_ExportHandler $exporter, core_kernel_classes_Resource $selectedResource, array $formData ): tao_actions_form_Export { $formFactory = parent::getFormFactory($handlers, $exporter, $selectedResource, $formData); $instances = $this->getClassInstances(); if (!count($instances)) { $formFactory->setInfoBox(__('Note: For empty classes, the RDF format
is the only available format.')); } return $formFactory; } /** * Function returns items to export. * Items that has no content (QTI items without qti.xml file or empty Open Web Items) will be filtered * * @return core_kernel_classes_Resource[] An array of items. */ protected function getResourcesToExport() { $resources = parent::getResourcesToExport(); $service = taoItems_models_classes_ItemsService::singleton(); $resources = array_filter($resources, function ($val) use ($service) { return $service->hasItemContent($val); }); return $resources; } }