home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / modules / tasks / index.php < prev    next >
Encoding:
PHP Script  |  2004-01-26  |  2.3 KB  |  60 lines

  1. <?php /* TASKS $Id: index.php,v 1.32 2004/01/25 20:16:16 gregorerhardt Exp $ */
  2. $AppUI->savePlace();
  3.  
  4. // retrieve any state parameters
  5. if (isset( $_POST['f'] )) {
  6.     $AppUI->setState( 'TaskIdxFilter', $_POST['f'] );
  7. }
  8. $f = $AppUI->getState( 'TaskIdxFilter' ) ? $AppUI->getState( 'TaskIdxFilter' ) : 'my';
  9.  
  10. if (isset( $_POST['f2'] )) {
  11.     $AppUI->setState( 'CompanyIdxFilter', $_POST['f2'] );
  12. }
  13. $f2 = $AppUI->getState( 'CompanyIdxFilter' ) ? $AppUI->getState( 'CompanyIdxFilter' ) : 'all';
  14.  
  15. if (isset( $_GET['project_id'] )) {
  16.     $AppUI->setState( 'TaskIdxProject', $_GET['project_id'] );
  17. }
  18. $project_id = $AppUI->getState( 'TaskIdxProject' ) ? $AppUI->getState( 'TaskIdxProject' ) : 0;
  19.  
  20. // get CCompany() to filter tasks by company
  21. require_once( $AppUI->getModuleClass( 'companies' ) );
  22. $obj = new CCompany();
  23. $companies = $obj->getAllowedRecords( $AppUI->user_id, 'company_id,company_name', 'company_name' );
  24. $filters2 = arrayMerge(  array( 'all' => $AppUI->_('All Companies') ), $companies );
  25.  
  26. // setup the title block
  27. $titleBlock = new CTitleBlock( 'Tasks', 'applet-48.png', $m, "$m.$a" );
  28.  
  29. $titleBlock->addCell( $AppUI->_('Company Filter') . ':' );
  30. $titleBlock->addCell(
  31.     arraySelect( $filters2, 'f2', 'size=1 class=text onChange="document.companyFilter.submit();"', $f2, false ), '',
  32.     '<form action="?m=tasks" method="post" name="companyFilter">', '</form>'
  33. );
  34.  
  35. $titleBlock->addCell( '     ' . $AppUI->_('Task Filter') . ':' );
  36. $titleBlock->addCell(
  37.     arraySelect( $filters, 'f', 'size=1 class=text onChange="document.taskFilter.submit();"', $f, true ), '',
  38.     '<form action="?m=tasks" method="post" name="taskFilter">', '</form>'
  39. );
  40. $titleBlock->addCell();
  41. if ($canEdit && $project_id) {
  42.     $titleBlock->addCell(
  43.         '<input type="submit" class="button" value="'.$AppUI->_('new task').'">', '',
  44.         '<form action="?m=tasks&a=addedit&task_project=' . $project_id . '" method="post">', '</form>'
  45.     );
  46. }
  47.  
  48. if ( dPgetParam( $_GET, 'inactive', '' ) == 'toggle' )
  49.     $AppUI->setState( 'inactive', $AppUI->getState( 'inactive' ) == -1 ? 0 : -1 );
  50. $in = $AppUI->getState( 'inactive' ) == -1 ? '' : 'in';
  51.  
  52. $titleBlock->addCrumb( "?m=tasks&a=todo", "my todo" );
  53. $titleBlock->addCrumb( "?m=tasks&inactive=toggle", "show ".$in."active tasks" );
  54. $titleBlock->show();
  55.  
  56. // include the re-usable sub view
  57.     $min_view = false;
  58.     include("{$AppUI->cfg['root_dir']}/modules/tasks/tasks.php");
  59. ?>
  60.