home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / modules / projects / reports.php < prev    next >
Encoding:
PHP Script  |  2004-01-17  |  1.8 KB  |  50 lines

  1. <?php /* PROJECTS $Id: reports.php,v 1.2 2004/01/17 14:59:45 gregorerhardt Exp $ */
  2. error_reporting( E_ALL );
  3.  
  4. $project_id = intval( dPgetParam( $_REQUEST, "project_id", 0 ) );
  5. $report_type = dPgetParam( $_REQUEST, "report_type", '' );
  6.  
  7. // check permissions for this record
  8. $canRead = !getDenyRead( $m, $project_id );
  9. if (!$canRead) {
  10.     $AppUI->redirect( "m=public&a=access_denied" );
  11. }
  12.  
  13. // get the prefered date format
  14. $df = $AppUI->getPref('SHDATEFORMAT');
  15.  
  16. $reports = $AppUI->readFiles( $AppUI->getConfig( 'root_dir' )."/modules/projects/reports", "\.php$" );
  17.  
  18. // setup the title block
  19. $titleBlock = new CTitleBlock( 'Project Reports', 'applet3-48.png', $m, "$m.$a" );
  20. $titleBlock->addCrumb( "?m=projects", "projects list" );
  21. $titleBlock->addCrumb( "?m=projects&a=view&project_id=$project_id", "view this project" );
  22. if ($report_type) {
  23.     $titleBlock->addCrumb( "?m=projects&a=reports&project_id=$project_id", "reports index" );
  24. }
  25. $titleBlock->show();
  26.  
  27. if ($report_type) {
  28.     $report_type = $AppUI->checkFileName( $report_type );
  29.     $report_type = str_replace( ' ', '_', $report_type );
  30.     require( $AppUI->getConfig( 'root_dir' )."/modules/projects/reports/$report_type.php" );
  31. } else {
  32.     echo "<table>";
  33.     echo "<tr><td><h2>" . $AppUI->_( 'Reports Available' ) . "</h2></td></tr>";
  34.     foreach ($reports as $v) {
  35.         $type = str_replace( ".php", "", $v );
  36.         $desc_file = str_replace( ".php", ".$AppUI->user_locale.txt", $v );
  37.         $desc = @file( $AppUI->getConfig( 'root_dir' )."/modules/projects/reports/$desc_file" );
  38.  
  39.         echo "\n<tr>";
  40.         echo "\n    <td><a href=\"index.php?m=projects&a=reports&project_id=$project_id&report_type=$type\">";
  41.         echo @$desc[0] ? $desc[0] : $v;
  42.         echo "</a>";
  43.         echo "\n</td>";
  44.         echo "\n<td>" . (@$desc[1] ? "- $desc[1]" : '') . "</td>";
  45.         echo "\n</tr>";
  46.     }
  47.     echo "</table>";
  48. }
  49. ?>
  50.