Move some functions that were previously declared in admin/global.php to a new includ...
[bugdar.git] / includes / functions_admin.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright (c)2004-2009 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 2 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 /**
23 * Fetches, evaluates, and returns the footer template
24 *
25 * @return string Footer template code
26 */
27 function admin_footer()
28 {
29 return BSTemplate::fetch('footer')->evaluate()->getTemplate();
30 }
31
32 /**
33 * Displays the login screen and ends execution of the script
34 */
35 function admin_login()
36 {
37 BSTemplate::fetch('login')->evaluate()->flush();
38 exit;
39 }
40
41 /**
42 * Callback function for the Pagination->BitProcessor()
43 *
44 * @param string Base link
45 * @param bool Do not show this as a link
46 * @param integer Page number
47 * @param object Page navigator framework
48 *
49 * @return string Processed HTML
50 */
51 function AdminPageNavigatorBitCallback($baselink, $nolink, $number, $paginator)
52 {
53 if ($nolink)
54 {
55 return '<strong>' . $number . '</strong>' . "\n";
56 }
57 else
58 {
59 return '<a href="' . $baselink . 'p=' . $number . '&amp;pp=' . $paginator->getPerPage() . '">' . $number . '</a>' . "\n";
60 }
61 }
62
63 /**
64 * Callback function for the Pagination->NavigatorProcessor()
65 *
66 * @param string Base URL
67 * @param integer Next page number
68 * @param integer Previous page number
69 * @param array Show information
70 * @param string Individual page bits
71 * @param object Page navigator framework
72 *
73 * @return string Processed HTML
74 */
75 function AdminPageNavigatorCallback($baselink, $nextpage, $prevpage, $show, $pagebits, $paginator)
76 {
77 global $stylevar;
78
79 $return = '';
80
81 if ($show['first'])
82 {
83 $return .= '<a href="' . $baselink . 'p=1&amp;pp=' . $paginator->getPerPage() . '">' . T('First') . '</a> ...';
84 }
85 if ($show['prev'])
86 {
87 $return .= '<a href="' . $baselink . 'p=' . $prevpage . '&amp;pp=' . $paginator->getPerPage() . '">' . T('Prev') . '</a> ...';
88 }
89
90 $return .= $pagebits;
91
92 if ($show['next'])
93 {
94 $return .= '... <a href="' . $baselink . 'p=' . $nextpage . '&amp;pp=' . $paginator->getPerPage() . '">' . T('Next') . '</a>';
95 }
96 if ($show['last'])
97 {
98 $return .= '... <a href="' . $baselink . 'p=' . $paginator->getPageCount() . '&amp;pp=' . $paginator->getPerPage() . '">' . T('Last') . '</a>';
99 }
100 return '<div style="margin-top: 15px; float: ' . $stylevar['right'] . '">' . $return . '</div>';
101 }
102
103 ?>