r1341: The basic workings of column ordering appear to now work
[bugdar.git] / index.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 $fetchtemplates = array(
23 'trackerhome',
24 'trackerhome_bits',
25 'pagenav',
26 'pagenav_bit'
27 );
28
29 define('SVN', '$Id$');
30
31 $focus['index'] = 'focus';
32
33 require_once('./global.php');
34 require_once('./includes/class_sort.php');
35
36 if (!can_perform('canviewbugs'))
37 {
38 $message->error_permission();
39 }
40
41 $sort = new ListSorter('index');
42 LoadPaginationFramework();
43
44 // ###################################################################
45
46 $count = $db->query_first("
47 SELECT COUNT(*) AS count
48 FROM " . TABLE_PREFIX . "bug
49 WHERE (!hidden OR (hidden AND product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR (hidden AND userid = " . $bugsys->userinfo['userid'] . " AND product IN (" . fetch_on_bits('canviewownhidden') . "))" : "") . ")
50 AND product IN (" . fetch_on_bits('canviewbugs') . ")" . (($bugsys->options['hidestatuses'] OR isset($bugsys->userinfo['hidestatuses'])) ? "
51 AND status NOT IN (" . ($bugsys->userinfo['hidestatuses'] != '' ? $bugsys->userinfo['hidestatuses'] : $bugsys->options['hidestatuses']) . ")" : "")
52 );
53
54 $pagination->setTotal($count['count']);
55 $pagination->splitPages();
56
57 $bugs_fetch = $db->query($sort->fetch_sql_query(null, $pagination->fetchLimit($pagination->getPage() - 1) . ", " . $pagination->getPerPage()));
58
59 while ($bug = $db->fetch_array($bugs_fetch))
60 {
61 $funct->exec_swap_bg($stylevar['alt_color'], '');
62 ProcessBugDataForDisplay(&$bug, $funct->bgcolour);
63 $bugs .= $sort->constructRow($bug);
64 }
65
66 $db->free_result($bugs_fetch);
67
68 $columnHeads = $sort->constructColumnHeaders(true);
69
70 $order = $sort->fetch_display_array('p=' . $pagination->page . '&amp;pp=' . $pagination->perpage);
71 $show['pagenav'] = ($pagination->getPageCount() > 1);
72 $pagenav = $pagination->constructPageNav($sort->fetch_sort_link($sort->sortkey));
73
74 eval('$template->flush("' . $template->fetch('trackerhome') . '");');
75
76 /*=====================================================================*\
77 || ###################################################################
78 || # $HeadURL$
79 || # $Id$
80 || ###################################################################
81 \*=====================================================================*/
82 ?>