$sectionid = $this->get_task()->get_sectionid();
// Get data object for current section availability (if any).
- $data = $DB->get_record('course_sections_availability',
- array('coursesectionid' => $sectionid), 'id, sourcecmid, gradeitemid', IGNORE_MISSING);
+ $records = $DB->get_records('course_sections_availability',
+ array('coursesectionid' => $sectionid), 'id, sourcecmid, gradeitemid');
// If it exists, update mappings.
- if ($data) {
+ foreach ($records as $data) {
// Only update mappings for entries which are created by this restore.
// Otherwise, when you restore to an existing course, it will mess up
// existing section availability entries.
val = val.replace('___name___', list[i].fullname);
}
if (list[i]['delete']||newcmt) {
- list[i].content = '<div class="comment-delete"><a href="#" id ="comment-delete-'+this.client_id+'-'+list[i].id+'" title="'+M.str.moodle.deletecomment+'"><img src="'+M.util.image_url('t/delete', 'core')+'" /></a></div>' + list[i].content;
+ list[i].content = '<div class="comment-delete"><a href="#" id ="comment-delete-'+this.client_id+'-'+list[i].id+'" title="'+M.str.moodle.deletecomment+'"><img alt="" src="'+M.util.image_url('t/delete', 'core')+'" /></a></div>' + list[i].content;
}
val = val.replace('___time___', list[i].time);
val = val.replace('___picture___', list[i].avatar);
if (!$mod->uservisible) {
echo '<div class="availabilityinfo">'.$mod->availableinfo.'</div>';
} else if ($canviewhidden && !empty($CFG->enableavailability)) {
- $visibilityclass = '';
- if (!$mod->visible) {
- $visibilityclass = 'accesshide';
- }
- $ci = new condition_info($mod);
- $fullinfo = $ci->get_full_information();
- if($fullinfo) {
- echo '<div class="availabilityinfo '.$visibilityclass.'">'.get_string($mod->showavailability
- ? 'userrestriction_visible'
- : 'userrestriction_hidden','condition',
- $fullinfo).'</div>';
+ // Don't add availability information if user is not editing and activity is hidden.
+ if ($mod->visible || $PAGE->user_is_editing()) {
+ $hidinfoclass = '';
+ if (!$mod->visible) {
+ $hidinfoclass = 'hide';
+ }
+ $ci = new condition_info($mod);
+ $fullinfo = $ci->get_full_information();
+ if($fullinfo) {
+ echo '<div class="availabilityinfo '.$hidinfoclass.'">'.get_string($mod->showavailability
+ ? 'userrestriction_visible'
+ : 'userrestriction_hidden','condition',
+ $fullinfo).'</div>';
+ }
}
}
if ($hascourses) {
$content .= html_writer::start_tag('div', array('class'=>'courses'));
$coursecount = 0;
+ $strinfo = new lang_string('info');
foreach ($category->courses as $course) {
$classes = array('course');
$linkclass = 'course_link';
}
if ($course->summary) {
+ $url = new moodle_url('/course/info.php', array('id' => $course->id));
$image = html_writer::empty_tag('img', array('src'=>$this->output->pix_url('i/info'), 'alt'=>$this->strings->summary));
- $content .= html_writer::link(new moodle_url('/course/info.php', array('id'=>$course->id)), $image, array('title'=>$this->strings->summary));
+ $content .= $this->action_link($url, $image, new popup_action('click', $url, 'courseinfo'), array('title' => $this->strings->summary));
}
$content .= html_writer::end_tag('div');
$content .= html_writer::end_tag('div');
CONDITIONALHIDDEN : 'conditionalhidden',
AVAILABILITYINFODIV : 'div.availabilityinfo',
SHOWCLASS : 'editing_show',
- ACCESSHIDECLASS : 'accesshide'
+ HIDECLASS : 'hide'
};
/**
var availabilityinfo = element.one(CSS.AVAILABILITYINFODIV);
if (availabilityinfo) {
- availabilityinfo.toggleClass(CSS.ACCESSHIDECLASS);
+ availabilityinfo.toggleClass(CSS.HIDECLASS);
}
return value;
},
$actionurl = new moodle_url($page->url, array('sesskey'=>sesskey()));
$select = new single_select($actionurl, 'bui_addblock', $menu, null, array(''=>get_string('adddots')), 'add_block');
+ $select->set_label(get_string('addblock'), array('class'=>'accesshide'));
$bc->content = $OUTPUT->render($select);
return $bc;
}
if (empty($modinfo->cms[$cmid])) {
global $PAGE, $UNITTEST;
if (!empty($UNITTEST) || (isset($PAGE) && strpos($PAGE->pagetype, 'course-view-')===0)) {
- debugging("Warning: activity {$this->cm->id} '{$this->cm->name}' has condition " .
+ debugging("Warning: activity {$this->item->id} '{$this->item->name}' has condition " .
"on deleted activity $cmid (to get rid of this message, edit the named activity)");
}
continue;
upgrade_main_savepoint(true, 2012062502.07);
}
+ if ($oldversion < 2012062503.07) {
+ // Remove "_utf8" suffix from all langs in course table.
+ $langs = $DB->get_records_sql("SELECT DISTINCT lang FROM {course} WHERE lang LIKE ?", array('%_utf8'));
+
+ foreach ($langs as $lang=>$unused) {
+ $newlang = str_replace('_utf8', '', $lang);
+ $sql = "UPDATE {course} SET lang = :newlang WHERE lang = :lang";
+ $DB->execute($sql, array('newlang'=>$newlang, 'lang'=>$lang));
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2012062503.07);
+ }
+
return true;
}
protected function load_category_settings() {
global $CFG;
- $categorynode = $this->add(print_context_name($this->context));
+ $categorynode = $this->add(print_context_name($this->context), null, null, null, 'categorysettings');
$categorynode->force_open();
if (has_any_capability(array('moodle/category:manage', 'moodle/course:create'), $this->context)) {
LEFT JOIN {assign_grades} g ON
s.assignment = g.assignment AND
s.userid = g.userid
- JOIN(' . $esql . ') AS e ON e.id = s.userid
+ JOIN(' . $esql . ') e ON e.id = s.userid
WHERE
s.assignment = :assignid AND
s.timemodified IS NOT NULL AND
LEFT JOIN {assign_grades} g ON
s.assignment = g.assignment AND
s.userid = g.userid
- JOIN(' . $esql . ') AS e ON e.id = s.userid
+ JOIN(' . $esql . ') e ON e.id = s.userid
WHERE
s.assignment = :assignid AND
s.timemodified IS NOT NULL AND
$sql = 'SELECT s.*, u.lastname, u.firstname, u.username
FROM {assign_submission} s
JOIN {user} u ON s.userid = u.id
- JOIN(' . $esql . ') AS e ON e.id = s.userid
+ JOIN(' . $esql . ') e ON e.id = s.userid
WHERE
s.assignment = :assignid AND
s.timemodified IS NOT NULL';
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
+ if ($oldversion < 2012061701) {
+ // Check if there is a directory containing any old presets.
+ $olddatadir = $CFG->dataroot . '/data';
+ $oldpresetdir = "$olddatadir/preset";
+ if (file_exists($oldpresetdir)) {
+ // Get directory contents.
+ $userfolders = new DirectoryIterator($oldpresetdir);
+ // Store the system context, these are site wide presets.
+ $context = get_system_context();
+ // Create file storage object.
+ $fs = get_file_storage();
+ // Create array of accepted files.
+ $arracceptedfilenames = array('singletemplate.html', 'listtemplateheader.html', 'listtemplate.html',
+ 'listtemplatefooter.html', 'addtemplate.html', 'rsstemplate.html',
+ 'rsstitletemplate.html', 'csstemplate.css', 'jstemplate.js',
+ 'asearchtemplate.html', 'preset.xml');
+ // Loop through all the folders, they should represent userids.
+ foreach ($userfolders as $userfolder) {
+ // If it is a file, skip it.
+ if ($userfolder->isFile()) {
+ continue;
+ }
+ // The folder name should represent the user id.
+ $userid = $userfolder->getFilename();
+ // Skip if it is not numeric.
+ if (!is_numeric($userid)) {
+ continue;
+ }
+ // Skip if the number does not correspond to a user (does not matter if user was deleted).
+ if (!$DB->record_exists('user', array('id' => $userid))) {
+ continue;
+ }
+ // Open this folder.
+ $presetfolders = new DirectoryIterator("$oldpresetdir/$userid");
+ foreach ($presetfolders as $presetfolder) {
+ // If it is a file, skip it.
+ if ($presetfolder->isFile()) {
+ continue;
+ }
+ // Save the name of the preset.
+ $presetname = $presetfolder->getFilename();
+ // Get the files in this preset folder.
+ $presetfiles = new DirectoryIterator("$oldpresetdir/$userid/$presetname");
+ // Now we want to get the contents of the presets.
+ foreach ($presetfiles as $file) {
+ // If it is not a file, skip it.
+ if (!$file->isFile()) {
+ continue;
+ }
+ // Set the filename.
+ $filename = $file->getFilename();
+ // If it is not in the array of accepted file names skip it.
+ if (!in_array($filename, $arracceptedfilenames)) {
+ continue;
+ }
+ // Store the full file path.
+ $fullfilepath = "$oldpresetdir/$userid/$presetname/$filename";
+ // Create file record.
+ $filerecord = array('contextid' => $context->id,
+ 'component' => 'mod_data',
+ 'filearea' => 'site_presets',
+ 'itemid' => 0,
+ 'filename' => $filename,
+ 'userid' => $userid);
+ // Check to ensure it does not already exists in the file directory.
+ if (!$fs->file_exists($context->id, 'mod_data', 'site_presets', 0, '/' . $presetfolder . '/', $filename)) {
+ $filerecord['filepath'] = '/' . $presetfolder . '/';
+ } else {
+ $filerecord['filepath'] = '/' . $presetfolder . '_' . $userid . '_old/';
+ }
+ $fs->create_file_from_pathname($filerecord, $fullfilepath);
+ // Remove the file.
+ @unlink($fullfilepath);
+ }
+ // Remove the preset directory.
+ @rmdir("$oldpresetdir/$userid/$presetname");
+ }
+ // Remove the user directory.
+ @rmdir("$oldpresetdir/$userid");
+ }
+ // Remove the final directories.
+ @rmdir("$oldpresetdir");
+ @rmdir("$olddatadir");
+ }
+
+ upgrade_mod_savepoint(true, 2012061701, 'data');
+ }
return true;
}
defined('MOODLE_INTERNAL') || die();
-$module->version = 2012061700; // The current module version (Date: YYYYMMDDXX)
-$module->requires = 2012061700; // Requires this Moodle version
+$module->version = 2012061701; // The current module version (Date: YYYYMMDDXX)
+$module->requires = 2012061700; // Requires this Moodle version
$module->component = 'mod_data'; // Full name of the plugin (used for diagnostics)
$module->cron = 0;
defined('MOODLE_INTERNAL') || die();
-$version = 2012062503.06; // YYYYMMDD = weekly release date of this DEV branch
+$version = 2012062503.07; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes