You are here

class Notifications_Custom_Subscription in Notifications 6.4

Message destination class

Hierarchy

Expanded class hierarchy of Notifications_Custom_Subscription

1 string reference to 'Notifications_Custom_Subscription'
notifications_custom_notifications in notifications_custom/notifications_custom.module
Implementation of hook_notifications().

File

notifications_custom/notifications_custom.class.inc, line 10
Drupal Notifications Framework - Default class file

View source
class Notifications_Custom_Subscription extends Notifications_Subscription {

  // Unique custom subscription id
  public $csid;

  // Array of field values, each is an array with type and value
  public $field_values;

  /**
   * Build for a subscription type
   *
   * @param $template
   *   Template object or subscription type
   */
  public static function build($template, $default_class = 'Notifications_Custom_Subscription') {
    return parent::build($template, $default_class);
  }

  // Get name
  function get_name() {
    return check_plain(notifications_translate("custom:{$this->type}:name", $this
      ->get_type('name')));
  }

  // Get title
  function get_title() {
    return check_plain(notifications_translate("custom:{$this->type}:title", $this
      ->get_type('title')));
  }

  // Get description
  function get_description() {
    return check_plain(notifications_translate("custom:{$this->type}:title", $this
      ->get_type('description')));
  }

  /**
   * Get default value for a possible checkbox
   */
  function get_default($user_registration = FALSE) {
    return $this
      ->is_instance() || $user_registration && $this
      ->get_type('default_value');
  }

  /**
   * Get fields as arrays
   */
  function get_fields_array() {
    $list = array();
    foreach ($this
      ->get_fields() as $field) {
      $list[] = array(
        'type' => $field->field,
        'value' => $field->value,
      );
    }
    return $list;
  }

  /**
   * Check visibility of this subscription type
   */
  function is_visible($user_registration = FALSE) {
    return user_access('administer users') || $user_registration ? $this
      ->get_type('register') : $this
      ->get_type('visibility');
  }

  /**
   * Format as a form element, which may be a visible checkbox or a hidden field
   */
  function form_element($user_registration = FALSE) {
    return $this
      ->is_visible($user_registration) ? $this
      ->form_checkbox($user_registration) : $this
      ->form_value();
  }

  /**
   * Format as a form checkbox
   */
  function form_checkbox($user_registration = FALSE) {
    return array(
      '#type' => 'checkbox',
      '#title' => $this
        ->get_name(),
      '#default_value' => $this
        ->get_default($user_registration),
      '#description' => $this
        ->get_description(),
    );
  }

