export_iframe_progress_handler($percentage, get_string('exportingusername', 'admin', $username)); $exporter = new PluginExportLeap($user, PluginExport::EXPORT_ALL_VIEWS, PluginExport::EXPORT_ALL_ARTEFACTS); try { $zipfile = $exporter->export(); } catch (Exception $e) { $exporterrors[] = $username; continue; } $listing[] = array($username, $zipfile); $files[] = $exporter->get('exportdir') . $zipfile; $exportcount++; } export_iframe_progress_handler(99, get_string('creatingzipfile', 'export')); if (!($zipfile = create_zipfile($listing, $files))) { export_iframe_die(get_string('bulkexportempty', 'admin')); } export_iframe_progress_handler(100, get_string('Done', 'export')); ob_end_flush(); log_info("Exported {$exportcount} users to {$zipfile}"); if (!empty($exporterrors)) { $SESSION->add_error_msg(get_string('couldnotexportusers', 'admin', implode(', ', $exporterrors))); } // Store the filename in the session, and redirect the iframe to it to trigger // the download. Here it would be nice to trigger the download for everyone, // but alas this is not possible for people without javascript. $SESSION->set('exportfile', $zipfile); $wwwroot = get_config('wwwroot'); $strexportgeneratedsuccessfullyjs = get_string('exportgeneratedsuccessfullyjs', 'export', '<a href="' . $wwwroot . '" target="_top">', '</a>'); $strexportgeneratedsuccessfully = get_string('exportgeneratedsuccessfully', 'export', '<a href="bulkdownload.php" target="_top">', '</a>'); print_export_footer($strexportgeneratedsuccessfully, $strexportgeneratedsuccessfullyjs);
break; default: export_iframe_die(get_string('unabletoexportportfoliousingoptions', 'export')); } $exporter->includefeedback = $exportdata['includefeedback']; // Get an estimate of how big the unzipped export file would be // so we can check that we have enough disk space for it $space = $exporter->is_diskspace_available(); if (!$space) { export_iframe_die(get_string('exportfiletoobig', 'mahara'), get_config('wwwroot') . 'view/index.php'); } try { $zipfile = $exporter->export(); } catch (SystemException $e) { export_iframe_die($e->getMessage(), get_config('wwwroot') . 'view/index.php'); } // Store the filename in the session, and redirect the iframe to it to trigger // the download. Here it would be nice to trigger the download for everyone, // but alas this is not possible for people without javascript. $SESSION->set('exportfile', $exporter->get('exportdir') . $zipfile); $continueurl = 'download.php'; $continueurljs = get_config('wwwroot') . 'export/index.php'; $result = $SESSION->get('messages'); if (empty($result)) { $strexport = get_string('exportgeneratedsuccessfully1', 'export'); } else { $SESSION->clear('messages'); $strexport = get_string('exportgeneratedwitherrors', 'export'); } print_export_footer($strexport, $continueurl, $continueurljs, $result, 'download.php');
$exporter = new PluginExportLeap($user, PluginExport::EXPORT_ALL_VIEWS, PluginExport::EXPORT_ALL_ARTEFACTS); try { $zipfile = $exporter->export(); } catch (Exception $e) { $exporterrors[] = $username; continue; } $listing[] = array($username, $zipfile); $files[] = $exporter->get('exportdir') . $zipfile; $exportcount++; } export_iframe_progress_handler(99, get_string('creatingzipfile', 'export')); if (!($zipfile = create_zipfile($listing, $files))) { export_iframe_die(get_string('bulkexportempty', 'admin')); } export_iframe_progress_handler(100, get_string('Done', 'export')); ob_end_flush(); log_info("Exported {$exportcount} users to {$zipfile}"); if (!empty($exporterrors)) { $SESSION->add_error_msg(get_string('couldnotexportusers', 'admin', implode(', ', $exporterrors))); } // Store the filename in the session, and redirect the iframe to it to trigger // the download. Here it would be nice to trigger the download for everyone, // but alas this is not possible for people without javascript. $SESSION->set('exportfile', $zipfile); $continueurljs = get_config('wwwroot'); $continueurl = 'bulkdownload.php'; $result = $SESSION->get('messages'); $SESSION->clear('messages'); print_export_footer(get_string('exportgeneratedsuccessfully1', 'export'), $continueurl, $continueurljs, $result, 'bulkdownload.php');