| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
1 <?php 2 # MantisBT - A PHP based bugtracking system 3 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. 8 # 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. 13 # 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/>. 16 17 /** 18 * @package MantisBT 19 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 20 * @link http://www.mantisbt.org 21 * 22 * @uses core.php 23 * @uses access_api.php 24 * @uses compress_api.php 25 * @uses config_api.php 26 * @uses database_api.php 27 * @uses form_api.php 28 * @uses gpc_api.php 29 * @uses helper_api.php 30 * @uses html_api.php 31 * @uses lang_api.php 32 * @uses print_api.php 33 * @uses string_api.php 34 * @uses user_api.php 35 */ 36 37 /** 38 * MantisBT Core API's 39 */ 40 require_once ( 'core.php' ); 41 require_api( 'access_api.php' ); 42 require_api( 'compress_api.php' ); 43 require_api( 'config_api.php' ); 44 require_api( 'database_api.php' ); 45 require_api( 'form_api.php' ); 46 require_api( 'gpc_api.php' ); 47 require_api( 'helper_api.php' ); 48 require_api( 'html_api.php' ); 49 require_api( 'lang_api.php' ); 50 require_api( 'print_api.php' ); 51 require_api( 'string_api.php' ); 52 require_api( 'user_api.php' ); 53 54 access_ensure_global_level( config_get( 'tag_view_threshold' ) ); 55 56 compress_enable(); 57 58 $t_can_edit = access_has_global_level( config_get( 'tag_edit_threshold' ) ); 59 $f_filter = utf8_strtoupper( gpc_get_string( 'filter', config_get( 'default_manage_tag_prefix' ) ) ); 60 $f_page_number = gpc_get_int( 'page_number', 1 ); 61 $t_tag_table = db_get_table( 'tag' ); 62 63 # Start Index Menu 64 $t_prefix_array = array( 'ALL' ); 65 66 for ( $i = 'A'; $i != 'AA'; $i++ ) { 67 $t_prefix_array[] = $i; 68 } 69 70 for ( $i = 0; $i <= 9; $i++ ) { 71 $t_prefix_array[] = "$i"; 72 } 73 74 $t_where_params = array(); 75 76 if ( $f_filter === 'ALL' ) { 77 $t_where = ''; 78 } else { 79 $t_where_params[] = $f_filter . '%'; 80 $t_where = 'WHERE ' . db_helper_like( 'name' ); 81 } 82 83 # Set the number of Tags per page. 84 $t_per_page = 20; 85 $t_offset = (( $f_page_number - 1 ) * $t_per_page ); 86 87 # Determine number of tags in tag table 88 $t_total_tag_count = 0; 89 $t_result = ''; 90 $t_query = "SELECT count(*) 91 FROM $t_tag_table 92 $t_where"; 93 94 $t_result = db_query_bound( $t_query, $t_where_params ); 95 $t_row = db_fetch_array( $t_result ); 96 $t_total_tag_count = (int)db_result( $t_result ); 97 98 #Number of pages from result 99 $t_page_count = ceil( $t_total_tag_count / $t_per_page ); 100 101 if ( $t_page_count < 1 ) { 102 $t_page_count = 1; 103 } 104 105 # Make sure $p_page_number isn't past the last page. 106 if ( $f_page_number > $t_page_count ) { 107 $f_page_number = $t_page_count; 108 } 109 110 # Make sure $p_page_number isn't before the first page 111 if ( $f_page_number < 1 ) { 112 $f_page_number = 1; 113 } 114 115 # Retrive Tags from tag table 116 $t_query = "SELECT * 117 FROM $t_tag_table 118 $t_where ORDER BY name"; 119 120 $t_result = db_query_bound( $t_query, $t_where_params, $t_per_page, $t_offset ); 121 122 html_page_top( lang_get( 'manage_tags_link' ) ); 123 print_manage_menu( 'manage_tags_page.php' ); ?> 124 125 <div id="manage-tags-filter-menu"> 126 <ul class="menu"><?php 127 foreach ( $t_prefix_array as $t_prefix ) { 128 $t_caption = ( $t_prefix === 'ALL' ? lang_get( 'show_all_tags' ) : $t_prefix ); 129 if ( $t_prefix == $f_filter ) { 130 $t_link = "<strong>$t_caption</strong>"; 131 } else { 132 $t_link = '<a href="manage_tags_page.php?filter=' . $t_prefix .'">' . $t_caption . '</a>'; 133 } 134 echo "<li>$t_link </li>"; 135 } ?> 136 </ul> 137 </div> 138 139 <div class="table-container"> 140 <h2><?php echo lang_get( 'manage_tags_link' ) ?> [<?php echo $t_total_tag_count ?>]</h2> 141 <div class="section-link"><?php print_link( '#tagcreate', lang_get( 'tag_create' ) ) ?></div> 142 <table cellspacing="1" cellpadding="5" border="1"> 143 <tr class="row-category"> 144 <td><?php echo lang_get( 'tag_name' ) ?></td> 145 <td><?php echo lang_get( 'tag_creator' ) ?></td> 146 <td><?php echo lang_get( 'tag_created' ) ?></td> 147 <td><?php echo lang_get( 'tag_updated' ) ?></td> 148 </tr><?php 149 foreach ( $t_result as $t_tag_row ) { 150 $t_tag_name = string_display_line( $t_tag_row['name'] ); 151 $t_tag_description = string_display( $t_tag_row['description'] ); ?> 152 <tr <?php echo helper_alternate_class() ?>><?php 153 if ( $t_can_edit ) { ?> 154 <td><a href="tag_view_page.php?tag_id=<?php echo $t_tag_row['id'] ?>" ><?php echo $t_tag_name ?></a></td><?php 155 } else { ?> 156 <td><?php echo $t_tag_name ?></td><?php 157 } ?> 158 <td><?php echo string_display_line( user_get_name( $t_tag_row['user_id'] ) ) ?></td> 159 <td><?php echo date( config_get( 'normal_date_format' ), $t_tag_row['date_created'] ) ?></td> 160 <td><?php echo date( config_get( 'normal_date_format' ), $t_tag_row['date_updated'] ) ?></td> 161 </tr><?php 162 } ?> 163 </table> 164 <div class="pager-links"><?php 165 /* @todo hack - pass in the hide inactive filter via cheating the actual filter value */ 166 print_page_links( 'manage_tags_page.php', 1, $t_page_count, (int)$f_page_number, $f_filter ); ?> 167 </div> 168 </div> 169 170 <?php if ( $t_can_edit ) { ?> 171 <div id="manage-tags-create-div" class="form-container"> 172 <a name="tagcreate" /> 173 <form id="manage-tags-create-form" method="post" action="tag_create.php"> 174 <fieldset class="has-required"> 175 <legend><span><?php echo lang_get( 'tag_create' ) ?></span></legend> 176 <?php echo form_security_field( 'tag_create' ); ?> 177 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>"> 178 <label for="tag-name" class="required"><span><?php echo lang_get( 'tag_name' ) ?></span></label> 179 <span class="input"><input type="text" id="tag-name" name="name" size="40" maxlength="100" /> 180 <span><?php echo sprintf( lang_get( 'tag_separate_by' ), config_get( 'tag_separator' ) ); ?></span> 181 </span> 182 <span class="label-style"></span> 183 </div> 184 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>"> 185 <label for="tag-description"><span><?php echo lang_get( 'tag_description' ) ?></span></label> 186 <span class="textarea"><textarea id="tag-description" name="description" cols="80" rows="6"></textarea></span> 187 <span class="label-style"></span> 188 </div> 189 <span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get( 'tag_create' ) ?>" /></span> 190 </fieldset> 191 </form> 192 </div> 193 <?php 194 } #End can Edit 195 196 html_page_bottom();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |