[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/core/ -> icon_api.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   * Icon API
  19   *
  20   * @package CoreAPI
  21   * @subpackage IconAPI
  22   * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  23   * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  24   * @link http://www.mantisbt.org
  25   *
  26   * @uses config_api.php
  27   * @uses constant_inc.php
  28   * @uses helper_api.php
  29   * @uses utility_api.php
  30   */
  31  
  32  require_api( 'config_api.php' );
  33  require_api( 'constant_inc.php' );
  34  require_api( 'helper_api.php' );
  35  require_api( 'utility_api.php' );
  36  
  37  /**
  38   * gets the status icon
  39   * @param string $p_icon
  40   * @return string html img tag containing status icon
  41   * @access public
  42   */
  43  function icon_get_status_icon( $p_icon ) {
  44      $t_icon_path = config_get( 'icon_path' );
  45      $t_status_icon_arr = config_get( 'status_icon_arr' );
  46      $t_priotext = get_enum_element( 'priority', $p_icon );
  47      if( isset( $t_status_icon_arr[$p_icon] ) && !is_blank( $t_status_icon_arr[$p_icon] ) ) {
  48          return "<img src=\"$t_icon_path$t_status_icon_arr[$p_icon]\" alt=\"\" title=\"$t_priotext\" />";
  49      } else {
  50          return "&#160;";
  51      }
  52  }
  53  
  54  /**
  55   * prints the status icon
  56   * @param string $p_icon
  57   * @return null
  58   * @access public
  59   */
  60  function print_status_icon( $p_icon ) {
  61      echo icon_get_status_icon( $p_icon );
  62  }
  63  
  64  /**
  65   * The input $p_dir is either ASC or DESC
  66   * The inputs $p_sort_by and $p_field are compared to see if they match
  67   * If the fields match then the sort icon is printed
  68   * This is a convenience feature to push the comparison code into this
  69   * function instead of in the page(s)
  70   * $p_field is a constant and $p_sort_by is whatever the page happens to
  71   * be sorting by at the moment
  72   * Multiple sort keys are not supported
  73   * @param int $p_dir
  74   * @param string $p_sort_by
  75   * @param string $p_field
  76   * @return null
  77   * @access public
  78   */
  79  function print_sort_icon( $p_dir, $p_sort_by, $p_field ) {
  80      $t_icon_path = config_get( 'icon_path' );
  81      $t_sort_icon_arr = config_get( 'sort_icon_arr' );
  82  
  83      if( $p_sort_by != $p_field ) {
  84          return;
  85      }
  86  
  87      if(( 'DESC' == $p_dir ) || ( DESCENDING == $p_dir ) ) {
  88          $t_dir = DESCENDING;
  89      } else {
  90          $t_dir = ASCENDING;
  91      }
  92  
  93      $t_none = NONE;
  94      if( !is_blank( $t_sort_icon_arr[$t_dir] ) ) {
  95          echo "<img src=\"$t_icon_path$t_sort_icon_arr[$t_dir]\" alt=\"\" />";
  96      } else {
  97          echo "<img src=\"$t_icon_path$t_status_icon_arr[$t_none]\" alt=\"\" />";
  98      }
  99  }
 100  


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