Fix #11417: Allow EVENT_MENU_MAIN plugin events to return null
[mantis/radio.git] / print_all_bug_page.php
blobdd56fbda0a0aeeb966a18c7c8afe70629f705b99
1 <?php
2 # MantisBT - A PHP based bugtracking system
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * Bugs to display / print / export can be selected with the checkboxes
19 * A printing Options link allows to choose the fields to export
20 * Export :
21 * - the bugs displayed in print_all_bug_page.php are saved in a .doc or .xls file
22 * - the IE icons allows to see or directly print the same result
24 * @package MantisBT
25 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
26 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
27 * @link http://www.mantisbt.org
29 * @uses core.php
30 * @uses authentication_api.php
31 * @uses config_api.php
32 * @uses constant_inc.php
33 * @uses filter_api.php
34 * @uses filter_constants_inc.php
35 * @uses gpc_api.php
36 * @uses helper_api.php
37 * @uses html_api.php
38 * @uses lang_api.php
39 * @uses print_api.php
40 * @uses project_api.php
41 * @uses string_api.php
42 * @uses utility_api.php
45 require_once( 'core.php' );
46 require_api( 'authentication_api.php' );
47 require_api( 'config_api.php' );
48 require_api( 'constant_inc.php' );
49 require_api( 'filter_api.php' );
50 require_api( 'filter_constants_inc.php' );
51 require_api( 'gpc_api.php' );
52 require_api( 'helper_api.php' );
53 require_api( 'html_api.php' );
54 require_api( 'lang_api.php' );
55 require_api( 'print_api.php' );
56 require_api( 'project_api.php' );
57 require_api( 'string_api.php' );
58 require_api( 'utility_api.php' );
60 auth_ensure_user_authenticated();
62 $f_search = gpc_get_string( FILTER_PROPERTY_FREE_TEXT, false ); /** @todo need a better default */
63 $f_offset = gpc_get_int( 'offset', 0 );
65 $t_cookie_value_id = gpc_get_cookie( config_get( 'view_all_cookie' ), '' );
66 $t_cookie_value = filter_db_get_filter( $t_cookie_value_id );
68 $f_highlight_changed = 0;
69 $f_sort = null;
70 $f_dir = null;
71 $t_project_id = 0;
73 $t_columns = helper_get_columns_to_view( COLUMNS_TARGET_PRINT_PAGE );
74 $t_num_of_columns = count( $t_columns );
76 # check to see if the cookie exists
77 if ( !is_blank( $t_cookie_value ) ) {
79 # check to see if new cookie is needed
80 if ( !filter_is_cookie_valid() ) {
81 print_header_redirect( 'view_all_set.php?type=0&print=1' );
84 $t_setting_arr = explode( '#', $t_cookie_value, 2 );
85 $t_filter_cookie_arr = unserialize( $t_setting_arr[1] );
87 $f_highlight_changed = $t_filter_cookie_arr[ FILTER_PROPERTY_HIGHLIGHT_CHANGED ];
88 $f_sort = $t_filter_cookie_arr[ FILTER_PROPERTY_SORT_FIELD_NAME ];
89 $f_dir = $t_filter_cookie_arr[ FILTER_PROPERTY_SORT_DIRECTION ];
90 $t_project_id = helper_get_current_project();
93 # This replaces the actual search that used to be here
94 $f_page_number = gpc_get_int( 'page_number', 1 );
95 $t_per_page = -1;
96 $t_bug_count = null;
97 $t_page_count = null;
99 $result = filter_get_bug_rows( $f_page_number, $t_per_page, $t_page_count, $t_bug_count );
100 $row_count = count( $result );
102 # for export
103 $t_show_flag = gpc_get_int( 'show_flag', 0 );
105 html_page_top1();
106 html_head_end();
107 html_body_begin();
110 <table class="width100"><tr><td class="form-title">
111 <div class="center">
112 <?php echo string_display( config_get( 'window_title' ) ) . ' - ' . string_display( project_get_name( $t_project_id ) ); ?>
113 </div>
114 </td></tr></table>
116 <br />
118 <form method="post" action="view_all_set.php">
119 <?php # CSRF protection not required here - form does not result in modifications ?>
120 <input type="hidden" name="type" value="1" />
121 <input type="hidden" name="print" value="1" />
122 <input type="hidden" name="offset" value="0" />
123 <input type="hidden" name="<?php echo FILTER_PROPERTY_SORT_FIELD_NAME; ?>" value="<?php echo $f_sort ?>" />
124 <input type="hidden" name="<?php echo FILTER_PROPERTY_SORT_DIRECTION; ?>" value="<?php echo $f_dir ?>" />
126 <table class="width100" cellpadding="2px">
127 <?php
128 #<SQLI> Excel & Print export
129 #$f_bug_array stores the number of the selected rows
130 #$t_bug_arr_sort is used for displaying
131 #$f_export is a string for the word and excel pages
133 $f_bug_arr = gpc_get_int_array( 'bug_arr', array() );
134 $f_bug_arr[$row_count]=-1;
136 for( $i=0; $i < $row_count; $i++ ) {
137 if ( isset( $f_bug_arr[$i] ) ) {
138 $index = $f_bug_arr[$i];
139 $t_bug_arr_sort[$index]=1;
142 $f_export = implode( ',', $f_bug_arr );
144 $t_icon_path = config_get( 'icon_path' );
147 <tr>
148 <td colspan="<?php echo $t_num_of_columns ?>">
149 <?php
150 if ( 'DESC' == $f_dir ) {
151 $t_new_dir = 'ASC';
152 } else {
153 $t_new_dir = 'DESC';
156 $t_search = urlencode( $f_search );
158 $t_icons = array(
159 array( 'print_all_bug_page_word', 'word', '', 'fileicons/doc.gif', 'Word 2000' ),
160 array( 'print_all_bug_page_word', 'html', 'target="_blank"', 'ie.gif', 'Word View' ) );
162 foreach ( $t_icons as $t_icon ) {
163 echo '<a href="' . $t_icon[0] . '.php' .
164 '?' . FILTER_PROPERTY_FREE_TEXT . "=$t_search" .
165 '&amp;' . FILTER_PROPERTY_SORT_FIELD_NAME . "=$f_sort" .
166 '&amp;' . FILTER_PROPERTY_SORT_DIRECTION . "=$t_new_dir" .
167 '&amp;type_page=' . $t_icon[1] .
168 "&amp;export=$f_export" .
169 "&amp;show_flag=$t_show_flag" .
170 '" ' . $t_icon[2] . '>' .
171 '<img src="' . $t_icon_path . $t_icon[3] . '" border="0" align="absmiddle" alt="' . $t_icon[4] . '" /></a> ';
174 </td>
175 </tr>
176 <?php #<SQLI> ?>
177 </table>
179 </form>
181 <br />
183 <form method="post" action="print_all_bug_page.php">
184 <?php # CSRF protection not required here - form does not result in modifications ?>
185 <table class="width100" cellspacing="1" cellpadding="2px">
186 <tr>
187 <td class="form-title" colspan="<?php echo $t_num_of_columns / 2 + $t_num_of_columns % 2; ?>">
188 <?php
189 echo lang_get( 'viewing_bugs_title' );
191 if ( $row_count > 0 ) {
192 $v_start = $f_offset+1;
193 $v_end = $f_offset+$row_count;
194 } else {
195 $v_start = 0;
196 $v_end = 0;
198 echo "( $v_start - $v_end )";
200 </td>
201 <td class="right" colspan="<?php echo $t_num_of_columns / 2 ?>">
202 <?php
203 # print_bracket_link( 'print_all_bug_options_page.php', lang_get( 'printing_options_link' ) );
204 # print_bracket_link( 'view_all_bug_page.php', lang_get( 'view_bugs_link' ) );
205 # print_bracket_link( 'summary_page.php', lang_get( 'summary' ) );
207 </td>
208 </tr>
209 <tr class="row-category">
210 <?php
211 $t_sort = $f_sort; // used within the custom function called in the loop (@todo cleanup)
212 $t_dir = $f_dir; // used within the custom function called in the loop (@todo cleanup)
214 foreach( $t_columns as $t_column ) {
215 $t_title_function = 'print_column_title';
216 helper_call_custom_function( $t_title_function, array( $t_column, COLUMNS_TARGET_PRINT_PAGE ) );
219 </tr>
220 <tr class="spacer">
221 <td colspan="9"></td>
222 </tr>
223 <?php
224 for( $i=0; $i < $row_count; $i++ ) {
225 $t_row = $result[$i];
227 # alternate row colors
228 $status_color = helper_alternate_colors( $i, '#ffffff', '#dddddd' );
229 if ( isset( $t_bug_arr_sort[ $t_row->id ] ) || ( $t_show_flag==0 ) ) {
231 <tr bgcolor="<?php echo $status_color ?>" border="1" valign="top">
232 <?php
233 foreach( $t_columns as $t_column ) {
234 $t_column_value_function = 'print_column_value';
235 helper_call_custom_function( $t_column_value_function, array( $t_column, $t_row, COLUMNS_TARGET_PRINT_PAGE ) );
238 </tr>
239 <?php
240 } # isset_loop
241 } # for_loop
243 <input type="hidden" name="show_flag" value="1" />
244 </table>
246 <br />
248 <input type="submit" class="button" value="<?php echo lang_get( 'hide_button' ) ?>" />
249 </form>