From 34b84d45b6abfdbbc325635bd88893b7d3052b8a Mon Sep 17 00:00:00 2001 From: Rossiani Wijaya Date: Tue, 22 May 2012 14:02:48 +0800 Subject: [PATCH] MDL-32766 course view section log: update patch --- course/view.php | 7 ++++++- lib/db/log.php | 1 + version.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/course/view.php b/course/view.php index 74a0bbca565..de3798102d2 100644 --- a/course/view.php +++ b/course/view.php @@ -90,11 +90,16 @@ $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, "$course->fullname"); + } + 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 4dad272d864..2ebc96ea8d1 100644 --- a/version.php +++ b/version.php @@ -30,7 +30,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2012051900.00; // YYYYMMDD = weekly release date of this DEV branch +$version = 2012051900.01; // YYYYMMDD = weekly release date of this DEV branch // RR = release increments - 00 in DEV branches // .XX = incremental changes