home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / modules / tasks / vw_logs.php < prev   
Encoding:
PHP Script  |  2004-01-14  |  3.3 KB  |  94 lines

  1. <?php /* TASKS $Id: vw_logs.php,v 1.9 2004/01/14 03:11:59 dylan_cuthbert Exp $ */
  2. global $AppUI, $task_id, $df, $canEdit;
  3. ?>
  4. <script language="JavaScript">
  5. function delIt2(id) {
  6.     if (confirm( "<?php echo $AppUI->_('doDelete').' '.$AppUI->_('Task Log').'?';?>" )) {
  7.         document.frmDelete2.task_log_id.value = id;
  8.         document.frmDelete2.submit();
  9.     }
  10. }
  11. </script>
  12.  
  13. <table border="0" cellpadding="2" cellspacing="1" width="100%" class="tbl">
  14. <form name="frmDelete2" action="./index.php?m=tasks" method="post">
  15.     <input type="hidden" name="dosql" value="do_updatetask">
  16.     <input type="hidden" name="del" value="1" />
  17.     <input type="hidden" name="task_log_id" value="0" />
  18. </form>
  19.  
  20. <tr>
  21.     <th></th>
  22.     <th><?php echo $AppUI->_('Date');?></th>
  23.     <th width="100"><?php echo $AppUI->_('Summary');?></th>
  24.     <th width="100"><?php echo $AppUI->_('User');?></th>
  25.     <th width="100"><?php echo $AppUI->_('Hours');?></th>
  26.     <th width="100"><?php echo $AppUI->_('Cost Code');?></th>
  27.     <th width="100%"><?php echo $AppUI->_('Comments');?></th>
  28.     <th></th>
  29. </tr>
  30. <?php
  31. // Pull the task comments
  32. $sql = "
  33. SELECT task_log.*, user_username
  34. FROM task_log
  35. LEFT JOIN users ON user_id = task_log_creator
  36. WHERE task_log_task = $task_id
  37. ORDER BY task_log_date
  38. ";
  39. $logs = db_loadList( $sql );
  40.  
  41. $s = '';
  42. $hrs = 0;
  43. foreach ($logs as $row) {
  44.     $task_log_date = intval( $row['task_log_date'] ) ? new CDate( $row['task_log_date'] ) : null;
  45.  
  46.     $s .= '<tr bgcolor="white" valign="top">';
  47.     $s .= "\n\t<td>";
  48.     if (!getDenyEdit($m, $task_id) ) {
  49.         $s .= "\n\t\t<a href=\"?m=tasks&a=view&task_id=$task_id&tab=1&task_log_id=".@$row['task_log_id']."\">"
  50.             . "\n\t\t\t". dPshowImage( './images/icons/stock_edit-16.png', 16, 16, '' )
  51.             . "\n\t\t</a>";
  52.     }
  53.     $s .= "\n\t</td>";
  54.     $s .= '<td nowrap="nowrap">'.($task_log_date ? $task_log_date->format( $df ) : '-').'</td>';
  55.     $s .= '<td width="30%">'.@$row["task_log_name"].'</td>';
  56.     $s .= '<td width="100">'.$row["user_username"].'</td>';
  57.     $s .= '<td width="100" align="right">'.sprintf( "%.2f", $row["task_log_hours"] ) . '</td>';
  58.     $s .= '<td width="100">'.$row["task_log_costcode"].'</td>';
  59.     $s .= '<td>';
  60.  
  61. // dylan_cuthbert: auto-transation system in-progress, leave these lines
  62.     $transbrk = "\n[translation]\n";
  63.     $descrip = str_replace( "\n", "<br />", $row['task_log_description'] );
  64.     $tranpos = strpos( $descrip, str_replace( "\n", "<br />", $transbrk ) );
  65.     if ( $tranpos === false) $s .= $descrip;
  66.     else
  67.     {
  68.         $descrip = substr( $descrip, 0, $tranpos );
  69.         $tranpos = strpos( $row['task_log_description'], $transbrk );
  70.         $transla = substr( $row['task_log_description'], $tranpos + strlen( $transbrk ) );
  71.         $transla = trim( str_replace( "'", '"', $transla ) );
  72.         $s .= $descrip."<div style='font-weight: bold; text-align: right'><a title='$transla' class='hilite'>[".$AppUI->_("translation")."]</a></div>";
  73.     }
  74. // end auto-translation code
  75.             
  76.     $s .= '</td>';
  77.     $s .= "\n\t<td>";
  78.     if ($canEdit) {
  79.         $s .= "\n\t\t<a href=\"javascript:delIt2({$row['task_log_id']});\" title=\"".$AppUI->_('delete log')."\">"
  80.             . "\n\t\t\t". dPshowImage( './images/icons/stock_delete-16.png', 16, 16, '' )
  81.             . "\n\t\t</a>";
  82.     }
  83.     $s .= "\n\t</td>";
  84.     $s .= '</tr>';
  85.     $hrs += (float)$row["task_log_hours"];
  86. }
  87. $s .= '<tr bgcolor="white" valign="top">';
  88. $s .= '<td colspan="3" align="right">' . $AppUI->_('Total Hours') . ' =</td>';
  89. $s .= '<td align="right">' . sprintf( "%.2f", $hrs ) . '</td>';
  90. $s .= '</tr>';
  91. echo $s;
  92. ?>
  93. </table>
  94.