You are here

function notifications_custom_list in Notifications 6

Same name and namespace in other branches
  1. 6.4 notifications_custom/notifications_custom.module \notifications_custom_list()

Retrieve list of custom notifications

@params Optional query conditions. It only works with integer values

6 calls to notifications_custom_list()
notifications_custom_admin_page in notifications_custom/notifications_custom.admin.inc
Page callback, administer custom subscriptions
notifications_custom_form_alter in notifications_custom/notifications_custom.module
Implementation of hook_form_alter()
notifications_custom_notifications in notifications_custom/notifications_custom.module
Implementatin of hook_notifications()
notifications_custom_user_form in notifications_custom/notifications_custom.module
Build user account form
notifications_custom_user_operations in notifications_custom/notifications_custom.module
Implementation of hook_user_operations()

... See full list

File

notifications_custom/notifications_custom.module, line 235
Custom notifications module

Code

function notifications_custom_list($params = array()) {
  if ($params) {
    foreach ($params as $field => $value) {
      $where[] = "{$field} = %d";
    }
  }
  $sql = "SELECT * FROM {notifications_custom}";
  if ($where) {
    $sql .= ' WHERE (' . implode(') AND (', $where) . ')';
  }
  $sql .= " ORDER BY weight";
  $result = db_query($sql, $params);
  $custom = array();
  while ($subs = db_fetch_object($result)) {
    $subs->fields = empty($subs->fields) ? array() : unserialize($subs->fields);
    $custom[$subs->type] = $subs;
  }
  return $custom;
}