course publication MDL-19315 rename screenshotsids for screenshots

This commit is contained in:
jerome mouneyrac 2010-06-10 06:11:43 +00:00
parent 427711b108
commit b8c2aea51b
3 changed files with 6 additions and 6 deletions

View File

@ -159,10 +159,10 @@ class block_community_renderer extends plugin_renderer_base {
// add a row to the table
$screenshothtml = '';
if (!empty($course->screenshotsids)) {
if (!empty($course->screenshots)) {
$images = array();
$baseurl = new moodle_url($huburl.'/local/hub/webservice/download.php', array('courseid' => $course->id, 'filetype' => HUB_SCREENSHOT_FILE_TYPE));
for ($i = 1; $i <= $course->screenshotsids; $i = $i + 1) {
for ($i = 1; $i <= $course->screenshots; $i = $i + 1) {
$params['screenshotnumber'] = $i;
$images[] = array(
'thumburl' => new moodle_url($baseurl, array('screenshotnumber' => $i)),

View File

@ -139,7 +139,7 @@ class course_publication_form extends moodleform {
$defaultaudience = $publishedcourse['audience'];
$defaulteducationallevel = $publishedcourse['educationallevel'];
$defaultcreatornotes = $publishedcourse['creatornotes'];
$screenshotsnumber = $publishedcourse['screenshotsids'];
$screenshotsnumber = $publishedcourse['screenshots'];
$privacy = $publishedcourse['privacy'];
} else {

View File

@ -137,16 +137,16 @@ 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)) {
$courseinfo->screenshotsids = 0;
$courseinfo->screenshots = 0;
} else {
$courseinfo->screenshotsids = $fromform->existingscreenshotnumber;
$courseinfo->screenshots = $fromform->existingscreenshotnumber;
}
if (!empty($fromform->screenshots)) {
$screenshots = $fromform->screenshots;
$fs = get_file_storage();
$files = $fs->get_area_files(get_context_instance(CONTEXT_USER, $USER->id)->id, 'user_draft', $screenshots);
if (!empty($files)) {
$courseinfo->screenshotsids = $courseinfo->screenshotsids + count($files)-1; //minus the ./ directory
$courseinfo->screenshots = $courseinfo->screenshots + count($files)-1; //minus the ./ directory
}
}