public function export(Workspace $workspace)
    {
        foreach ($this->listImporters as $importer) {
            $importer->setListImporters($this->listImporters);
        }

        $data = [];
        $files = [];
        $data['roles'] = $this->getImporterByName('roles')->export($workspace, $files, null);
        $data['tools'] = $this->getImporterByName('tools')->export($workspace, $files, null);
        $_resManagerData = array();

        foreach ($data['tools'] as &$_tool) {
            if ($_tool['tool']['type'] === 'resource_manager') {
                $_resManagerData = &$_tool['tool'];
            }
        }

        //then we parse and replace the text, we also add missing files in $resManagerData
        $files = $this->container->get('claroline.importer.rich_text_formatter')
            ->setPlaceHolders($files, $_resManagerData);
        //throw new \Exception();
        //generate the archive in a temp dir
        $content = Yaml::dump($data, 10);
        //zip and returns the archive
        $archDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid();
        $archPath = $archDir . DIRECTORY_SEPARATOR . 'archive.zip';
        mkdir($archDir);
        $manifestPath = $archDir . DIRECTORY_SEPARATOR . 'manifest.yml';
        file_put_contents($manifestPath, $content);
        $archive = new \ZipArchive();
        $success = $archive->open($archPath, \ZipArchive::CREATE);

        if ($success === true) {
            $archive->addFile($manifestPath, 'manifest.yml');

            foreach ($files as $uid => $file) {
                $archive->addFile($file, $uid);
            }

            $archive->close();
        } else {
            throw new \Exception('Unable to create archive . ' . $archPath . ' (error ' . $success . ')');
        }

        return $archPath;
    }