You are here

function pm_attribute_list_filter in Drupal PM (Project Management) 7

Defines form for attribute list filter.

1 string reference to 'pm_attribute_list_filter'
pm_attribute_list in ./pm.admin.inc
Provides a list of attributes.

File

./pm.admin.inc, line 220
List functions for the Project Management module.

Code

function pm_attribute_list_filter($form, &$form_state, $filterdesc = 'Filter') {
  $domain = isset($_SESSION['pmattribute_list_filter']['domain']) ? $_SESSION['pmattribute_list_filter']['domain'] : '';
  $akey = isset($_SESSION['pmattribute_list_filter']['akey']) ? $_SESSION['pmattribute_list_filter']['akey'] : '';
  $avalue = isset($_SESSION['pmattribute_list_filter']['avalue']) ? $_SESSION['pmattribute_list_filter']['avalue'] : '';
  $isactive = isset($_SESSION['pmattribute_list_filter']['isactive']) ? $_SESSION['pmattribute_list_filter']['isactive'] : TRUE;
  $isdefault = isset($_SESSION['pmattribute_list_filter']['isdefault']) ? $_SESSION['pmattribute_list_filter']['isdefault'] : FALSE;
  $itemsperpage = isset($_SESSION['pmattribute_list_filter']['itemsperpage']) ? $_SESSION['pmattribute_list_filter']['itemsperpage'] : variable_get('pm_default_items_per_page', 10);
  $_SESSION['pmattribute_list_filter']['itemsperpage'] = $itemsperpage;
  $form['filter'] = array(
    '#type' => 'fieldset',
    '#title' => $filterdesc,
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['filter']['group1'] = array(
    '#type' => 'markup',
    '#theme' => 'pm_form_group',
  );
  $form['filter']['group1']['domain'] = array(
    '#type' => 'textfield',
    '#title' => t('Domain'),
    '#default_value' => $domain,
    '#size' => 30,
    '#autocomplete_path' => 'pm/attributes/domain/autocomplete',
  );
  $form['filter']['group1']['akey'] = array(
    '#type' => 'textfield',
    '#title' => t('Key'),
    '#default_value' => $akey,
    '#size' => 20,
  );
  $form['filter']['group1']['avalue'] = array(
    '#type' => 'textfield',
    '#title' => t('Value'),
    '#default_value' => $avalue,
    '#size' => 20,
  );
  $form['filter']['group2'] = array(
    '#type' => 'markup',
    '#theme' => 'pm_form_group',
  );
  $form['filter']['group2']['isactive'] = array(
    '#type' => 'select',
    '#title' => t('Active'),
    '#default_value' => $isactive,
    '#options' => array(
      '-' => '-',
      '0' => t('No'),
      '1' => t('Yes'),
    ),
  );
  $form['filter']['group2']['isdefault'] = array(
    '#type' => 'select',
    '#title' => t('Default'),
    '#default_value' => $isdefault,
    '#options' => array(
      '-' => '-',
      '0' => t('No'),
      '1' => t('Yes'),
    ),
  );
  $form['filter']['group3'] = array(
    '#type' => 'markup',
    '#theme' => 'pm_form_group',
  );
  $form['filter']['group3']['itemsperpage'] = array(
    '#type' => 'textfield',
    '#title' => t('Items'),
    '#size' => 10,
    '#default_value' => $itemsperpage,
    '#prefix' => '<div class="container-inline">',
    '#suffix' => '</div>',
  );
  $form['filter']['group3']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Filter'),
    '#submit' => array(
      'pm_attribute_list_filter_filter',
    ),
  );
  $form['filter']['group3']['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset'),
    '#submit' => array(
      'pm_attribute_list_filter_reset',
    ),
  );
  return $form;
}