diff --git a/blocks/community/communitycourse.php b/blocks/community/communitycourse.php index c5a391e8788..4e7af65baa3 100644 --- a/blocks/community/communitycourse.php +++ b/blocks/community/communitycourse.php @@ -94,16 +94,28 @@ $huburl = optional_param('huburl', false, PARAM_URL); $download = optional_param('download', -1, PARAM_INTEGER); $downloadcourseid = optional_param('downloadcourseid', '', PARAM_INTEGER); $coursefullname = optional_param('coursefullname', '', PARAM_ALPHANUMEXT); +$backupsize = optional_param('backupsize', 0, PARAM_INT); if ($usercandownload and $download != -1 and !empty($downloadcourseid) and confirm_sesskey()) { $course = new stdClass(); $course->fullname = $coursefullname; $course->id = $downloadcourseid; $course->huburl = $huburl; - $filenames = $communitymanager->block_community_download_course_backup($course); //OUTPUT: display restore choice page echo $OUTPUT->header(); - echo $OUTPUT->heading(get_string('restorecourse', 'block_community'), 3, 'main'); + echo $OUTPUT->heading(get_string('downloadingcourse', 'block_community'), 3, 'main'); + echo html_writer::tag('div', get_string('downloading', 'block_community'), + array('class' => 'textinfo')); + $sizeinfo = new stdClass(); + $sizeinfo->total = $backupsize / 1000000; + $sizeinfo->modem = (int) ($backupsize / 5000); + $sizeinfo->dsl = (int) $sizeinfo->total; + echo html_writer::tag('div', get_string('downloadingsize', 'block_community', $sizeinfo), + array('class' => 'textinfo')); + flush(); + echo html_writer::tag('div', get_string('downloaded', 'block_community'), + array('class' => 'textinfo')); + $filenames = $communitymanager->block_community_download_course_backup($course); echo $OUTPUT->notification(get_string('downloadconfirmed', 'block_community', '/downloaded_backup/' . $filenames['privatefile']), 'notifysuccess'); echo $renderer->restore_confirmation_box($filenames['tmpfile'], $context); diff --git a/blocks/community/lang/en/block_community.php b/blocks/community/lang/en/block_community.php index 9042cbae35c..eed7d7686e4 100644 --- a/blocks/community/lang/en/block_community.php +++ b/blocks/community/lang/en/block_community.php @@ -48,6 +48,10 @@ $string['dorestore'] = 'Yes'; $string['download'] = 'Download'; $string['downloadable'] = 'courses I can download'; $string['downloadconfirmed'] = 'The backup has been saved in your private files {$a}'; +$string['downloaded'] = '...finished.'; +$string['downloading'] = 'Do not refresh your browser ! The site is downloading the course backup...'; +$string['downloadingcourse'] = 'Downloading course'; +$string['downloadingsize'] = 'Downloading the backup ({$a->total}Mb) should take approximately between {$a->dsl}s and {$a->modem}s, depending on the site/hub connection...'; $string['downloadtemplate'] = 'Create course from template'; $string['educationallevel'] = 'Educational level'; $string['educationallevel_help'] = 'What educational level are you searching for? In the case of communities of educators, this level describes the level they are teaching.'; diff --git a/blocks/community/renderer.php b/blocks/community/renderer.php index e5e054205e7..7ce118deb9f 100644 --- a/blocks/community/renderer.php +++ b/blocks/community/renderer.php @@ -242,7 +242,7 @@ class block_community_renderer extends plugin_renderer_base { $params = array('sesskey' => sesskey(), 'download' => 1, 'confirmed' => 1, 'remotemoodleurl' => $CFG->wwwroot, 'courseid' => $contextcourseid, 'downloadcourseid' => $course->id, 'huburl' => $huburl, - 'coursefullname' => $course->fullname); + 'coursefullname' => $course->fullname, 'backupsize' => $course->backupsize); $downloadurl = new moodle_url("/blocks/community/communitycourse.php", $params); $downloadbuttonhtml = html_writer::tag('a', get_string('download', 'block_community'), array('href' => $downloadurl, 'class' => 'centeredbutton, hubcoursedownload')); diff --git a/blocks/community/styles.css b/blocks/community/styles.css index f99c3c1dc6b..d5360b5d924 100644 --- a/blocks/community/styles.css +++ b/blocks/community/styles.css @@ -152,3 +152,4 @@ #page-blocks-community-communitycourse .hubrateandcomment { font-size: 80%;} #page-blocks-community-communitycourse .hubcourseoutcomes {} #page-blocks-community-communitycourse .nextlink {text-align: center;margin-top: 6px;} +#page-blocks-community-communitycourse .textinfo {}