![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: departments_tab.view.projects.php 102 2008-03-18 19:52:59Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/projects/departments_tab.view.projects.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 global $a, $addPwOiD, $addPwT, $AppUI, $buffer, $dept_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('DeptProjectIdxFilter', $_POST['proFilter']); 15 } 16 $proFilter = $AppUI->getState('DeptProjectIdxFilter') !== null ? $AppUI->getState('DeptProjectIdxFilter') : '-1'; 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('DeptProjIdxTab', w2PgetParam($_GET, 'tab', null)); 29 } 30 31 if (isset($_GET['orderby'])) { 32 $orderdir = $AppUI->getState('DeptProjIdxOrderDir') ? ($AppUI->getState('DeptProjIdxOrderDir') == 'asc' ? 'desc' : 'asc') : 'desc'; 33 $AppUI->setState('DeptProjIdxOrderBy', w2PgetParam($_GET, 'orderby', null)); 34 $AppUI->setState('DeptProjIdxOrderDir', $orderdir); 35 } 36 $orderby = $AppUI->getState('DeptProjIdxOrderBy') ? $AppUI->getState('DeptProjIdxOrderBy') : 'project_end_date'; 37 $orderdir = $AppUI->getState('DeptProjIdxOrderDir') ? $AppUI->getState('DeptProjIdxOrderDir') : 'asc'; 38 39 if (isset($_POST['show_form'])) { 40 $AppUI->setState('addProjWithTasks', w2PgetParam($_POST, 'add_pwt', 0)); 41 $AppUI->setState('addProjWithOwnerInDep', w2PgetParam($_POST, 'add_pwoid', 0)); 42 } 43 $addPwT = $AppUI->getState('addProjWithTasks', 0); 44 $addPwOiD = $AppUI->getState('addProjWithOwnerInDep', 0); 45 46 $extraGet = '&user_id=' . $user_id; 47 48 require_once ($AppUI->getModuleClass('projects')); 49 50 // collect the full projects list data via function in projects.class.php 51 projects_list_data($user_id); 52 ?> 53 54 <table width="100%" border="0" cellpadding="3" cellspacing="1" class="tbl"> 55 <tr> 56 <form action="?m=departments&a=view&dept_id=<?php echo $dept_id; ?>&tab=<?php echo $tab; ?>" method="post" name="form_cb"> 57 <input type="hidden" name="show_form" value="1" /> 58 <td align="right" width="65" nowrap="nowrap"> <?php echo $AppUI->_('sort by'); ?>: </td> 59 <td align="center" width="100%" nowrap="nowrap" colspan="6"> </td><td align="right" nowrap="nowrap"><input type="checkbox" name="add_pwoid" id="add_pwoid" onclick="document.form_cb.submit()" <?php echo $addPwOiD ? 'checked="checked"' : ''; ?> /><label for="add_pwoid"><?php echo $AppUI->_('Show Projects whose Owner is Member of the Dep.'); ?>?</label></td> 60 <td align="right" nowrap="nowrap"><form action="?m=departments&a=view&dept_id=<?php echo $dept_id; ?>&tab=<?php echo $tab; ?>" method="post" name="checkPwT"><input type="checkbox" name="add_pwt" id="add_pwt" onclick="document.form_cb.submit()" <?php echo $addPwT ? 'checked="checked"' : ''; ?> /><label for="add_pwt"><?php echo $AppUI->_('Show Projects with assigned Tasks'); ?>?</label></td> 61 </form> 62 <td align="right" nowrap="nowrap"><form action="?m=departments&a=view&dept_id=<?php echo $dept_id; ?>&tab=<?php echo $tab; ?>" method="post" name="pickProject"><?php echo arraySelect($projFilter, 'proFilter', 'size=1 class=text onChange="document.pickProject.submit()"', $proFilter, true); ?></form></td> 63 </tr> 64 </table> 65 <table width="100%" border="0" cellpadding="3" cellspacing="1" class="tbl"> 66 <tr> 67 <th nowrap="nowrap"> 68 <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> 69 </th> 70 </th> 71 <th nowrap="nowrap"> 72 <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> 73 </th> 74 <th nowrap="nowrap"> 75 <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> 76 </th> 77 <th nowrap="nowrap"> 78 <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> 79 </th> 80 <th nowrap="nowrap"> 81 <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> 82 </th> 83 <th nowrap="nowrap"> 84 <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> 85 </th> 86 <th nowrap="nowrap"> 87 <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> 88 </th> 89 <th nowrap="nowrap"> 90 <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> 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=task_log_problem" class="hdr"><?php echo $AppUI->_('LP'); ?></a> 94 </th> 95 <th nowrap="nowrap"> 96 <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> 97 </th> 98 <th nowrap="nowrap"> 99 <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> 100 <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> 101 </th> 102 <th nowrap="nowrap"> 103 <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> 104 </th> 105 </tr> 106 107 <?php 108 $none = true; 109 foreach ($projects as $row) { 110 // We dont check the percent_completed == 100 because some projects 111 // were being categorized as completed because not all the tasks 112 // have been created (for new projects) 113 if ($proFilter == -1 || $row['project_status'] == $proFilter || ($proFilter == -2 && $row['project_status'] != 3) || ($proFilter == -3 && $row['project_active'] != 0)) { 114 $none = false; 115 $start_date = intval($row['project_start_date']) ? new CDate($row['project_start_date']) : null; 116 $end_date = intval($row['project_end_date']) ? new CDate($row['project_end_date']) : null; 117 $actual_end_date = intval($row['project_actual_end_date']) ? new CDate($row['project_actual_end_date']) : null; 118 $style = (($actual_end_date > $end_date) && !empty($end_date)) ? 'style="color:red; font-weight:bold"' : ''; 119 120 $s = '<tr><td width="65" align="right" style="border: outset #eeeeee 1px;background-color:#' . $row['project_color_identifier'] . '"><font color="' . bestColor($row['project_color_identifier']) . '">' . sprintf('%.1f%%', $row['project_percent_complete']) . '</font></td>'; 121 122 $s .= '<td align="center">'; 123 if ($row['project_priority'] < 0) { 124 $s .= '<img src="' . w2PfindImage('icons/priority-' . -$row['project_priority'] . '.gif') . '" width=13 height=16>'; 125 } elseif ($row['project_priority'] > 0) { 126 $s .= '<img src="' . w2PfindImage('icons/priority+' . $row['project_priority'] . '.gif') . '" width=13 height=16>'; 127 } 128 $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>'; 129 $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>'; 130 $s .= '<td nowrap="nowrap" align="center">' . ($start_date ? $start_date->format($df) : '-') . '</td>'; 131 $s .= '<td nowrap="nowrap" align="right">' . ($row['project_duration'] > 0 ? round($row['project_duration'], 0) . $AppUI->_('h') : '-') . '</td>'; 132 $s .= '<td nowrap="nowrap" align="center" nowrap="nowrap" style="background-color:' . $priority[$row['project_priority']]['color'] . '">'; 133 $s .= ($end_date ? $end_date->format($df) : '-'); 134 $s .= '</td><td nowrap="nowrap" align="center">'; 135 $s .= $actual_end_date ? '<a href="?m=tasks&a=view&task_id=' . $row['critical_task'] . '">' : ''; 136 $s .= $actual_end_date ? '<span ' . $style . '>' . $actual_end_date->format($df) . '</span>' : '-'; 137 $s .= $actual_end_date ? '</a>' : ''; 138 $s .= '</td><td align="center">'; 139 $s .= $row['task_log_problem'] ? '<a href="?m=tasks&a=index&f=all&project_id=' . $row['project_id'] . '">' : ''; 140 $s .= $row['task_log_problem'] ? w2PshowImage('icons/dialog-warning5.png', 16, 16, 'Problem', 'Problem') : '-'; 141 $s .= $row['task_log_problem'] ? '</a>' : ''; 142 $s .= '</td><td align="center" nowrap="nowrap">' . htmlspecialchars($row['owner_name'], ENT_QUOTES) . '</td>'; 143 $s .= '<td align="center" nowrap="nowrap">'; 144 $s .= $row['total_tasks'] . ($row['my_tasks'] ? ' (' . $row['my_tasks'] . ')' : ''); 145 $s .= '</td><td align="left" nowrap="nowrap">' . $AppUI->_($pstatus[$row['project_status']]) . '</td></tr>'; 146 echo $s; 147 } 148 } 149 if ($none) { 150 echo '<tr><td colspan="12">' . $AppUI->_('No projects available') . '</td></tr>'; 151 } 152 ?> 153 <tr> 154 <td colspan="12"> </td> 155 </tr> 156 </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 |