Commit 9438e08c authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1940346: Creating new pdflite exporter



To be used with the Ouriginal plagiarism software

Change-Id: I3deaa6c5a6509973fe0f22107a851deaa865d7d8
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
parent 32144cc3
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ function bulkexport_submit(Pieform $form, $values) {
        else if ($exporttype == 'htmllite') {
            $exporter = new PluginExportHtmlLite($user, PluginExport::EXPORT_ALL_VIEWS_COLLECTIONS, PluginExport::EXPORT_ALL_ARTEFACTS, 'export_bulk_progress_handler', $exportcount+1, $num_users);
        }
        else if ($exporttype == 'pdf') {
        else if ($exporttype == 'pdf' || $exporttype = 'pdflite') {
            if ($exportcount === 0 && $num_users === 1) {
                $pdfrun = 'all';
            }
@@ -156,8 +156,14 @@ function bulkexport_submit(Pieform $form, $values) {
            else {
                $pdfrun = 'multi';
            }

            if ($exporttype == 'pdflite') {
                $exporter = new PluginExportPdfLite($user, PluginExport::EXPORT_ALL_VIEWS_COLLECTIONS, PluginExport::EXPORT_ALL_ARTEFACTS, 'export_bulk_progress_handler', $exportcount+1, $num_users);
            }
            else {
                $exporter = new PluginExportPdf($user, PluginExport::EXPORT_ALL_VIEWS_COLLECTIONS, PluginExport::EXPORT_ALL_ARTEFACTS, 'export_bulk_progress_handler', $exportcount+1, $num_users);
            }
        }
        else {
            $exporter = new PluginExportLeap($user, PluginExport::EXPORT_ALL_VIEWS_COLLECTIONS, PluginExport::EXPORT_ALL_ARTEFACTS, 'export_bulk_progress_handler', $exportcount+1, $num_users);
        }
+2 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ class PluginBlocktypeFiledownload extends MaharaCoreBlocktype {
    }

    public static function render_instance_export(BlockInstance $instance, $editing=false, $versioning=false, $exporting=null) {
        if ($exporting != 'pdf') {
        if ($exporting != 'pdf' && $exporting != 'pdflite') {
            return self::render_instance($instance, $editing, $versioning);
        }
        // The exporting for pdf
@@ -41,6 +41,7 @@ class PluginBlocktypeFiledownload extends MaharaCoreBlocktype {
        $smarty->assign('blockid', $instance->get('id'));
        $smarty->assign('files', $files);
        $smarty->assign('editing', $editing);
        $smarty->assign('exporttype', $exporting);
        return $smarty->fetch('blocktype:filedownload:filedownload_pdfexport.tpl');
    }

+3 −3
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ class PluginBlocktypeFolder extends MaharaCoreBlocktype {
    }

    public static function render_instance_export(BlockInstance $instance, $editing=false, $versioning=false, $exporting=null) {
        if ($exporting != 'pdf') {
        if ($exporting != 'pdf' && $exporting != 'pdflite') {
            return self::render_instance($instance, $editing, $versioning);
        }
        // The exporting for pdf
@@ -51,8 +51,8 @@ class PluginBlocktypeFolder extends MaharaCoreBlocktype {
        $configdata = $instance->get('configdata');
        $configdata['viewid'] = $instance->get('view');
        $configdata['simpledisplay'] = true;
        $configdata['pdfexport'] = true; // pass down flag that we are in pdf export
        $configdata['pdfexportfiledir'] = 'export_info/files/';
        $configdata['exporttype'] = $exporting; // pass down flag of the export type
        $configdata['exportfiledir'] = 'export_info/files/';
        list($result, $commentcount, $comments) = self::render_instance_data($instance, $editing, $versioning, $configdata);

        $smarty = smarty_core();
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
                        if ($description) {
                            $html .= '<div class="card-body">' . $description . '</div>';
                        }
                        $html .= '<div class="text-midtone">' . get_string('notrendertopdf', 'artefact.file');
                        $html .= '<div class="text-midtone text-small">' . get_string('notrendertopdf', 'artefact.file');
                        $html .= '<br>' . get_string('notrendertopdffiles', 'artefact.file', count($artefactids));
                        $firstdone = true;
                    }
+32 −0
Original line number Diff line number Diff line
@@ -49,6 +49,38 @@ class PluginBlocktypeInternalmedia extends MaharaCoreBlocktype {
        return true;
    }

    /**
     * Render the block for export
     * Allowing us to render it differently for each export type
     *
     * @param BlockInstance $instance An instance of the block
     * @param boolean $editing        If rendering in edit mode    - unused but needed to match render_instance()
     * @param boolean $versioning     If rendering in version mode - unused but needed to match render_instance()
     * @param string|null $exporting  The exporting format name
     * @return string HTML markup
     */
    public static function render_instance_export(BlockInstance $instance, $editing=false, $versioning=false, $exporting=null) {
        if ($exporting != 'pdf' && $exporting != 'pdflite') {
            return self::render_instance($instance, $editing, $versioning);
        }
        list($artefact, $width, $height) = self::get_mediaplayer_details($instance);
        $html = '<div class="text-midtone text-small">';
        if ($artefact && $artefact->get('description')) {
            $html .= $artefact->get('description');
        }
        else {
            $html .= get_string('notrendertopdf', 'artefact.file');
        }
        if ($exporting == 'pdf') {
            $html .= '<br>' . get_string('notrendertopdflink', 'artefact.file');
            // We need to add an <a> link so that the HTML export() sub-task makes a copy of the artefct for the export 'files/' directory
            // We then override the link in the PDF pdf_view_export_data() function.
            $html .= '<a href="' . $url . '">export_info/files/' . $artefact->get('id') . '_' . $artefact->get('title') . '</a>';
        }
        $html .= '</div>';
        return $html;
    }

    public static function render_instance(BlockInstance $instance, $editing=false, $versioning=false) {
        list($artefact, $width, $height) = self::get_mediaplayer_details($instance);
        if (!$artefact) {
Loading