A few small changes for Vy to continue working on (logs, mostly)

This commit is contained in:
moodler
2006-02-27 04:13:03 +00:00
parent e045d2042c
commit 735a795229
5 changed files with 30 additions and 19 deletions
+7 -3
View File
@@ -74,7 +74,6 @@
}
}
add_to_log($course->id, 'data', 'view', "view.php?id=$cm->id", $data->id, $cm->id);
/// Print the page header
@@ -127,8 +126,6 @@
update_record('data_records',$record);
foreach ($datarecord as $name=>$value){
//this creates a new field subclass object
if ($name != 'MAX_FILE_SIZE' && $name != 'sesskey' and $name!='d' and $name!='rid'){
if (($currentfield = data_get_field_from_name($name)) !== false) {
@@ -137,6 +134,9 @@
}
}
}
add_to_log($course->id, 'data', 'update', "view.php?d=$data->id&rid=$rid", $data->id, $cm->id);
redirect($CFG->wwwroot.'/mod/data/view.php?d='.$data->id);
} else { //we are adding a new record
@@ -180,6 +180,10 @@
if ($emptyform){ //nothing gets written to database
notify(get_string('emptyaddform','data'));
}
if ($entrysaved) {
add_to_log($course->id, 'data', 'add', "view.php?d=$data->id&rid=$recordid", $data->id, $cm->id);
}
}
}
/**************************
+2
View File
@@ -104,3 +104,5 @@ CREATE TABLE prefix_data_ratings (
PRIMARY KEY (id)
) TYPE=MyISAM;
INSERT INTO prefix_log_display VALUES ('data', 'view', 'data', 'name');
+7 -3
View File
@@ -65,8 +65,6 @@
error(get_string('noaccess','data'));
}
add_to_log($course->id, 'data', 'view', "view.php?id=$cm->id", $data->id, $cm->id);
$strdata = get_string('modulenameplural','data');
print_header_simple($data->name, "", "<a href='index.php?id=$course->id'>$strdata</a> -> $data->name", "", "", true, "", navmenu($course));
@@ -101,10 +99,12 @@
$field->$key = $str;
}
}
insert_record('data_fields', $field);
$field->id = insert_record('data_fields', $field);
// Add the new field to the form templates.
data_append_field_in_form($field->dataid, $field->name);
add_to_log($course->id, 'data', 'fields add', "fields.php?d=$data->id&amp;mode=display&amp;fid=$field->id", $field->id, $cm->id);
$displayflag = get_string('fieldadded','data');
}
@@ -130,6 +130,8 @@
// Delete the field.
delete_records('data_fields', 'id', $fid);
add_to_log($course->id, 'data', 'fields delete', "fields.php?d=$data->id", $data->id, $cm->id);
$displayflag = get_string('fielddeleted', 'data');
}
@@ -172,6 +174,8 @@
// Update the templates.
data_replace_field_in_forms($currentfield->dataid, $currentfield->name, $field->name);
add_to_log($course->id, 'data', 'fields add', "fields.php?d=$data->id&amp;mode=display&amp;fid=$field->id", $field->id, $cm->id);
$displayflag = get_string('fieldupdated','data');
}
+12 -11
View File
@@ -343,25 +343,26 @@ function data_replace_field_in_forms($dataid, $searchfieldname, $newfieldname) {
if (!empty($newfieldname)) {
$prestring = '[[';
$poststring = ']]';
}
else {
} else {
$prestring = '';
$poststring = '';
}
$data->singletemplate = str_replace('[['.$searchfieldname.']]',
$prestring.$newfieldname.$poststring, $data->singletemplate);
$newdata->id = $data->id;
$newdata->singletemplate = addslashes(str_replace('[['.$searchfieldname.']]',
$prestring.$newfieldname.$poststring, $data->singletemplate));
$data->listtemplate = str_replace('[['.$searchfieldname.']]',
$prestring.$newfieldname.$poststring, $data->listtemplate);
$newdata->listtemplate = addslashes(str_replace('[['.$searchfieldname.']]',
$prestring.$newfieldname.$poststring, $data->listtemplate));
$data->addtemplate = str_replace('[['.$searchfieldname.']]',
$prestring.$newfieldname.$poststring, $data->addtemplate);
$newdata->addtemplate = addslashes(str_replace('[['.$searchfieldname.']]',
$prestring.$newfieldname.$poststring, $data->addtemplate));
$data->rsstemplate = str_replace('[['.$searchfieldname.']]',
$prestring.$newfieldname.$poststring, $data->rsstemplate);
$newdata->rsstemplate = addslashes(str_replace('[['.$searchfieldname.']]',
$prestring.$newfieldname.$poststring, $data->rsstemplate));
update_record('data', $data);
return update_record('data', $newdata);
}
+2 -2
View File
@@ -30,7 +30,7 @@
$id = optional_param('id', 0, PARAM_INT); // course module id
$d = optional_param('d', 0, PARAM_INT); // database id
$mode = optional_param('mode', '', PARAM_ALPHA);
$mode = optional_param('mode', 'singletemplate', PARAM_ALPHA);
if ($id) {
if (! $cm = get_record('course_modules', 'id', $id)) {
@@ -65,7 +65,7 @@
}
}
add_to_log($course->id, 'data', 'view', "view.php?id=$cm->id", $data->id, $cm->id);
add_to_log($course->id, 'data', 'templates', "templates.php?id=$cm->id", $data->id, $cm->id);
/// Print the page header