r511: Added ability to disable status colouring on bug listing pages
[bugdar.git] / index.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
12
13 $fetchtemplates = array(
14 'TRACKERHOME',
15 'trackerhome_bits',
16 'pagenav',
17 'pagenav_bit'
18 );
19
20 define('SVN', '$Id$');
21
22 $focus['index'] = 'focus';
23
24 require_once('./global.php');
25 require_once('./includes/class_pagination.php');
26
27 if (!can_perform('canviewbugs'))
28 {
29 $message->error_permission();
30 }
31
32 // ###################################################################
33
34 $pagination = new Pagination('p', 'pp');
35 $count = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "bug" . (!can_perform('canviewhidden') ? " WHERE !hidden" : ""));
36 $pagination->total = $count['count'];
37 $pagination->split_pages();
38
39 $bugs_fetch = $db->query("
40 SELECT bug.*, user1.displayname AS firstreport, user2.displayname AS lastpost, user3.displayname AS hiddenlastpost
41 FROM " . TABLE_PREFIX . "bug AS bug
42 LEFT JOIN user AS user1
43 ON (bug.userid = user1.userid)
44 LEFT JOIN user AS user2
45 ON (bug.lastpostby = user2.userid)
46 LEFT JOIN user AS user3
47 ON (bug.hiddenlastpostby = user3.userid)" . ((!can_perform('canviewhidden')) ? "
48 WHERE !hidden" : "") . "
49 ORDER BY bug." . ((can_perform('canviewhidden')) ? "lastposttime" : "hiddenlastposttime") . " DESC
50 LIMIT " . $pagination->fetch_limit($pagination->page - 1) . ", " . $pagination->perpage
51 );
52
53 while ($bug = $db->fetch_array($bugs_fetch))
54 {
55 $funct->exec_swap_bg($stylevar['alt_colour'], '');
56 $bug['bgcolour'] = ($bugsys->userinfo['showcolours'] ? $bugsys->datastore['status']["$bug[status]"]['color'] : $funct->bgcolour);
57 $bug['product'] = $bugsys->datastore['product']["$bug[productid]"]['title'];
58 $bug['version'] = $bugsys->datastore['version']["$bug[versionid]"]['version'];
59 $bug['status'] = $bugsys->datastore['status']["$bug[status]"]['status'];
60 $bug['resolution'] = $bugsys->datastore['resolution']["$bug[resolution]"]['resolution'];
61
62 $bug['hiddendisplay'] = ((!can_perform('canviewhidden') AND $bug['hiddenlastposttime']) ? true : false);
63
64 $bug['lastposttime'] = (($bug['hiddendisplay']) ? $bug['hiddenlastposttime'] : $bug['lastposttime']);
65 $bug['lastpost'] = (($bug['hiddendisplay']) ? $bug['hiddenlastpost'] : $bug['lastpost']);
66
67 $bug['lastposttime'] = $datef->format($bugsys->options['dateformat'], $bug['lastposttime']);
68
69 eval('$bugs .= "' . $template->fetch('trackerhome_bits') . '";');
70 }
71
72 $db->free_result($bugs_fetch);
73
74 $show['pagenav'] = (($pagination->pagecount > 1) ? true : false);
75 $pagenav = $pagination->construct_page_nav('index.php');
76
77 eval('$template->flush("' . $template->fetch('TRACKERHOME') . '");');
78
79 /*=====================================================================*\
80 || ###################################################################
81 || # $HeadURL$
82 || # $Id$
83 || ###################################################################
84 \*=====================================================================*/
85 ?>