You are here

function seochecklist_admin_settings in SEO Checklist 5.2

Same name and namespace in other branches
  1. 5 SEOChecklist.module \SEOChecklist_admin_settings()
  2. 6.3 seochecklist.admin.inc \seochecklist_admin_settings()
  3. 6.2 seochecklist.module \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 44
SEO Checklist module allows users to track important SEO techniques on the website.

Code

function seochecklist_admin_settings() {
  global $user;
  $form['save_above'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );

  // 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' => t($data->name),
      '#collapsible' => TRUE,
      '#description' => t($data->description),
    );
    $res = db_query("SELECT download, enable, configure, module, completed, id, name, uid FROM {seo_checklist} WHERE group_id = %d ORDER BY order_id", $group_id);
    while ($row = db_fetch_object($res)) {
      $row->links = array();
      if ($row->completed) {

        // Show when and who completed this task.
        $row->links[] = t('Completed on %date by !username', array(
          '%date' => format_date($row->completed, 'small'),
          '!username' => theme('username', user_load(array(
            'uid' => $row->uid,
          ))),
        ));
      }
      else {

        // Show non-completed sub-tasks.
        if ($row->download) {
          $row->links[] = l(t('Download'), $row->download, array(
            'target' => '_blank',
          ));
        }
        if ($row->enable) {
          $row->links[] = l(t('Enable'), $row->enable);
        }
      }
      if ($row->configure && (!$row->module || module_exists($row->module))) {

        // Show the link to configure if this isn't a module or module is enabled.
        $row->links[] = l(t('Configure'), $row->configure);
      }
      $task = $form['group_' . $group_id]['seochecklist_task_' . $row->id] = array(
        '#type' => 'checkbox',
        '#title' => t($row->name),
        '#default_value' => $row->completed || $row->module && module_exists($row->module),
        '#description' => join(' | ', $row->links),
      );
      if (strpos($row->name, 'Clean URLs') === 0) {
        $task['#disabled'] = !variable_get('clean_url', 0);
        $task['#default_value'] |= variable_get('clean_url', 0);
      }
    }
  }
  $form['extras'] = array(
    '#type' => 'fieldset',
    '#title' => t('Extras'),
    '#collapsible' => TRUE,
  );
  $form['extras']['seo_checklist_link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Link to Volacci to thank them for this awesome module.'),
    '#default_value' => variable_get('seo_checklist_link', 0),
    '#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!'),
  );
  $form['extras']['seo_checklist_thanks'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send us feedback on the Drupal 6 SEO Checklist module or just say <em>Thanks!</em> and we will link to you from our website. Send your feedback and link information to <a href="mailto:@email">@email</a>.', array(
      '@email' => 'seochecklist@volacci.com',
    )),
    '#default_value' => variable_get('seo_checklist_thanks', 0),
    '#description' => t('If you do not know why you should link with other websites, read the following article: <a href="@link">Why links help SEO</a>.', array(
      '@link' => 'http://www.volacci.com/why-links-help-seo',
    )),
  );
  $form['extras']['seo_checklist_podcast'] = array(
    '#type' => 'checkbox',
    '#title' => t('Listen to the <a href="@podcast">Volacci Drupal SEO Podcast</a> for more tips and tricks about Drupal SEO.', array(
      '@podcast' => 'http://www.volacci.com/podcast',
    )),
    '#default_value' => variable_get('seo_checklist_podcast', 0),
  );
  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}