[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> manage_proj_page.php (source)

   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) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  20   * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  21   * @link http://www.mantisbt.org
  22   *
  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
  41   */
  42  
  43  /**
  44   * MantisBT Core API's
  45   */
  46  require_once ( 'core.php' );
  47  require_api( 'access_api.php' );
  48  require_api( 'authentication_api.php' );
  49  require_api( 'category_api.php' );
  50  require_api( 'config_api.php' );
  51  require_api( 'constant_inc.php' );
  52  require_api( 'form_api.php' );
  53  require_api( 'gpc_api.php' );
  54  require_api( 'helper_api.php' );
  55  require_api( 'html_api.php' );
  56  require_api( 'icon_api.php' );
  57  require_api( 'lang_api.php' );
  58  require_api( 'print_api.php' );
  59  require_api( 'project_api.php' );
  60  require_api( 'project_hierarchy_api.php' );
  61  require_api( 'string_api.php' );
  62  require_api( 'user_api.php' );
  63  require_api( 'utility_api.php' );
  64  
  65  auth_reauthenticate();
  66  
  67  $f_sort    = gpc_get_string( 'sort', 'name' );
  68  $f_dir    = gpc_get_string( 'dir', 'ASC' );
  69  
  70  if ( 'ASC' == $f_dir ) {
  71      $t_direction = ASCENDING;
  72  } else {
  73      $t_direction = DESCENDING;
  74  }
  75  
  76  html_page_top( lang_get( 'manage_projects_link' ) );
  77  
  78  print_manage_menu( 'manage_proj_page.php' );
  79  
  80  # Project Menu Form BEGIN
  81  ?>
  82  <div class="form-container">
  83      <h2><?php echo lang_get( 'projects_title' ); ?></h2><?php
  84  
  85      # Check the user's global access level before allowing project creation
  86      if ( access_has_global_level ( config_get( 'create_project_threshold' ) ) ) {
  87          print_button( 'manage_proj_create_page.php', lang_get( 'create_new_project_link' ) );
  88      } ?>
  89  
  90      <table cellspacing="1" cellpadding="5" border="1">
  91          <tr class="row-category">
  92              <td><?php
  93                  print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'name' ), 'name', $t_direction, $f_sort );
  94                  print_sort_icon( $t_direction, $f_sort, 'name' ); ?>
  95              </td>
  96              <td><?php
  97                  print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'status' ), 'status', $t_direction, $f_sort );
  98                  print_sort_icon( $t_direction, $f_sort, 'status' ); ?>
  99              </td>
 100              <td><?php
 101                  print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'enabled' ), 'enabled', $t_direction, $f_sort );
 102                  print_sort_icon( $t_direction, $f_sort, 'enabled' ); ?>
 103              </td>
 104              <td><?php
 105                  print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'view_status' ), 'view_state', $t_direction, $f_sort );
 106                  print_sort_icon( $t_direction, $f_sort, 'view_state' ); ?>
 107              </td>
 108              <td><?php
 109                  print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'description' ), 'description', $t_direction, $f_sort );
 110                  print_sort_icon( $t_direction, $f_sort, 'description' ); ?>
 111              </td>
 112          </tr><?php
 113          $t_manage_project_threshold = config_get( 'manage_project_threshold' );
 114          $t_projects = user_get_accessible_projects( auth_get_current_user_id(), true );
 115          $t_full_projects = array();
 116          foreach ( $t_projects as $t_project_id ) {
 117              $t_full_projects[] = project_get_row( $t_project_id );
 118          }
 119          $t_projects = multi_sort( $t_full_projects, $f_sort, $t_direction );
 120          $t_stack     = array( $t_projects );
 121  
 122          while ( 0 < count( $t_stack ) ) {
 123              $t_projects   = array_shift( $t_stack );
 124  
 125              if ( 0 == count( $t_projects ) ) {
 126                  continue;
 127              }
 128  
 129              $t_project = array_shift( $t_projects );
 130              $t_project_id = $t_project['id'];
 131              $t_level      = count( $t_stack );
 132  
 133              # only print row if user has project management privileges
 134              if (access_has_project_level( $t_manage_project_threshold, $t_project_id, auth_get_current_user_id() ) ) { ?>
 135              <tr <?php echo helper_alternate_class() ?>>
 136                  <td>
 137                      <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>
 138                  </td>
 139                  <td><?php echo get_enum_element( 'project_status', $t_project['status'] ) ?></td>
 140                  <td><?php echo trans_bool( $t_project['enabled'] ) ?></td>
 141                  <td><?php echo get_enum_element( 'project_view_state', $t_project['view_state'] ) ?></td>
 142                  <td><?php echo string_display_links( $t_project['description'] ) ?></td>
 143              </tr><?php
 144              }
 145              $t_subprojects = project_hierarchy_get_subprojects( $t_project_id, true );
 146  
 147              if ( 0 < count( $t_projects ) || 0 < count( $t_subprojects ) ) {
 148                  array_unshift( $t_stack, $t_projects );
 149              }
 150  
 151              if ( 0 < count( $t_subprojects ) ) {
 152                  $t_full_projects = array();
 153                  foreach ( $t_subprojects as $t_project_id ) {
 154                      $t_full_projects[] = project_get_row( $t_project_id );
 155                  }
 156                  $t_subprojects = multi_sort( $t_full_projects, $f_sort, $t_direction );
 157                  array_unshift( $t_stack, $t_subprojects );
 158              }
 159          } ?>
 160      </table>
 161  </div>
 162  
 163  <div id="categories" class="form-container">
 164      <h2><?php echo lang_get( 'global_categories' ) ?></h2>
 165      <table cellspacing="1" cellpadding="5" border="1"><?php
 166          $t_categories = category_get_all_rows( ALL_PROJECTS );
 167          if ( count( $t_categories ) > 0 ) { ?>
 168          <tr class="row-category">
 169              <td><?php echo lang_get( 'category' ) ?></td>
 170              <td><?php echo lang_get( 'assign_to' ) ?></td>
 171              <td class="center"><?php echo lang_get( 'actions' ) ?></td>
 172          </tr><?php
 173          }
 174  
 175      foreach ( $t_categories as $t_category ) {
 176          $t_id = $t_category['id'];
 177  
 178          $t_name = $t_category['name'];
 179          if ( NO_USER != $t_category['user_id'] && user_exists( $t_category['user_id'] )) {
 180              $t_user_name = user_get_name( $t_category['user_id'] );
 181          } else {
 182              $t_user_name = '';
 183          } ?>
 184  
 185          <tr <?php echo helper_alternate_class() ?>>
 186              <td><?php echo string_display( category_full_name( $t_category['id'], false ) )  ?></td>
 187              <td><?php echo string_display_line( $t_user_name ) ?></td>
 188              <td class="center">
 189                  <?php
 190                      $t_id = urlencode( $t_id );
 191                      $t_project_id = urlencode( ALL_PROJECTS );
 192  
 193                      print_button( "manage_proj_cat_edit_page.php?id=$t_id&project_id=$t_project_id", lang_get( 'edit_link' ) );
 194                      echo '&#160;';
 195                      print_button( "manage_proj_cat_delete.php?id=$t_id&project_id=$t_project_id", lang_get( 'delete_link' ) );
 196                  ?>
 197              </td>
 198          </tr><?php
 199      } # end for loop ?>
 200      </table>
 201  
 202      <form method="post" action="manage_proj_cat_add.php">
 203          <fieldset>
 204              <?php echo form_security_field( 'manage_proj_cat_add' ) ?>
 205              <input type="hidden" name="project_id" value="<?php echo ALL_PROJECTS ?>" />
 206              <input type="text" name="name" size="32" maxlength="128" />
 207              <input type="submit" class="button" value="<?php echo lang_get( 'add_category_button' ) ?>" />
 208          </fieldset>
 209      </form>
 210  </div>
 211  
 212  <?php
 213  html_page_bottom();


Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7