From 58e167c3f442f4d76c1de03cbd0e18a8fedcdad7 Mon Sep 17 00:00:00 2001 From: vyshane Date: Mon, 27 Mar 2006 05:20:50 +0000 Subject: [PATCH] Added 2 columns for number of records and number of records not approved yet. --- mod/data/index.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/mod/data/index.php b/mod/data/index.php index bb2aaa3e04..8e9af0415a 100755 --- a/mod/data/index.php +++ b/mod/data/index.php @@ -51,13 +51,15 @@ $strweek = get_string('week'); $strtopic = get_string('topic'); $strdescription = get_string("description"); + $strnumrecords = get_string('numrecords', 'data'); + $strnumnotapproved = get_string('numnotapproved', 'data'); if ($course->format == 'weeks') { - $table->head = array ($strweek, $strname, $strdescription); - $table->align = array ('center', 'center', 'center'); + $table->head = array ($strweek, $strname, $strdescription, $strnumrecords, $strnumnotapproved); + $table->align = array ('center', 'center', 'center', 'center', 'center'); } else if ($course->format == 'topics') { - $table->head = array ($strtopic, $strname, $strdescription); - $table->align = array ('center', 'center', 'center'); + $table->head = array ($strtopic, $strname, $strdescription, $strnumrecords, $strnumnotapproved); + $table->align = array ('center', 'center', 'center', 'center', 'center'); } else { $table->head = array ($strname); $table->align = array ('center', 'center'); @@ -86,7 +88,19 @@ $link = "coursemodule\">".format_string($data->name,true).""; } if ($course->format == 'weeks' or $course->format == 'topics') { - $table->data[] = array ($printsection, $link, $data->intro); + + $numrecords = count_records_sql('SELECT COUNT(r.id) FROM '.$CFG->prefix. + 'data_records r WHERE r.dataid ='.$data->id); + + if ($data->approval == 1) { + $numunapprovedrecords = count_records_sql('SELECT COUNT(r.id) FROM '.$CFG->prefix. + 'data_records r WHERE r.dataid ='.$data->id. + ' AND r.approved <> 1'); + } else { + $numunapprovedrecords = get_string('noapprovalrequired', 'data'); + } + + $table->data[] = array ($printsection, $link, $data->intro, $numrecords, $numunapprovedrecords); } else { $table->data[] = array ($link); } -- 2.39.5