|
From: Benjamin C. <bc...@us...> - 2001-08-04 03:39:01
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv22789
Modified Files:
report.php
Log Message:
Allow for reporting on specific projects as well as all projects
Index: report.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/report.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- report.php 2001/08/03 20:12:31 1.3
+++ report.php 2001/08/04 03:38:58 1.4
@@ -7,7 +7,7 @@
page_open(array('sess' => 'usess', 'auth' => 'uauth', 'perm' => 'uperm'));
$u = $auth->auth['uid'];
-function resolution_by_engineer() {
+function resolution_by_engineer($projectid = 0) {
global $q, $t;
$t->set_block('content', 'row', 'rows');
@@ -15,8 +15,8 @@
$t->set_var('reporttitle', 'Status of Assigned bugs');
// Start off our query
- $querystring = 'select Email, sum(if(Resolution = "0",1,0)) as "Open"';
- $resfields = array('Email','Open');
+ $querystring = 'select Email as "Assigned To", sum(if(Resolution = "0",1,0)) as "Open"';
+ $resfields = array('Assigned To','Open');
// Grab the resolutions from the database
$q->query("select Name, concat(', sum(if(Resolution = \"',ResolutionID,'\",1,0)) as \"',Resolution.Name,'\"') from Resolution");
while (list($fieldname, $countquery) = $q->grab()) {
@@ -24,7 +24,11 @@
$querystring .= $countquery;
}
$resfields[] = 'Total';
- $q->query("$querystring, count(BugID) as Total from Bug b, User u where AssignedTo = UserID group by AssignedTo");
+
+ if ($projectid && is_numeric($projectid))
+ $projectquery = "and Project = $projectid";
+
+ $q->query("$querystring, count(BugID) as Total from Bug b, User u where AssignedTo = UserID $projectquery group by AssignedTo");
if (!$q->num_rows()) {
$t->set_var('rows', 'No data to display');
} else {
@@ -39,8 +43,11 @@
while ($row = $q->grab()) {
foreach ($resfields as $col) {
$t->set_var(array(
- 'coldata' => stripslashes($row[$col]),
- 'colclass' => $col == 'Email' ? '' : 'center-col'
+ 'coldata' => $col == 'Assigned To'
+ ? sprintf("<a href='mailto:%s'>%s</a>", stripslashes($row[$col]),
+ stripslashes($row[$col]))
+ : stripslashes($row[$col]),
+ 'colclass' => $col == 'Assigned To' ? '' : 'center-col'
));
$t->parse('cols', 'col', true);
}
@@ -53,8 +60,9 @@
$t->set_file('wrap','wrap.html');
$t->set_file('content','report.html');
+$t->set_var('projects', build_select('Project', $projectid));
-resolution_by_engineer();
+resolution_by_engineer($projectid);
$t->pparse('main',array('content','wrap','main'));
|