You are here

function easy_social_admin_summary in Easy Social 7.2

Form callback. Displays Easy Social Summary.

See also

easy_social_menu()

1 string reference to 'easy_social_admin_summary'
easy_social_menu in ./easy_social.module
Implements hook_menu().

File

includes/easy_social.admin.inc, line 431
Easy Social admin settings.

Code

function easy_social_admin_summary() {
  $form = array();

  // Global settings.
  $form['global_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Global Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $table = '<table>';
  $type = variable_get_value('easy_social_global_type') == EASY_SOCIAL_WIDGET_HORIZONTAL ? t('Horizontal') : t('Vertical');
  $table .= '<tr><td style="width:33%;">' . t('Global Widget Type') . '</td><td style="width:33%;">' . $type . '</td><td style="width:33%;text-align:left;">' . l(t('Configure'), 'admin/config/content/easy_social', array(
    'attributes' => array(
      'class' => 'module-link module-link-configure',
    ),
  )) . '</td></tr>';
  $widgets = variable_get_value('easy_social_global_widgets');
  $widget_info = easy_social_get_widgets();
  $widget_list = array();
  foreach ($widgets as $widget) {
    if ((bool) $widget !== FALSE) {
      $widget_list[] = $widget_info[$widget]['name'];
    }
  }
  $widget_list = theme('item_list', array(
    'items' => $widget_list,
    'type' => 'ol',
  ));
  $table .= '<tr><td style="width:33%;">' . t('Global Widgets') . '</td><td style="width:33%;">' . $widget_list . '</td><td style="width:33%;text-align:left;">' . l(t('Configure'), 'admin/config/content/easy_social', array(
    'attributes' => array(
      'class' => 'module-link module-link-configure',
    ),
  )) . '</td></tr>';
  $ignore = check_plain(variable_get_value('easy_social_ignore_paths'));
  $table .= '<tr><td style="width:33%;">' . t('Ignore Paths') . '</td><td style="width:33%;">' . $ignore . '</td><td style="width:33%;text-align:left;">' . l(t('Configure'), 'admin/config/content/easy_social/ignore-paths', array(
    'attributes' => array(
      'class' => 'module-link module-link-configure',
    ),
  )) . '</td></tr>';
  $table .= '</table>';
  $form['global_settings']['summary'] = array(
    '#markup' => $table,
  );

  // Content Type settings.
  $form['content_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Content Type Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $table = '<table>';
  $node_types = node_type_get_types();
  foreach ($node_types as $type => $typeobj) {
    $enabled = variable_get_value("easy_social_{$type}_enable");
    $enabled_string = $enabled == 1 ? '<strong>' . t('Enabled') . '</strong>' : t('Disabled');
    $table .= '<tr><td style="width:33%;">' . $typeobj->name . '</td><td style="width:33%;">' . $enabled_string . '</td><td style="width:33%;text-align:left;">' . l(t('Configure'), 'admin/structure/types/manage/' . $type, array(
      'attributes' => array(
        'class' => 'module-link module-link-configure',
      ),
    )) . '</td></tr>';
    if ($enabled == 1) {
      $count = variable_get_value("easy_social_{$type}_count");
      $table .= '<tr><td style="width:33%;"> -- ' . t('Number of fields') . '</td><td style="width:33%;">' . $count . '</td><td style="width:33%;"></td></tr>';
      $type = _easy_social_variable_get_value("easy_social_{$type}_type") == EASY_SOCIAL_WIDGET_HORIZONTAL ? t('Horizontal') : t('Vertical');
      $table .= '<tr><td style="width:33%;"> -- ' . t('Widget Type') . '</td><td style="width:33%;">' . $type . '</td><td style="width:33%;"></td></tr>';
      $widgets = _easy_social_variable_get_value("easy_social_{$type}_widgets");
      $widget_list = array();
      foreach ($widgets as $widget) {
        if ((bool) $widget !== FALSE) {
          $widget_list[] = $widget_info[$widget]['name'];
        }
      }
      $widget_list = theme('item_list', array(
        'items' => $widget_list,
        'type' => 'ol',
      ));
      $table .= '<tr><td style="width:33%;"> -- ' . t('Widgets') . '</td><td style="width:33%;">' . $widget_list . '</td><td style="width:33%;"></td></tr>';
    }
  }
  $table .= '</table>';
  $form['content_settings']['summary'] = array(
    '#markup' => $table,
  );

  // Block settings.
  $form['block_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Block Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $table = '<table>';
  $count = variable_get_value('easy_social_block_count');
  $table .= '<tr><td style="width:33%;">' . t('Number of Blocks') . '</td><td style="width:33%;">' . $count . '</td><td style="width:33%;text-align:left;">' . l(t('Configure'), 'admin/config/content/easy_social', array(
    'attributes' => array(
      'class' => 'module-link module-link-configure',
    ),
  )) . '</td></tr>';
  $table .= '</table>';
  if ($count > 0) {
    for ($i = 1; $i <= $count; ++$i) {
      $table .= '<table>';
      $table .= '<tr><td colspan="2"><strong>' . t('Block') . ' #' . $i . '</strong></td></tr>';
      $title = filter_xss(variable_get_value("easy_social_block_{$i}_title"));
      if (empty($title)) {
        $title = check_plain('<empty>');
      }
      $override = variable_get_value("easy_social_block_{$i}_override");
      $override_string = $override == 1 ? t('Yes') : t('No');
      $table .= '<tr><td style="width:33%;">' . t('Title') . '</td><td style="width:33%;">' . $title . '</td></tr>';
      $table .= '<tr><td style="width:33%;">' . t('Override Settings') . '</td><td style="width:33%;">' . $override_string . '</td></tr>';
      if ($override == 1) {
        $type = variable_get_value("easy_social_block_{$i}_type") == EASY_SOCIAL_WIDGET_HORIZONTAL ? t('Horizontal') : t('Vertical');
        $widgets = variable_get_value("easy_social_block_{$i}_widgets");
        $widget_list = array();
        foreach ($widgets as $widget) {
          $widget_list[] = $widget_info[$widget]['name'];
        }
        $widget_list = theme('item_list', array(
          'items' => $widget_list,
          'type' => 'ol',
        ));
        $table .= '<tr><td style="width:33%;">' . t('Widgets') . '</td><td style="width:33%;">' . $widget_list . '</td></tr>';
      }
      $table .= '</table>';
    }
  }
  $table .= '</table>';
  $form['block_settings']['summary'] = array(
    '#markup' => $table,
  );
  return $form;
}