You are here

function seochecklist_admin_settings in SEO Checklist 6.2

Same name and namespace in other branches
  1. 5.2 seochecklist.module \seochecklist_admin_settings()
  2. 5 SEOChecklist.module \SEOChecklist_admin_settings()
  3. 6.3 seochecklist.admin.inc \seochecklist_admin_settings()
  4. 7.3 seochecklist.admin.inc \seochecklist_admin_settings()

Define the settings form.

1 string reference to 'seochecklist_admin_settings'
seochecklist_menu in ./seochecklist.module
Implementation of hook_menu().

File

./seochecklist.module, line 37
SEO Checklist module allows users to track important SEO techniques on the website.

Code

function seochecklist_admin_settings() {
  drupal_add_css(drupal_get_path('module', 'seochecklist') . '/css/seochecklist.css');
  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  $form['frm_Check_title'] = array(
    '#type' => 'item',
    '#value' => '<strong>' . t('Check off each SEO-related task as you complete it. Don\'t forget to click "Save".') . '</strong>',
  );
  $form['frm_Check_existing'] = array(
    '#type' => 'submit',
    '#value' => t('Check for already Installed Modules'),
  );

  // Fetch modules and groups from database.
  $query = "SELECT id, name, description FROM {seo_group} ORDER BY id";
  $result = db_query($query);
  $group_id = 0;

  // Every group is a fieldset.
  while ($data = db_fetch_object($result)) {
    $group_id = intval($data->id);
    $form['group_' . $group_id] = array(
      '#type' => 'fieldset',
      '#title' => check_plain(t($data->name)),
      '#collapsible' => TRUE,
      '#description' => check_plain(t($data->description)),
    );
    $res = db_query("SELECT download, enable, configure, module, option_checked, date_changed, id, name FROM {seo_checklist} WHERE group_id = %d ORDER BY order_id", $group_id);
    while ($row = db_fetch_object($res)) {

      // Service links.
      $links = array();
      if ($row->download) {
        $links[] = l(t('Download'), $row->download, array(
          'attributes' => array(
            'target' => '_blank',
          ),
        ));
      }
      if ($row->enable) {
        $links[] = l(t('Enable'), $row->enable);
      }
      if ($row->configure && module_exists(strtolower($row->module))) {
        $links[] = l(t('Configure'), $row->configure);
      }
      if ($row->option_checked) {
        $links[] = t('Date completed: %date', array(
          '%date' => format_date(strtotime($row->date_changed), 'small'),
        ));
      }
      $form['group_' . $group_id]['seochecklist_nodetypes_' . intval($row->id)] = array(
        '#type' => 'checkbox',
        '#return_value' => intval($row->id),
        '#title' => t($row->name),
        '#default_value' => $row->option_checked ? 1 : 0,
        '#prefix' => '<div class="seochecklist_item">',
        '#suffix' => '<div class="seochecklist_links">' . join(', ', $links) . '</div></div>',
      );
      if (substr($row->name, 0, 10) == 'Clean URLs') {
        $form['group_' . $group_id]['seochecklist_nodetypes_' . intval($row->id)]['#default_value'] = variable_get('clean_url', 0);
      }
    }
  }
  $form['bottom_code'] = array(
    '#type' => 'fieldset',
    '#title' => t('Extras'),
    '#collapsible' => TRUE,
  );
  $form['bottom_code']['Bottom_code'] = array(
    '#type' => 'checkbox',
    '#title' => t("Link to Volacci to thank them for this awesome module. <strong>Don't forget to click Save!</strong>"),
    '#description' => t("A small link will appear at the very bottom of your website. You can disable it at any time by un-checking this box. We really appreciate it!!!"),
    '#default_value' => variable_get('seo_checklist_link', 0),
  );
  $form['bottom_code']['Bottom_code_more'] = array(
    '#type' => 'checkbox',
    '#title' => t("Link to us then send us feedback on the Drupal 6 SEO Checklist module or just say \"Thanks!\" and we will link to you from our website. Send your feedback and link information to !email. (If you don't know why you should link with other websites, read this: !link.)", array(
      '!email' => l('seochecklist@volacci.com', 'mailto:seochecklist@volacci.com'),
      '!link' => l('Why links help SEO', 'http://www.volacci.com/why-links-help-seo'),
    )),
    '#default_value' => variable_get('seo_checklist_thanks', 0),
  );
  $form['bottom_code']['Bottom_code_podcast'] = array(
    '#type' => 'checkbox',
    '#title' => t("Listen to the Volacci Drupal SEO Podcast for more tips and tricks about Drupal SEO: !link", array(
      '!link' => l('http://www.volacci.com/podcast', 'http://www.volacci.com/podcast'),
    )),
    '#default_value' => variable_get('seo_checklist_podcast', 0),
  );
  $form['save1'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}