  /**
   * Format as a form value
   */
  function form_value() {
    return array(
      '#type' => 'value',
      '#value' => $this->type,
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Messaging_Object::$deleted protected property
Messaging_Object::db_load public static function Load object from DB
Messaging_Object::is_instance public function Check whether this object is an instance or just a template
Messaging_Object::key function Get unike id key
Messaging_Object::object_build public static function Build object from template
Messaging_Object::object_load public static function Load object by unique key, no static caching 1
Messaging_Object::save public function Save to database
Messaging_Object::unserialize public function Unserialize after loading. It does nothing but can be overridden
Notifications_Custom_Subscription::$csid public property
Notifications_Custom_Subscription::$field_values public property
Notifications_Custom_Subscription::build public static function Build for a subscription type Overrides Notifications_Subscription::build
Notifications_Custom_Subscription::form_checkbox function Format as a form checkbox
Notifications_Custom_Subscription::form_element function Format as a form element, which may be a visible checkbox or a hidden field
Notifications_Custom_Subscription::form_value function Format as a form value
Notifications_Custom_Subscription::get_default function Get default value for a possible checkbox
Notifications_Custom_Subscription::get_description function Get description Overrides Notifications_Subscription::get_description
Notifications_Custom_Subscription::get_fields_array function Get fields as arrays
Notifications_Custom_Subscription::get_name function Get subscription short name. Overrides Notifications_Subscription::get_name
Notifications_Custom_Subscription::get_title function Overrides Notifications_Subscription::get_title
Notifications_Custom_Subscription::is_visible function Check visibility of this subscription type
Notifications_Subscription::$conditions public property
Notifications_Subscription::$cron public property
Notifications_Subscription::$destination public property
Notifications_Subscription::$destination_object protected property
Notifications_Subscription::$editable public property
Notifications_Subscription::$error_message public property
Notifications_Subscription::$event_type public property
Notifications_Subscription::$fields protected property
Notifications_Subscription::$format protected property
Notifications_Subscription::$incomplete public property
Notifications_Subscription::$mdid public property
Notifications_Subscription::$module public property
Notifications_Subscription::$name public property
Notifications_Subscription::$objects protected property
Notifications_Subscription::$send_interval public property
Notifications_Subscription::$send_method public property
Notifications_Subscription::$sid public property
Notifications_Subscription::$status public property
Notifications_Subscription::$type public property
Notifications_Subscription::add_condition function Add a new condition, update counter
Notifications_Subscription::add_field function Add a new field with name, value
Notifications_Subscription::add_fields function Add field values to existing ones
Notifications_Subscription::add_field_args function Add field arguments from url
Notifications_Subscription::build_field public static function Build field from type, value
Notifications_Subscription::build_link function Build subscribe /unsubscribe link
Notifications_Subscription::build_submission public static function Build from form submission
Notifications_Subscription::check_access function Check permission for user account
Notifications_Subscription::check_account function Check subscription user account and related parameters
Notifications_Subscription::check_destination function Check destination or create it if new
Notifications_Subscription::check_fields function Check all fields are there and optinally that they have a value
Notifications_Subscription::create_destination function Create destination for this subscription
Notifications_Subscription::db_key public static function Overrides Messaging_Object::db_key
Notifications_Subscription::DB_KEY constant Overrides Messaging_Object::DB_KEY
Notifications_Subscription::db_table public static function Overrides Messaging_Object::db_table
Notifications_Subscription::DB_TABLE constant Overrides Messaging_Object::DB_TABLE
Notifications_Subscription::delete function Delete from db Overrides Messaging_Object::delete
Notifications_Subscription::fields_subform function Produce fieldset to edit field values
Notifications_Subscription::field_element public function Display a form field for a notifications_field
Notifications_Subscription::filter_fields public static function Filter out fields that have no value set ($isset = FALSE to get the ones that are set)
Notifications_Subscription::format_field function Format subscriptions field for display and get some more information
Notifications_Subscription::format_fields function Format all fields
Notifications_Subscription::FORMAT_HTML constant
Notifications_Subscription::FORMAT_INLINE constant
Notifications_Subscription::format_items function Format items
Notifications_Subscription::FORMAT_LIST constant
Notifications_Subscription::format_long function Format as long text
Notifications_Subscription::format_name function If the subscription type has a name, like custom subscriptions have, that will be the name Otherwise we build the name using fields and values
Notifications_Subscription::FORMAT_PLAIN constant
Notifications_Subscription::format_short function Format as short text
Notifications_Subscription::FORMAT_TABLE constant
Notifications_Subscription::form_info function Subscription information field for several forms
Notifications_Subscription::get_account function Get user account
Notifications_Subscription::get_conditions function Get fields as array of field => value pairs
Notifications_Subscription::get_destination function Get destination object
Notifications_Subscription::get_editable_fields function Get editable fields. They're the ones in the subscription type that have no value
Notifications_Subscription::get_fields function Get fields as array of field objects
Notifications_Subscription::get_instance function Get instance of this one for certain conditions
Notifications_Subscription::get_instance_fields function Get instance fields that have a value set
Notifications_Subscription::get_language function Get language object
Notifications_Subscription::get_objects function Get objects
Notifications_Subscription::get_type function Get subscription type data
Notifications_Subscription::get_type_fields function Get fields from subscription type as normalized array of objects
Notifications_Subscription::has_condition function Check whether we have a given condition
Notifications_Subscription::insert function Save to db Overrides Messaging_Object::insert
Notifications_Subscription::is_editable function Whether this subscription's fields are editable or not
Notifications_Subscription::load public static function Load from db Overrides Messaging_Object::load
Notifications_Subscription::load_fields function Load condition fields from db
Notifications_Subscription::load_objects function Load subscription objects
Notifications_Subscription::normalize_fields public static function Convert fields to a standard format: arrray of object fields
Notifications_Subscription::save_fields function Save condition fields to db
Notifications_Subscription::serialize_fields function Order and serialize fields so we can get a unique signature for this subscription fields
Notifications_Subscription::serialize_type function Serialize type and conditions
Notifications_Subscription::set_account function Set user account as the owner of this subscription and take care of defaults for this account.
Notifications_Subscription::set_destination function Set destination object
Notifications_Subscription::set_field function Set a field.
Notifications_Subscription::set_fields function Set field values, all at a time
Notifications_Subscription::set_properties public function Save fields from form submission
Notifications_Subscription::STATUS_ACTIVE constant
Notifications_Subscription::STATUS_BLOCKED constant
Notifications_Subscription::STATUS_DISABLED constant
Notifications_Subscription::STATUS_INACTIVE constant
Notifications_Subscription::status_list public static function Status list
Notifications_Subscription::update function Update db Overrides Messaging_Object::update
Notifications_Subscription::validate_destination function Validate destination for this subscription
Notifications_Subscription::validate_submission public static function Validate form submission
Notifications_Subscription::__construct function Class constructor Overrides Messaging_Object::__construct
Notifications_Subscription::__get public function Magic method, get protected properties
Notifications_Subscription::__set public function Magic method, set protected properties Overrides Messaging_Object::__set