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

approve_topic.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 3.23 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  /**
017  * Topic approved notifications class
018  * This class handles notifications for topics when they are approved (for authors)
019  */
020   
021  class approve_topic extends \phpbb\notification\type\topic
022  {
023      /**
024      * Get notification type name
025      *
026      * @return string
027      */
028      public function get_type()
029      {
030          return 'notification.type.approve_topic';
031      }
032   
033      /**
034      * Language key used to output the text
035      *
036      * @var string
037      */
038      protected $language_key = 'NOTIFICATION_TOPIC_APPROVED';
039   
040      /**
041      * Inherit notification read status from topic.
042      *
043      * @var bool
044      */
045      protected $inherit_read_status = false;
046   
047      /**
048      * Notification option data (for outputting to the user)
049      *
050      * @var bool|array False if the service should use it's default data
051      *                     Array of data (including keys 'id', 'lang', and 'group')
052      */
053      static public $notification_option = array(
054          'id'    => 'moderation_queue',
055          'lang'    => 'NOTIFICATION_TYPE_MODERATION_QUEUE',
056          'group'    => 'NOTIFICATION_GROUP_POSTING',
057      );
058   
059      /**
060      * Is available
061      */
062      public function is_available()
063      {
064          return !$this->auth->acl_get('m_approve');
065      }
066   
067      /**
068      * Find the users who want to receive notifications
069      *
070      * @param array $post Data from submit_post
071      * @param array $options Options for finding users for notification
072      *
073      * @return array
074      */
075      public function find_users_for_notification($post, $options = array())
076      {
077          $options = array_merge(array(
078              'ignore_users'        => array(),
079          ), $options);
080   
081          $users = array();
082          $users[$post['poster_id']] = $this->notification_manager->get_default_methods();
083   
084          return $this->get_authorised_recipients(array_keys($users), $post['forum_id'], array_merge($options, array(
085              'item_type'        => static::$notification_option['id'],
086          )));
087      }
088   
089      /**
090      * Pre create insert array function
091      * This allows you to perform certain actions, like run a query
092      * and load data, before create_insert_array() is run. The data
093      * returned from this function will be sent to create_insert_array().
094      *
095      * @param array $post Post data from submit_post
096      * @param array $notify_users Notify users list
097      *         Formated from find_users_for_notification()
098      * @return array Whatever you want to send to create_insert_array().
099      */
100      public function pre_create_insert_array($post, $notify_users)
101      {
102          // In the parent class, this is used to check if the post is already
103          // read by a user and marks the notification read if it was marked read.
104          // Returning an empty array in effect, forces it to be marked as unread
105          // (and also saves a query)
106          return array();
107      }
108   
109      /**
110      * {@inheritdoc}
111      */
112      public function create_insert_array($post, $pre_create_data = array())
113      {
114   
115          parent::create_insert_array($post, $pre_create_data);
116   
117          $this->notification_time = time();
118      }
119   
120      /**
121      * {@inheritdoc}
122      */
123      public function get_insert_array()
124      {
125          $data = parent::get_insert_array();
126          $data['notification_time'] = $this->notification_time;
127   
128          return $data;
129      }
130   
131      /**
132      * Get email template
133      *
134      * @return string|bool
135      */
136      public function get_email_template()
137      {
138          return 'topic_approved';
139      }
140  }
141