[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/report/ -> report_reason_list_provider.php (source)

   1  <?php
   2  /**
   3   *
   4   * This file is part of the phpBB Forum Software package.
   5   *
   6   * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7   * @license GNU General Public License, version 2 (GPL-2.0)
   8   *
   9   * For full copyright and license information, please see
  10   * the docs/CREDITS.txt file.
  11   *
  12   */
  13  
  14  namespace phpbb\report;
  15  
  16  class report_reason_list_provider
  17  {
  18      /**
  19       * @var \phpbb\db\driver\driver_interface
  20       */
  21      protected $db;
  22  
  23      /**
  24       * @var \phpbb\template\template
  25       */
  26      protected $template;
  27  
  28      /**
  29       * @var \phpbb\user
  30       */
  31      protected $user;
  32  
  33      /**
  34       * Constructor
  35       *
  36       * @param \phpbb\db\driver\driver_interface    $db
  37       * @param \phpbb\template\template            $template
  38       * @param \phpbb\user                        $user
  39       */
  40  	public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user)
  41      {
  42          $this->db        = $db;
  43          $this->template    = $template;
  44          $this->user        = $user;
  45      }
  46  
  47      /**
  48       * Sets template variables to render report reasons select HTML input
  49       *
  50       * @param int    $reason_id
  51       * @return null
  52       */
  53  	public function display_reasons($reason_id = 0)
  54      {
  55          $sql = 'SELECT *
  56              FROM ' . REPORTS_REASONS_TABLE . '
  57              ORDER BY reason_order ASC';
  58          $result = $this->db->sql_query($sql);
  59  
  60          while ($row = $this->db->sql_fetchrow($result))
  61          {
  62              // If the reason is defined within the language file, we will use the localized version, else just use the database entry...
  63              if (isset($this->user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($this->user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]))
  64              {
  65                  $row['reason_description'] = $this->user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])];
  66                  $row['reason_title'] = $this->user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])];
  67              }
  68  
  69              $this->template->assign_block_vars('reason', array(
  70                  'ID'            => $row['reason_id'],
  71                  'TITLE'            => $row['reason_title'],
  72                  'DESCRIPTION'    => $row['reason_description'],
  73                  'S_SELECTED'    => ($row['reason_id'] == $reason_id) ? true : false,
  74              ));
  75          }
  76          $this->db->sql_freeresult($result);
  77      }
  78  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1