publication MDL-24687 fix pb with screenshots sent during a second course sharing

This commit is contained in:
jerome mouneyrac 2010-11-03 02:43:40 +00:00
parent b1d2d048b0
commit 042bb40e79
2 changed files with 20 additions and 18 deletions

View File

@ -337,25 +337,27 @@ class course_publication_form extends moodleform {
$mform->setType('creatornotes', PARAM_CLEANHTML);
$mform->addHelpButton('creatornotes', 'creatornotes', 'hub');
if (!empty($screenshotsnumber)) {
if ($advertise) {
if (!empty($screenshotsnumber)) {
if (!empty($privacy)) {
$baseurl = new moodle_url($huburl . '/local/hub/webservice/download.php',
array('courseid' => $hubcourseid, 'filetype' => HUB_SCREENSHOT_FILE_TYPE));
$screenshothtml = html_writer::empty_tag('img',
array('src' => $baseurl, 'alt' => $defaultfullname));
$screenshothtml = html_writer::tag('div', $screenshothtml,
array('class' => 'coursescreenshot',
'id' => 'image-' . $hubcourseid));
} else {
$screenshothtml = get_string('existingscreenshotnumber', 'hub', $screenshotsnumber);
if (!empty($privacy)) {
$baseurl = new moodle_url($huburl . '/local/hub/webservice/download.php',
array('courseid' => $hubcourseid, 'filetype' => HUB_SCREENSHOT_FILE_TYPE));
$screenshothtml = html_writer::empty_tag('img',
array('src' => $baseurl, 'alt' => $defaultfullname));
$screenshothtml = html_writer::tag('div', $screenshothtml,
array('class' => 'coursescreenshot',
'id' => 'image-' . $hubcourseid));
} else {
$screenshothtml = get_string('existingscreenshotnumber', 'hub', $screenshotsnumber);
}
$mform->addElement('static', 'existingscreenshots', get_string('existingscreenshots', 'hub'), $screenshothtml);
$mform->addHelpButton('existingscreenshots', 'deletescreenshots', 'hub');
$mform->addElement('checkbox', 'deletescreenshots', '', ' ' . get_string('deletescreenshots', 'hub'));
}
$mform->addElement('static', 'existingscreenshots', get_string('existingscreenshots', 'hub'), $screenshothtml);
$mform->addHelpButton('existingscreenshots', 'deletescreenshots', 'hub');
$mform->addElement('checkbox', 'deletescreenshots', '', ' ' . get_string('deletescreenshots', 'hub'));
}
$mform->addElement('hidden', 'existingscreenshotnumber', $screenshotsnumber);
$mform->addElement('hidden', 'existingscreenshotnumber', $screenshotsnumber);
}
$mform->addElement('filemanager', 'screenshots', get_string('addscreenshots', 'hub'), null,
array('subdirs' => 0,

View File

@ -162,7 +162,7 @@ if (has_capability('moodle/course:publish', get_context_instance(CONTEXT_COURSE,
//save into screenshots field the references to the screenshot content hash
//(it will be like a unique id from the hub perspective)
if (!empty($fromform->deletescreenshots)) {
if (!empty($fromform->deletescreenshots) or $share) {
$courseinfo->screenshots = 0;
} else {
$courseinfo->screenshots = $fromform->existingscreenshotnumber;
@ -214,7 +214,7 @@ if (has_capability('moodle/course:publish', get_context_instance(CONTEXT_COURSE,
// send screenshots
if (!empty($fromform->screenshots)) {
if (!empty($fromform->deletescreenshots)) {
if (!empty($fromform->deletescreenshots) or $share) {
$screenshotnumber = 0;
} else {
$screenshotnumber = $fromform->existingscreenshotnumber;