Fix #11417: Allow EVENT_MENU_MAIN plugin events to return null
[mantis/radio.git] / manage_proj_page.php
blob02729290849045b1de04ea5e1551f89e2e409a1d
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 * @package MantisBT
19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
20 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
21 * @link http://www.mantisbt.org
23 * @uses core.php
24 * @uses access_api.php
25 * @uses authentication_api.php
26 * @uses category_api.php
27 * @uses config_api.php
28 * @uses constant_inc.php
29 * @uses form_api.php
30 * @uses gpc_api.php
31 * @uses helper_api.php
32 * @uses html_api.php
33 * @uses icon_api.php
34 * @uses lang_api.php
35 * @uses print_api.php
36 * @uses project_api.php
37 * @uses project_hierarchy_api.php
38 * @uses string_api.php
39 * @uses user_api.php
40 * @uses utility_api.php
43 require_once( 'core.php' );
44 require_api( 'access_api.php' );
45 require_api( 'authentication_api.php' );
46 require_api( 'category_api.php' );
47 require_api( 'config_api.php' );
48 require_api( 'constant_inc.php' );
49 require_api( 'form_api.php' );
50 require_api( 'gpc_api.php' );
51 require_api( 'helper_api.php' );
52 require_api( 'html_api.php' );
53 require_api( 'icon_api.php' );
54 require_api( 'lang_api.php' );
55 require_api( 'print_api.php' );
56 require_api( 'project_api.php' );
57 require_api( 'project_hierarchy_api.php' );
58 require_api( 'string_api.php' );
59 require_api( 'user_api.php' );
60 require_api( 'utility_api.php' );
62 auth_reauthenticate();
64 $f_sort = gpc_get_string( 'sort', 'name' );
65 $f_dir = gpc_get_string( 'dir', 'ASC' );
67 if ( 'ASC' == $f_dir ) {
68 $t_direction = ASCENDING;
69 } else {
70 $t_direction = DESCENDING;
73 html_page_top( lang_get( 'manage_projects_link' ) );
75 print_manage_menu( 'manage_proj_page.php' );
77 # Project Menu Form BEGIN
79 <br />
80 <table class="width100" cellspacing="1">
81 <tr>
82 <td class="form-title" colspan="5">
83 <?php
84 echo lang_get( 'projects_title' );
86 # Check the user's global access level before allowing project creation
87 if ( access_has_global_level ( config_get( 'create_project_threshold' ) ) ) {
88 print_button( 'manage_proj_create_page.php', lang_get( 'create_new_project_link' ) );
91 </td>
92 </tr>
93 <tr class="row-category">
94 <td width="20%">
95 <?php
96 print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'name' ), 'name', $t_direction, $f_sort );
97 print_sort_icon( $t_direction, $f_sort, 'name' );
99 </td>
100 <td width="10%">
101 <?php
102 print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'status' ), 'status', $t_direction, $f_sort );
103 print_sort_icon( $t_direction, $f_sort, 'status' );
105 </td>
106 <td width="10%">
107 <?php
108 print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'enabled' ), 'enabled', $t_direction, $f_sort );
109 print_sort_icon( $t_direction, $f_sort, 'enabled' );
111 </td>
112 <td width="10%">
113 <?php
114 print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'view_status' ), 'view_state', $t_direction, $f_sort );
115 print_sort_icon( $t_direction, $f_sort, 'view_state' );
117 </td>
118 <td width="40%">
119 <?php
120 print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'description' ), 'description', $t_direction, $f_sort );
121 print_sort_icon( $t_direction, $f_sort, 'description' );
123 </td>
124 </tr>
125 <?php
126 $t_manage_project_threshold = config_get( 'manage_project_threshold' );
127 $t_projects = user_get_accessible_projects( auth_get_current_user_id(), true );
128 $t_full_projects = array();
129 foreach ( $t_projects as $t_project_id ) {
130 $t_full_projects[] = project_get_row( $t_project_id );
132 $t_projects = multi_sort( $t_full_projects, $f_sort, $t_direction );
133 $t_stack = array( $t_projects );
135 while ( 0 < count( $t_stack ) ) {
136 $t_projects = array_shift( $t_stack );
138 if ( 0 == count( $t_projects ) ) {
139 continue;
142 $t_project = array_shift( $t_projects );
143 $t_project_id = $t_project['id'];
144 $t_level = count( $t_stack );
146 # only print row if user has project management privileges
147 if (access_has_project_level( $t_manage_project_threshold, $t_project_id, auth_get_current_user_id() ) ) {
150 <tr <?php echo helper_alternate_class() ?>>
151 <td>
152 <a href="manage_proj_edit_page.php?project_id=<?php echo $t_project['id'] ?>"><?php echo str_repeat( "&raquo; ", $t_level ) . string_display( $t_project['name'] ) ?></a>
153 </td>
154 <td>
155 <?php echo get_enum_element( 'project_status', $t_project['status'] ) ?>
156 </td>
157 <td>
158 <?php echo trans_bool( $t_project['enabled'] ) ?>
159 </td>
160 <td>
161 <?php echo get_enum_element( 'project_view_state', $t_project['view_state'] ) ?>
162 </td>
163 <td>
164 <?php echo string_display_links( $t_project['description'] ) ?>
165 </td>
166 </tr>
167 <?php
169 $t_subprojects = project_hierarchy_get_subprojects( $t_project_id, true );
171 if ( 0 < count( $t_projects ) || 0 < count( $t_subprojects ) ) {
172 array_unshift( $t_stack, $t_projects );
175 if ( 0 < count( $t_subprojects ) ) {
176 $t_full_projects = array();
177 foreach ( $t_subprojects as $t_project_id ) {
178 $t_full_projects[] = project_get_row( $t_project_id );
180 $t_subprojects = multi_sort( $t_full_projects, $f_sort, $t_direction );
181 array_unshift( $t_stack, $t_subprojects );
185 </table>
186 <br/>
188 <!-- GLOBAL CATEGORIES -->
189 <a name="categories" />
190 <div align="center">
191 <table class="width75" cellspacing="1">
193 <!-- Title -->
194 <tr>
195 <td class="form-title" colspan="3">
196 <?php echo lang_get( 'global_categories' ) ?>
197 </td>
198 </tr>
199 <?php
200 $t_categories = category_get_all_rows( ALL_PROJECTS );
202 if ( count( $t_categories ) > 0 ) {
204 <tr class="row-category">
205 <td>
206 <?php echo lang_get( 'category' ) ?>
207 </td>
208 <td>
209 <?php echo lang_get( 'assign_to' ) ?>
210 </td>
211 <td class="center">
212 <?php echo lang_get( 'actions' ) ?>
213 </td>
214 </tr>
215 <?php
218 foreach ( $t_categories as $t_category ) {
219 $t_id = $t_category['id'];
221 $t_name = $t_category['name'];
222 if ( NO_USER != $t_category['user_id'] && user_exists( $t_category['user_id'] )) {
223 $t_user_name = user_get_name( $t_category['user_id'] );
224 } else {
225 $t_user_name = '';
228 <!-- Repeated Info Row -->
229 <tr <?php echo helper_alternate_class() ?>>
230 <td>
231 <?php echo string_display( category_full_name( $t_category['id'], false ) ) ?>
232 </td>
233 <td>
234 <?php echo string_display_line( $t_user_name ) ?>
235 </td>
236 <td class="center">
237 <?php
238 $t_id = urlencode( $t_id );
239 $t_project_id = urlencode( ALL_PROJECTS );
241 print_button( "manage_proj_cat_edit_page.php?id=$t_id&project_id=$t_project_id", lang_get( 'edit_link' ) );
242 echo '&nbsp;';
243 print_button( "manage_proj_cat_delete.php?id=$t_id&project_id=$t_project_id", lang_get( 'delete_link' ) );
245 </td>
246 </tr>
247 <?php
248 } # end for loop
251 <!-- Add Category Form -->
252 <tr>
253 <td class="left" colspan="3">
254 <form method="post" action="manage_proj_cat_add.php">
255 <?php echo form_security_field( 'manage_proj_cat_add' ) ?>
256 <input type="hidden" name="project_id" value="<?php echo ALL_PROJECTS ?>" />
257 <input type="text" name="name" size="32" maxlength="128" />
258 <input type="submit" class="button" value="<?php echo lang_get( 'add_category_button' ) ?>" />
259 </form>
260 </td>
261 </tr>
263 </table>
264 </div>
266 <?php
267 html_page_bottom();