plugin/scorm/Manager/ExportManager.php
private function addCommons(\ZipArchive $archive, $locale)
    {
        $assets = [
            'bootstrap.css' => 'themes/claroline/bootstrap.css',
            'fontawesome' => 'packages/@fortawesome/fontawesome-free/css/fontawesome.css',
            'v4-shims' => 'packages/@fortawesome/fontawesome-free/css/v4-shims.css',
            'solid' => 'packages/@fortawesome/fontawesome-free/css/solid.css',
            'regular' => 'packages/@fortawesome/fontawesome-free/css/regular.css',
            'brands' => 'packages/@fortawesome/fontawesome-free/css/brands.css',
            'claroline-reset.css' => 'vendor/clarolinescorm/claroline-reset.css',
            'jquery.min.js' => 'packages/jquery/dist/jquery.min.js',
            'jquery-ui.min.js' => 'packages/jquery-ui-dist/jquery-ui.min.js',
            'bootstrap.min.js' => 'packages/bootstrap/dist/js/bootstrap.min.js',
            'translator.js' => 'bundles/bazingajstranslation/js/translator.min.js',
            'router.js' => 'bundles/fosjsrouting/js/router.js',
            'video.min.js' => 'packages/video.js/dist/video.min.js',
            'video-js.min.css' => 'packages/video.js/dist/video-js.min.css',
            'video-js.swf' => 'packages/video.js/dist/video-js.swf',
        ];

        $webpackAssets = [
            'commons.js' => 'dist/commons.js',
            'claroline-distribution-plugin-video-player-watcher.js' => 'dist/claroline-distribution-plugin-video-player-watcher.js',
        ];

        $translationDomains = [
            'resource',
            'home',
            'platform',
            'error',
            'validators',
        ];

        foreach ($assets as $filename => $originalFile) {
            $this->copyToPackage($archive, 'commons/'.$filename, $this->getFilePath($this->webPath, $originalFile));
        }

        // Add webpack assets
        foreach ($webpackAssets as $filename => $originalFile) {
            $this->copyToPackage(
                $archive,
                'commons/'.$filename,
                $this->getFilePath($this->webPath, $this->webpack->hotAsset($originalFile, true))
            );
        }

        // Add FontAwesome font files
        $fontDir = $this->webPath.DIRECTORY_SEPARATOR.'packages/@fortawesome/fontawesome-free/webfonts';
        $files = scandir($fontDir);
        foreach ($files as $file) {
            $filePath = $fontDir.DIRECTORY_SEPARATOR.$file;
            if (is_file($filePath)) {
                $this->copyToPackage($archive, 'fonts/'.$file, $this->getFilePath($fontDir, $file));
            }
        }

        // Generate JS routes with FOSJSRoutingBundle
        $request = new Request([
            'callback' => 'fos.Router.setData',
        ]);
        $jsRoutes = $this->jsRouterCtrl->indexAction($request, 'js');
        $this->saveToPackage($archive, 'commons/routes.js', $jsRoutes->getContent());

        // Add common translations
        foreach ($translationDomains as $domain) {
            $translationFile = 'js/translations/'.$domain.'/'.$locale.'.js';
            $this->copyToPackage($archive, 'translations/'.$domain.'.js', $this->getFilePath($this->webPath, $translationFile));
        }
    }
private function addCommons(\ZipArchive $archive, $locale)
    {
        $assets = [
            'bootstrap.css' => 'themes/claroline/bootstrap.css',
            'fontawesome' => 'packages/@fortawesome/fontawesome-free/css/fontawesome.css',
            'v4-shims' => 'packages/@fortawesome/fontawesome-free/css/v4-shims.css',
            'solid' => 'packages/@fortawesome/fontawesome-free/css/solid.css',
            'regular' => 'packages/@fortawesome/fontawesome-free/css/regular.css',
            'brands' => 'packages/@fortawesome/fontawesome-free/css/brands.css',
            'claroline-reset.css' => 'vendor/clarolinescorm/claroline-reset.css',
            'jquery.min.js' => 'packages/jquery/dist/jquery.min.js',
            'jquery-ui.min.js' => 'packages/jquery-ui-dist/jquery-ui.min.js',
            'bootstrap.min.js' => 'packages/bootstrap/dist/js/bootstrap.min.js',
            'translator.js' => 'bundles/bazingajstranslation/js/translator.min.js',
            'router.js' => 'bundles/fosjsrouting/js/router.js',
            'video.min.js' => 'packages/video.js/dist/video.min.js',
            'video-js.min.css' => 'packages/video.js/dist/video-js.min.css',
            'video-js.swf' => 'packages/video.js/dist/video-js.swf',
        ];

        $webpackAssets = [
            'commons.js' => 'dist/commons.js',
            'claroline-distribution-plugin-video-player-watcher.js' => 'dist/claroline-distribution-plugin-video-player-watcher.js',
        ];

        $translationDomains = [
            'resource',
            'home',
            'platform',
            'error',
            'validators',
        ];

        foreach ($assets as $filename => $originalFile) {
            $this->copyToPackage($archive, 'commons/'.$filename, $this->getFilePath($this->webPath, $originalFile));
        }

        // Add webpack assets
        foreach ($webpackAssets as $filename => $originalFile) {
            $this->copyToPackage(
                $archive,
                'commons/'.$filename,
                $this->getFilePath($this->webPath, $this->webpack->hotAsset($originalFile, true))
            );
        }

        // Add FontAwesome font files
        $fontDir = $this->webPath.DIRECTORY_SEPARATOR.'packages/@fortawesome/fontawesome-free/webfonts';
        $files = scandir($fontDir);
        foreach ($files as $file) {
            $filePath = $fontDir.DIRECTORY_SEPARATOR.$file;
            if (is_file($filePath)) {
                $this->copyToPackage($archive, 'fonts/'.$file, $this->getFilePath($fontDir, $file));
            }
        }

        // Generate JS routes with FOSJSRoutingBundle
        $request = new Request([
            'callback' => 'fos.Router.setData',
        ]);
        $jsRoutes = $this->jsRouterCtrl->indexAction($request, 'js');
        $this->saveToPackage($archive, 'commons/routes.js', $jsRoutes->getContent());

        // Add common translations
        foreach ($translationDomains as $domain) {
            $translationFile = 'js/translations/'.$domain.'/'.$locale.'.js';
            $this->copyToPackage($archive, 'translations/'.$domain.'.js', $this->getFilePath($this->webPath, $translationFile));
        }
    }
