You are here

function workbench_email_get in Workbench Email 7

Same name and namespace in other branches
  1. 7.3 workbench_email.module \workbench_email_get()

Determines the email attributes to retrieve.

Parameters

object $transition: The transtion object

int $rid: The role ID

Return value

email Returns the workbench_email object or FALSE

6 calls to workbench_email_get()
workbench_email_features_export_options in ./workbench_email.features.inc
Implements COMPONENT_features_export_options().
workbench_email_form in ./workbench_email.admin.inc
Form for administering the email content.
workbench_email_form_node_form_alter in ./workbench_email.module
Implements hook_node_form_alter().
workbench_email_form_submit in ./workbench_email.admin.inc
Submit function for the form, saves or deletes emails.
workbench_email_form_validate in ./workbench_email.admin.inc
Validates the form values.

... See full list

File

./workbench_email.module, line 403
Code for the Workbench Email Module.

Code

function workbench_email_get($transition = NULL, $rid = NULL) {
  $emails = array();
  $query = db_select('workbench_emails', 'wve')
    ->fields('wve', array(
    'rid',
    'from_name',
    'to_name',
    'subject',
    'message',
  ));
  if ($transition) {
    $query
      ->condition('wve.from_name', $transition->from_name);
    $query
      ->condition('wve.to_name', $transition->to_name);
  }
  if ($rid) {
    $query
      ->condition('wve.rid', $rid);
  }
  $result = $query
    ->execute();
  foreach ($result as $row) {
    $emails[$row->from_name . '_to_' . $row->to_name][$row->rid] = $row;
  }
  return $emails;
}