Merge branch 'MDL-34435-master' of git://github.com/FMCorz/moodle

Conflicts:
	version.php
This commit is contained in:
Sam Hemelryk 2013-01-23 11:08:55 +13:00
commit 8c35fcdcd9
6 changed files with 26 additions and 5 deletions

View File

@ -144,6 +144,7 @@ if ($editingon && $sesskeyprovided) {
require_capability('moodle/course:visibility', $coursecontext);
// Set the visibility of the course. we set the old flag when user manually changes visibility of course.
$DB->update_record('course', array('id' => $course->id, 'visible' => $visible, 'visibleold' => $visible, 'timemodified' => time()));
add_to_log($course->id, "course", ($visible ? 'show' : 'hide'), "edit.php?id=$course->id", $course->id);
}
}
@ -172,6 +173,7 @@ if ($editingon && $sesskeyprovided) {
}
$DB->set_field('course', 'sortorder', $swapcourse->sortorder, array('id' => $movecourse->id));
$DB->set_field('course', 'sortorder', $movecourse->sortorder, array('id' => $swapcourse->id));
add_to_log($movecourse->id, "course", "move", "edit.php?id=$movecourse->id", $movecourse->id);
}
}

View File

@ -102,6 +102,7 @@ if ($mform->is_cancelled()) {
$newcategory->theme = $data->theme;
}
$logaction = 'update';
if ($id) {
// Update an existing category.
$newcategory->id = $category->id;
@ -119,10 +120,12 @@ if ($mform->is_cancelled()) {
$category = create_course_category($newcategory);
$newcategory->id = $category->id;
$categorycontext = $category->context;
$logaction = 'add';
}
$newcategory = file_postupdate_standard_editor($newcategory, 'description', $editoroptions, $categorycontext, 'coursecat', 'description', 0);
$DB->update_record('course_categories', $newcategory);
add_to_log(SITEID, "category", $logaction, "editcategory.php?id=$newcategory->id", $newcategory->id);
fix_course_sortorder();
redirect('category.php?id='.$newcategory->id.'&categoryedit=on');

View File

@ -230,6 +230,7 @@ if ((!empty($moveup) or !empty($movedown)) and confirm_sesskey()) {
if ($swapcategory and $movecategory) {
$DB->set_field('course_categories', 'sortorder', $swapcategory->sortorder, array('id'=>$movecategory->id));
$DB->set_field('course_categories', 'sortorder', $movecategory->sortorder, array('id'=>$swapcategory->id));
add_to_log(SITEID, "category", "move", "editcategory.php?id=$movecategory->id", $movecategory->id);
}
// finally reorder courses

View File

@ -68,6 +68,7 @@ function make_log_url($module, $url) {
case 'lib':
case 'admin':
case 'calendar':
case 'category':
case 'mnet course':
if (strpos($url, '../') === 0) {
$url = ltrim($url, '.');
@ -2738,6 +2739,7 @@ function category_delete_full($category, $showfeedback=true) {
// finally delete the category and it's context
$DB->delete_records('course_categories', array('id'=>$category->id));
delete_context(CONTEXT_COURSECAT, $category->id);
add_to_log(SITEID, "category", "delete", "index.php", "$category->name (ID $category->id)");
events_trigger('course_category_deleted', $category);
@ -2793,6 +2795,7 @@ function category_delete_move($category, $newparentid, $showfeedback=true) {
// finally delete the category and it's context
$DB->delete_records('course_categories', array('id'=>$category->id));
delete_context(CONTEXT_COURSECAT, $category->id);
add_to_log(SITEID, "category", "delete", "index.php", "$category->name (ID $category->id)");
events_trigger('course_category_deleted', $category);
@ -2839,6 +2842,7 @@ function move_courses($courseids, $categoryid) {
}
$DB->update_record('course', $course);
add_to_log($course->id, "course", "move", "edit.php?id=$course->id", $course->id);
$context = context_course::instance($course->id);
context_moved($context, $newparent);
@ -2871,6 +2875,7 @@ function course_category_hide($category) {
$DB->set_field('course', 'visible', 0, array('category' => $cat->id));
}
}
add_to_log(SITEID, "category", "hide", "editcategory.php?id=$category->id", $category->id);
}
/**
@ -2894,6 +2899,7 @@ function course_category_show($category) {
$DB->execute("UPDATE {course} SET visible = visibleold WHERE category = ?", array($cat->id));
}
}
add_to_log(SITEID, "category", "show", "editcategory.php?id=$category->id", $category->id);
}
/**
@ -2907,12 +2913,10 @@ function move_category($category, $newparentcat) {
$hidecat = false;
if (empty($newparentcat->id)) {
$DB->set_field('course_categories', 'parent', 0, array('id'=>$category->id));
$DB->set_field('course_categories', 'parent', 0, array('id' => $category->id));
$newparent = context_system::instance();
} else {
$DB->set_field('course_categories', 'parent', $newparentcat->id, array('id'=>$category->id));
$DB->set_field('course_categories', 'parent', $newparentcat->id, array('id' => $category->id));
$newparent = context_coursecat::instance($newparentcat->id);
if (!$newparentcat->visible and $category->visible) {
@ -2926,6 +2930,9 @@ function move_category($category, $newparentcat) {
// now make it last in new category
$DB->set_field('course_categories', 'sortorder', MAX_COURSES_IN_CATEGORY*MAX_COURSE_CATEGORIES, array('id'=>$category->id));
// Log action.
add_to_log(SITEID, "category", "move", "editcategory.php?id=$category->id", $category->id);
// and fix the sortorders
fix_course_sortorder();

View File

@ -40,6 +40,9 @@ $logs = array(
array('module'=>'course', 'action'=>'view', 'mtable'=>'course', 'field'=>'fullname'),
array('module'=>'course', 'action'=>'view section', 'mtable'=>'course_sections', 'field'=>'name'),
array('module'=>'course', 'action'=>'update', 'mtable'=>'course', 'field'=>'fullname'),
array('module'=>'course', 'action'=>'hide', 'mtable'=>'course', 'field'=>'fullname'),
array('module'=>'course', 'action'=>'show', 'mtable'=>'course', 'field'=>'fullname'),
array('module'=>'course', 'action'=>'move', '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!
array('module'=>'course', 'action'=>'report log', 'mtable'=>'course', 'field'=>'fullname'),
@ -47,6 +50,11 @@ $logs = array(
array('module'=>'course', 'action'=>'report outline', 'mtable'=>'course', 'field'=>'fullname'),
array('module'=>'course', 'action'=>'report participation', 'mtable'=>'course', 'field'=>'fullname'),
array('module'=>'course', 'action'=>'report stats', 'mtable'=>'course', 'field'=>'fullname'),
array('module'=>'category', 'action'=>'add', 'mtable'=>'course_categories', 'field'=>'name'),
array('module'=>'category', 'action'=>'hide', 'mtable'=>'course_categories', 'field'=>'name'),
array('module'=>'category', 'action'=>'move', 'mtable'=>'course_categories', 'field'=>'name'),
array('module'=>'category', 'action'=>'show', 'mtable'=>'course_categories', 'field'=>'name'),
array('module'=>'category', 'action'=>'update', 'mtable'=>'course_categories', 'field'=>'name'),
array('module'=>'message', 'action'=>'write', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')),
array('module'=>'message', 'action'=>'read', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')),
array('module'=>'message', 'action'=>'add contact', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')),

View File

@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2013011800.01; // YYYYMMDD = weekly release date of this DEV branch
$version = 2013011800.02; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes