예제 #1
0
 $q = $db->query($sql);
 if (DB::isError($q)) {
     die("db error: " . $q->getMessage());
 }
 $numRows = $q->numRows();
 if ($numRows == 0) {
     echo "No matches found.";
     exit;
 } else {
     while ($row = $q->fetchRow()) {
         foreach ($row as $key => $val) {
             ${$key} = $val;
         }
     }
 }
 $formData1 = array('dir_category' => array('type' => 'select', 'label' => 'Category', 'value' => $dir_category, 'required' => 2, 'options' => display_tree_select(1, $dir_category, "data"), 'attributes' => array('style' => 'width:320px')), 'dir_title' => array('type' => 'text', 'label' => 'Business Name', 'value' => $dir_title, 'required' => 2, 'attributes' => array('style' => 'width:320px')), 'dir_name' => array('type' => 'text', 'label' => 'Contact Name', 'value' => $dir_name, 'required' => 1, 'attributes' => array('style' => 'width:320px'), 'function' => 'format_name'), 'dir_tel' => array('type' => 'text', 'label' => 'Telephone', 'value' => $dir_tel, 'required' => 1, 'attributes' => array('style' => 'width:164px', 'maxlength' => 30)), 'dir_fax' => array('type' => 'text', 'label' => 'Fax', 'value' => $dir_fax, 'required' => 1, 'attributes' => array('style' => 'width:164px', 'maxlength' => 30)), 'dir_email' => array('type' => 'text', 'label' => 'Email', 'value' => $dir_email, 'required' => 1, 'attributes' => array('style' => 'width:320px', 'maxlength' => 255)), 'dir_web' => array('type' => 'text', 'label' => 'Website', 'value' => $dir_web, 'init' => 'http://', 'required' => 1, 'attributes' => array('style' => 'width:320px', 'maxlength' => 255)), 'dir_blurb' => array('type' => 'textarea', 'label' => 'Description', 'value' => $dir_blurb, 'required' => 1, 'attributes' => array('style' => 'width:320px;height:80px')));
 // make fields read only if address comes from paf
 if ($pro_pcid == '-1') {
     $attribute_array = array('class' => 'addr');
     $attribute_array_pc = array('class' => 'pc', 'maxlength' => 9);
 } else {
     $attribute_array = array('class' => 'addr', 'readonly' => 'readonly');
     $attribute_array_pc = array('class' => 'pc', 'maxlength' => 9, 'readonly' => 'readonly');
 }
 $formData2 = array('pro_pcid' => array('type' => 'hidden', 'value' => $pro_pcid), 'pro_addr1' => array('type' => 'text', 'label' => 'House Number', 'value' => $pro_addr1, 'required' => 2, 'attributes' => $attribute_array, 'function' => 'format_street'), 'pro_addr2' => array('type' => 'text', 'label' => 'Building Name', 'value' => $pro_addr2, 'required' => 1, 'attributes' => $attribute_array, 'function' => 'format_street'), 'pro_addr3' => array('type' => 'text', 'label' => 'Street', 'value' => $pro_addr3, 'required' => 2, 'attributes' => $attribute_array, 'function' => 'format_street'), 'pro_addr4' => array('type' => 'text', 'label' => 'Town or Area', 'value' => $pro_addr4, 'required' => 3, 'attributes' => $attribute_array, 'function' => 'format_street'), 'pro_addr5' => array('type' => 'text', 'label' => 'City or County', 'value' => $pro_addr5, 'required' => 2, 'attributes' => $attribute_array, 'function' => 'format_street'), 'pro_postcode' => array('type' => 'text', 'label' => 'Postcode', 'value' => $pro_postcode, 'required' => 2, 'attributes' => $attribute_array_pc, 'function' => 'format_postcode', 'group' => 'Postcode'), 'pro_postcode_change' => array('type' => 'button', 'label' => 'Postcode', 'value' => 'Change Address', 'group' => 'Postcode', 'attributes' => array('class' => 'button', 'onClick' => 'javascript:resetDirectoryAddress(' . $dir_id . ');'), 'last_in_group' => 1));
 // form is not submitted, show the form
 if (!$_POST["action"]) {
     // start new form object
     $form = new Form();
     $form->addForm("form", "post", $PHP_SELF, "multipart/form-data");
     $form->addHtml("<div id=\"standard_form\">\n");
예제 #2
0
<?php

require_once '../inx/global.inc.php';
require_once '../inx/dbtree.inc.php';
include "menu.php";
$db = new CDatabase("wsv3_test", "localhost", "wsv3_db_user", "CHe9adru+*=!a!uC7ubRad!TRu#raN");
$tree = new CDBTree($db, 'category', 'cat_id');
if (!$_GET["action"]) {
    $node_id = $_GET["node_id"];
    $sql = "SELECT cat_title FROM category WHERE cat_id = {$node_id} LIMIT 1";
    $result = mysql_query($sql);
    while ($row = mysql_fetch_array($result)) {
        $node_title = $row["cat_title"];
    }
    $formData1 = array('title' => array('type' => 'text', 'label' => 'Title', 'value' => $node_title, 'required' => 2, 'attributes' => array('class' => 'addr')));
    $formData2 = array('new_id' => array('type' => 'select', 'label' => 'Category', 'value' => $node_id, 'options' => display_tree_select(1, $node_id, 'data'), 'required' => 2, 'attributes' => array('class' => 'addr')));
    // start new form object
    $form = new Form();
    $form->addForm("form", "get", $PHP_SELF);
    $form->addHtml("<div id=\"standard_form\">\n");
    $form->addField("hidden", "action", "", "edit");
    $form->addField("hidden", "id", "", $node_id);
    $form->addHtml("<fieldset>\n");
    $form->addLegend('Edit Node');
    $form->addData($formData1, $_GET);
    $form->addHtml($form->addDiv($form->makeField("submit", "", "", "Save Changes", array('class' => 'submit'))));
    $form->addHtml("</fieldset>\n");
    $form->addHtml("</div>\n");
    $form2 = new Form();
    $form2->addForm("form", "get", $PHP_SELF);
    $form2->addHtml("<div id=\"standard_form\">\n");