diff --git a/mod/data/index.php b/mod/data/index.php index e9877208a183b..bb2aaa3e04403 100755 --- a/mod/data/index.php +++ b/mod/data/index.php @@ -6,7 +6,7 @@ // Moodle - Modular Object-Oriented Dynamic Learning Environment // // http://moodle.org // // // -// Copyright (C) 2005 Martin Dougiamas http://dougiamas.com // +// Copyright (C) 1990-onwards Moodle Pty Ltd http://moodle.com // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // @@ -32,6 +32,7 @@ } require_course_login($course); + add_to_log($course->id, "data", "view all", "index.php?id=$course->id", ""); $strweek = get_string('week'); @@ -40,10 +41,10 @@ $strdata = get_string('modulename','data'); if (! $datas = get_all_instances_in_course("data", $course)) { - notice("There are no databases", "../../course/view.php?id=$course->id"); + notice("There are no databases", "$CFG->wwwroot/course/view.php?id=$course->id"); } - print_header_simple($strdata, "", $strdata, "", "", true, "", navmenu($course)); + print_header_simple($strdata, '', $strdata, '', '', true, "", navmenu($course)); $timenow = time(); $strname = get_string('name'); diff --git a/mod/data/lib.php b/mod/data/lib.php index 1ab440889b2bb..cb504c6557e56 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -437,17 +437,23 @@ function data_replace_field_in_templates($data, $searchfieldname, $newfieldname) function data_append_new_field_to_templates($data, $newfieldname) { $newdata->id = $data->id; + $change = false; if (!empty($data->singletemplate)) { $newdata->singletemplate = addslashes($data->singletemplate.' [[' . $newfieldname .']]'); + $change = true; } if (!empty($data->addtemplate)) { $newdata->addtemplate = addslashes($data->addtemplate.' [[' . $newfieldname . ']]'); + $change = true; } if (!empty($data->rsstemplate)) { $newdata->rsstemplate = addslashes($data->singletemplate.' [[' . $newfieldname . ']]'); + $change = true; + } + if ($change) { + update_record('data', $newdata); } - update_record('data', $newdata); } diff --git a/mod/data/view.php b/mod/data/view.php index f236c657ef77b..b994f5a7b1195 100755 --- a/mod/data/view.php +++ b/mod/data/view.php @@ -65,7 +65,7 @@ } if (isteacher($course->id)) { - if (!count_records('data_fields','dataid',$data->id)) { // Brand new database! + if (!record_exists('data_fields','dataid',$data->id)) { // Brand new database! redirect($CFG->wwwroot.'/mod/data/fields.php?d='.$data->id); // Redirect to field entry } } @@ -81,6 +81,7 @@ } $d = $data->id;//set this so tabs can work properly + add_to_log($course->id, 'data', 'view', "view.php?id=$cm->id", $data->id, $cm->id); @@ -120,11 +121,10 @@ print_heading(format_string($data->name)); - // Do we need to show a link to the RSS feed for the records? if (isset($CFG->enablerssfeeds) && isset($CFG->data_enablerssfeeds) && $data->rssarticles > 0) { echo '
'; - rss_print_link($course->id, $USER->id, 'data', $data->id, $tooltiptext='RSS feed for entries'); + rss_print_link($course->id, $USER->id, 'data', $data->id, get_string('rsstype')); echo '
'; echo '
'; } @@ -136,7 +136,9 @@ /// Check to see if groups are being used here if ($groupmode = groupmode($course, $cm)) { // Groups are being used - $currentgroup = setup_and_print_groups($course, $groupmode, 'view.php?d='.$data->id.'&search='.s($search).'&sort='.s($sort).'&order='.s($order).'&'); + $currentgroup = setup_and_print_groups($course, $groupmode, + 'view.php?d='.$data->id.'&search='.s($search).'&sort='.s($sort). + '&order='.s($order).'&'); } else { $currentgroup = 0; } @@ -159,6 +161,7 @@ if (optional_param('approved','0',PARAM_INT)) { print_heading(get_string('recordapproved','data')); } + /*************************** * code to delete a record * ***************************/