[ Index ] |
PHP Cross Reference of phpBB-3.1.12-deutsch |
[Summary view] [Print] [Text view]
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\notification\type; 15 16 /** 17 * Topic approved notifications class 18 * This class handles notifications for topics when they are approved (for authors) 19 */ 20 21 class approve_topic extends \phpbb\notification\type\topic 22 { 23 /** 24 * Get notification type name 25 * 26 * @return string 27 */ 28 public function get_type() 29 { 30 return 'notification.type.approve_topic'; 31 } 32 33 /** 34 * Language key used to output the text 35 * 36 * @var string 37 */ 38 protected $language_key = 'NOTIFICATION_TOPIC_APPROVED'; 39 40 /** 41 * Inherit notification read status from topic. 42 * 43 * @var bool 44 */ 45 protected $inherit_read_status = false; 46 47 /** 48 * Notification option data (for outputting to the user) 49 * 50 * @var bool|array False if the service should use it's default data 51 * Array of data (including keys 'id', 'lang', and 'group') 52 */ 53 public static $notification_option = array( 54 'id' => 'moderation_queue', 55 'lang' => 'NOTIFICATION_TYPE_MODERATION_QUEUE', 56 'group' => 'NOTIFICATION_GROUP_POSTING', 57 ); 58 59 /** 60 * Is available 61 */ 62 public function is_available() 63 { 64 return !$this->auth->acl_get('m_approve'); 65 } 66 67 /** 68 * Find the users who want to receive notifications 69 * 70 * @param array $post Data from submit_post 71 * @param array $options Options for finding users for notification 72 * 73 * @return array 74 */ 75 public function find_users_for_notification($post, $options = array()) 76 { 77 $options = array_merge(array( 78 'ignore_users' => array(), 79 ), $options); 80 81 $users = array(); 82 $users[$post['poster_id']] = array(''); 83 84 return $this->get_authorised_recipients(array_keys($users), $post['forum_id'], array_merge($options, array( 85 'item_type' => static::$notification_option['id'], 86 ))); 87 } 88 89 /** 90 * Pre create insert array function 91 * This allows you to perform certain actions, like run a query 92 * and load data, before create_insert_array() is run. The data 93 * returned from this function will be sent to create_insert_array(). 94 * 95 * @param array $post Post data from submit_post 96 * @param array $notify_users Notify users list 97 * Formated from find_users_for_notification() 98 * @return array Whatever you want to send to create_insert_array(). 99 */ 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 * Function for preparing the data for insertion in an SQL query 111 * (The service handles insertion) 112 * 113 * @param array $post Data from submit_post 114 * @param array $pre_create_data Data from pre_create_insert_array() 115 * 116 * @return array Array of data ready to be inserted into the database 117 */ 118 public function create_insert_array($post, $pre_create_data = array()) 119 { 120 $data = parent::create_insert_array($post, $pre_create_data); 121 122 $this->notification_time = $data['notification_time'] = time(); 123 124 return $data; 125 } 126 127 /** 128 * Get email template 129 * 130 * @return string|bool 131 */ 132 public function get_email_template() 133 { 134 return 'topic_approved'; 135 } 136 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Jan 11 00:25:41 2018 | Cross-referenced by PHPXref 0.7.1 |