[ Index ]

Source Code Reference for V1.00

title

Body

[close]

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

   1  <?php /* $Id: vw_idx_types.php 115 2008-03-21 17:20:33Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/projects/vw_idx_types.php $ */
   2  global $AppUI, $projects, $company_id, $pstatus, $project_types, $currentTabId, $currentTabName, $st_projects_arr;
   3  
   4  $check = $AppUI->_('All Projects', UI_OUTPUT_RAW);
   5  $show_all_projects = false;
   6  if (stristr($currentTabName, $check) !== false)
   7      $show_all_projects = true;
   8  
   9  $perms = &$AppUI->acl();
  10  $df = $AppUI->getPref('SHDATEFORMAT');
  11  // Let's check if the user submited the change status form

  12  
  13  $project_status = dPgetSysVal('ProjectStatus');
  14  $project_types = dPgetSysVal('ProjectType');
  15  
  16  ?>
  17  <script type="text/JavaScript">
  18  
  19  function expand_multiproject(id, table_name) {
  20        var trs = document.getElementsByTagName('tr');
  21  
  22        for (var i=0, i_cmp=trs.length;i < i_cmp;i++) {
  23            var tr_name = trs.item(i).id;
  24            if (tr_name.indexOf(id+'_') >= 0) {
  25                  var tr = document.getElementById(tr_name);
  26                  tr.style.visibility = (tr.style.visibility == '' || tr.style.visibility == 'collapse') ? 'visible' : 'collapse';
  27                  var img_expand = document.getElementById(id+'_expand');
  28                  var img_collapse = document.getElementById(id+'_collapse');
  29                  img_collapse.style.display = (tr.style.visibility == 'visible') ? 'inline' : 'none';
  30                  img_expand.style.display = (tr.style.visibility == '' || tr.style.visibility == 'collapse') ? 'inline' : 'none';
  31            }
  32        }
  33  }
  34    
  35  </script>
  36  
  37  <form name='frmProjects' action='./index.php' method='get'>
  38  
  39  
  40  <table id="tblProjects" width="100%" border="0" cellpadding="3" cellspacing="1" class="tbl">
  41  <tr>
  42      <td align="right" width="65" nowrap="nowrap">&nbsp;<?php echo $AppUI->_('sort by'); ?>:&nbsp;</td>
  43  </tr>
  44  <tr>
  45      <th nowrap="nowrap">
  46          <a href="?m=projects&orderby=project_color_identifier" class="hdr"><?php echo $AppUI->_('Progress'); ?></a>
  47      </th>
  48      <th nowrap="nowrap">
  49          <a href="?m=projects&orderby=project_name" class="hdr"><?php echo $AppUI->_('Project Name'); ?></a>
  50      </th>
  51      <th nowrap="nowrap">
  52          <a href="?m=projects&orderby=company_name" class="hdr"><?php echo $AppUI->_('Company'); ?></a>
  53      </th>
  54          <th nowrap="nowrap">
  55          <a href="?m=projects&orderby=project_start_date" class="hdr"><?php echo $AppUI->_('Start'); ?></a>
  56      </th>
  57          <th nowrap="nowrap">
  58          <a href="?m=projects&orderby=project_end_date" class="hdr"><?php echo $AppUI->_('End'); ?></a>
  59      </th>
  60        <!-- <th nowrap="nowrap">
  61          <a href="?m=projects&orderby=project_actual_end_date" class="hdr"><?php echo $AppUI->_('Actual'); ?></a>
  62      </th>-->
  63        <th nowrap="nowrap">
  64          <a href="?m=projects&orderby=project_status" class="hdr"><?php echo $AppUI->_('Status'); ?></a>
  65      </th>
  66      <th nowrap="nowrap">
  67          <a href="?m=projects&orderby=user_username" class="hdr"><?php echo $AppUI->_('Owner'); ?></a>
  68      </th>
  69      <th nowrap="nowrap">
  70          <a href="?m=projects&orderby=total_tasks" class="hdr"><?php echo $AppUI->_('Tasks'); ?></a>
  71          <a href="?m=projects&orderby=my_tasks" class="hdr">(<?php echo $AppUI->_('My'); ?>)</a>
  72      </th>
  73      <?php
  74  //    if($show_all_projects){

  75  ?>
  76          <th nowrap="nowrap">
  77              <?php echo $AppUI->_('Type'); ?>
  78          </th>
  79          <?php
  80  //    }

  81  ?>
  82      <th nowrap="nowrap">
  83          <a href="?m=projects&orderby=task_log_problem" class="hdr"><?php echo $AppUI->_('P'); ?></a>
  84      </th>
  85      <th nowrap="nowrap">
  86          <?php echo $AppUI->_('Selection'); ?>
  87      </th>
  88  </tr>
  89  
  90  <?php
  91  $none = true;
  92  
  93  //Tabbed view

  94  $project_status_filter = $currentTabId;
  95  //Project not defined

  96  if ($currentTabId == count($project_types) - 1)
  97      $project_status_filter = 0;
  98  
  99  foreach ($projects as $row_proj) {
 100      if (!$perms->checkModuleItem('projects', 'view', $row_proj['project_id'])) {
 101          continue;
 102      }
 103      if (($row_proj['project_type'] == $currentTabId && $row_proj['project_type'] != 0) || (!$currentTabId && $row_proj['project_id'] == $row_proj['project_original_parent']) || ($currentTabId && $row_proj['project_type'] == 0 && $currentTabId == count($project_types))) {
 104          //unset($st_projects_arr);

 105          $st_projects_arr = array();
 106          $sp_obj = new CProject();
 107          $sp_obj->load($project_id);
 108          if ($row_proj['project_id'] == $row_proj['project_original_parent']) {
 109              $structprojects = getStructuredProjects($row_proj['project_original_parent']);
 110          } else {
 111              $st_projects_arr[0][0] = $row_proj;
 112              $st_projects_arr[0][1] = 0;
 113          }
 114  
 115          $st_projects_counter = 1;
 116          foreach ($st_projects_arr as $st_project) {
 117              $multiproject_id = 0;
 118              $project = $st_project[0];
 119              $level = $st_project[1];
 120              $row_st = new CProject();
 121              $row_st->load($project['project_id']);
 122              if (!$perms->checkModuleItem('projects', 'view', $row['project_id'])) {
 123                  continue;
 124              }
 125              $row = $projects[$project['project_id']];
 126              //                if ($show_all_projects || ($row_st->project_status == $project_status_filter)) {

 127              $none = false;
 128              $start_date = intval($row['project_start_date']) ? new CDate($row['project_start_date']) : null;
 129              $end_date = intval($row['project_end_date']) ? new CDate($row['project_end_date']) : null;
 130              // $actual_end_date = intval( $row['project_actual_end_date'] ) ? new CDate( $row['project_actual_end_date'] ) : null;

 131              // $style = (( $actual_end_date > $end_date) && !empty($end_date)) ? 'style="color:red; font-weight:bold"' : '';

 132  
 133              if ($level) { 
 134                  $s = '<tr id="multiproject_' . $row['project_original_parent'] . '_' . $row['project_id'] . '" style="visibility:collapse">';
 135              } else {
 136                  $s = '<tr>';
 137              }
 138              $s .= '<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 width="50%">';
 139  
 140              $q = new DBQuery();
 141              $q->addTable('projects');
 142              $q->addQuery('COUNT(project_id)');
 143              $q->addWhere('project_original_parent = ' . (int)$row['project_id']);
 144              $count_projects = $q->loadResult();
 145  
 146              if ($level) {
 147                  $s .= str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', ($level - 1)) . '<img src="./images/corner-dots.gif" width="16" height="12" border="0">&nbsp;' . '<a href="./index.php?m=projects&a=view&project_id=' . $row['project_id'] . '" title="' . htmlspecialchars($row['project_description'], ENT_QUOTES) . '">' . $row['project_name'] . '</a>';
 148              } elseif ($count_projects > 1 && !$level) {
 149                  $s .= '<a href="javascript: void(0);" onClick="expand_multiproject(\'multiproject_' . $row['project_id'] . '\', \'tblProjects\')"><img id="multiproject_' . $row['project_id'] . '_expand" src="./images/icons/expand.gif" width="12" height="12" border="0"><img id="multiproject_' . $row['project_id'] . '_collapse" src="./images/icons/collapse.gif" width="12" height="12" border="0" style="display:none"></a>&nbsp;' . '<a href="./index.php?m=projects&a=view&project_id=' . $row['project_id'] . '" title="' . htmlspecialchars($row['project_description'], ENT_QUOTES) . '">' . $row['project_name'] . '</a>';
 150              } else {
 151                  $s .= '<a href="./index.php?m=projects&a=view&project_id=' . $row['project_id'] . '" title="' . htmlspecialchars($row['project_description'], ENT_QUOTES) . '">' . $row['project_name'] . '</a>';
 152              }
 153              $s .= '</td><td width="30%">';
 154              if ($perms->checkModuleItem('companies', 'access', $row['project_company'])) {
 155                  $s .= '<a href="?m=companies&a=view&company_id=' . $row['project_company'] . '" title="' . htmlspecialchars($row['company_description'], ENT_QUOTES) . '">' . htmlspecialchars($row['company_name'], ENT_QUOTES) . '</a>';
 156              } else {
 157                  $s .= htmlspecialchars($row['company_name'], ENT_QUOTES);
 158              }
 159              $s .= '</td><td align="center">' . ($start_date ? $start_date->format($df) : '-') . '</td><td align="center">' . ($end_date ? $end_date->format($df) : '-') . '</td>';
 160              /*$s .= '<td align="center">';

 161              $s .= $actual_end_date ? '<a href="?m=tasks&a=view&task_id='.$row["critical_task"].'">' : '';

 162              $s .= $actual_end_date ? '<span '. $style.'>'.$actual_end_date->format( $df ).'</span>' : '-';

 163              $s .= $actual_end_date ? '</a>' : '';*/
 164              $s .= '<td align="center" nowrap="nowrap">' . $project_status[$row['project_status']] . '</td>';
 165  
 166              $s .= '<td nowrap="nowrap">' . htmlspecialchars($row['user_username'], ENT_QUOTES) . '</td><td align="center" nowrap="nowrap">';
 167              $s .= $row['total_tasks'] . ($row['my_tasks'] ? ' (' . $row['my_tasks'] . ')' : '');
 168              $s .= '</td><td align="center" nowrap="nowrap">';
 169              $s .= $row['project_type'] == 0 ? $AppUI->_('Unknown') : $project_types[$row['project_type']];
 170              $s .= '</td><td align="center">';
 171              $s .= $row['task_log_problem'] ? '<a href="?m=tasks&a=index&f=all&project_id=' . $row['project_id'] . '">' : '';
 172              $s .= $row['task_log_problem'] ? dPshowImage('./images/icons/dialog-warning5.png', 16, 16, 'Problem', 'Problem') : '-';
 173              $s .= $row['task_log_problem'] ? '</a>' : '';
 174              $s .= '</td><td align="center">';
 175              if ($perms->checkModuleItem('projects', 'edit', $row['project_id'])) {
 176                  $s .= '<input type="checkbox" name="project_id[]" value="' . $row['project_id'] . '" />';
 177              } else {
 178                  $s .= '&nbsp;';
 179              }
 180              $s .= '</td></tr>';
 181              /*                        if (!$level && $count_projects>1) {

 182              $multiproject_id = $row['project_id'];

 183              $s .= '<div style="display: none;" id="multiproject_'.$multiproject_id.'">';

 184              }                                               

 185              if (($count_projects==$st_projects_counter) && $level && $count_projects>1)      

 186              $s .= '</div>';      

 187              if ($count_projects>1)

 188              $st_projects_counter++;*/
 189              echo $s;
 190              //                }

 191          }
 192          //$st_projects_counter = 1;

 193      }
 194  }
 195  if ($none) {
 196      echo '<tr><td colspan="20">' . $AppUI->_('No projects available') . '</td></tr>';
 197  } else {
 198  ?>
 199  <tr>
 200      <td colspan="20" align="right">
 201          <?php
 202              $s = '<input type="submit" class="button" value="' . $AppUI->_('Update projects status') . '" />';
 203              $s .= '<input type="hidden" name="update_project_status" value="1" />';
 204              $s .= '<input type="hidden" name="m" value="projects" />';
 205              $s .= arraySelect($pstatus, 'project_status', 'size="1" class="text"', 2, true);
 206              echo $s;
 207      // 2 will be the next step

 208  }
 209  ?>
 210      </td>
 211  </tr>
 212  </table>
 213  </form>


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