function accessibility_tests_list

cis7 accessibility.admin.inc accessibility_tests_list($form, $form_state)
cle7 accessibility.admin.inc accessibility_tests_list($form, $form_state)
elmsmedia7 accessibility.admin.inc accessibility_tests_list($form, $form_state)
icor7 accessibility.admin.inc accessibility_tests_list($form, $form_state)
meedjum_blog7 accessibility.admin.inc accessibility_tests_list($form, $form_state)
mooc7 accessibility.admin.inc accessibility_tests_list($form, $form_state)

Form for importing tests.

1 string reference to 'accessibility_tests_list'
accessibility_menu in sites/all/modules/ulmus/accessibility/accessibility.module
Implements hook_menu().

File

sites/all/modules/ulmus/accessibility/accessibility.admin.inc, line 21

Code

function accessibility_tests_list($form, $form_state) {
  $library_path = libraries_get_path('quail');
  $options = array();
  $form = array();
  $tests = module_invoke_all('accessibility_tests', TRUE);

  $guidelines = module_invoke_all('accessibility_guidelines', TRUE);

  $session = isset($_SESSION['accessibility_tests_filter']) ? $_SESSION['accessibility_tests_filter'] : array();
  $form['filter'] = array(
    '#type' => 'fieldset',
    '#title' => t('Filter tests'),
    '#collapsible' => TRUE,
  );

  $guideline_options = array();
  foreach ($guidelines as $k => $guideline) {
    $guideline_options[$k] = $guideline['title'];
  }

  $form['filter']['guideline'] = array(
    '#type' => 'select',
    '#title' => t('Guideline'),
    '#options' => $guideline_options,
    '#default_value' => isset($session['guideline']) ? $session['guideline'] : '',
    '#empty_option' => t('-- Any --'),
  );

  $categories = array();
  foreach ($tests as $test) {
    foreach ($test['tags'] as $tag) {
      $categories[$tag] = $tag;
    }
  }
  ksort($categories);
  $form['filter']['category'] = array(
    '#type' => 'select',
    '#title' => t('Category'),
    '#options' => $categories,
    '#default_value' => isset($session['category']) ? $session['category'] : '',
    '#empty_option' => t('-- Any --'),
  );

  $form['filter']['severity'] = array(
    '#type' => 'select',
    '#title' => t('Severity'),
    '#options' => array(
      ACCESSIBILITY_TEST_SEVERE => t('Severe'),
      ACCESSIBILITY_TEST_MODERATE => t('Moderate'),
      ACCESSIBILITY_TEST_SUGGESTION => t('Suggestion'),
    ),
    '#default_value' => isset($session['severity']) ? $session['severity'] : '',
    '#empty_option' => t('-- Any --'),
  );

  $form['filter']['filter'] = array(
    '#type' => 'submit',
    '#value' => t('Filter'),
  );

  $form['filter']['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset'),
  );

  $enabled_tests = _accessibility_admin_get_enabled_tests();
  foreach ($tests as $testname => $test) {
    if (!isset($enabled_tests[$testname]) && (!isset($session['category']) || !$session['category'] || in_array($session['category'], $test['tags'])) && (!isset($session['guideline']) || !$session['guideline'] || in_array($testname, $guidelines[$session['guideline']]['tests'])) && (!isset($session['severity']) || !$session['severity'] || $test['severity'] == $session['severity'])) {
      $options[$testname] = array(
        'test' => $test['title'],
        'severity' => t(ucfirst($test['severity'])),
        'categories' => implode(', ', $test['tags']),
      );
    }
  }

  $header = array(
    'test' => t('Test'),
    'categories' => t('Categories'),
    'severity' => t('Severity'),
  );

  $form['tests'] = array(
    '#type' => 'tableselect',
    '#title' => t('Available accessibility tests'),
    '#options' => $options,
    '#header' => $header,
    '#default_value' => $enabled_tests,
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Import tests'),
  );

  return $form;
}