![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: printprojects.php 166 2008-05-16 21:30:25Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/projects/printprojects.php $ */ 2 global $AppUI, $w2Pconfig; 3 // check permissions for this module 4 $perms = &$AppUI->acl(); 5 $canView = $perms->checkModule($m, 'view'); 6 7 if (!$canView) { 8 $AppUI->redirect('m=public&a=access_denied'); 9 } 10 // load the companies class to retrieved denied companies 11 require_once ($AppUI->getModuleClass('companies')); 12 13 // End of project status update 14 /*if (isset( $_POST['projsearchtext'] )) { 15 $AppUI->setState( 'projsearchtext', $_POST['projsearchtext']); 16 } */ 17 18 $search_text = $AppUI->getState('projsearchtext') ? $AppUI->getState('projsearchtext') : ''; 19 20 $projectDesigner = $AppUI->getState('ProjIdxProjectDesigner') !== null ? $AppUI->getState('ProjIdxProjectDesigner') : 0; 21 22 // retrieve any state parameters 23 if (isset($_GET['tab'])) { 24 $AppUI->setState('ProjIdxTab', w2PgetParam($_GET, 'tab', null)); 25 } 26 $tab = $AppUI->getState('ProjIdxTab') !== null ? $AppUI->getState('ProjIdxTab') : 1; 27 $active = intval(!$AppUI->getState('ProjIdxTab')); 28 29 if (isset($_POST['company_id'])) { 30 $AppUI->setState('ProjIdxCompany', intval($_POST['company_id'])); 31 } 32 $company_id = $AppUI->getState('ProjIdxCompany') !== null ? $AppUI->getState('ProjIdxCompany') : $AppUI->user_company; 33 34 $company_prefix = 'company_'; 35 36 if (isset($_POST['department'])) { 37 $AppUI->setState('ProjIdxDepartment', $_POST['department']); 38 39 //if department is set, ignore the company_id field 40 unset($company_id); 41 } 42 $department = $AppUI->getState('ProjIdxDepartment') !== null ? $AppUI->getState('ProjIdxDepartment') : $company_prefix . $AppUI->user_company; 43 44 //if $department contains the $company_prefix string that it's requesting a company and not a department. So, clear the 45 // $department variable, and populate the $company_id variable. 46 if (!(strpos($department, $company_prefix) === false)) { 47 $company_id = substr($department, strlen($company_prefix)); 48 $AppUI->setState('ProjIdxCompany', $company_id); 49 unset($department); 50 } 51 52 if (isset($_GET['orderby'])) { 53 $orderdir = $AppUI->getState('ProjIdxOrderDir') ? ($AppUI->getState('ProjIdxOrderDir') == 'asc' ? 'desc' : 'asc') : 'desc'; 54 $AppUI->setState('ProjIdxOrderBy', w2PgetParam($_GET, 'orderby', null)); 55 $AppUI->setState('ProjIdxOrderDir', $orderdir); 56 } 57 $orderby = $AppUI->getState('ProjIdxOrderBy') ? $AppUI->getState('ProjIdxOrderBy') : 'project_end_date'; 58 $orderdir = $AppUI->getState('ProjIdxOrderDir') ? $AppUI->getState('ProjIdxOrderDir') : 'asc'; 59 60 if (isset($_POST['project_owner'])) { // this means that 61 $AppUI->setState('ProjIdxowner', $_POST['project_owner']); 62 } 63 $owner = $AppUI->getState('ProjIdxowner'); 64 65 $project_type = $AppUI->getState('ProjIdxType') !== null ? $AppUI->getState('ProjIdxType') : -1; 66 $project_types = array(-1 => '(all)') + w2PgetSysVal('ProjectType'); 67 68 // collect the full projects list data via function in projects.class.php 69 projects_list_data(); 70 71 72 ?> 73 <style type="text/css"> 74 /* Standard table 'spreadsheet' style */ 75 TABLE.prjprint { 76 background: #ffffff; 77 } 78 79 TABLE.prjprint TH { 80 background-color: #ffffff; 81 color: black; 82 list-style-type: disc; 83 list-style-position: inside; 84 border:solid 1px; 85 font-weight: normal; 86 font-size:13px; 87 } 88 89 TABLE.prjprint TD { 90 background-color: #ffffff; 91 font-size:13px; 92 } 93 94 TABLE.prjprint TR { 95 padding:5px; 96 } 97 98 </style> 99 <table width="100%" class="prjprint"> 100 101 <tr> 102 <td style="border: outset #d1d1cd 1px;" colspan="3"> 103 <table border="0" cellpadding="0" cellspacing="0" width="100%" class="prjprint"> 104 <tr> 105 <td width="22"> 106 107 </td> 108 <td align="center" colspan="2"> 109 <?php 110 echo '<strong> Projects List <strong>'; 111 ?> 112 </td> 113 </tr> 114 </table> 115 </td> 116 </tr> 117 <tr> 118 <td style="border: outset #d1d1cd 1px;" colspan="3"> 119 <table border="0" cellpadding="0" cellspacing="0" width="100%" class="prjprint"> 120 <tr> 121 <td width="22"> 122 123 </td> 124 <td align="center" colspan="2"> 125 <?php 126 $project_statuses = w2PgetSysVal('ProjectStatus'); 127 128 $active = 0; 129 $archived = 0; 130 131 foreach ($project_statuses as $key => $value) { 132 $counter[$key] = 0; 133 if (is_array($projects)) { 134 foreach ($projects as $p) { 135 if ($p['project_status'] == $key && $p['project_active'] > 0) { 136 ++$counter[$key]; 137 } 138 } 139 } 140 $project_statuses[$key] = $AppUI->_($project_statuses[$key], UI_OUTPUT_RAW) . ' (' . $counter[$key] . ')'; 141 } 142 143 if (is_array($projects)) { 144 foreach ($projects as $p) { 145 if ($p['project_active'] == 0) { 146 ++$archived; 147 } else { 148 ++$active; 149 } 150 } 151 } 152 153 $fixed_project_status_file = array($AppUI->_('In Progress', UI_OUTPUT_RAW) . ' (' . $active . ')' => 'vw_idx_active', $AppUI->_('Complete', UI_OUTPUT_RAW) . ' (' . $complete . ')' => 'vw_idx_complete', $AppUI->_('Archived', UI_OUTPUT_RAW) . ' (' . $archive . ')' => 'vw_idx_archived'); 154 // we need to manually add Archived project type because this status is defined by 155 // other field (Active) in the project table, not project_status 156 $project_statuses[] = $AppUI->_('Archived', UI_OUTPUT_RAW) . ' (' . $archived . ')'; 157 158 // Only display the All option in tabbed view, in plain mode it would just repeat everything else 159 // already in the page 160 $tabBox = new CTabBox('?m=projects', W2P_BASE_DIR . '/modules/projects/', $tab); 161 // This will overwrited the initial tabs, so we need to add that separately. 162 $allactive = (int)count($projects) - (int)($archived); 163 array_unshift($project_statuses, $AppUI->_('All Projects', UI_OUTPUT_RAW) . ' (' . count($projects) . ')', $AppUI->_('All Active', UI_OUTPUT_RAW) . ' (' . $allactive . ')'); 164 165 //Tabbed view 166 $currentTabId = ($AppUI->getState('ProjIdxTab') !== null ? $AppUI->getState('ProjIdxTab') : 0); 167 168 $show_all_projects = false; 169 if ($currentTabId == 0 || $currentTabId == -1) { 170 $show_all_projects = true; 171 //set it to 0 again in case we are on a flat view 172 $currentTabId == 0; 173 } 174 175 $project_status_filter = $currentTabId - 1; 176 177 $currentTabName = $project_statuses[$currentTabId]; 178 echo '<strong>' . $AppUI->_('Status') . ' (' . $AppUI->_('Records') . '): ' . $currentTabName . '<strong>'; 179 ?> 180 </td> 181 </tr> 182 </table> 183 </td> 184 </tr> 185 <tr> 186 <td style="border: outset #d1d1cd 1px;" colspan="3"> 187 <table border="0" cellpadding="0" cellspacing="0" width="100%" class="prjprint"> 188 <tr> 189 <td align="center" colspan="2"> 190 <?php 191 $txt = ' ' . $AppUI->_('Search') . ': ' . '<input type="text" disabled class="text" SIZE="20" name="projsearchtext" onChange="document.searchfilter.submit();" value=' . "'$search_text'" . 'title="' . $AppUI->_('Search in name and description fields') . '"/> '; 192 $txt .= $AppUI->_('Type') . ': ' . arraySelect($project_types, 'project_type', 'size="1" disabled class="text"', $project_type, false); 193 194 $q = new DBQuery(); 195 $q->addTable('projects', 'p'); 196 $q->addQuery('user_id, concat(contact_first_name, \' \', contact_last_name)'); 197 $q->leftJoin('users', 'u', 'u.user_id = p.project_owner'); 198 $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact'); 199 $q->addOrder('contact_first_name, contact_last_name'); 200 $q->addWhere('user_id > 0'); 201 $q->addWhere('p.project_owner IS NOT NULL'); 202 $user_list = array(0 => '(all)'); 203 $user_list = $user_list + $q->loadHashList(); 204 $txt .= $AppUI->_('Owner') . ': ' . arraySelect($user_list, 'project_owner', 'size="1" disabled class="text"', $owner, false); 205 206 $q = new DBQuery(); 207 $q->addTable('projects', 'p'); 208 $q->addQuery('user_id, concat(contact_first_name, \' \', contact_last_name)'); 209 $q->leftJoin('users', 'u', 'u.user_id = p.project_owner'); 210 $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact'); 211 $q->addOrder('contact_first_name, contact_last_name'); 212 $q->addWhere('user_id > 0'); 213 $user_list = array(0 => '(all)'); 214 $user_list = $user_list + $q->loadHashList(); 215 216 // requestors combo 217 /*$q = new DBQuery(); 218 $q->addTable('projects','p'); 219 $q->addQuery('user_id, concat(contact_first_name, \' \', contact_last_name)'); 220 $q->addJoin('users', 'u', 'u.user_id = p.project_requested_by', 'inner'); 221 $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact', 'inner'); 222 $q->addOrder('contact_first_name, contact_last_name'); 223 $q->addWhere('p.project_requested_by<>0'); 224 $req_list = array (0 =>'(all)'); 225 $req_list = $req_list + $q->loadHashList(); 226 echo $AppUI->_('Requested By') . ': '. 227 arraySelect($req_list, "project_requested_by", "size='1' class='text' disabled", $project_requested_by, false);*/ 228 229 $txt .= $AppUI->_('Company') . ': ' . str_replace('<select', '<select disabled="disabled"', $buffer); 230 echo $txt; 231 ?> 232 </td> 233 </tr> 234 </table> 235 </td> 236 </tr> 237 <?php 238 require (W2P_BASE_DIR . '/modules/projects/vw_projects.php'); 239 ?> 240 </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 |