Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

report_reason_list_provider.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 2.07 KiB


01  <?php
02  /**
03   *
04   * This file is part of the phpBB Forum Software package.
05   *
06   * @copyright (c) phpBB Limited <https://www.phpbb.com>
07   * @license GNU General Public License, version 2 (GPL-2.0)
08   *
09   * 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  }
79