You are here

function site_verify_list in Site verification 7

Same name and namespace in other branches
  1. 6 site_verify.admin.inc \site_verify_list()
  2. 7.2 site_verify.admin.inc \site_verify_list()
1 string reference to 'site_verify_list'
site_verify_menu in ./site_verify.module
Implements hook_menu().

File

./site_verify.admin.inc, line 3

Code

function site_verify_list() {
  $engines = site_verify_get_engines();
  $destination = drupal_get_destination();
  $header = array(
    array(
      'data' => t('Engine'),
      'field' => 'engine',
    ),
    array(
      'data' => t('Meta tag'),
      'field' => 'meta',
    ),
    array(
      'data' => t('File'),
      'field' => 'file',
    ),
    array(
      'data' => t('Operations'),
    ),
  );
  $query = db_select('site_verify');
  $query
    ->fields('site_verify');
  $query
    ->extend('TableSort')
    ->orderByHeader($header);

  //$query->extend('PagerDefault')->limit(50);
  $verifications = $query
    ->execute();
  $rows = array();
  foreach ($verifications as $verification) {
    $row = array(
      'data' => array(),
    );
    $row['data'][] = $engines[$verification->engine]['name'];
    $row['data'][] = $verification->meta ? '<span title="' . check_plain(truncate_utf8($verification->meta, 48)) . '">' . t('Yes') . '</spam>' : t('No');
    $row['data'][] = $verification->file ? l($verification->file, $verification->file) : t('None');
    $operations = array();
    $operations['edit'] = array(
      'title' => t('Edit'),
      'href' => "admin/config/search/verifications/{$verification->svid}/edit",
      'query' => $destination,
    );
    $operations['delete'] = array(
      'title' => t('Delete'),
      'href' => "admin/config/search/verifications/{$verification->svid}/delete",
      'query' => $destination,
    );
    $row['data']['operations'] = array(
      'data' => array(
        '#theme' => 'links',
        '#links' => $operations,
        '#attributes' => array(
          'class' => array(
            'links',
            'inline',
          ),
        ),
      ),
    );
    $rows[] = $row;
  }
  $build['verification_tabe'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No verifications available. <a href="@add">Add verification</a>.', array(
      '@add' => url('admin/config/search/verifications/add'),
    )),
  );

  //$build['verification_pager'] = array('#theme' => 'pager');
  return $build;
}