<?php
// $Id: notifications_message.class.inc,v 1.1.2.1 2010-01-25 14:10:54 jareyero Exp $
/**
 * @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;
    }
  }
}
