Ejemplo n.º 1
0
    $render = '
	<p><a href="?stage=2&search_string=' . $_GET["back_search"] . '">Back</a></p>
	<table border="1" cellpadding="5" cellspacing="0"><tr>
	';
    foreach ($Data as $keyd => $data) {
        $render .= '<td><a href="?stage=4&search_string=' . $data["id"] . '">' . trim($data["description"]) . '</a></td>' . "\n";
        $i++;
        if ($i % 1 == 0) {
            $render .= "</tr>\n<tr>\n";
        }
    }
    $render .= '</tr></table>';
    $render = '<p>' . $i . ' Properties</p>' . $render;
} elseif ($_GET["stage"] == 4) {
    $postcode = new Postcode();
    $pro_id = $postcode->property($_GET["search_string"]);
    $sql = "SELECT * FROM property WHERE pro_id = {$pro_id} LIMIT 1";
    $q = $db->query($sql);
    if (DB::isError($q)) {
        die("db error: " . $q->getMessage());
    }
    while ($row = $q->fetchRow()) {
        $render = '
<a href="?">Start again</a>
<table width="500" border="1" cellspacing="0" cellpadding="5">
   <tr>
     <td>House or flat no.</td>
     <td><input type="text" name="pro_addr1" value="' . $row["pro_addr1"] . '"></td>
   </tr>
   <tr>
     <td>Building name &amp; no.</td>
Ejemplo n.º 2
0
     /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 // stage 3: create property and elaborate
 // (postcode)
 // if selected address (postcode_id OR UDPRN) is present in database, use that property
 // else get and format address data from postcode lookup and enter into database
 // (no postcode)
 // if selected existing property ($pro_id) is selected
 // if manual form has been used, verify values and enter into database
 // goto stage 4
 /////////////////////////////////////////////////////////////////////////////
 case "elaborate":
     // if using postcode_id (or UDPRN in future)
     if ($_GET["postcode_id"]) {
         $postcode = new Postcode();
         $pro_id = $postcode->property($_GET["postcode_id"]);
     } elseif ($_GET["pro_id"]) {
         $pro_id = $_GET["pro_id"];
     } else {
         foreach ($_GET as $key => $val) {
             $_GET[$key] = trim($val);
         }
         if ($pro_addr1) {
             $db_data["pro_addr1"] = trim($pro_addr1);
         } else {
             $errors[] = "Missing or Invalid data: House or Flat number";
         }
         if ($pro_addr2) {
             $db_data["pro_addr2"] = trim($pro_addr2);
         } else {
             //$errors[] = "Missing or Invalid data: ";
Ejemplo n.º 3
0
} else {
    $scope = 'pro';
}
// start new postcode object
$postcode = new Postcode();
if ($lookup_type == "udprn") {
    /* 
    here we need to switch between scope : cli pro con (other)
    maybe change the way the data is handled for each
    as we are doing a fetch, we may aswell add the data to the property table without geocode
    geocode can be done later if they property is ever associated with a deal
    */
    // fetch the full address info
    $Data = $postcode->output_form($postcode->fetch($search_string));
    // geocode the bastard, and get id from property table
    $pro_id = $postcode->property($Data["id"]);
    $addr4_type = 'text';
    $addr4_options = '';
    $addr4_attributes = array('class' => 'addr');
    // make the form
    $formData = array($scope . '_pcid' => array('type' => 'hidden', 'value' => $Data["id"]), $scope . '_addr1' => array('type' => 'text', 'label' => 'House Number', 'value' => $Data["addr1"], 'required' => 2, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), $scope . '_addr2' => array('type' => 'text', 'label' => 'Building Name', 'value' => $Data["addr2"], 'required' => 1, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), $scope . '_addr3' => array('type' => 'text', 'label' => 'Street', 'value' => $Data["addr3"], 'required' => 2, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), $scope . '_addr5' => array('type' => 'text', 'label' => 'City or County', 'value' => $Data["addr5"], 'required' => 2, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), $scope . '_postcode' => array('type' => 'text', 'label' => 'Postcode', 'value' => $Data["postcode"], 'required' => 2, 'attributes' => array('class' => 'pc', 'maxlength' => 9, 'readonly' => 'readonly'), 'function' => 'format_postcode'), $scope . '_pro_id' => array('type' => 'hidden', 'value' => $pro_id));
    $form = new Form();
    $form->addData($formData, $_GET);
    $formName = "form2";
    $form->addHtml($form->addDiv($form->makeField("submit", $formName, "", "Save Changes", array('class' => 'submit'))));
    echo '<div id="inset">If this address is incorrect please <a href="javascript:cancelResponse();">try again</a></div>';
    echo $form->renderForm();
    exit;
} elseif ($lookup_type == "manual") {
    // make the form
    $formData = array($scope . '_pcid' => array('type' => 'hidden', 'value' => '-1'), $scope . '_addr1' => array('type' => 'text', 'label' => 'House Number', 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), $scope . '_addr2' => array('type' => 'text', 'label' => 'Building Name', 'required' => 1, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), $scope . '_addr3' => array('type' => 'text', 'label' => 'Street', 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), $scope . '_addr5' => array('type' => 'text', 'label' => 'City or County', 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), $scope . '_postcode' => array('type' => 'text', 'label' => 'Postcode', 'required' => 2, 'attributes' => array('class' => 'pc', 'maxlength' => 9), 'function' => 'format_postcode'), $scope . '_country' => array('type' => 'select', 'label' => 'Country', 'value' => $default_country, 'required' => 2, 'options' => db_lookup("pro_country", "country", "array"), 'attributes' => array('class' => 'addr')));