예제 #1
0
function get_alias($username, $tools)
{
    require $tools->include_path . 'settings.php';
    $alias = false;
    switch ($storage_type) {
        case 'file':
            $alias = file_lookup($username, $file_location, $tools);
            break;
        case 'db':
            $alias = db_lookup($username, $table_name, $tools);
            break;
    }
    return $alias;
}
 # build data arrays
 $formData1 = array('cli_salutation' => array('type' => 'select', 'group' => 'Full Name', 'label' => 'Salutation', 'value' => $cli_salutation, 'required' => 2, 'options' => db_enum("client", "cli_salutation", "array"), 'attributes' => array('style' => 'width:60px')), 'cli_fname' => array('type' => 'text', 'group' => 'Full Name', 'label' => 'Forename', 'value' => $cli_fname, 'init' => 'Forename(s)', 'required' => 2, 'attributes' => array('style' => 'width:100px', 'onFocus' => 'javascript:clearField(this,\'Forename(s)\')'), 'function' => 'format_name'), 'cli_sname' => array('type' => 'text', 'group' => 'Full Name', 'last_in_group' => 1, 'label' => 'Surname', 'value' => $cli_sname, 'init' => 'Surname', 'required' => 2, 'attributes' => array('style' => 'width:152px', 'onFocus' => 'javascript:clearField(this,\'Surname\')'), 'function' => 'format_name'), 'cli_tel' => array('type' => 'tel', 'label' => 'Telephone 1', 'required' => 2, 'value' => $_GET["telnew"]), 'cli_email' => array('type' => 'text', 'label' => 'Email', 'value' => $cli_email, 'required' => 3, 'attributes' => array('style' => 'width:320px', 'maxlength' => 255)), 'cli_preferred' => array('type' => 'radio', 'label' => 'Preferred Contact', 'value' => $cli_preferred, 'required' => 2, 'options' => db_enum("client", "cli_preferred", "array")));
 // we will only have a pro_pro_id in the GET when returning from error message
 // so build a form that is read-only populated with the data, and give button to change, which shows ajax screen again
 if ($_GET["pro_pro_id"]) {
     $sqlP = "SELECT * FROM property WHERE pro_id = " . $_GET["pro_pro_id"] . " LIMIT 1";
     $qP = $db->query($sqlP);
     if (DB::isError($qP)) {
         die("db error: " . $q->getMessage() . "sqlP<br>" . $sqlP);
     }
     while ($row = $qP->fetchRow()) {
         $formData2 = array('pro_pro_id' => array('type' => 'hidden', 'value' => $row["pro_id"]), 'pro_pcid' => array('type' => 'hidden', 'value' => $row["pro_pcid"]), 'pro_addr1' => array('type' => 'text', 'label' => 'House Number', 'value' => $row["pro_addr1"], 'required' => 1, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), 'pro_addr2' => array('type' => 'text', 'label' => 'Building Name', 'value' => $row["pro_addr2"], 'required' => 1, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), 'pro_addr3' => array('type' => 'text', 'label' => 'Street', 'value' => $row["pro_addr3"], 'required' => 1, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), 'pro_addr5' => array('type' => 'text', 'label' => 'City or County', 'value' => $row["pro_addr5"], 'required' => 1, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), 'pro_postcode' => array('type' => 'text', 'label' => 'Postcode', 'value' => $row["pro_postcode"], 'required' => 1, 'attributes' => array('class' => 'pc', 'maxlength' => 9, 'readonly' => 'readonly'), 'function' => 'format_postcode', 'group' => 'Postcode'), 'pro_postcode_change' => array('type' => 'button', 'label' => 'Postcode', 'value' => 'Change Address', 'group' => 'Postcode', 'attributes' => array('class' => 'button', 'onClick' => 'javascript:document.location.href = \'' . $_SERVER['SCRIPT_NAME'] . '?' . replaceQueryString($_SERVER['QUERY_STRING'], 'pro_pro_id') . '\';'), 'last_in_group' => 1));
     }
     // manually inputted address
 } else {
     $formData2 = array('pro_addr1' => array('type' => 'text', 'label' => 'House Number', 'value' => $pro_addr1, 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_addr2' => array('type' => 'text', 'label' => 'Building Name', 'value' => $pro_addr2, 'required' => 1, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_addr3' => array('type' => 'text', 'label' => 'Street', 'value' => $pro_addr3, 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_addr4' => array('type' => 'text', 'label' => 'Town or Area', 'value' => $pro_addr4, 'required' => 3, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_addr5' => array('type' => 'text', 'label' => 'City or County', 'value' => $pro_addr5, 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_postcode' => array('type' => 'text', 'label' => 'Postcode', 'value' => $pro_postcode, 'required' => 2, 'attributes' => array('class' => 'pc', 'maxlength' => 9), 'function' => 'format_postcode'), 'pro_country' => array('type' => 'select', 'label' => 'Country', 'value' => $pro_country, 'required' => 2, 'options' => db_lookup("cli_country", "country", "array"), 'attributes' => array('class' => 'addr')));
 }
 if (!$_POST["action"]) {
     $sql_1 = remove_lastchar(trim($sql_1), "OR");
     $sql_2 = remove_lastchar(trim($sql_2), "OR");
     if (!$_GET["return"]) {
         $return = $_SERVER['SCRIPT_NAME'] . '?' . http_build_query(array('cli_name' => $_GET["cli_name"], 'cli_email' => $_GET["cli_email"], 'dest' => $_GET["dest"], 'dea_id' => $_GET["dea_id"]));
     } else {
         $return = $_GET["return"];
     }
     if ($sql_1) {
         // first, match both first AND surnames and put at top of list
         $sql = "SELECT cli_id,cli_fname,cli_sname,pro_addr1,pro_addr2,pro_addr3,pro_postcode FROM client\n\tLEFT JOIN property ON property.pro_id = client.cli_pro\n\tWHERE " . $sql_1 . "\n\tORDER BY cli_fname ASC, cli_sname ASC";
         $q = $db->query($sql);
         if (DB::isError($q)) {
             die("db error: " . $q->getMessage() . "sql_1<br>" . $sql);
예제 #3
0
     $subtype_title = $row["subtype_title"];
     $area_title = $row["are_title"];
 }
 // get list of matching area, based on first half of postcode
 // show radio buttons, or a full drop down if no postcode match is found
 $pc1 = explode(" ", $pro_postcode);
 $pc1 = $pc1[0];
 $len = strlen($pc1);
 $sql = "SELECT are_id,are_title,are_postcode \nFROM area WHERE \nLEFT(area.are_postcode,4) = '" . $pc1 . "' \nORDER BY are_title";
 $q = $db->query($sql);
 if (DB::isError($q)) {
     die("db error: " . $q->getMessage());
 }
 $numRows = $q->numRows();
 if ($numRows == 0) {
     $render_area = db_lookup("pro_area", "area", "select", $pro_area, "are_title");
     $render_area .= '<a href="area_add.php?pc=' . $pc1 . '">Click here to add a new area</a>';
 } else {
     while ($row = $q->fetchRow()) {
         if ($numRows == 1) {
             $render_area .= '<input type="radio" name="pro_area" value="' . $row["are_id"] . '" checked>' . $row["are_title"] . '';
         } else {
             $render_area .= '<input type="radio" name="pro_area" value="' . $row["are_id"] . '"';
             if ($row["are_id"] == $pro_area) {
                 $render_area .= ' checked';
             }
             $render_area .= '> ' . $row["are_title"] . '<br> ';
         }
     }
 }
 // get property types to populate javascript drop downs
예제 #4
0
 if ($cli_lettings !== 'Yes') {
     $form->addHtml('<div id="let2">');
     $form->addHtml($form->addDiv($form->makeField("button", $formName, "", "Register", array('class' => 'submit', 'onClick' => 'javascript:swapDiv(\'let\',\'let2\');'))));
     $form->addHtml('</div>');
 }
 $form->addHtml("</div>\n");
 $form->addHtml("</fieldset>\n");
 /////////////////////////////////////////////////////////////////////////////////
 // only show if client is registered for sales or lettings
 if ($cli_sales == "Yes" || $cli_lettings == "Yes") {
     $formName = 'form7';
     $form->addHtml("<fieldset>\n");
     $form->addHtml('<div class="block-header">Specifics</div>');
     $form->addHtml('<div id="' . $formName . '">');
     $feature_form = $form->makeField('select', 'status', 'Status', '', '', db_enum("link_client_to_feature", "status", "array"));
     $feature_form .= $form->makeField('select', 'featureId', 'Feature', '', '', db_lookup("feature", "feature", "array", "", "fea_title"));
     $feature_form .= $form->makeField("button", $formName, "", "Add", array('class' => 'button', 'onClick' => 'javascript:addFeature();'));
     $form->addHtml($fea_table);
     $form->addHtml($form->addLabel('Add Feature', 'Add Feature', $feature_form));
     $form->addSeperator();
     $form->addHtml('<p class="appInfo">Only enter special requirements below if they aren\'t listed in the options above.</p>');
     $form->addData(${$formName}, $_POST);
     $form->addHtml(renderNotes('client_req', $cli_id, array('viewform' => 7, 'label' => 'Special Requirements')));
     $form->addHtml($form->makeField("submit", $formName, "", "Save Changes", array('class' => 'submit')));
     $form->addHtml("</div>\n");
     $form->addHtml("</fieldset>\n");
     $areas = area(explode("|", $areas));
     $formName = 'form6';
     $form->addHtml("<fieldset>\n");
     $form->addHtml('<div class="block-header">Areas</div>');
     $form->addHtml('<div id="' . $formName . '" style="margin-left:10px">');
예제 #5
0
    $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')));
    $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;
} else {
    $Data = $postcode->lookup($lookup_type, $search_string, "data");
    if (count($Data) == 1) {
        foreach ($Data as $keyd => $data) {
            $udprn = $data["id"];
        }
        header("Location:?lookup_type=udprn&search_string=" . $udprn . "&scope=" . $scope);
        exit;
예제 #6
0
// get list of negs (currently all staff)
$negotiators[] = '-- select --';
// blank option
$sql = "SELECT use_id,CONCAT(use_fname,' ',use_sname) AS use_name FROM user\nWHERE use_status = 'Active'\nAND use_branch = '" . $dea_branch . "'\nORDER BY use_sname ASC, use_sname ASC";
$q = $db->query($sql);
if (DB::isError($q)) {
    die("db error: " . $q->getMessage());
}
$numRows = $q->numRows();
while ($row = $q->fetchRow()) {
    $negotiators[$row["use_id"]] = $row["use_name"];
}
// non editable fields
$formData1 = array('dea_vendor' => array('type' => 'text', 'label' => 'Vendor', 'value' => $cli_name, 'attributes' => array('readonly' => 'readonly', 'style' => 'width:400px', 'onClick' => 'document.location.href = \'client_edit.php?cli_id=' . $cli_id . '&searchLink=' . $_SERVER['PHP_SELF'] . urlencode('?' . $_SERVER['QUERY_STRING']) . '\';')), 'dea_prop' => array('type' => 'text', 'label' => 'Property', 'value' => $pro_addr, 'attributes' => array('readonly' => 'readonly', 'style' => 'width:400px')));
// editable, branch and neg
$formData2 = array('dea_branch' => array('type' => 'select', 'label' => 'Branch', 'value' => $dea_branch, 'required' => 2, 'options' => db_lookup('dea_branch', 'branch', 'array', $dea_branch), 'attributes' => array('style' => 'width: 200px')), 'dea_neg' => array('type' => 'select', 'label' => 'Negotiator', 'value' => $dea_neg, 'required' => 2, 'options' => $negotiators, 'attributes' => array('style' => 'width: 200px')));
$offers_table = '<div id="innerTable">
<table cellspacing="2" cellpadding="2" width="400">
<tr><td>Lists all offers made on this deal</td></tr>
</table>
</div>';
$statistics_table = '<div id="innerTable">
<table cellspacing="2" cellpadding="2" width="400">
<tr><td>Hits, viewings, and so on</td></tr>
</table>
</div>';
if (!$_GET["action"]) {
    $form = new Form();
    $form->addForm("", "GET", $PHP_SELF);
    $form->addHtml("<div id=\"standard_form\">\n");
    $form->addField("hidden", "stage", "", "1");