function setFilter() { global $dbInst, $loginInst; if (!$loginInst->hasAccess("request.setFilter")) { return false; } $filter = "where " . $dbInst->config['table_request'] . ".project_id = " . $dbInst->config['table_project'] . ".id "; $filter .= "and " . $dbInst->config['table_request'] . ".priority_id = " . $dbInst->config['table_taskpriority'] . ".id "; $filter .= "and " . $dbInst->config['table_request'] . ".type_id = " . $dbInst->config['table_tasktype'] . ".id "; // customers should only be able to view requests for own projects if ($loginInst->isCustomer()) { $projectInst = new project(); $list = $projectInst->getList(); if ($projectInst->matches >= 1) { $filter .= "and ("; } $or = ""; while ($element = current($list)) { $filter .= " " . $or . " (" . $dbInst->config['table_request'] . ".project_id = '" . $element . "')"; $or = "or"; next($list); } if ($projectInst->matches >= 1) { $filter .= ")"; } } return $filter; }
<table border="0" cellpadding="2" cellspacing="1" width="99%" bgcolor="#ffffff"> <tr> <?php echo "<th width=\"20%\" align=left><a href=\"" . $toolInst->encodeUrl("index.php?content=projects.php&order=name&desc=" . $desc) . "\" title=\"" . $lang['common_orderByProject'] . "\">" . $lang['common_project'] . "</a></th>\n"; echo "<th width=\"30%\" align=left><a href=\"" . $toolInst->encodeUrl("index.php?content=projects.php&order=description&desc=" . $desc) . "\" title=\"" . $lang['project_orderByDescription'] . "\">" . $lang['common_description'] . "</a></th>\n"; if (!$loginInst->isCustomer()) { echo "<th width=\"20%\" align=left><a href=\"" . $toolInst->encodeUrl("index.php?content=projects.php&order=customer&desc=" . $desc) . "\" title=\"" . $lang['project_orderByCustomer'] . "\">" . $lang['common_customer'] . "</a></th>\n"; } echo "<th width=\"20%\" align=left><a href=\"" . $toolInst->encodeUrl("index.php?content=projects.php&order=projectstatus_id&desc=" . $desc) . "\" title=\"" . $lang['common_orderByStatus'] . "\">" . $lang['common_status'] . "</a></th>\n"; echo "<th width=\"20%\" align=left><a href=\"" . $toolInst->encodeUrl("index.php?content=projects.php&order=priority_id&desc=" . $desc) . "\" title=\"" . $lang['common_orderByPriority'] . "\">" . $lang['common_priority'] . "</a></th>\n"; if (!$loginInst->isCustomer()) { echo "<th>" . $lang['project_paid'] . "</th>\n"; echo "<th colspan=2>" . $lang['common_action'] . "</th>\n"; } echo "</tr>\n"; $list = $projectInst->getList($order, $desc); $style = "light"; while ($element = current($list)) { $projectInst->activate($element); ?> <tr class="<?php echo $style; ?> " onmouseover="this.style.backgroundColor='#fafafa'" onmouseout="this.style.backgroundColor=''"><?php echo "<td><a href=\"javascript:openwindow('" . $toolInst->encodeUrl("index.php?content=projectdetails.php&view=details&projectid=" . $element) . "',width='500',height='500')\" title=\"" . $lang['common_showDetailsForThisProject'] . "\">" . $projectInst->name . "</a></td>\n"; echo "<td>" . $projectInst->description . "</td>\n"; $customerInst = new customer($projectInst->customerId); if (!$loginInst->isCustomer()) { echo "<td><a href=\"javascript:openwindow('" . $toolInst->encodeUrl("index.php?content=customerdetails.php&view=details&customerid=" . $customerInst->id) . "',width='500',height='500')\" title=\"" . $lang['project_showDetailsForThisCustomer'] . "\">" . $customerInst->company . "</a></td>\n"; } echo "<td>" . $projectInst->getStatusName() . "</td>\n";
</a>)<?php } else { echo $lang['requests_newRequest']; } ?> </h2> <table border="0" cellpadding="2" cellspacing="0"> <tr> <td><?php echo $lang['common_project']; ?> : </td> <td><select name="projectid"> <?php $projectInst = new project(); $list = $projectInst->getList(); while ($element = current($list)) { $projectInst->activate($element); $selected = ""; if ($projectInst->id == $requestInst->projectId) { $selected = "selected"; } echo "<option " . $selected . " value=\"" . $projectInst->id . "\">" . $projectInst->name . "\n"; next($list); } ?> </select></td> </tr><tr> <td><?php echo $lang['common_subject']; ?>