You are here

function location_upgrade_page in Location 5

1 call to location_upgrade_page()
location_upgrade.php in ./location_upgrade.php

File

./location_upgrade.php, line 52

Code

function location_upgrade_page() {
  global $user, $sql_updates;
  if (isset($_POST['edit'])) {
    $edit = $_POST['edit'];
  }
  if (isset($_POST['op'])) {
    $op = $_POST['op'];
  }
  switch ($op) {
    case "Update":
      $edit = $_POST['edit'];
      if (!isset($edit['location_update_version']) || $edit['location_update_version'] == 0) {

        //*****************************
        $form = form_select('Select the update after your most recent update', 'location_update_version', '', $sql_updates, 'Please select what you think was the last update for this module.  If you\'re not sure of what your last update was, it is better to select one that is older than what you think than to select one that is newer.  Updates that are too old for you will fail while the newer ones will still execute.');
        $form .= form_submit('Update');
        $form = form($form);
        print location_upgrade_page_header('location.module database update');
        print location_upgrade_info();
        print '<font color="#FF0000">You need to select your last update first!</font>' . "<br/>\n";
        print $form;
        print location_upgrade_page_footer();
        break;

        //*****************************
      }
      else {

        // make sure we have updates to run.
        print location_upgrade_page_header("location.module database update");
        $links[] = "<a href=\"index.php\">main page</a>";
        $links[] = "<a href=\"index.php?q=admin\">administration pages</a>";
        print theme("item_list", $links);
        location_upgrade($edit['location_update_version']);
        print location_upgrade_page_footer();
      }
      break;
    default:
      $form = form_select('Select the update after your most recent update.', 'location_update_version', '', array_merge(array(
        '' => '',
      ), $sql_updates), 'Please select what you think was the last update for this module.  If you\'re not sure of what your last update was, it is better to select one that is older than what you think than to select one that is newer.  Updates that are too old for you will fail while the newer ones will still execute.');
      $form .= form_submit('Update');
      $form = form($form);
      print location_upgrade_page_header('location.module database update');
      print location_upgrade_info();
      print $form;
      print location_upgrade_page_footer();
      break;
  }
}