Permalink
Browse files

MDL-33465 course: 'Course view section' logs should use sectionid ins…

…tead of section number to generate action urls'
  • Loading branch information...
1 parent 4db0616 commit 336d8c49f475bffe709665752809447c07b0eb0a @ankitagarwal ankitagarwal committed Jun 5, 2012
Showing with 4 additions and 10 deletions.
  1. +1 −1 backup/moodle2/restore_final_task.class.php
  2. +0 −5 backup/moodle2/restore_stepslib.php
  3. +3 −4 course/view.php
@@ -135,7 +135,7 @@ static public function define_restore_log_rules() {
$rules[] = new restore_log_rule('course', 'report outline', 'report/outline/index.php?id={course}', '{course}');
$rules[] = new restore_log_rule('course', 'report participation', 'report/participation/index.php?id={course}', '{course}');
$rules[] = new restore_log_rule('course', 'report stats', 'report/stats/index.php?id={course}', '{course}');
- $rules[] = new restore_log_rule('course', 'view section', 'view.php?id={course}&section={course_sectionnumber}', '{course_section}');
+ $rules[] = new restore_log_rule('course', 'view section', 'view.php?id={course}&sectionid={course_section}', '{course_section}');
// module 'user' rules
$rules[] = new restore_log_rule('user', 'view', 'view.php?id={user}&course={course}', '{user}');
@@ -1047,7 +1047,6 @@ public function process_section($data) {
global $CFG, $DB;
$data = (object)$data;
$oldid = $data->id; // We'll need this later
- $oldsection = $data->number;
$restorefiles = false;
@@ -1100,12 +1099,10 @@ public function process_section($data) {
$DB->update_record('course_sections', $section);
$newitemid = $secrec->id;
- $oldsection = $secrec->section;
}
// Annotate the section mapping, with restorefiles option if needed
$this->set_mapping('course_section', $oldid, $newitemid, $restorefiles);
- $this->set_mapping('course_sectionnumber', $oldsection, $section->section, $restorefiles);
// set the new course_section id in the task
$this->task->set_sectionid($newitemid);
@@ -2544,7 +2541,6 @@ protected function process_module($data) {
$data = (object)$data;
$oldid = $data->id;
- $oldsection = $data->sectionnumber;
$this->task->set_old_moduleversion($data->version);
$data->course = $this->task->get_courseid();
@@ -2571,7 +2567,6 @@ protected function process_module($data) {
'course' => $this->get_courseid(),
'section' => 1);
$data->section = $DB->insert_record('course_sections', $sectionrec); // section 1
- $this->set_mapping('course_sectionnumber', $oldsection, $sectionrec->section, $restorefiles);
}
$data->groupingid= $this->get_mappingid('grouping', $data->groupingid); // grouping
if (!$CFG->enablegroupmembersonly) { // observe groupsmemberonly
View
@@ -92,12 +92,11 @@
$loglabel = 'view';
$infoid = $course->id;
if(!empty($section)) {
- $logparam .= '&section='. $section;
$loglabel = 'view section';
$sectionparams = array('course' => $course->id, 'section' => $section);
- if ($coursesections = $DB->get_record('course_sections', $sectionparams, 'id', MUST_EXIST)) {
- $infoid = $coursesections->id;
- }
+ $coursesections = $DB->get_record('course_sections', $sectionparams, 'id', MUST_EXIST);
+ $infoid = $coursesections->id;
+ $logparam .= '&sectionid='. $infoid;
}
add_to_log($course->id, 'course', $loglabel, "view.php?". $logparam, $infoid);

0 comments on commit 336d8c4

Please sign in to comment.