[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/projects/ -> vw_projects.php (source)

   1  <?php /* $Id: vw_projects.php 190 2008-07-21 23:17:18Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/projects/vw_projects.php $ */
   2  global $AppUI, $projects, $company_id, $pstatus, $project_statuses, $project_status_filter, $currentTabId, $currentTabName, $projectDesigner;
   3  
   4  $perms = &$AppUI->acl();
   5  $df = $AppUI->getPref('SHDATEFORMAT');
   6  //$df = '%m/%d/%y';
   7  // Let's check if the user submited the change status form
   8  
   9  $projectStatuses = w2PgetSysVal('ProjectStatus');
  10  
  11  $show_all_projects = false;
  12  $currentTabId = ($AppUI->getState('ProjIdxTab') !== null ? $AppUI->getState('ProjIdxTab') : 0);
  13  
  14  //Lets fix the status filter for Not defined, All, All Active and Archived
  15  //All
  16  if ($currentTabId == 0 || $currentTabId == -1) {
  17      $project_status_filter = -1;
  18  //All Active
  19  } elseif ($currentTabId == 1) {
  20      $project_status_filter = -2;
  21  //Archived
  22  } elseif ($currentTabId == count($project_statuses) - 1) {
  23      $project_status_filter = -3;
  24      //The other project status
  25  } else {
  26      $project_status_filter = ($projectStatuses[0] ? $currentTabId - 2 : $currentTabId - 1);
  27  }
  28  
  29  $show_all_projects = false;
  30  //If we are on All, All active or Archived then show the Status column
  31  if (($project_status_filter == -1 || $project_status_filter == -2 || $project_status_filter == -3)) {
  32      $show_all_projects = true;
  33  }
  34  
  35  //Lets remove the unnecessary projects:
  36  //All
  37  if ($project_status_filter == -1) {
  38      //Don't do nothing because we are going to show evey project
  39      //All active
  40  } elseif ($project_status_filter == -2) {
  41      $key = 0;
  42      foreach ($projects as $project) {
  43          if (!$project['project_active']) {
  44              unset($projects[$key]);
  45          }
  46          $key++;
  47      }
  48      $key = 0;
  49      foreach ($projects as $project) {
  50          $tmp_projects[$key] = $project;
  51          $key++;
  52      }
  53      $projects = $tmp_projects;
  54      //Archived
  55  } elseif ($project_status_filter == -3) {
  56      $key = 0;
  57      foreach ($projects as $project) {
  58          if ($project['project_active']) {
  59              unset($projects[$key]);
  60          }
  61          $key++;
  62      }
  63      $key = 0;
  64      foreach ($projects as $project) {
  65          $tmp_projects[$key] = $project;
  66          $key++;
  67      }
  68      $projects = $tmp_projects;
  69      //The Status themselves
  70  } else {
  71  }
  72  
  73  ?>
  74  
  75  <table width="100%" border="0" cellpadding="3" cellspacing="1" class="prjprint">
  76  <tr>
  77      <th nowrap="nowrap">
  78          <?php echo $AppUI->_('Color'); ?>
  79      </th>
  80          <th nowrap="nowrap">
  81          <?php echo $AppUI->_('P'); ?>
  82      </th>
  83      <th nowrap="nowrap">
  84          <?php echo $AppUI->_('ID'); ?>
  85      </th>
  86      <th nowrap="nowrap">
  87          <?php echo $AppUI->_('Project Name'); ?>
  88      </th>
  89      <th nowrap="nowrap">
  90          <?php echo $AppUI->_('Company'); ?>
  91      </th>
  92          <th nowrap="nowrap">
  93          <?php echo $AppUI->_('Start'); ?>
  94      </th>
  95          <th nowrap="nowrap">
  96          <?php echo $AppUI->_('End'); ?>
  97      </th>
  98          <th nowrap="nowrap">
  99          <?php echo $AppUI->_('Actual'); ?>
 100      </th>
 101      <th nowrap="nowrap">
 102          <?php echo $AppUI->_('Owner'); ?>
 103      </th>
 104      <th nowrap="nowrap">
 105          <?php echo $AppUI->_('Tasks'); ?>
 106          (<?php echo $AppUI->_('My'); ?>)
 107      </th>
 108      <?php
 109  if ($project_status_filter < 0) {
 110  ?>
 111          <th nowrap="nowrap">
 112              <?php echo $AppUI->_('Status'); ?>
 113          </th>
 114          <?php
 115  }
 116  ?>
 117  </tr>
 118  
 119  <?php
 120  $none = true;
 121  
 122  //print_r($currentTabId.'.'.$show_all_projects.'.'.count($project_statuses).'.'.$project_status_filter);
 123  
 124  foreach ($projects as $row) {
 125      if (($show_all_projects || ($row['project_active'] && $row['project_status'] == $project_status_filter)) || //tabbed view
 126          (($row['project_active'] && $row['project_status'] == $project_status_filter)) || //flat active projects
 127          ((!$row['project_active'] && $project_status_filter == -3)) //flat archived projects
 128          ) {
 129          $none = false;
 130          $start_date = intval($row['project_start_date']) ? new CDate($row['project_start_date']) : null;
 131          $end_date = intval($row['project_end_date']) ? new CDate($row['project_end_date']) : null;
 132          $adjusted_end_date = intval($row['project_end_date_adjusted']) ? new CDate($row['project_end_date_adjusted']) : null;
 133          $actual_end_date = intval($row['project_actual_end_date']) ? new CDate($row['project_actual_end_date']) : null;
 134          $style = (($actual_end_date > $end_date) && !empty($end_date)) ? 'style="color:red; font-weight:bold"' : '';
 135  
 136          $s = '<tr><td width="65" align="center" style="border: outset #eeeeee 2px;background-color:#' . $row['project_color_identifier'] . '"><font color="' . bestColor($row['project_color_identifier']) . '">' . sprintf("%.1f%%", $row['project_percent_complete']) . '</font></td><td align="center">';
 137          if ($row['project_priority'] < 0) {
 138              $s .= '<img src="' . w2PfindImage('icons/priority-' . -$row['project_priority'] . '.gif') . '" width=13 height=16>';
 139          } else
 140              if ($row['project_priority'] > 0) {
 141                  $s .= '<img src="' . w2PfindImage('icons/priority+' . $row['project_priority'] . '.gif') . '"  width=13 height=16>';
 142              }
 143          $s .= '</td><td nowrap="nowrap">' . $row['project_id'] . '</td><td width="40%">' . htmlspecialchars($row['project_name']) . '</td>';
 144          $s .= '<td width="30%">' . htmlspecialchars($row['company_name'], ENT_QUOTES) . '</td>';
 145  
 146          $s .= '<td align="center">' . ($start_date ? $start_date->format($df) : '-') . '</td><td align="center" nowrap="nowrap">' . ($end_date ? $end_date->format($df) : '-') . '</td><td align="center">';
 147          $s .= $actual_end_date ? '<span ' . $style . '>' . $actual_end_date->format($df) . '</span>' : '-';
 148          $s .= '</td><td nowrap="nowrap">' . htmlspecialchars($row['owner_name'], ENT_QUOTES) . '</td><td align="center" nowrap="nowrap">';
 149          $s .= $row['total_tasks'] . ($row['my_tasks'] ? ' (' . $row['my_tasks'] . ')' : '');
 150          $s .= '</td>';
 151  
 152          if ($show_all_projects) {
 153              $s .= '<td align="center" nowrap="nowrap">';
 154              $s .= $row['project_status'] == 0 ? $AppUI->_('Not Defined') : $projectStatuses[$row['project_status']];
 155              $s .= '</td>';
 156          }
 157  
 158          $s .= '</tr>';
 159          echo $s;
 160  
 161          echo '<tr><td height="1" colspan="12" style="border-bottom: 1px solid;padding:0px;" bgcolor="#FFFFFF"><img src="' . w2PfindImage('shim.gif') . '"></td></tr>';
 162      }
 163  }
 164  if ($none) {
 165      echo '<tr><td colspan="10">' . $AppUI->_('No projects available') . '</td></tr>';
 166  }
 167  ?>
 168      </td>
 169  </tr>
 170  </table>


Generated: Fri Jan 9 03:00:02 2009 Cross-referenced by PHPXref 0.7