You are here

function agreement_type_overview in Agreement 7.2

Display a list of agreement types.

Return value

array A render array.

1 string reference to 'agreement_type_overview'
agreement_menu in ./agreement.module
Implements hook_menu().

File

./agreement.admin.inc, line 14
Agreement administration page callback.

Code

function agreement_type_overview() {
  $content = array();
  $header = array(
    t('Type'),
    t('Machine name'),
    t('Agreement page'),
    t('Visibility'),
    t('Visibility pages'),
    t('Operations'),
  );
  $rows = array();
  $types = agreement_type_load();
  $operation_attributes = array(
    'class' => array(
      'links',
      'inline',
    ),
  );
  foreach ($types as $name => $type) {
    $row = array(
      check_plain($type['type']),
      check_plain($type['name']),
      l(check_plain($type['path']), $type['path']),
    );
    $row[] = $type['settings']['visibility_settings'] ? t('Show on only the listed pages.') : t('Show on every page except the listed pages.');
    $row[] = array(
      'data' => check_markup($type['settings']['visibility_pages']),
    );
    $operations = array(
      'edit' => array(
        'title' => t('Modify'),
        'href' => 'admin/config/people/agreement/manage/' . $name,
      ),
      'reset' => array(
        'title' => t('Reset'),
        'href' => 'admin/config/people/agreement/manage/' . $name . '/reset',
      ),
      'delete' => array(
        'title' => t('Remove'),
        'href' => 'admin/config/people/agreement/manage/' . $name . '/delete',
      ),
    );
    $row[] = array(
      'data' => theme('links', array(
        'links' => $operations,
        'attributes' => $operation_attributes,
      )),
    );
    $rows[] = $row;
  }
  $content['agreement_types'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#sticky' => FALSE,
    '#empty' => t('There are no agreement types. Please add an agreement type.'),
  );
  return $content;
}