public function importDeferred()
    {
        try {
            if ($this->getRequestMethod() != Request::HTTP_POST) {
                throw new \common_exception_NotImplemented('Only post method is accepted to import Qti package.');
            }

            $task = ImportQtiItem::createTask(
                $this->getUploadedPackage(),
                $this->getDestinationClass(),
                $this->getServiceLocator(),
                $this->isMetadataGuardiansEnabled(),
                $this->isMetadataValidatorsEnabled(),
                $this->isItemMustExistEnabled(),
                $this->isItemMustBeOverwrittenEnabled()
            );

            $result = [
                'reference_id' => $task->getId()
            ];

            /** @var TaskLogInterface $taskLog */
            $taskLog = $this->getServiceManager()->get(TaskLogInterface::SERVICE_ID);

            if ($report = $taskLog->getReport($task->getId())) {
                $result['report'] = $report->toArray();
            }

            return $this->returnSuccess($result);
        } catch (\Exception $e) {
            return $this->returnFailure($e);
        }
    }
public function importDeferred()
    {
        try {
            if ($this->getRequestMethod() != Request::HTTP_POST) {
                throw new \common_exception_NotImplemented('Only post method is accepted to import Qti package.');
            }

            $task = ImportQtiItem::createTask(
                $this->getUploadedPackage(),
                $this->getDestinationClass(),
                $this->getServiceLocator(),
                $this->isMetadataGuardiansEnabled(),
                $this->isMetadataValidatorsEnabled(),
                $this->isItemMustExistEnabled(),
                $this->isItemMustBeOverwrittenEnabled()
            );

            $result = [
                'reference_id' => $task->getId()
            ];

            /** @var TaskLogInterface $taskLog */
            $taskLog = $this->getServiceManager()->get(TaskLogInterface::SERVICE_ID);

            if ($report = $taskLog->getReport($task->getId())) {
                $result['report'] = $report->toArray();
            }

            return $this->returnSuccess($result);
        } catch (\Exception $e) {
            return $this->returnFailure($e);
        }
    }
public function importDeferred ( ) { try { if ( $ this -> getRequestMethod ( ) != Request :: HTTP_POST ) { throw new \ common_exception_NotImplemented ( 'Only post method is accepted to import Qti package.' ) ; } $ task = ImportQtiItem :: createTask ( $ this -> getUploadedPackage ( ) , $ this -> getDestinationClass ( ) , $ this -> getServiceLocator ( ) , $ this -> isMetadataGuardiansEnabled ( ) , $ this -> isMetadataValidatorsEnabled ( ) , $ this -> isItemMustExistEnabled ( ) , $ this -> isItemMustBeOverwrittenEnabled ( ) ) ; $ result = [ 'reference_id' => $ task -> getId ( ) ] ; /** @var TaskLogInterface $taskLog */ $ taskLog = $ this -> getServiceManager ( ) -> get ( TaskLogInterface :: SERVICE_ID ) ; if ( $ report = $ taskLog -> getReport ( $ task -> getId ( ) ) ) { $ result [ 'report' ] = $ report -> toArray ( ) ; } return $ this -> returnSuccess ( $ result ) ; } catch ( \ Exception $ e ) { return $ this -> returnFailure ( $ e ) ; } }
Import item package through the task queue.
Import item package through the task queue .