Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Mar 22, 2006
1 parent 0997e51 commit ed69c72
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
7 changes: 4 additions & 3 deletions mod/data/index.php
Expand Up @@ -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 //
Expand All @@ -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');
Expand All @@ -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');
Expand Down
8 changes: 7 additions & 1 deletion mod/data/lib.php
Expand Up @@ -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);
}


Expand Down
11 changes: 7 additions & 4 deletions mod/data/view.php
Expand Up @@ -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
}
}
Expand All @@ -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);


Expand Down Expand Up @@ -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 '<div style="float:right;">';
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 '</div>';
echo '<div style="clear:both;"></div>';
}
Expand All @@ -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.'&amp;search='.s($search).'&amp;sort='.s($sort).'&amp;order='.s($order).'&amp;');
$currentgroup = setup_and_print_groups($course, $groupmode,
'view.php?d='.$data->id.'&amp;search='.s($search).'&amp;sort='.s($sort).
'&amp;order='.s($order).'&amp;');
} else {
$currentgroup = 0;
}
Expand All @@ -159,6 +161,7 @@
if (optional_param('approved','0',PARAM_INT)) {
print_heading(get_string('recordapproved','data'));
}

/***************************
* code to delete a record *
***************************/
Expand Down

0 comments on commit ed69c72

Please sign in to comment.