community block MDL-24606 add information (waiting alert + expected time) when user downloads a course from community block

This commit is contained in:
jerome mouneyrac 2010-10-12 07:10:19 +00:00
parent 1e72829db7
commit 19eb73cdf3
4 changed files with 20 additions and 3 deletions

View File

@ -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);

View File

@ -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.';

View File

@ -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'));

View File

@ -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 {}