[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> account_prefs_inc.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 - 2010  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  21   * @link http://www.mantisbt.org
  22   *
  23   * @uses authentication_api.php
  24   * @uses config_api.php
  25   * @uses constant_inc.php
  26   * @uses event_api.php
  27   * @uses form_api.php
  28   * @uses helper_api.php
  29   * @uses html_api.php
  30   * @uses lang_api.php
  31   * @uses print_api.php
  32   * @uses user_api.php
  33   * @uses user_pref_api.php
  34   * @uses utility_api.php
  35   */
  36  
  37  if ( !defined( 'ACCOUNT_PREFS_INC_ALLOW' ) ) {
  38      return;
  39  }
  40  
  41  require_api( 'authentication_api.php' );
  42  require_api( 'config_api.php' );
  43  require_api( 'constant_inc.php' );
  44  require_api( 'event_api.php' );
  45  require_api( 'form_api.php' );
  46  require_api( 'helper_api.php' );
  47  require_api( 'html_api.php' );
  48  require_api( 'lang_api.php' );
  49  require_api( 'print_api.php' );
  50  require_api( 'user_api.php' );
  51  require_api( 'user_pref_api.php' );
  52  require_api( 'utility_api.php' );
  53  
  54  function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_accounts_menu = true, $p_redirect_url = '') {
  55      if ( null === $p_user_id ) {
  56          $p_user_id = auth_get_current_user_id();
  57      }
  58  
  59      $t_redirect_url = $p_redirect_url;
  60      if ( is_blank( $t_redirect_url ) ) {
  61          $t_redirect_url = 'account_prefs_page.php';
  62      }
  63  
  64      # protected account check
  65      if ( user_is_protected( $p_user_id ) ) {
  66          if ( $p_error_if_protected ) {
  67              trigger_error( ERROR_PROTECTED_ACCOUNT, ERROR );
  68          } else {
  69              return;
  70          }
  71      }
  72  
  73      # prefix data with u_
  74      $t_pref = user_pref_get( $p_user_id );
  75  
  76  # Account Preferences Form BEGIN
  77  ?>
  78  <br />
  79  <div align="center">
  80  <form method="post" action="account_prefs_update.php">
  81  <?php echo form_security_field( 'account_prefs_update' ) ?>
  82  <input type="hidden" name="user_id" value="<?php echo $p_user_id ?>" />
  83  <input type="hidden" name="redirect_url" value="<?php echo $t_redirect_url ?>" />
  84  <table class="width75" cellspacing="1">
  85  <tr>
  86      <td class="form-title">
  87          <?php echo lang_get( 'default_account_preferences_title' ) ?>
  88      </td>
  89      <td class="right">
  90          <?php
  91              if ( $p_accounts_menu ) {
  92                  print_account_menu( 'account_prefs_page.php' );
  93              }
  94          ?>
  95      </td>
  96  </tr>
  97  <tr <?php echo helper_alternate_class() ?>>
  98      <td class="category" width="50%">
  99          <?php echo lang_get( 'default_project' ) ?>
 100      </td>
 101      <td width="50%">
 102          <select name="default_project">
 103              <?php print_project_option_list( $t_pref->default_project ) ?>
 104          </select>
 105      </td>
 106  </tr>
 107  <tr <?php echo helper_alternate_class() ?>>
 108      <td class="category">
 109          <?php echo lang_get( 'refresh_delay' ) ?>
 110      </td>
 111      <td>
 112          <input type="text" name="refresh_delay" size="4" maxlength="4" value="<?php echo $t_pref->refresh_delay ?>" /> <?php echo lang_get( 'minutes' ) ?>
 113      </td>
 114  </tr>
 115  <tr <?php echo helper_alternate_class() ?>>
 116      <td class="category">
 117          <?php echo lang_get( 'redirect_delay' ) ?>
 118      </td>
 119      <td>
 120          <input type="text" name="redirect_delay" size="4" maxlength="3" value="<?php echo $t_pref->redirect_delay ?>" /> <?php echo lang_get( 'seconds' ) ?>
 121      </td>
 122  </tr>
 123  <tr <?php echo helper_alternate_class() ?>>
 124      <td class="category">
 125          <?php echo lang_get( 'bugnote_order' ) ?>
 126      </td>
 127      <td>
 128          <label><input type="radio" name="bugnote_order" value="ASC" <?php check_checked( $t_pref->bugnote_order, 'ASC' ); ?> /><?php echo lang_get( 'bugnote_order_asc' ) ?></label>
 129          <label><input type="radio" name="bugnote_order" value="DESC" <?php check_checked( $t_pref->bugnote_order, 'DESC' ); ?> /><?php echo lang_get( 'bugnote_order_desc' ) ?></label>
 130      </td>
 131  </tr>
 132  <?php
 133      if ( ON == config_get( 'enable_email_notification' ) ) {
 134  ?>
 135  <tr <?php echo helper_alternate_class() ?>>
 136      <td class="category">
 137          <?php echo lang_get( 'email_on_new' ) ?>
 138      </td>
 139      <td>
 140          <input type="checkbox" name="email_on_new" <?php check_checked( $t_pref->email_on_new, ON ); ?> />
 141          <?php echo lang_get( 'with_minimum_severity' ) ?>
 142          <select name="email_on_new_min_severity">
 143              <option value="<?php echo OFF ?>"><?php echo lang_get( 'any' ) ?></option>
 144              <option disabled="disabled">-----</option>
 145              <?php print_enum_string_option_list( 'severity', $t_pref->email_on_new_min_severity ) ?>
 146          </select>
 147      </td>
 148  </tr>
 149  <tr <?php echo helper_alternate_class() ?>>
 150      <td class="category">
 151          <?php echo lang_get( 'email_on_assigned' ) ?>
 152      </td>
 153      <td>
 154          <input type="checkbox" name="email_on_assigned" <?php check_checked( $t_pref->email_on_assigned, ON ); ?> />
 155          <?php echo lang_get( 'with_minimum_severity' ) ?>
 156          <select name="email_on_assigned_min_severity">
 157              <option value="<?php echo OFF ?>"><?php echo lang_get( 'any' ) ?></option>
 158              <option disabled="disabled">-----</option>
 159              <?php print_enum_string_option_list( 'severity', $t_pref->email_on_assigned_min_severity ) ?>
 160          </select>
 161      </td>
 162  </tr>
 163  <tr <?php echo helper_alternate_class() ?>>
 164      <td class="category">
 165          <?php echo lang_get( 'email_on_feedback' ) ?>
 166      </td>
 167      <td>
 168          <input type="checkbox" name="email_on_feedback" <?php check_checked( $t_pref->email_on_feedback, ON ); ?> />
 169          <?php echo lang_get( 'with_minimum_severity' ) ?>
 170          <select name="email_on_feedback_min_severity">
 171              <option value="<?php echo OFF ?>"><?php echo lang_get( 'any' ) ?></option>
 172              <option disabled="disabled">-----</option>
 173              <?php print_enum_string_option_list( 'severity', $t_pref->email_on_feedback_min_severity ) ?>
 174          </select>
 175      </td>
 176  </tr>
 177  <tr <?php echo helper_alternate_class() ?>>
 178      <td class="category">
 179          <?php echo lang_get( 'email_on_resolved' ) ?>
 180      </td>
 181      <td>
 182          <input type="checkbox" name="email_on_resolved" <?php check_checked( $t_pref->email_on_resolved, ON ); ?> />
 183          <?php echo lang_get( 'with_minimum_severity' ) ?>
 184          <select name="email_on_resolved_min_severity">
 185              <option value="<?php echo OFF ?>"><?php echo lang_get( 'any' ) ?></option>
 186              <option disabled="disabled">-----</option>
 187              <?php print_enum_string_option_list( 'severity', $t_pref->email_on_resolved_min_severity ) ?>
 188          </select>
 189      </td>
 190  </tr>
 191  <tr <?php echo helper_alternate_class() ?>>
 192      <td class="category">
 193          <?php echo lang_get( 'email_on_closed' ) ?>
 194      </td>
 195      <td>
 196          <input type="checkbox" name="email_on_closed" <?php check_checked( $t_pref->email_on_closed, ON ); ?> />
 197          <?php echo lang_get( 'with_minimum_severity' ) ?>
 198          <select name="email_on_closed_min_severity">
 199              <option value="<?php echo OFF ?>"><?php echo lang_get( 'any' ) ?></option>
 200              <option disabled="disabled">-----</option>
 201              <?php print_enum_string_option_list( 'severity', $t_pref->email_on_closed_min_severity ) ?>
 202          </select>
 203      </td>
 204  </tr>
 205  <tr <?php echo helper_alternate_class() ?>>
 206      <td class="category">
 207          <?php echo lang_get( 'email_on_reopened' ) ?>
 208      </td>
 209      <td>
 210          <input type="checkbox" name="email_on_reopened" <?php check_checked( $t_pref->email_on_reopened, ON ); ?> />
 211          <?php echo lang_get( 'with_minimum_severity' ) ?>
 212          <select name="email_on_reopened_min_severity">
 213              <option value="<?php echo OFF ?>"><?php echo lang_get( 'any' ) ?></option>
 214              <option disabled="disabled">-----</option>
 215              <?php print_enum_string_option_list( 'severity', $t_pref->email_on_reopened_min_severity ) ?>
 216          </select>
 217      </td>
 218  </tr>
 219  <tr <?php echo helper_alternate_class() ?>>
 220      <td class="category">
 221          <?php echo lang_get( 'email_on_bugnote_added' ) ?>
 222      </td>
 223      <td>
 224          <input type="checkbox" name="email_on_bugnote" <?php check_checked( $t_pref->email_on_bugnote, ON ); ?> />
 225          <?php echo lang_get( 'with_minimum_severity' ) ?>
 226          <select name="email_on_bugnote_min_severity">
 227              <option value="<?php echo OFF ?>"><?php echo lang_get( 'any' ) ?></option>
 228              <option disabled="disabled">-----</option>
 229              <?php print_enum_string_option_list( 'severity', $t_pref->email_on_bugnote_min_severity ) ?>
 230          </select>
 231      </td>
 232  </tr>
 233  <tr <?php echo helper_alternate_class() ?>>
 234      <td class="category">
 235          <?php echo lang_get( 'email_on_status_change' ) ?>
 236      </td>
 237      <td>
 238          <input type="checkbox" name="email_on_status" <?php check_checked( $t_pref->email_on_status, ON ); ?> />
 239          <?php echo lang_get( 'with_minimum_severity' ) ?>
 240          <select name="email_on_status_min_severity">
 241              <option value="<?php echo OFF ?>"><?php echo lang_get( 'any' ) ?></option>
 242              <option disabled="disabled">-----</option>
 243              <?php print_enum_string_option_list( 'severity', $t_pref->email_on_status_min_severity ) ?>
 244          </select>
 245      </td>
 246  </tr>
 247  <tr <?php echo helper_alternate_class() ?>>
 248      <td class="category">
 249          <?php echo lang_get( 'email_on_priority_change' ) ?>
 250      </td>
 251      <td>
 252          <input type="checkbox" name="email_on_priority" <?php check_checked( $t_pref->email_on_priority , ON); ?> />
 253          <?php echo lang_get( 'with_minimum_severity' ) ?>
 254          <select name="email_on_priority_min_severity">
 255              <option value="<?php echo OFF ?>"><?php echo lang_get( 'any' ) ?></option>
 256              <option disabled="disabled">-----</option>
 257              <?php print_enum_string_option_list( 'severity', $t_pref->email_on_priority_min_severity ) ?>
 258          </select>
 259      </td>
 260  </tr>
 261  <tr <?php echo helper_alternate_class() ?>>
 262      <td class="category">
 263          <?php echo lang_get( 'email_bugnote_limit' ) ?>
 264      </td>
 265      <td>
 266          <input type="text" name="email_bugnote_limit" maxlength="2" size="2" value="<?php echo $t_pref->email_bugnote_limit ?>" />
 267      </td>
 268  </tr>
 269  <?php } else { ?>
 270          <input type="hidden" name="email_on_new"      value="<?php echo $t_pref->email_on_new ?>" />
 271          <input type="hidden" name="email_on_assigned" value="<?php echo $t_pref->email_on_assigned ?>" />
 272          <input type="hidden" name="email_on_feedback" value="<?php echo $t_pref->email_on_feedback ?>" />
 273          <input type="hidden" name="email_on_resolved" value="<?php echo $t_pref->email_on_resolved ?>" />
 274          <input type="hidden" name="email_on_closed"   value="<?php echo $t_pref->email_on_closed ?>" />
 275          <input type="hidden" name="email_on_reopened" value="<?php echo $t_pref->email_on_reopened ?>" />
 276          <input type="hidden" name="email_on_bugnote"  value="<?php echo $t_pref->email_on_bugnote ?>" />
 277          <input type="hidden" name="email_on_status"   value="<?php echo $t_pref->email_on_status ?>" />
 278          <input type="hidden" name="email_on_priority" value="<?php echo $t_pref->email_on_priority ?>" />
 279          <input type="hidden" name="email_on_new_min_severity"      value="<?php echo $t_pref->email_on_new_min_severity ?>" />
 280          <input type="hidden" name="email_on_assigned_min_severity" value="<?php echo $t_pref->email_on_assigned_min_severity ?>" />
 281          <input type="hidden" name="email_on_feedback_min_severity" value="<?php echo $t_pref->email_on_feedback_min_severity ?>" />
 282          <input type="hidden" name="email_on_resolved_min_severity" value="<?php echo $t_pref->email_on_resolved_min_severity ?>" />
 283          <input type="hidden" name="email_on_closed_min_severity"   value="<?php echo $t_pref->email_on_closed_min_severity ?>" />
 284          <input type="hidden" name="email_on_reopened_min_severity" value="<?php echo $t_pref->email_on_reopened_min_severity ?>" />
 285          <input type="hidden" name="email_on_bugnote_min_severity"  value="<?php echo $t_pref->email_on_bugnote_min_severity ?>" />
 286          <input type="hidden" name="email_on_status_min_severity"   value="<?php echo $t_pref->email_on_status_min_severity ?>" />
 287          <input type="hidden" name="email_on_priority_min_severity" value="<?php echo $t_pref->email_on_priority_min_severity ?>" />
 288          <input type="hidden" name="email_bugnote_limit" value="<?php echo $t_pref->email_bugnote_limit ?>" />
 289  <?php } ?>
 290  <tr <?php echo helper_alternate_class() ?>>
 291      <td class="category">
 292          <?php echo lang_get( 'timezone' ) ?>
 293      </td>
 294      <td>
 295          <select name="timezone">
 296              <?php print_timezone_option_list( $t_pref->timezone ?  $t_pref->timezone  : config_get_global( 'default_timezone' ) ) ?>
 297          </select>
 298      </td>
 299  </tr>
 300  <tr <?php echo helper_alternate_class() ?>>
 301      <td class="category">
 302          <?php echo lang_get( 'language' ) ?>
 303      </td>
 304      <td>
 305          <select name="language">
 306              <?php print_language_option_list( $t_pref->language ) ?>
 307          </select>
 308      </td>
 309  </tr>
 310  <?php event_signal( 'EVENT_ACCOUNT_PREF_UPDATE_FORM', array( $p_user_id ) ); ?>
 311  <tr>
 312      <td colspan="2" class="center">
 313          <input type="submit" class="button" value="<?php echo lang_get( 'update_prefs_button' ) ?>" />
 314      </td>
 315  </tr>
 316  </table>
 317  </form>
 318  </div>
 319  
 320  <br />
 321  
 322  <div class="border center">
 323      <form method="post" action="account_prefs_reset.php">
 324      <?php echo form_security_field( 'account_prefs_reset' ) ?>
 325      <input type="hidden" name="user_id" value="<?php echo $p_user_id ?>" />
 326      <input type="hidden" name="redirect_url" value="<?php echo $t_redirect_url ?>" />
 327      <input type="submit" class="button" value="<?php echo lang_get( 'reset_prefs_button' ) ?>" />
 328      </form>
 329  </div>
 330  
 331  <?php
 332  } # end of edit_account_prefs()


Generated: Sat Mar 6 17:17:35 2010 Cross-referenced by PHPXref 0.7