diff --git a/backup/moodle2/restore_final_task.class.php b/backup/moodle2/restore_final_task.class.php index e8831d71651..06674acaaa3 100644 --- a/backup/moodle2/restore_final_task.class.php +++ b/backup/moodle2/restore_final_task.class.php @@ -135,6 +135,7 @@ class restore_final_task extends restore_task { $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}§ion={course_sectionnumber}', '{course}'); // module 'user' rules $rules[] = new restore_log_rule('user', 'view', 'view.php?id={user}&course={course}', '{user}'); diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php index 4d610e5cafb..d87cdb94db9 100644 --- a/backup/moodle2/restore_stepslib.php +++ b/backup/moodle2/restore_stepslib.php @@ -1047,6 +1047,7 @@ class restore_section_structure_step extends restore_structure_step { global $CFG, $DB; $data = (object)$data; $oldid = $data->id; // We'll need this later + $oldsection = $data->number; $restorefiles = false; @@ -1099,10 +1100,12 @@ class restore_section_structure_step extends restore_structure_step { $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); @@ -2541,7 +2544,7 @@ class restore_module_structure_step extends restore_structure_step { $data = (object)$data; $oldid = $data->id; - + $oldsection = $data->sectionnumber; $this->task->set_old_moduleversion($data->version); $data->course = $this->task->get_courseid(); @@ -2568,6 +2571,7 @@ class restore_module_structure_step extends restore_structure_step { '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 diff --git a/course/view.php b/course/view.php index a7b1784b1c5..de3798102d2 100644 --- a/course/view.php +++ b/course/view.php @@ -88,8 +88,18 @@ require_once($CFG->dirroot.'/calendar/lib.php'); /// This is after login because it needs $USER - //TODO: danp do we need different urls? - add_to_log($course->id, 'course', 'view', "view.php?id=$course->id", "$course->id"); + $logparam = 'id='. $course->id; + $loglabel = 'view'; + $infoid = $course->id; + if(!empty($section)) { + $logparam .= '§ion='. $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; + } + } + add_to_log($course->id, 'course', $loglabel, "view.php?". $logparam, $infoid); $course->format = clean_param($course->format, PARAM_ALPHA); if (!file_exists($CFG->dirroot.'/course/format/'.$course->format.'/format.php')) { diff --git a/lib/db/log.php b/lib/db/log.php index f404e019e0c..16d1f433c3b 100644 --- a/lib/db/log.php +++ b/lib/db/log.php @@ -38,6 +38,7 @@ global $DB; // TODO: this is a hack, we should really do something with the SQL $logs = array( array('module'=>'course', 'action'=>'user report', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')), array('module'=>'course', 'action'=>'view', 'mtable'=>'course', 'field'=>'fullname'), + array('module'=>'course', 'action'=>'view section', 'mtable'=>'course_section', 'field'=>'COALESCE(name, section)'), array('module'=>'course', 'action'=>'update', 'mtable'=>'course', 'field'=>'fullname'), array('module'=>'course', 'action'=>'enrol', 'mtable'=>'course', 'field'=>'fullname'), // there should be some way to store user id of the enrolled user! array('module'=>'course', 'action'=>'unenrol', 'mtable'=>'course', 'field'=>'fullname'), // there should be some way to store user id of the enrolled user! diff --git a/version.php b/version.php index f9992a16395..9a4c454f1f9 100644 --- a/version.php +++ b/version.php @@ -30,7 +30,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2012052500.00; // YYYYMMDD = weekly release date of this DEV branch +$version = 2012052500.01; // YYYYMMDD = weekly release date of this DEV branch // RR = release increments - 00 in DEV branches // .XX = incremental changes