function accessibility_admin_existing_tests

cis7 accessibility.admin.inc accessibility_admin_existing_tests()
cle7 accessibility.admin.inc accessibility_admin_existing_tests()
elmsmedia7 accessibility.admin.inc accessibility_admin_existing_tests()
icor7 accessibility.admin.inc accessibility_admin_existing_tests()
meedjum_blog7 accessibility.admin.inc accessibility_admin_existing_tests()
mooc7 accessibility.admin.inc accessibility_admin_existing_tests()

List existing accessibility tests. @todo - add a filter form

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

File

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

Code

function accessibility_admin_existing_tests() {
  $build = array('filter_form' => drupal_get_form('accessibility_admin_filter_form'));

  $header = array(
    t('Name'),
    t('Severity'),
    t('Status'),
    t('Edit'),
    t('Delete'),
  );

  $rows = array();

  $query = db_select('accessibility_test', 't')->fields('t', array('test_id', 'name', 'quail_name', 'severity', 'status'))->orderBy('t.name');

  $filter = (isset($_SESSION['accessibility_admin_filter'])) ? $_SESSION['accessibility_admin_filter'] : array();
  if (isset($filter['severity'])) {
    $in = array();
    foreach ($filter['severity'] as $severity) {
      if ($severity) {
        $in[] = $severity;
      }
    }
    if (count($in)) {
      $query->condition('t.severity', $in, 'IN');
    }
  }
  if (isset($filter['name']) && strlen($filter['name'])) {
    $query->condition('t.name', '%' . $filter['name'] . '%', 'LIKE');
  }

  $tests = $query->execute()->fetchAll();
  foreach ($tests as $test) {
    $rows[] = array(
      l($test->name, 'accessibility-test/' . $test->test_id),
      t(ucfirst($test->severity)),
      (($test->status) ? t('Active') : t('Inactive')),
      l(t('edit'), 'accessibility-test/' . $test->test_id . '/edit', array('query' => array('destination' => 'admin/config/accessibility/tests'))),
      l(t('delete'), 'accessibility-test/' . $test->test_id . '/delete', array('query' => array('destination' => 'admin/config/accessibility/tests'))),
    );
  }

  $build['result_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
  );
  if (!count($rows)) {
    $build['result_table'] = array('#markup' => t('No tests, found. !link.', array('!link' => l(t('Import tests'), 'admin/config/accessibility/tests/import'))));
  }
  return $build;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.