Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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

group_request.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 3.37 KiB


 001  <?php
 002  /**
 003  *
 004  * This file is part of the phpBB Forum Software package.
 005  *
 006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 007  * @license GNU General Public License, version 2 (GPL-2.0)
 008  *
 009  * For full copyright and license information, please see
 010  * the docs/CREDITS.txt file.
 011  *
 012  */
 013   
 014  namespace phpbb\notification\type;
 015   
 016  class group_request extends \phpbb\notification\type\base
 017  {
 018      /**
 019      * {@inheritdoc}
 020      */
 021      public function get_type()
 022      {
 023          return 'notification.type.group_request';
 024      }
 025   
 026      /**
 027      * {@inheritdoc}
 028      */
 029      public static $notification_option = array(
 030          'lang'    => 'NOTIFICATION_TYPE_GROUP_REQUEST',
 031      );
 032   
 033      /**
 034      * {@inheritdoc}
 035      */
 036      public function is_available()
 037      {
 038          // Leader of any groups?
 039          $sql = 'SELECT group_id
 040              FROM ' . USER_GROUP_TABLE . '
 041              WHERE user_id = ' . (int) $this->user->data['user_id'] . '
 042                  AND group_leader = 1';
 043          $result = $this->db->sql_query_limit($sql, 1);
 044          $row = $this->db->sql_fetchrow($result);
 045          $this->db->sql_freeresult($result);
 046   
 047          return (!empty($row)) ? true : false;
 048      }
 049   
 050      /**
 051      * {@inheritdoc}
 052      */
 053      public static function get_item_id($group)
 054      {
 055          return (int) $group['user_id'];
 056      }
 057   
 058      /**
 059      * {@inheritdoc}
 060      */
 061      public static function get_item_parent_id($group)
 062      {
 063          // Group id is the parent
 064          return (int) $group['group_id'];
 065      }
 066   
 067      /**
 068      * {@inheritdoc}
 069      */
 070      public function find_users_for_notification($group, $options = array())
 071      {
 072          $options = array_merge(array(
 073              'ignore_users'        => array(),
 074          ), $options);
 075   
 076          $sql = 'SELECT user_id
 077              FROM ' . USER_GROUP_TABLE . '
 078              WHERE group_leader = 1
 079                  AND group_id = ' . (int) $group['group_id'];
 080          $result = $this->db->sql_query($sql);
 081   
 082          $user_ids = array();
 083          while ($row = $this->db->sql_fetchrow($result))
 084          {
 085              $user_ids[] = (int) $row['user_id'];
 086          }
 087          $this->db->sql_freeresult($result);
 088   
 089          $this->user_loader->load_users($user_ids);
 090   
 091          return $this->check_user_notification_options($user_ids, $options);
 092      }
 093   
 094      /**
 095      * {@inheritdoc}
 096      */
 097      public function get_avatar()
 098      {
 099          return $this->user_loader->get_avatar($this->item_id);
 100      }
 101   
 102      /**
 103      * {@inheritdoc}
 104      */
 105      public function get_title()
 106      {
 107          $username = $this->user_loader->get_username($this->item_id, 'no_profile');
 108   
 109          return $this->user->lang('NOTIFICATION_GROUP_REQUEST', $username, $this->get_data('group_name'));
 110      }
 111   
 112      /**
 113      * {@inheritdoc}
 114      */
 115      public function get_email_template()
 116      {
 117          return 'group_request';
 118      }
 119   
 120      /**
 121      * {@inheritdoc}
 122      */
 123      public function get_email_template_variables()
 124      {
 125          $user_data = $this->user_loader->get_user($this->item_id);
 126   
 127          return array(
 128              'GROUP_NAME'                   => htmlspecialchars_decode($this->get_data('group_name')),
 129              'REQUEST_USERNAME'                => htmlspecialchars_decode($user_data['username']),
 130   
 131              'U_PENDING'                      => generate_board_url() . "/ucp.{$this->php_ext}?i=groups&mode=manage&action=list&g={$this->item_parent_id}",
 132              'U_GROUP'                    => generate_board_url() . "/memberlist.{$this->php_ext}?mode=group&g={$this->item_parent_id}",
 133          );
 134      }
 135   
 136      /**
 137      * {@inheritdoc}
 138      */
 139      public function get_url()
 140      {
 141          return append_sid($this->phpbb_root_path . 'ucp.' . $this->php_ext, "i=groups&mode=manage&action=list&g={$this->item_parent_id}");
 142      }
 143   
 144      /**
 145      * {@inheritdoc}
 146      */
 147      public function users_to_query()
 148      {
 149          return array($this->item_id);
 150      }
 151   
 152      /**
 153      * {@inheritdoc}
 154      */
 155      public function create_insert_array($group, $pre_create_data = array())
 156      {
 157          $this->set_data('group_name', $group['group_name']);
 158   
 159          return parent::create_insert_array($group, $pre_create_data);
 160      }
 161  }
 162