![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: vw_logs.php 136 2008-04-04 14:24:17Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/tasks/vw_logs.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 global $AppUI, $task_id, $df, $canEdit, $m; 7 8 $perms = &$AppUI->acl(); 9 if (!$perms->checkModule('task_log', 'view')) { 10 $AppUI->redirect('m=public&a=access_denied'); 11 } 12 13 $problem = intval(w2PgetParam($_GET, 'problem', null)); 14 // get sysvals 15 $taskLogReference = w2PgetSysVal('TaskLogReference'); 16 $taskLogReferenceImage = w2PgetSysVal('TaskLogReferenceImage'); 17 ?> 18 <script language="JavaScript"> 19 <?php 20 // security improvement: 21 // some javascript functions may not appear on client side in case of user not having write permissions 22 // else users would be able to arbitrarily run 'bad' functions 23 $canDelete = $perms->checkModule('task_log', 'delete'); 24 if ($canDelete) { 25 ?> 26 function delIt2(id) { 27 if (confirm( '<?php echo $AppUI->_('doDelete', UI_OUTPUT_JS) . ' ' . $AppUI->_('Task Log', UI_OUTPUT_JS) . '?'; ?>' )) { 28 document.frmDelete2.task_log_id.value = id; 29 document.frmDelete2.submit(); 30 } 31 } 32 <?php } ?> 33 </script> 34 35 <table border="0" cellpadding="2" cellspacing="1" width="100%" class="tbl"> 36 <form name="frmDelete2" action="./index.php?m=tasks" method="post"> 37 <input type="hidden" name="dosql" value="do_updatetask" /> 38 <input type="hidden" name="del" value="1" /> 39 <input type="hidden" name="task_log_id" value="0" /> 40 </form> 41 42 <tr> 43 <th></th> 44 <th><?php echo $AppUI->_('Date'); ?></th> 45 <th title="<?php echo $AppUI->_('Reference'); ?>"><?php echo $AppUI->_('Ref'); ?></th> 46 <th width="100"><?php echo $AppUI->_('Summary'); ?></th> 47 <th><?php echo $AppUI->_('URL'); ?></th> 48 <th width="100"><?php echo $AppUI->_('User'); ?></th> 49 <th width="100"><?php echo $AppUI->_('Hours'); ?></th> 50 <th width="100" nowrap="nowrap"><?php echo $AppUI->_('Cost Code'); ?></th> 51 <th width="100%"><?php echo $AppUI->_('Comments'); ?></th> 52 <th></th> 53 </tr> 54 <?php 55 // Pull the task comments 56 $q = new DBQuery(); 57 $q->addTable('task_log'); 58 $q->addQuery('task_log.*, user_username, billingcode_name as task_log_costcode'); 59 $q->addQuery('CONCAT(contact_first_name, \' \', contact_last_name) AS real_name'); 60 $q->addWhere('task_log_task = ' . (int)$task_id . ($problem ? ' AND task_log_problem > 0' : '')); 61 $q->addOrder('task_log_date'); 62 $q->leftJoin('billingcode', '', 'task_log.task_log_costcode = billingcode_id'); 63 $q->addJoin('users', '', 'task_log_creator = user_id', 'inner'); 64 $q->addJoin('contacts', 'ct', 'contact_id = user_contact', 'inner'); 65 $logs = $q->loadList(); 66 67 $s = ''; 68 $hrs = 0; 69 $canEdit = $perms->checkModule('task_log', 'edit'); 70 foreach ($logs as $row) { 71 $task_log_date = intval($row['task_log_date']) ? new CDate($row['task_log_date']) : null; 72 $style = $row['task_log_problem'] ? 'background-color:#cc6666;color:#ffffff' : ''; 73 74 $s .= '<tr bgcolor="white" valign="top"><td>'; 75 if ($canEdit) { 76 if ($tab == -1) { 77 $s .= '<a href="?m=tasks&a=view&task_id=' . $task_id . '&tab=' . $AppUI->getState('TaskLogVwTab'); 78 } else { 79 $s .= '<a href="?m=tasks&a=view&task_id=' . $task_id . '&tab=1'; 80 81 } 82 $s .= '&task_log_id=' . $row['task_log_id'] . '#log">' . w2PshowImage('icons/stock_edit-16.png', 16, 16, '') . '</a>'; 83 } 84 $s .= '</td><td nowrap="nowrap">' . ($task_log_date ? $task_log_date->format($df) : '-') . '</td>'; 85 //$s .= '<td align="center" valign="middle">'.($row['task_log_problem'] ? w2PshowImage('icons/mark-as-important-16.png', 16, 16, 'Problem', 'Problem' ) : '').'</td>'; 86 $reference_image = '-'; 87 if ($row['task_log_reference'] > 0) { 88 if (isset($taskLogReferenceImage[$row['task_log_reference']])) { 89 $reference_image = w2PshowImage($taskLogReferenceImage[$row['task_log_reference']], 16, 16, $taskLogReference[$row['task_log_reference']], $taskLogReference[$row['task_log_reference']]); 90 } elseif (isset($taskLogReference[$row['task_log_reference']])) { 91 $reference_image = $taskLogReference[$row['task_log_reference']]; 92 } 93 } 94 $s .= '<td align="center" valign="middle">' . $reference_image . '</td>'; 95 $s .= '<td width="30%" style="' . $style . '">' . $row['task_log_name'] . '</td>'; 96 $s .= !empty($row['task_log_related_url']) ? '<td><a href="' . $row['task_log_related_url'] . '" title="' . $row['task_log_related_url'] . '">' . $AppUI->_('URL') . '</a></td>' : '<td></td>'; 97 $s .= '<td width="100">' . $row['real_name'] . '</td>'; 98 $s .= '<td width="100" align="right">' . sprintf('%.2f', $row['task_log_hours']) . '<br />('; 99 $minutes = (int)(($row['task_log_hours'] - ((int)$row['task_log_hours'])) * 60); 100 $minutes = ((strlen($minutes) == 1) ? ('0' . $minutes) : $minutes); 101 $s .= (int)$row['task_log_hours'] . ':' . $minutes . ')</td>'; 102 $s .= '<td width="100">' . $row['task_log_costcode'] . '</td><td>' . '<a name="tasklog' . $row['task_log_id'] . '"></a>'; 103 104 // dylan_cuthbert: auto-transation system in-progress, leave these lines 105 $transbrk = "\n[translation]\n"; 106 $descrip = str_replace("\n", '<br />', ($row['task_log_description'])); 107 $tranpos = strpos($descrip, str_replace("\n", '<br />', $transbrk)); 108 if ($tranpos === false) { 109 $s .= $descrip; 110 } else { 111 $descrip = substr($descrip, 0, $tranpos); 112 $tranpos = strpos($row['task_log_description'], $transbrk); 113 $transla = substr($row['task_log_description'], $tranpos + strlen($transbrk)); 114 $transla = trim(str_replace("'", '"', $transla)); 115 $s .= $descrip . '<div style="font-weight: bold; text-align: right"><a title="' . $transla . '" class="hilite">[' . $AppUI->_('translation') . ']</a></div>'; 116 } 117 // end auto-translation code 118 119 $s .= '</td><td>'; 120 if ($canDelete) { 121 $s .= '<a href="javascript:delIt2(' . $row['task_log_id'] . ');" title="' . $AppUI->_('delete log') . '">' . w2PshowImage('icons/stock_delete-16.png', 16, 16, '') . '</a>'; 122 } 123 $s .= '</td></tr>'; 124 $hrs += (float)$row['task_log_hours']; 125 } 126 $s .= '<tr bgcolor="white" valign="top">'; 127 $s .= '<td colspan="6" align="right">' . $AppUI->_('Total Hours') . ' =</td>'; 128 $s .= '<td align="right">' . sprintf('%.2f', $hrs) . '</td>'; 129 $s .= '<td align="right" colspan="3"><form action="?m=tasks&a=view&tab=1&task_id=' . $task_id . '" method="post">'; 130 if ($perms->checkModuleItem('tasks', 'edit', $task_id)) { 131 $s .= '<input type="submit" class="button" value="' . $AppUI->_('new log') . '"></form></td>'; 132 } 133 $s .= '</tr>'; 134 echo $s; 135 ?> 136 </table> 137 <table> 138 <tr> 139 <td><?php echo $AppUI->_('Key'); ?>:</td> 140 <td> </td> 141 <td bgcolor="#ffffff"> </td> 142 <td>=<?php echo $AppUI->_('Normal Log'); ?></td> 143 <td bgcolor="#CC6666"> </td> 144 <td>=<?php echo $AppUI->_('Problem Report'); ?></td> 145 </tr> 146 </table>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jan 8 03:00:03 2009 | Cross-referenced by PHPXref 0.7 |