private function addCommons ( \ ZipArchive $ archive , $ locale ) { $ assets = [ 'bootstrap.css' => 'themes/claroline/bootstrap.css' , 'fontawesome' => 'packages/@fortawesome/fontawesome-free/css/fontawesome.css' , 'v4-shims' => 'packages/@fortawesome/fontawesome-free/css/v4-shims.css' , 'solid' => 'packages/@fortawesome/fontawesome-free/css/solid.css' , 'regular' => 'packages/@fortawesome/fontawesome-free/css/regular.css' , 'brands' => 'packages/@fortawesome/fontawesome-free/css/brands.css' , 'claroline-reset.css' => 'vendor/clarolinescorm/claroline-reset.css' , 'jquery.min.js' => 'packages/jquery/dist/jquery.min.js' , 'jquery-ui.min.js' => 'packages/jquery-ui-dist/jquery-ui.min.js' , 'bootstrap.min.js' => 'packages/bootstrap/dist/js/bootstrap.min.js' , 'translator.js' => 'bundles/bazingajstranslation/js/translator.min.js' , 'router.js' => 'bundles/fosjsrouting/js/router.js' , 'video.min.js' => 'packages/video.js/dist/video.min.js' , 'video-js.min.css' => 'packages/video.js/dist/video-js.min.css' , 'video-js.swf' => 'packages/video.js/dist/video-js.swf' , ] ; $ webpackAssets = [ 'commons.js' => 'dist/commons.js' , 'claroline-distribution-plugin-video-player-watcher.js' => 'dist/claroline-distribution-plugin-video-player-watcher.js' , ] ; $ translationDomains = [ 'resource' , 'home' , 'platform' , 'error' , 'validators' , ] ; foreach ( $ assets as $ filename => $ originalFile ) { $ this -> copyToPackage ( $ archive , 'commons/' . $ filename , $ this -> getFilePath ( $ this -> webPath , $ originalFile ) ) ; } // Add webpack assets foreach ( $ webpackAssets as $ filename => $ originalFile ) { $ this -> copyToPackage ( $ archive , 'commons/' . $ filename , $ this -> getFilePath ( $ this -> webPath , $ this -> webpack -> hotAsset ( $ originalFile , true ) ) ) ; } // Add FontAwesome font files $ fontDir = $ this -> webPath . DIRECTORY_SEPARATOR . 'packages/@fortawesome/fontawesome-free/webfonts' ; $ files = scandir ( $ fontDir ) ; foreach ( $ files as $ file ) { $ filePath = $ fontDir . DIRECTORY_SEPARATOR . $ file ; if ( is_file ( $ filePath ) ) { $ this -> copyToPackage ( $ archive , 'fonts/' . $ file , $ this -> getFilePath ( $ fontDir , $ file ) ) ; } } // Generate JS routes with FOSJSRoutingBundle $ request = new Request ( [ 'callback' => 'fos.Router.setData' , ] ) ; $ jsRoutes = $ this -> jsRouterCtrl -> indexAction ( $ request , 'js' ) ; $ this -> saveToPackage ( $ archive , 'commons/routes.js' , $ jsRoutes -> getContent ( ) ) ; // Add common translations foreach ( $ translationDomains as $ domain ) { $ translationFile = 'js/translations/' . $ domain . '/' . $ locale . '.js' ; $ this -> copyToPackage ( $ archive , 'translations/' . $ domain . '.js' , $ this -> getFilePath ( $ this -> webPath , $ translationFile ) ) ; } }
Adds the claroline common assets and translations into the package.

@param \ZipArchive $archive
@param string      $locale
Adds the claroline common assets and translations into the package .