home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / modules / projects / vw_idx_proposed.php < prev   
Encoding:
PHP Script  |  2003-12-04  |  3.7 KB  |  110 lines

  1. <?php /* PROJECTS $Id: vw_idx_proposed.php,v 1.8 2003/12/04 17:53:33 jcgonz Exp $ */
  2. GLOBAL $AppUI, $projects, $company_id, $pstatus, $show_all_projects, $project_types, $tab;
  3. $df = $AppUI->getPref('SHDATEFORMAT');
  4.  
  5.     // Let's check if the user submited the change status form
  6.     
  7. ?>
  8.  
  9. <form action='./index.php' method='get'>
  10.  
  11.  
  12. <table width="100%" border="0" cellpadding="3" cellspacing="1" class="tbl">
  13. <tr>
  14.     <td align="right" width="65" nowrap="nowrap"> <?php echo $AppUI->_('sort by');?>: </td>
  15.     <th nowrap="nowrap">
  16.         <a href="?m=projects&orderby=project_name" class="hdr"><?php echo $AppUI->_('Name');?></a>
  17.     </th>
  18.     <th nowrap="nowrap">
  19.         <a href="?m=projects&orderby=user_username" class="hdr"><?php echo $AppUI->_('Owner');?></a>
  20.     </th>
  21.     <th nowrap="nowrap">
  22.         <a href="?m=projects&orderby=total_tasks%20desc" class="hdr"><?php echo $AppUI->_('Tasks');?></a>
  23.         <a href="?m=projects&orderby=my_tasks%20desc" class="hdr">(<?php echo $AppUI->_('My');?>)</a>
  24.     </th>
  25.     <th nowrap="nowrap">
  26.         <?php echo $AppUI->_('Selection'); ?>
  27.     </th>
  28.     <?php
  29.     if($show_all_projects){
  30.         ?>
  31.         <th nowrap="nowrap">
  32.             <?php echo $AppUI->_('Status'); ?>
  33.         </th>
  34.         <?php
  35.     }
  36.     ?>
  37. </tr>
  38.  
  39. <?php
  40. $CR = "\n";
  41. $CT = "\n\t";
  42. $none = true;
  43.  
  44. // When in plain view, $AppUI->getState( 'ProjIdxTab' ) doesn't contain the selected index for which we want
  45. // to filter projects, we must get the current box name from the calling file overrides.php variable $v
  46. if ( $tab == -1 ){
  47.     //Plain view
  48.     foreach ($project_types as $project_key => $project_type){
  49.         $project_type = trim($project_type);
  50.         $flip_project_types[$project_type] = $project_key;
  51.     }
  52.     $project_status_filter = $flip_project_types[$v[1]];
  53. } else{
  54.     //Tabbed view
  55.     $project_status_filter = $tab;
  56. }
  57.  
  58. foreach ($projects as $row) {
  59.     if ($show_all_projects || 
  60.         ($row["project_active"] > 0 && $row["project_status"] == $project_status_filter)) {
  61.         $none = false;
  62.         $end_date = intval( @$row["project_end_date"] ) ? new CDate( $row["project_end_date"] ) : null;
  63.  
  64.         $s = '<tr>';
  65.         $s .= '<td width="65" align="center" style="border: outset #eeeeee 2px;background-color:#'
  66.             . $row["project_color_identifier"] . '">';
  67.         $s .= $CT . '<font color="' . bestColor( $row["project_color_identifier"] ) . '">'
  68.             . sprintf( "%.1f%%", $row["project_percent_complete"] )
  69.             . '</font>';
  70.         $s .= $CR . '</td>';
  71.         $s .= $CR . '<td width="100%">';
  72.         $s .= $CT . '<a href="?m=projects&a=view&project_id=' . $row["project_id"] . '" title="' . htmlspecialchars( $row["project_description"], ENT_QUOTES ) . '">' . htmlspecialchars( $row["project_name"], ENT_QUOTES ) . '</a>';
  73.         $s .= $CR . '</td>';
  74.         $s .= $CR . '<td nowrap="nowrap">' . htmlspecialchars( $row["user_username"], ENT_QUOTES ) . '</td>';
  75.         $s .= $CR . '<td align="center" nowrap="nowrap">';
  76.         $s .= $CT . $row["total_tasks"] . ($row["my_tasks"] ? ' ('.$row["my_tasks"].')' : '');
  77.         $s .= $CR . '</td>';
  78.         $s .= $CR . '<td align="center">';
  79.         $s .= $CT . '<input type="checkbox" name="project_id[]" value="'.$row["project_id"].'" />';
  80.         $s .= $CR . '</td>';
  81.  
  82.         if($show_all_projects){
  83.             $s .= $CR . '<td align="center">';
  84.             $s .= $CT . $AppUI->_($project_types[$row["project_status"]]);
  85.             $s .= $CR . '</td>';
  86.         }
  87.         
  88.         $s .= $CR . '</tr>';
  89.         echo $s;
  90.     }
  91. }
  92. if ($none) {
  93.     echo $CR . '<tr><td colspan="6">' . $AppUI->_( 'No projects available' ) . '</td></tr>';
  94. } else {
  95. ?>
  96. <tr>
  97.     <td colspan="6" align="right">
  98.         <?php
  99.             echo "<input type='submit' class='button' value='".$AppUI->_('Update projects status')."' />";
  100.             echo "<input type='hidden' name='update_project_status' value='1' />";
  101.             echo "<input type='hidden' name='m' value='projects' />";
  102.             echo arraySelect( $pstatus, 'project_status', 'size="1" class="text"', 2, true );
  103.                                                                                 // 2 will be the next step
  104. }
  105.         ?>
  106.     </td>
  107. </tr>
  108. </table>
  109. </form>
  110.