You are here

function theme_sharebar_buttons_table in ShareBar 7

Same name and namespace in other branches
  1. 6 sharebar.admin.inc \theme_sharebar_buttons_table()
  2. 7.2 sharebar.admin.inc \theme_sharebar_buttons_table()

Theme the administer buttons page.

1 theme call to theme_sharebar_buttons_table()
sharebar_settings in ./sharebar.admin.inc
Form builder: Configure the sharebar system.

File

./sharebar.admin.inc, line 13
Admin page callbacks for the block module.

Code

function theme_sharebar_buttons_table($variables = NULL) {
  $out = '';
  $out .= '<div>' . l(t('Add New Button'), 'admin/config/sharebar/add') . '</div>';
  $buttons = unserialize(variable_get('sharebar_buttons', sharebar_buttons_def()));
  if (is_array($buttons) && count($buttons)) {
    usort($buttons, "sharebar_cmp_up");
    foreach ($buttons as $key => $value) {
      $row = array();
      $row[] = array(
        'data' => $value->enabled ? t('Yes') : t('No'),
      );
      $row[] = array(
        'data' => $value->name,
      );
      $row[] = array(
        'data' => $value->big_button,
      );
      $row[] = array(
        'data' => $value->small_button,
      );
      $row[] = array(
        'data' => $value->weight,
      );
      $row[] = array(
        'data' => l(t('Edit'), 'admin/config/sharebar/edit/' . $value->machine_name) . ' | ' . l(t('Delete'), 'admin/config/sharebar/del/' . $value->machine_name),
      );
      $rows[] = $row;
    }
  }
  if (count($rows)) {
    $header = array(
      t('Enabled'),
      t('Name'),
      t('Big Button'),
      t('Small Button'),
      t('Weight'),
      t('Actions'),
    );
    $out .= theme('table', array(
      'header' => $header,
      'rows' => $rows,
    ));
  }
  else {
    $out .= '<b>' . t('No data') . '</b>';
  }
  return $out;
}