Index: lib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/data/lib.php,v
retrieving revision 1.137.2.36
diff -u -r1.137.2.36 lib.php
--- mod/data/lib.php 16 Jun 2008 13:46:43 -0000 1.137.2.36
+++ mod/data/lib.php 6 Jul 2008 17:08:53 -0000
@@ -881,7 +881,7 @@
* @param string $template *
* output null *
************************************************************************/
-function data_print_template($template, $records, $data, $search='',$page=0, $return=false) {
+function data_print_template($template, $records, $data, $search='', $page=0, $return=false) {
global $CFG;
$cm = get_coursemodule_from_instance('data', $data->id);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -924,11 +924,14 @@
$replacement[] = '';
$replacement[] = '';
}
+
+ $moreurl = $CFG->wwwroot . '/mod/data/view.php?d=' . $data->id . '&rid=' . $record->id;
+ $search && $moreurl .= '&filter=1';
$patterns[]='##more##';
- $replacement[] = '
';
+ $replacement[] = '
';
$patterns[]='##moreurl##';
- $replacement[] = $CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$record->id;
+ $replacement[] = $moreurl;
$patterns[]='##user##';
$replacement[] = '';
+ echo ' ';
echo ' ';
echo ' ';
echo '
';
Index: view.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/data/view.php,v
retrieving revision 1.70.2.23
diff -u -r1.70.2.23 view.php
--- mod/data/view.php 21 Apr 2008 14:15:30 -0000 1.70.2.23
+++ mod/data/view.php 6 Jul 2008 17:01:49 -0000
@@ -30,11 +30,12 @@
require_once('pagelib.php');
/// One of these is necessary!
- $id = optional_param('id', 0, PARAM_INT); // course module id
- $d = optional_param('d', 0, PARAM_INT); // database id
- $rid = optional_param('rid', 0, PARAM_INT); //record id
-
- $mode = optional_param('mode', '', PARAM_ALPHA); // Force the browse mode ('single')
+ $id = optional_param('id', 0, PARAM_INT); // course module id
+ $d = optional_param('d', 0, PARAM_INT); // database id
+ $rid = optional_param('rid', 0, PARAM_INT); //record id
+ $mode = optional_param('mode', '', PARAM_ALPHA); // Force the browse mode ('single')
+ $filter = optional_param('filter', 0, PARAM_BOOL);
+ // search filter will only be applied when $filter is true
$edit = optional_param('edit', -1, PARAM_BOOL);
$page = optional_param('page', 0, PARAM_INT);
@@ -143,8 +144,7 @@
//(even if page 0 is revisited).
//A false $paging flag generates advanced search results based on the fields input by the user.
//A true $paging flag generates davanced search results from the $SESSION global.
- //(See lines 147-158)
-
+
$paging = optional_param('paging', NULL, PARAM_BOOL);
if($page == 0 && !isset($paging)) {
$paging = false;
@@ -222,6 +222,9 @@
$paging = NULL;
}
+ // Disable search filters if $filter is not true:
+ $filter || $search = '';
+
$textlib = textlib_get_instance();
if ($textlib->strlen($search) < 2) {
$search = '';
@@ -577,8 +580,8 @@
}
if ($mode == 'single') { // Single template
- $baseurl = 'view.php?d='.$data->id.'&mode=single&';
-
+ $baseurl = 'view.php?d=' . $data->id . '&mode=single&';
+ $search && $baseurl .= 'filter=1&';
print_paging_bar($totalcount, $page, $nowperpage, $baseurl, $pagevar='page');
if (empty($data->singletemplate)){