]> git.mjollnir.org Git - moodle.git/commitdiff
Fixes
authormoodler <moodler>
Wed, 22 Mar 2006 08:32:54 +0000 (08:32 +0000)
committermoodler <moodler>
Wed, 22 Mar 2006 08:32:54 +0000 (08:32 +0000)
mod/data/index.php
mod/data/lib.php
mod/data/view.php

index e9877208a183bcb3a7305ddb62ef123a52a8d6a8..bb2aaa3e044036e92088bafb475c1d86e10c694f 100755 (executable)
@@ -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');
     $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');
index 1ab440889b2bb4918e53453dca311f7f0f0fa1eb..cb504c6557e56acf02a81a26cd466d47a2e024cd 100755 (executable)
@@ -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);
 }
 
 
index f236c657ef77b47d1764739df9255def8fbd0002..b994f5a7b11956e7622d3255734338bf4c77d961 100755 (executable)
@@ -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);
 
 
 
     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>';
     }
 
 /// 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;
     }
     if (optional_param('approved','0',PARAM_INT)) {
         print_heading(get_string('recordapproved','data'));
     }
+
     /***************************
      * code to delete a record *
      ***************************/