![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: admin_tab.viewuser.projects.php 102 2008-03-18 19:52:59Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/projects/admin_tab.viewuser.projects.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 global $a, $addPwT, $AppUI, $buffer, $company_id, $department, $min_view, $m, $priority, $projects, $tab, $user_id, $orderdir, $orderby; 7 8 $perms = &$AppUI->acl(); 9 $df = $AppUI->getPref('SHDATEFORMAT'); 10 11 $pstatus = w2PgetSysVal('ProjectStatus'); 12 13 if (isset($_POST['proFilter'])) { 14 $AppUI->setState('UsrProjectIdxFilter', $_POST['proFilter']); 15 } 16 $proFilter = $AppUI->getState('UsrProjectIdxFilter') !== null ? $AppUI->getState('UsrProjectIdxFilter') : '-3'; 17 18 $projFilter = arrayMerge(array('-1' => 'All Projects'), $pstatus); 19 $projFilter = arrayMerge(array('-2' => 'All w/o in progress'), $projFilter); 20 $projFilter = arrayMerge(array('-3' => 'All w/o archived'), $projFilter); 21 natsort($projFilter); 22 23 // load the companies class to retrieved denied companies 24 require_once ($AppUI->getModuleClass('companies')); 25 26 // retrieve any state parameters 27 if (isset($_GET['tab'])) { 28 $AppUI->setState('UsrProjIdxTab', w2PgetParam($_GET, 'tab', null)); 29 } 30 31 if (isset($_GET['orderby'])) { 32 $orderdir = $AppUI->getState('UsrProjIdxOrderDir') ? ($AppUI->getState('UsrProjIdxOrderDir') == 'asc' ? 'desc' : 'asc') : 'desc'; 33 $AppUI->setState('UsrProjIdxOrderBy', w2PgetParam($_GET, 'orderby', null)); 34 $AppUI->setState('UsrProjIdxOrderDir', $orderdir); 35 } 36 $orderby = $AppUI->getState('UsrProjIdxOrderBy') ? $AppUI->getState('UsrProjIdxOrderBy') : 'project_end_date'; 37 $orderdir = $AppUI->getState('UsrProjIdxOrderDir') ? $AppUI->getState('UsrProjIdxOrderDir') : 'asc'; 38 39 $extraGet = '&user_id=' . $user_id; 40 41 require_once ($AppUI->getModuleClass('projects')); 42 43 // collect the full projects list data via function in projects.class.php 44 projects_list_data($user_id); 45 ?> 46 47 <table width="100%" border="0" cellpadding="3" cellspacing="1" class="tbl"> 48 <tr> 49 <td align="center" width="100%" nowrap="nowrap" colspan="7"> </td> 50 <form action="?m=admin&a=viewuser&user_id=<?php echo $user_id; ?>&tab=<?php echo $tab; ?>" method="post" name="checkPwT"><td align="right" nowrap="nowrap"><input type="checkbox" name="add_pwt" id="add_pwt" onclick="document.checkPwT.submit()" <?php echo $addPwT ? 'checked="checked"' : ''; ?> /></td><td align="right" nowrap="nowrap"><label for="add_pwt"><?php echo $AppUI->_('Show Projects with assigned Tasks'); ?>?</label><input type="hidden" name="show_form" value="1" /></td></form> 51 <form action="?m=admin&a=viewuser&user_id=<?php echo $user_id; ?>&tab=<?php echo $tab; ?>" method="post" name="pickCompany"><td align="right" nowrap="nowrap"><?php echo $buffer; ?></td></form> 52 <form action="?m=admin&a=viewuser&user_id=<?php echo $user_id; ?>&tab=<?php echo $tab; ?>" method="post" name="pickProject"><td align="right" nowrap="nowrap"><?php echo arraySelect($projFilter, 'proFilter', 'size=1 class=text onChange="document.pickProject.submit()"', $proFilter, true); ?></td></form> 53 </tr> 54 </table> 55 <table width="100%" border="0" cellpadding="3" cellspacing="1" class="tbl"> 56 <tr> 57 <th nowrap="nowrap"> 58 <a href="?m=<?php echo $m; ?><?php echo (isset($a) ? '&a=' . $a : ''); ?><?php echo (isset($extraGet) ? $extraGet : ''); ?>&orderby=project_color_identifier" class="hdr"><?php echo $AppUI->_('Color'); ?></a> 59 </th> 60 </th> 61 <th nowrap="nowrap"> 62 <a href="?m=<?php echo $m; ?><?php echo (isset($a) ? '&a=' . $a : ''); ?><?php echo (isset($extraGet) ? $extraGet : ''); ?>&orderby=project_priority" class="hdr"><?php echo $AppUI->_('P'); ?></a> 63 </th> 64 <th nowrap="nowrap"> 65 <a href="?m=<?php echo $m; ?><?php echo (isset($a) ? '&a=' . $a : ''); ?><?php echo (isset($extraGet) ? $extraGet : ''); ?>&orderby=project_name" class="hdr"><?php echo $AppUI->_('Project Name'); ?></a> 66 </th> 67 <th nowrap="nowrap"> 68 <a href="?m=<?php echo $m; ?><?php echo (isset($a) ? '&a=' . $a : ''); ?><?php echo (isset($extraGet) ? $extraGet : ''); ?>&orderby=company_name" class="hdr"><?php echo $AppUI->_('Company'); ?></a> 69 </th> 70 <th nowrap="nowrap"> 71 <a href="?m=<?php echo $m; ?><?php echo (isset($a) ? '&a=' . $a : ''); ?><?php echo (isset($extraGet) ? $extraGet : ''); ?>&orderby=project_start_date" class="hdr"><?php echo $AppUI->_('Start'); ?></a> 72 </th> 73 <th nowrap="nowrap"> 74 <a href="?m=<?php echo $m; ?><?php echo (isset($a) ? '&a=' . $a : ''); ?><?php echo (isset($extraGet) ? $extraGet : ''); ?>&orderby=project_duration" class="hdr"><?php echo $AppUI->_('Duration'); ?></a> 75 </th> 76 <th nowrap="nowrap"> 77 <a href="?m=<?php echo $m; ?><?php echo (isset($a) ? '&a=' . $a : ''); ?><?php echo (isset($extraGet) ? $extraGet : ''); ?>&orderby=project_end_date" class="hdr"><?php echo $AppUI->_('Due Date'); ?></a> 78 </th> 79 <th nowrap="nowrap"> 80 <a href="?m=<?php echo $m; ?><?php echo (isset($a) ? '&a=' . $a : ''); ?><?php echo (isset($extraGet) ? $extraGet : ''); ?>&orderby=project_actual_end_date" class="hdr"><?php echo $AppUI->_('Actual'); ?></a> 81 </th> 82 <th nowrap="nowrap"> 83 <a href="?m=<?php echo $m; ?><?php echo (isset($a) ? '&a=' . $a : ''); ?><?php echo (isset($extraGet) ? $extraGet : ''); ?>&orderby=task_log_problem" class="hdr"><?php echo $AppUI->_('LP'); ?></a> 84 </th> 85 <th nowrap="nowrap"> 86 <a href="?m=<?php echo $m; ?><?php echo (isset($a) ? '&a=' . $a : ''); ?><?php echo (isset($extraGet) ? $extraGet : ''); ?>&orderby=user_username" class="hdr"><?php echo $AppUI->_('Owner'); ?></a> 87 </th> 88 <th nowrap="nowrap"> 89 <a href="?m=<?php echo $m; ?><?php echo (isset($a) ? '&a=' . $a : ''); ?><?php echo (isset($extraGet) ? $extraGet : ''); ?>&orderby=total_tasks" class="hdr"><?php echo $AppUI->_('Tasks'); ?></a> 90 <a href="?m=<?php echo $m; ?><?php echo (isset($a) ? '&a=' . $a : ''); ?><?php echo (isset($extraGet) ? $extraGet : ''); ?>&orderby=my_tasks" class="hdr">(<?php echo $AppUI->_('My'); ?>)</a> 91 </th> 92 <th nowrap="nowrap"> 93 <a href="?m=<?php echo $m; ?><?php echo (isset($a) ? '&a=' . $a : ''); ?><?php echo (isset($extraGet) ? $extraGet : ''); ?>&orderby=project_status" class="hdr"><?php echo $AppUI->_('Status'); ?></a> 94 </th> 95 </tr> 96 97 <?php 98 $none = true; 99 foreach ($projects as $row) { 100 // We dont check the percent_completed == 100 because some projects 101 // were being categorized as completed because not all the tasks 102 // have been created (for new projects) 103 if ($proFilter == -1 || $row['project_status'] == $proFilter || ($proFilter == -2 && $row['project_status'] != 3) || ($proFilter == -3 && $row['project_active'] != 0)) { 104 $none = false; 105 $start_date = intval($row['project_start_date']) ? new CDate($row['project_start_date']) : null; 106 $end_date = intval($row['project_end_date']) ? new CDate($row['project_end_date']) : null; 107 $actual_end_date = intval($row['project_actual_end_date']) ? new CDate($row['project_actual_end_date']) : null; 108 $style = (($actual_end_date > $end_date) && !empty($end_date)) ? 'style="color:red; font-weight:bold"' : ''; 109 110 $s = '<tr><td width="65" align="right" style="border: outset #eeeeee 1px;background-color:#' . $row['project_color_identifier'] . '">'; 111 $s .= '<font color="' . bestColor($row['project_color_identifier']) . '">' . sprintf('%.1f%%', $row['project_percent_complete']) . '</font></td><td align="center">'; 112 if ($row['project_priority'] < 0) { 113 $s .= '<img src="' . w2PfindImage('icons/priority-' . -$row['project_priority'] . '.gif') . '" width=13 height=16>'; 114 } elseif ($row['project_priority'] > 0) { 115 $s .= '<img src="' . w2PfindImage('icons/priority+' . $row['project_priority'] . '.gif') . '" width=13 height=16>'; 116 } 117 $s .= '</td><td width="40%"><a href="?m=projects&a=view&project_id=' . $row['project_id'] . '" ><span title="' . (nl2br(htmlspecialchars($row['project_description'])) ? htmlspecialchars($row['project_name'], ENT_QUOTES) . '::' . nl2br(htmlspecialchars($row['project_description'])) : '') . '" >' . htmlspecialchars($row['project_name'], ENT_QUOTES) . '</span></a></td>'; 118 119 $s .= '<td width="30%"><a href="?m=companies&a=view&company_id=' . $row['project_company'] . '" ><span title="' . (nl2br(htmlspecialchars($row['company_description'])) ? htmlspecialchars($row['company_name'], ENT_QUOTES) . '::' . nl2br(htmlspecialchars($row['company_description'])) : '') . '" >' . htmlspecialchars($row['company_name'], ENT_QUOTES) . '</span></a></td>'; 120 $s .= '<td nowrap="nowrap" align="center">' . ($start_date ? $start_date->format($df) : '-') . '</td>'; 121 $s .= '<td nowrap="nowrap" align="right">' . ($row['project_duration'] > 0 ? round($row['project_duration'], 0) . $AppUI->_('h') : '-') . '</td>'; 122 $s .= '<td nowrap="nowrap" align="center" nowrap="nowrap" style="background-color:' . $priority[$row['project_priority']]['color'] . '">'; 123 $s .= ($end_date ? $end_date->format($df) : '-'); 124 $s .= '</td><td nowrap="nowrap" align="center">'; 125 $s .= $actual_end_date ? '<a href="?m=tasks&a=view&task_id=' . $row['critical_task'] . '">' : ''; 126 $s .= $actual_end_date ? '<span ' . $style . '>' . $actual_end_date->format($df) . '</span>' : '-'; 127 $s .= $actual_end_date ? '</a>' : ''; 128 $s .= '</td><td align="center">'; 129 $s .= $row['task_log_problem'] ? '<a href="?m=tasks&a=index&f=all&project_id=' . $row['project_id'] . '">' : ''; 130 $s .= $row['task_log_problem'] ? w2PshowImage('icons/dialog-warning5.png', 16, 16, 'Problem', 'Problem') : '-'; 131 $s .= $row['task_log_problem'] ? '</a>' : ''; 132 $s .= '</td><td align="center" nowrap="nowrap">' . htmlspecialchars($row['owner_name'], ENT_QUOTES) . '</td><td align="center" nowrap="nowrap">'; 133 $s .= $row['total_tasks'] . ($row['my_tasks'] ? ' (' . $row['my_tasks'] . ')' : ''); 134 $s .= '</td><td align="left" nowrap="nowrap">' . $AppUI->_($pstatus[$row['project_status']]) . '</td></tr>'; 135 echo $s; 136 } 137 } 138 if ($none) { 139 echo '<tr><td colspan="12">' . $AppUI->_('No projects available') . '</td></tr>'; 140 } 141 ?> 142 <tr> 143 <td colspan="12"> </td> 144 </tr> 145 </table>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 9 03:00:02 2009 | Cross-referenced by PHPXref 0.7 |