You are here

function tinybrowser_admin in TinyBrowser 7

Admin page

2 string references to 'tinybrowser_admin'
tinybrowser_menu in ./tinybrowser.module
Implements hook_menu
tinybrowser_settings_form in ./tinybrowser.module

File

./tinybrowser.module, line 256

Code

function tinybrowser_admin() {

  //------ Configuration profiles ------
  $profiles = variable_get('tinybrowser_profiles', array());
  if (empty($profiles)) {

    // first time after the new installation
    $profiles = tinybrowser_install_profiles();
  }
  $header = array(
    t('Profile name'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $attributes = array(
    'style' => 'width:100%',
  );
  $rows = array();
  foreach ($profiles as $pid => $profile) {
    $rows[] = array(
      $profile['name'],
      l(t('Edit'), 'admin/config/media/tinybrowser/profile/edit/' . $pid),
      $pid == 1 ? '' : l(t('Delete'), 'admin/config/media/tinybrowser/profile/delete/' . $pid),
    );
  }
  $rows[] = array(
    '',
    array(
      'data' => l(t('Add new profile'), 'admin/config/media/tinybrowser/profile'),
      'colspan' => 2,
    ),
  );
  $output['title'] = array(
    '#markup' => '<h2 class="title">' . t('Configuration profiles') . '</h2>',
  );
  $output['table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#attributes' => $attributes,
  );
  $output['form'] = drupal_get_form('tinybrowser_settings_form');
  return $output;
}