public function getFile()
    {
        if (!$this->hasGetParameter('uri')) {
            throw new \common_exception_Error('invalid media identifier');
        }
        $uri = urldecode($this->getGetParameter('uri'));

        $mediaSource = new MediaSource(array());
        $fileInfo = $mediaSource->getFileInfo($uri);

        $fileManagement = $this->getServiceLocator()->get(FileManagement::SERVICE_ID);
        $stream = $fileManagement->getFileStream($fileInfo['link']);
        if ($fileInfo['mime'] === 'application/qti+xml') {
            $this->response = $this->getPsrResponse()->withBody($stream);
        } elseif ($this->hasGetParameter('xml')) {
            $this->returnJson(htmlentities((string)$stream));
        } else {
            $this->setContentHeader($fileInfo['mime']);
            $this->response = $this->getPsrResponse()->withBody($stream);
        }
    }
public function getFile()
    {
        if (!$this->hasGetParameter('uri')) {
            throw new \common_exception_Error('invalid media identifier');
        }
        $uri = urldecode($this->getGetParameter('uri'));

        $mediaSource = new MediaSource(array());
        $fileInfo = $mediaSource->getFileInfo($uri);

        $fileManagement = $this->getServiceLocator()->get(FileManagement::SERVICE_ID);
        $stream = $fileManagement->getFileStream($fileInfo['link']);
        if ($fileInfo['mime'] === 'application/qti+xml') {
            $this->response = $this->getPsrResponse()->withBody($stream);
        } elseif ($this->hasGetParameter('xml')) {
            $this->returnJson(htmlentities((string)$stream));
        } else {
            $this->setContentHeader($fileInfo['mime']);
            $this->response = $this->getPsrResponse()->withBody($stream);
        }
    }
public function getFile ( ) { if ( ! $ this -> hasGetParameter ( 'uri' ) ) { throw new \ common_exception_Error ( 'invalid media identifier' ) ; } $ uri = urldecode ( $ this -> getGetParameter ( 'uri' ) ) ; $ mediaSource = new MediaSource ( array ( ) ) ; $ fileInfo = $ mediaSource -> getFileInfo ( $ uri ) ; $ fileManagement = $ this -> getServiceLocator ( ) -> get ( FileManagement :: SERVICE_ID ) ; $ stream = $ fileManagement -> getFileStream ( $ fileInfo [ 'link' ] ) ; if ( $ fileInfo [ 'mime' ] === 'application/qti+xml' ) { $ this -> response = $ this -> getPsrResponse ( ) -> withBody ( $ stream ) ; } elseif ( $ this -> hasGetParameter ( 'xml' ) ) { $ this -> returnJson ( htmlentities ( ( string ) $ stream ) ) ; } else { $ this -> setContentHeader ( $ fileInfo [ 'mime' ] ) ; $ this -> response = $ this -> getPsrResponse ( ) -> withBody ( $ stream ) ; } }
Get the file stream associated to given uri GET parameter

@throws \common_exception_Error
@throws \tao_models_classes_FileNotFoundException
Get the file stream associated to given uri GET parameter