You are here

function customfilter_get_set in Custom filter 5

Get a filter set from the database.

Parameters

$sid: ID of the filterset.

$cols: The columns to retrieve.

Return value

The filter set.

8 calls to customfilter_get_set()
customfilter_filter_tips in ./customfilter.module
Implements hook_filter_tips().
customfilter_menu in ./customfilter.module
Implements hook_menu().
customfilter_set_delete in ./customfilter.module
Delete a filter set.
customfilter_set_edit in ./customfilter.module
Edit a filter set.
customfilter_xml_filterset in ./customfilter.module

... See full list

File

./customfilter.module, line 977

Code

function customfilter_get_set($sid, $cols = array(
  'sid',
  'name',
  'description',
)) {
  static $sets;
  if (!is_array($sets)) {
    $sets = array();
  }
  if (!$sets[$sid]) {

    // Prepare columns to select
    if (!is_array($cols)) {
      $cols = array(
        $cols,
      );
    }
    $columns = join(', ', $cols);

    // Query & Fetch
    $set = db_fetch_array(db_query("SELECT {$columns} FROM {customfilter_set} WHERE sid = %d", $sid));
    $sets[$sid] = $set;
  }
  return $sets[$sid];
}