-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreports.php
More file actions
49 lines (42 loc) · 1.74 KB
/
Copy pathreports.php
File metadata and controls
49 lines (42 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php /* PROJECTS $Id: reports.php,v 1.1.1.1 2004/04/01 16:08:45 aardvarkads Exp $ */
error_reporting( E_ALL );
$project_id = intval( dPgetParam( $_REQUEST, "project_id", 0 ) );
$report_type = dPgetParam( $_REQUEST, "report_type", '' );
// check permissions for this record
$canRead = !getDenyRead( $m, $project_id );
if (!$canRead) {
$AppUI->redirect( "m=public&a=access_denied" );
}
// get the prefered date format
$df = $AppUI->getPref('SHDATEFORMAT');
$reports = $AppUI->readFiles( dPgetConfig('root_dir' )."/modules/projects/reports", "\.php$" );
// setup the title block
$titleBlock = new CTitleBlock( 'Project Reports', 'applet3-48.png', $m, "$m.$a" );
$titleBlock->addCrumb( "?m=projects", "projects list" );
$titleBlock->addCrumb( "?m=projects&a=view&project_id=$project_id", "view this project" );
if ($report_type) {
$titleBlock->addCrumb( "?m=projects&a=reports&project_id=$project_id", "reports index" );
}
$titleBlock->show();
if ($report_type) {
$report_type = $AppUI->makeFileNameSafe( $report_type );
$report_type = str_replace( ' ', '_', $report_type );
require( dPgetConfig( 'root_dir' )."/modules/projects/reports/$report_type.php" );
} else {
echo "<table>";
echo "<tr><td><h2>" . $AppUI->_( 'Reports Available' ) . "</h2></td></tr>";
foreach ($reports as $v) {
$type = str_replace( ".php", "", $v );
$desc_file = str_replace( ".php", ".$AppUI->user_locale.txt", $v );
$desc = @file( dPgetConfig( 'root_dir' )."/modules/projects/reports/$desc_file" );
echo "\n<tr>";
echo "\n <td><a href=\"index.php?m=projects&a=reports&project_id=$project_id&report_type=$type\">";
echo @$desc[0] ? $desc[0] : $v;
echo "</a>";
echo "\n</td>";
echo "\n<td>" . (@$desc[1] ? "- $desc[1]" : '') . "</td>";
echo "\n</tr>";
}
echo "</table>";
}
?>