You are here

function SEOChecklist_admin_settings in SEO Checklist 5

Same name and namespace in other branches
  1. 5.2 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 33
seo_checklist.module Keep track of all the Search Engine Optimization related tasks in your Drupal site.

Code

function SEOChecklist_admin_settings() {

  // Array values
  $bot_arr = array();
  $bot_val = array();
  $bot_arr1 = array();
  $bot_val1 = array();

  //Bottom code more
  $bot_arr1[1] = 'Send us feedback on this module or just say "Thanks!" and we will link to you from our website. Send your feedback and link information to <a href="mailTo:seochecklist@sprydev.com">seochecklist@sprydev.com</a>. (If you don\'t know why you should link with other websites, read this: <a href="http://www.sprydev.com/why-links-help-seo">Why Links Help SEO</a>';
  $bot_arr1[2] = 'Listen to the SpryDev Drupal SEO Podcast for more tips and tricks about Drupal SEO: <a href="http://www.sprydev.com/podcast">http://www.sprydev.com/podcast</a>';
  $sql = "SELECT extra2,extra3 FROM {seo_checklist} where id=1";
  $result = db_query(db_rewrite_sql($sql));
  while ($data = db_fetch_object($result)) {
    $bot_val1[1] = $data->extra2;
    $bot_val1[2] = $data->extra3;
  }

  //Bottom code more end
  $check_val = array();
  $bot_arr[1] = "Link to SpryDev to thank them for this awesome module.";
  $sql = "select linked_seo  from {seo_checklist} where id=1";
  $result = db_query(db_rewrite_sql($sql));
  $bot_val[] = db_result(db_query($sql));

  //Array values end

  //Upper save button
  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  $sql = "select checked_module  from {seo_checklist} where id=1";
  $result = db_query(db_rewrite_sql($sql));
  $temp = db_result(db_query($sql));
  $checked = '';
  if ($temp == 1) {
    $checked = 'checked';
  }
  $form['space'] = array(
    '#value' => t('<br>'),
  );
  $form['frm_Check_title'] = array(
    '#value' => t('<b>Check off each SEO-related task as you complete it. Don\'t forget to click "Save":</b>'),
  );
  $form['space1'] = array(
    '#value' => t('<br>'),
  );
  $form['frm_Check_existing'] = array(
    '#value' => t('<div style="float:left;border:0px solid #EAEAEA; width:100%;height:23px;"><div style="float:left;border:0px solid #EAEAEA; width:50%"><input name="Check_existing" id="edit-Check-existing" value="1"  class="form-checkbox" type="checkbox"' . $checked . '> Check for already Installed Modules</div><div style="float:left;border:0px solid #EAEAEA;width:50%;padding-bottom:0;"><input name="op" id="edit-submit" value="Check" type="submit"></div></div><br>'),
  );

  //$test_code='<div class="form-checkboxes"><div class="form-item"><label class="option"><input type="checkbox" name="SEOChecklist_nodetypes[1]" id="edit-SEOChecklist-nodetypes-1" value="1"  checked="checked"  class="form-checkbox" /> <b>Captcha</b> &nbsp;&nbsp;<span class="description"> Date Completed: (2007-10-11 12:27:54)</span><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\'http://drupal.org/project/captcha\' >Download</a>&nbsp;|&nbsp;<a href=\'?q=admin/build/modules\'>Enable</a>&nbsp;| &nbsp;<a href=\'?q=admin/user/captcha\'>Configure</a> </label></div><div class="form-item"> <label class="option"><input type="checkbox" name="SEOChecklist_nodetypes[2]" id="edit-SEOChecklist-nodetypes-2" value="2"  checked="checked"  class="form-checkbox" /> <b>Excerpt Module</b> &nbsp;&nbsp;<span class="description"> Date Completed: (2007-10-11 12:27:54)</span><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\'http://drupal.org/project/excerpt\' >Download</a>&nbsp;|&nbsp;<a href=\'?q=admin/build/modules\'>Enable</a>&nbsp;</label></div><div class="form-item"> <label class="option"><input type="checkbox" name="SEOChecklist_nodetypes[3]" id="edit-SEOChecklist-nodetypes-3" value="3"  checked="checked"  class="form-checkbox" /> <b>Find URL Alias Module</b> &nbsp;&nbsp;<span class="description"> Date Completed: (2007-10-11 12:27:54)</span><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\'http://drupal.org/project/find_path\' >Download</a>&nbsp;|&nbsp;<a href=\'?q=admin/build/modules\'>Enable</a>&nbsp;</label></div><div class="form-item"> <label class="option"><input type="checkbox" name="SEOChecklist_nodetypes[4]" id="edit-SEOChecklist-nodetypes-4" value="4"  checked="checked"  class="form-checkbox" /> <b>Global Redirect Module</b> &nbsp;&nbsp;<span class="description"> Date Completed: (2007-10-11 12:27:54)</span><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\'http://drupal.org/project/globalredirect\' >Download</a>&nbsp;|&nbsp;<a href=\'?q=admin/build/modules\'>Enable</a>&nbsp;</label></div>';

  //Fech modules and groups from database
  $page_contents = '';
  $query = "select * from {seo_group}  order by id";
  $result = db_query(db_rewrite_sql($query));
  $group_id = 0;
  while ($data = db_fetch_object($result)) {
    $group_id = $data->id;
    $page_contents .= '<br><b>' . $data->name . '</b>';
    if ($data->subgroup == 0) {
      $page_contents .= '<br><div style="font-size:11px; font-style:italic;">' . $data->description . '</div>';
      $page_contents .= '<div class="form-checkboxes">';
      $q = "select * from {seo_checklist}  where  group_id=" . $group_id . " order by order_id";
      $res = db_query(db_rewrite_sql($q));
      while ($row = db_fetch_object($res)) {
        $id = $row->id;
        $option_download_link = $row->download;
        $option_enable_link = $row->enable;
        $option_conf_link = $row->configure;
        $option_val = $row->option_checked;
        $option_checked = '';
        if ($option_val == $id) {
          $option_checked = 'checked="checked"';
        }
        if ($row->option_checked == 0) {
          $option_attr = '';
        }
        else {
          $option_attr = $row->date_changed;
        }

        //Check for module already existance
        $module_name = $row->module;
        $exist_f = 0;
        if (module_exists($module_name)) {
          $exist_f = 1;
        }
        $page_contents .= '<div class="form-item"><label class="option"> <input type="checkbox" name="SEOChecklist_nodetypes[' . $row->id . ']" id="edit-SEOChecklist-nodetypes-' . $row->id . '" value="' . $row->id . '"  ' . $option_checked . '  class="form-checkbox" /> ' . $row->name;

        //Configure link enables only when module is installed
        $conf_link = '';
        if ($option_conf_link == '') {
          $conf_link = '';
        }
        else {
          if ($exist_f == 0) {
            $conf_link = "| &nbsp;Configure";
          }
          else {
            $conf_link = "| &nbsp;<a href='{$option_conf_link}'>Configure</a> ";
          }
        }
        $page_contents .= "</label>&nbsp;&nbsp;" . ($option_download_link == '' ? '' : "<a href='{$option_download_link}' >Download</a>&nbsp;|") . ($option_enable_link == '' ? '' : "&nbsp;<a href='{$option_enable_link}'>Enable</a>&nbsp;") . $conf_link . ($option_attr == '' ? '' : '<span class="description"> Date Completed: (' . $option_attr . ')</span>');
      }
    }
    else {

      // If group has subtitle, fetch modules under each subtitle
      $q = "select * from {seo_subgroup} where group_id=" . $group_id . " order by id";
      $res1 = db_query(db_rewrite_sql($q));
      while ($row1 = db_fetch_object($res1)) {
        $page_contents .= '<br><div style="font-size:11px;font-style:italic;">' . $row1->name . '</div>';
        $page_contents .= '<div class="form-checkboxes">';
        $q = "select * from {seo_checklist} where group_id=" . $group_id . " and subgroup_id=" . $row1->id . " order by order_id";
        $res = db_query(db_rewrite_sql($q));
        while ($row = db_fetch_object($res)) {
          $id = $row->id;
          $option_download_link = $row->download;
          $option_enable_link = $row->enable;
          $option_conf_link = $row->configure;
          $option_val = $row->option_checked;
          $option_checked = '';
          if ($option_val == $id) {
            $option_checked = 'checked="checked"';
          }
          if ($row->option_checked == 0) {
            $option_attr = '';
          }
          else {
            $option_attr = $row->date_changed;
          }

          //Check for module already existance
          $module_name = $row->module;
          $exist_f = 0;
          if (module_exists($module_name)) {
            $exist_f = 1;
          }
          $page_contents .= '<div class="form-item"><label class="option"><input type="checkbox" name="SEOChecklist_nodetypes[' . $row->id . ']" id="edit-SEOChecklist-nodetypes-' . $row->id . '" value="' . $row->id . '"  ' . $option_checked . '  class="form-checkbox" />' . $row->name;

          //Configure link enables only when module is installed
          $conf_link = '';
          if ($option_conf_link == '') {
            $conf_link = '';
          }
          else {
            if ($exist_f == 0 && $id != 2) {
              $conf_link = "| &nbsp;Configure";
            }
            else {
              $conf_link = "| &nbsp;<a href='{$option_conf_link}'>Configure</a> ";
            }
          }
          $page_contents .= "</label>&nbsp;&nbsp;" . ($option_download_link == '' ? '' : "<a href='{$option_download_link}' >Download</a>&nbsp;|") . ($option_enable_link == '' ? '' : "&nbsp;<a href='{$option_enable_link}'>Enable</a>&nbsp;") . $conf_link . ($option_attr == '' ? '' : '<span class="description"> Date Completed: (' . $option_attr . ')</span>');
        }
      }
    }
    $page_contents .= '</div>';
  }
  $form['SEOChecklist_nodetypes'] = array(
    '#value' => t($page_contents),
  );
  $form['Bottom_code'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Extras'),
    '#options' => $bot_arr,
    '#default_value' => $bot_val,
    '#description' => t('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['Bottom_code_more'] = array(
    '#type' => 'checkboxes',
    '#options' => $bot_arr1,
    '#default_value' => $bot_val1,
  );
  $form['save1'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  $form['array_filter'] = array(
    '#type' => 'hidden',
  );

  //return system_settings_form($form);
  return $form;
}