You are here

notifications_message.class.inc in Notifications 6.3

Notifications_Message class

File

classes/notifications_message.class.inc
View source
<?php

/**
 * @file
 * Notifications_Message class
 */
class Notifications_Message extends Messaging_Message {

  // Template used
  // protected $template = NULL;
  // Array with notifications data ('subscriptions', 'events'...)
  public $notifications = array();

  // Events that produced this notification

  /**
   * Build from a template and parameters object
   */
  function __construct($data = array()) {
    $this->type = 'outgoing';
    parent::__construct($data);
  }

  /**
   * Set sender uid or user account
   */
  function set_sender($uid, $sender_option) {
    $sender = notifications_load_user($uid);
    switch ($sender_option) {
      case 2:

        // Full sender account and sender address
        parent::set_sender($sender);
        break;
      case 1:

        // Sender name but anything else defaults to system
        $this->sender = 0;
        $this->sender_name = $sender->name;
        break;
      default:

        // Sender name is site name
        $this->sender = 0;
        $this->sender_name = variable_get('site_name', 'Drupal');
        break;
    }
  }

}

Classes

Namesort descending Description
Notifications_Message @file Notifications_Message class