/** * The action that displays the entry insert form . * * @param PDO $pdo The PDO object. * @return Opt_View */ function action($pdo, $config) { $view = new Opt_View('add.tpl'); $view->title = 'Add new entry'; $form = new Form($view); $form->setAction('index.php?action=add'); $form->addField('author', 'required,min_len=3,max_len=30', 'The length must be between 3 and 30 characters.'); $form->addField('email', 'required,email,min_len=3,max_len=100', 'The value must be a valid mail with maximum 100 characters long.'); $form->addField('website', 'url,min_len=3,max_len=100', 'The value must be a valid URL with maximum 100 characters long.'); $form->addField('body', 'required,min_len=3', 'The body must be at least 3 characters long.'); if ($form->validate()) { $values = $form->getValues(); $stmt = $pdo->prepare('INSERT INTO `entries` (`author`, `email`, `date`, `website`, `body`) VALUES(:author, :email, :date, :website, :body)'); $stmt->bindValue(':author', $values['author'], PDO::PARAM_STR); $stmt->bindValue(':email', $values['email'], PDO::PARAM_STR); $stmt->bindValue(':date', time(), PDO::PARAM_INT); $stmt->bindValue(':website', $values['website'], PDO::PARAM_STR); $stmt->bindValue(':body', $values['body'], PDO::PARAM_STR); $stmt->execute(); $view->setTemplate('message.tpl'); $view->message = 'The entry has been successfully added!'; $view->redirect = 'index.php?action=list'; } else { // The form is an object, so we need to inform OPT about it. $view->form = $form; $view->setFormat('form', 'Objective'); } return $view; }
public function getForm($type, $action, $request, $isPost = false, $errors = array()) { $form = new Form('form-post-' . $type, 'form-post-' . $type, $action, 'POST', 'form-horizontal', $errors, $isPost); $form->addField('author', Lang::_('Author'), 'text', $this->_getfieldvalue('author', $type, $request), true, '', @$errors['author']); $form->addField('title', Lang::_('Title'), 'text', $this->_getfieldvalue('title', $type, $request), true, '', @$errors['title']); $form->addField('content', Lang::_('Content'), 'text', $this->_getfieldvalue('content', $type, $request), true, '', @$errors['content']); $form->addField('date', Lang::_('Date'), 'date', $this->_getfieldvalue('date', $type, $request), false, '', @$errors['date']); return $form; }
public function getForm($type, $action, $request, $isPost = false, $errors = array()) { $form = new Form($id = 'form-picture', $name = 'form-picture', $action, 'POST', 'form-horizontal', $isPost); $form->addField('id', Lang::_('Picture Id'), 'text', $this->_getfieldvalue('id', $type, $request), true, '', @$errors['id']); $form->addField('quarter_id', Lang::_('Quarter id'), 'text', $this->_getfieldvalue('quarter_id', $type, $request), false, '', @$errors['quarter_id']); $form->addField('src', Lang::_('Src'), 'file', $this->_getfieldvalue('src', $type, $request), false, '', @$errors['src']); $form->addField('info_id', Lang::_('Info id'), 'text', $this->_getfieldvalue('info_id', $type, $request), true, '', @$errors['info_id']); $form->addField('user_id', Lang::_('User id'), 'text', $this->_getfieldvalue('user_id', $type, $request), true, '', @$errors['user_id']); return $form->render(); }
/** * Loads our index/default welcome/dashboard screen */ public function view() { $form = new Form('config'); // add all config variables to our form $sql = sprintf('SELECT * FROM config'); $model = model()->open('config'); $records = $model->results(); if ($records) { foreach ($records as $record) { $value = $record['current_value'] == '' ? $record['default_value'] : $record['current_value']; $form->addField($record['config_key'], $value, $value); } } // process the form if submitted if ($form->isSubmitted()) { foreach (app()->params->getRawSource('post') as $field => $value) { $model->update(array('current_value' => $value), $field, 'config_key'); } sml()->say('Website settings have been updated successfully.'); router()->redirect('view'); } $data['form'] = $form; $model = model()->open('pages'); $model->where('page_is_live', 1); $data['pages'] = $model->results(); // $data['mods'] = app()->moduleControls(); $data['themes'] = $this->listThemes(); $data['live'] = settings()->getConfig('active_theme'); template()->addCss('style.css'); template()->addJs('admin/jquery.qtip.js'); template()->addJs('view.js'); template()->display($data); }
function getForm($action) { $form = new Form('site_globals', $action); foreach ($this as $key => $value) { $form->addField(['name' => $key, 'label' => $key, 'type' => 'text', 'value' => $value]); } return $form; }
/** * Import one field from model into form. * * @param string $field * @param string $field_name * * @return void|Form_Field */ public function importField($field, $field_name = null) { $field = $this->model->hasElement($field); if (!$field) { return; } /** @type Field $field */ if (!$field->editable()) { return; } if ($field_name === null) { $field_name = $this->_unique($this->owner->elements, $field->short_name); } $field_type = $this->getFieldType($field); $field_caption = $field->caption(); $this->field_associations[$field_name] = $field; if ($field->listData() || $field instanceof Field_Reference) { if ($field_type == 'Line') { $field_type = 'DropDown'; } } $form_field = $this->owner->addField($field_type, $field_name, $field_caption); $form_field->set($field->get()); $field_placeholder = $field->placeholder() ?: $field->emptyText() ?: null; if ($field_placeholder) { $form_field->setAttr('placeholder', $field_placeholder); } if ($field->hint()) { $form_field->setFieldHint($field->hint()); } if ($field->listData()) { /** @type Form_Field_ValueList $form_field */ $a = $field->listData(); $form_field->setValueList($a); } if ($msg = $field->mandatory()) { $form_field->validateNotNULL($msg); } if ($field instanceof Field_Reference || $field_type == 'reference') { $form_field->setModel($field->getModel()); } if ($field->theModel) { $form_field->setModel($field->theModel); } if ($form_field instanceof Form_Field_ValueList && !$field->mandatory()) { /** @type string $text */ $text = $field->emptyText(); $form_field->setEmptyText($text); } if ($field->onField()) { call_user_func($field->onField(), $form_field); } return $form_field; }
/** * Displays and processes the add/edit user form * @access public * @param integer $id */ public function edit($id = false) { $result = false; $form = new Form('users', $id, array('groups')); $form->addField('password_confirm'); // process the form if submitted if ($form->isSubmitted()) { $result = $form->save($id); } template()->set(array('form' => $form)); return $result; }
public function getForm($type, $action, $request, $isPost = false, $errors = array()) { $form = new Form($id = 'form-comment', $name = 'form-comment', $action, 'POST', 'form-horizontal', $isPost); $form->addField('id', Lang::_('Id'), 'text', $this->_getfieldvalue('id', $type, $request), true, '', @$errors['id']); $form->addField('user_id', Lang::_('User Id'), 'text', $this->_getfieldvalue('user_id', $type, $request), true, '', @$errors['user_id']); $form->addField('quarter_id', Lang::_('Quarter Id'), 'text', $this->_getfieldvalue('quarter_id', $type, $request), false, '', @$errors['quarter_id']); $form->addField('info_id', Lang::_('Info Id'), 'text', $this->_getfieldvalue('info_id', $type, $request), false, '', @$errors['info_id']); $form->addField('content', Lang::_('Content'), 'text-area', $this->_getfieldvalue('content', $type, $request), true, '', @$errors['content']); $form->addField('photo_id', Lang::_('Photo Id'), 'file', $this->_getfieldvalue('photo_id', $type, $request), false); return $form->render(); }
/** * @abstract Edits an event recprd * @param integer $id * @access public */ public function edit($id = false) { $form = new Form('courses', $id); // grab existing groups settings $model = model()->open('course_groups_link'); $model->where('course_id', $id); $group_records = $model->results(); $groups = array(); if ($group_records) { foreach ($group_records as $course_record) { $groups[] = $course_record['group_id']; } } $form->addField('groups', $groups, $groups); // proces the form if submitted if ($form->isSubmitted()) { // validation if (!$form->isFilled('title')) { $form->addError('title', 'You must enter a course title.'); } // if we have no errors, process sql if (!$form->error()) { if ($res_id = $form->save($id)) { $id = $id ? $id : $res_id; // update course groups $model->delete('course_groups_link', $id, 'course_id'); $groups = $form->cv('groups'); foreach ($groups as $group) { $sql = sprintf('INSERT INTO course_groups_link (course_id, group_id) VALUES ("%s", "%s")', $id, $group); $model->query($sql); } // if successful insert, redirect to the list sml()->say('The course has successfully been saved.'); router()->redirect('view'); } } } $data['form'] = $form; template()->addView(template()->getTemplateDir() . DS . 'header.tpl.php'); template()->addView(template()->getModuleTemplateDir() . DS . 'edit.tpl.php'); template()->addView(template()->getTemplateDir() . DS . 'footer.tpl.php'); template()->display($data); }
public static function createFromConfig($config, $data = [], $errors = []) { $form = new Form($data, $errors); if (isset($config['fields'])) { if (isset($config['defaults']) && isset($config['defaults']['fields'])) { $field_defaults = $config['defaults']['fields'] + self::$fieldsDefaults; } else { $field_defaults = self::$fieldsDefaults; } foreach ($config['fields'] as $key => $fc) { if (!isset($fc['name'])) { trigger_error('Skipping index "' . $key . '". No name attibute.', E_USER_WARNING); continue; } extract(self::parseDynamicValues(array_replace_recursive($field_defaults, $fc))); if (!isset($data[$name]) && !is_null($default)) { $data[$name] = $default; } if ($required) { $attributes["required"] = "required"; } $field = $form->addField($type, $name, $label, $choices, $group, $attributes, $container_attributes, $html); } $form->setData($data); if (isset($config['layout'])) { $form->setGroupLayout($config['layout']); } if (isset($config['groups'])) { foreach ($config['groups'] as $groupname => $groupconfig) { $groupconfig = array_replace_recursive(self::$groupsDefaults, $groupconfig); $form->defineGroup($groupname, $groupconfig['label'], $groupconfig['attributes']); } } } return $form; }
getQueryResults($sql); $headers = 'From: No Reply <signup@' . $_SERVER['HTTP_HOST'] . '>' . CRLF; $subject = 'Your account signup at ' . $_SERVER['HTTP_HOST']; $content = 'Thank you for your request for any account.' . CR . CR; $content .= 'To validate your signup please follow the link below' . CR; $content .= 'http://' . $_SERVER['HTTP_HOST'] . $config->get('web', 'root') . '/signup/at8/?v=' . md5($member['camra_number']) . CR; $content .= CR . CR . 'Thank you.'; mail($member['email'], $subject, $content, $headers); header('Location: ' . $config->get('web', 'root') . '/signup/thankyou/'); exit; } else { $form->submiterrormsg .= '<p class="error">Username/CAMRA Number is already registered.</p><p> Please choose another one or check with your system administrator.</p>'; } } $form->addFieldsetOpen('Signup'); $form->addField('firstname', 'text', $member['firstname']); $form->addLabel('Firstname'); $form->addFieldValidation('required'); $form->addField('lastname', 'text', $member['lastname']); $form->addLabel('Lastname'); $form->addFieldValidation('required'); $form->addField('email', 'text', $member['email']); $form->addLabel('Email Address'); $form->addFieldValidation('required email'); $form->addField('camra_number', 'text', $member['camra_number']); if ($config->get('web', 'signupNonCamra')) { $form->addLabel('CAMRA Membership Number/Username'); $form->addFieldValidation('required'); } else { $form->addLabel('CAMRA Membership Number'); $form->addFieldValidation('required numeric');
public function getForm($type, $action, $request, $isPost = false, $errors = array()) { $form = new Form($id = 'form-contact', $name = 'form-contact', $action, 'POST', 'form-horizontal', $isPost); $form->addField('lastname', Lang::_('Lastname'), 'text', $this->_getfieldvalue('lastname', $type, $request), true, '', @$errors['lastname']); $form->addField('firstname', Lang::_('Firstname'), 'text', $this->_getfieldvalue('firstname', $type, $request), true, '', @$errors['firstname']); $form->addField('email', Lang::_('Email'), 'email', $this->_getfieldvalue('email', $type, $request), true, '', @$errors['email']); $form->addField('message', Lang::_('Message'), 'textarea', $this->_getfieldvalue('message', $type, $request), true, '', @$errors['message']); $form->addField('cgu', Lang::_('Accept the terms of service'), 'checkbox', $this->_getfieldvalue('cgu', $type, $request), true, '', @$errors['cgu']); return $form->render(); }
} } /* if ($app["type"] == "Lunch" || $app["type"] == "Note" || $app["type"] == "Meeting") { $db_data["app_status"] = 'Cancelled'; db_query($db_data,"UPDATE","appointment","app_id",$app["id"]); header("Location:calendar.php?branch=".$app["branch"]."&y=$y&m=$m&d=$d"); exit; } */ $formData1 = array('notes' => array('type' => 'textarea', 'label' => 'Reason for Cancelling', 'value' => '', 'attributes' => array('class' => 'noteInput'))); $form = new Form(); $form->addForm("app_form", "POST", $PHP_SELF); $form->addHtml("<div id=\"standard_form\">\n"); $form->addField("hidden", "action", "", "update"); $form->addField("hidden", "app_id", "", $app_id); $form->addField("hidden", "searchLink", "", urlencode($return)); $form->addHtml("<fieldset>\n"); $form->addHtml('<div class="block-header">Cancel ' . $app["type"] . '</div>'); $form->addHtml('<p class="appInfo">Please remember to inform all vendors/landlords and/or viewers that this appointment has been cancelled</p>'); $form->addData($formData1, $_POST); $form->addHtml(renderNotes('appointment_cancel', $app_id, array('label' => 'Cancellation Notes'))); $buttons = $form->makeField("submit", $formName, "", "Save Changes", array('class' => 'submit')); $form->addHtml($form->addDiv($buttons)); $form->addHtml("</fieldset>\n"); $form->addHtml('</div>'); if (!$_POST["action"]) { /* if ($_GET["searchLink"]) { $searchLink = str_replace("%3F","?",replaceQueryStringArray($_GET["searchLink"],array('app_id'))).'&jumpto='.$hour;
$numRows = $q->numRows(); if ($numRows !== 0) { while ($row = $q->fetchRow()) { foreach ($row as $key => $val) { ${$key} = $val; } } } $formData1 = array('cli_salemin' => array('type' => 'select_price', 'value' => $cli_salemin, 'label' => 'Minimum Price', 'group' => 'Price Range', 'required' => 2, 'options' => array('scope' => 'sales', 'default' => 'Minimum'), 'attributes' => array('style' => 'width:120px')), 'cli_salemax' => array('type' => 'select_price', 'value' => $cli_salemax, 'label' => 'Maximum Price', 'group' => 'Price Range', 'last_in_group' => 1, 'required' => 2, 'options' => array('scope' => 'sales', 'default' => 'Maximum'), 'attributes' => array('style' => 'width:120px')), 'cli_salebed' => array('type' => 'select_number', 'value' => $cli_salebed, 'label' => 'Minimum Beds', 'required' => 2), 'cli_saleemail' => array('type' => 'radio', 'value' => $cli_saleemail, 'label' => 'Email Updates', 'required' => 2, 'options' => db_enum("client", "cli_saleemail", "array"))); $ptype_sale = ptype("sale", explode("|", $cli_saleptype)); $formData2 = array('cli_letmin' => array('type' => 'select_price', 'value' => $cli_letmin, 'label' => 'Minimum Price', 'group' => 'Price Range', 'required' => 2, 'options' => array('scope' => 'lettings', 'default' => 'Minimum'), 'attributes' => array('style' => 'width:120px')), 'cli_letmax' => array('type' => 'select_price', 'value' => $cli_letmax, 'label' => 'Maximum Price', 'group' => 'Price Range', 'last_in_group' => 1, 'required' => 2, 'options' => array('scope' => 'lettings', 'default' => 'Maximum'), 'attributes' => array('style' => 'width:120px')), 'cli_letbed' => array('type' => 'select_number', 'value' => $cli_letbed, 'label' => 'Minimum Beds', 'required' => 2), 'cli_letemail' => array('type' => 'radio', 'value' => $cli_letemail, 'label' => 'Email Updates', 'required' => 2, 'options' => db_enum("client", "cli_letemail", "array"))); $ptype_let = ptype("let", explode("|", $cli_letptype)); $form = new Form(); $form->addHtml("<div id=\"standard_form\">\n"); $form->addForm("", "get"); $form->addField("hidden", "stage", "", "requirements"); $form->addField("hidden", "action", "", "update"); $form->addField("hidden", "cli_id", "", $cli_id); $form->addField("hidden", "app_id", "", $_GET["app_id"]); $form->addField("hidden", "searchLink", "", $searchLink); $form->addHtml("<fieldset>\n"); $form->addLegend('Sales Requirements'); $form->addHtml($form->addLabel('cli_saleptype', 'Houses', $ptype_sale['house'], 'javascript:checkAll(document.forms[0], \'sale1\');')); $form->addHtml($form->addLabel('cli_saleptype', 'Apartments', $ptype_sale['apartment'], 'javascript:checkAll(document.forms[0], \'sale2\');')); $form->addHtml($form->addLabel('cli_saleptype', 'Others', $ptype_sale['other'], 'javascript:checkAll(document.forms[0], \'sale3\');')); $form->addData($formData1, $_GET); $form->addHtml($form->addDiv($form->makeField("submit", "submit", "", "Save Changes", array('class' => 'submit')))); $form->addHtml("</fieldset>\n"); $form->addHtml("<fieldset>\n"); $form->addLegend('Lettings Requirements'); $form->addHtml($form->addLabel('cli_letptype', 'Houses', $ptype_let['house'], 'javascript:checkAll(document.forms[0], \'sale1\');'));
} elseif ('deleteUser' == $form->submittedaction) { getQueryResults('DELETE FROM user WHERE id=' . $request->get('post', 'member_id')); header('Location: ' . $config->get('web', 'root') . '/admin/?msg=User+deleted'); exit; } } else { if (!is_null($member_id) && '' != $member_id && 'new' != $member_id) { $member = reset(getQueryResults('SELECT * FROM ' . $config->get('database', 'tablePrefix') . 'user WHERE id=' . $member_id)); } elseif ('new' == $member_id) { $member = array('id' => 'new', 'firstname' => $request->get('post', 'firstname') ? $request->get('post', 'firstname') : '', 'lastname' => $request->get('post', 'lastname') ? $request->get('post', 'lastname') : '', 'type' => 'reviewer', 'camra_number' => $request->get('post', 'camra_number') ? $request->get('post', 'camra_number') : '', 'postcode' => $request->get('post', 'postcode') ? $request->get('post', 'postcode') : '', 'email' => $request->get('post', 'email') ? $request->get('post', 'email') : '', 'active' => $request->get('post', 'active') != 1 ? 0 : 1); } else { $members = getQueryResults('SELECT id, CONCAT(lastname, \', \', firstname) as name FROM `' . $config->get('database', 'tablePrefix') . 'user` ORDER BY `lastname`,`firstname`;'); } } if (isset($members)) { $form->addField('member_id', 'select'); $form->addLabel('Select Member'); $form->addOptions(array('new' => 'Add New Member')); $form->addOptions($members, 'id', 'name'); $form->addField('selectMember', 'submit', 'Select Member'); $form->addInputClass('btnSubmit'); } else { $form->addField('member_id', 'hidden', $member['id']); $form->addField('firstname', 'text', $member['firstname']); $form->addLabel('Firstname'); $form->addFieldValidation('required'); $form->addField('lastname', 'text', $member['lastname']); $form->addLabel('Lastname'); $form->addFieldValidation('required'); $form->addField('email', 'text', $member['email']); $form->addLabel('Email Address');
$form->addField("hidden", "app_id", "", $_GET["app_id"]); $form->addField("hidden", "searchLink", "", $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING']); // carry is for carrying return link through (e.g. when adding vendor to deal, we still want to retain the searchLink) $form->addField("hidden", "carry", "", $_GET["carry"]); $form->addHtml("<fieldset>\n"); $form->addHtml('<div class="block-header">Select Client</div>'); $form->addHtml($form->addLabel('cli_id', 'Existing Clients', $form->makeField("select", "cli_id", "", "", array('size' => '6', 'style' => 'width:400px;', 'onDblClick' => 'document.forms[0].submit();'), $options))); $form->addHtml($form->addDiv($form->makeField("submit", "", "", "Use Selected Client", array('class' => 'submit')))); #$form->addHtml($form->addDiv($form->makeField("button","","","Create New Client",array('class'=>'submit','onClick'=>'location.href=\''.$goto_notfound.'?'.http_build_query($terms).'&dest='.$_GET["dest"].'\';')))); $form->addHtml("</fieldset>\n"); $form->addHtml("</div>\n"); } $form2 = new Form(); $form2->addForm("form", "post", $PHP_SELF); $form2->addHtml("<div id=\"standard_form\">\n"); $form2->addField("hidden", "stage", "", "2"); $form2->addField("hidden", "action", "", "new_client"); $form2->addField("hidden", "dest", "", $_GET["dest"]); $form2->addField("hidden", "dea_id", "", $_GET["dea_id"]); $form2->addField("hidden", "app_id", "", $_GET["app_id"]); $form2->addField("hidden", "carry", "", $_GET["carry"]); $form2->addHtml("<fieldset>\n"); $form2->addLegend('New Client'); $form2->addData($formData1, $_GET); $form2->addRow('radio', 'p2c_type', 'Address Type', 'Home', '', db_enum("pro2cli", "p2c_type", "array")); if (!$_GET["pro_pro_id"]) { $form2->ajaxPostcode("by_freetext", "pro"); } else { $form2->addData($formData2, $_GET); $form2->addHtml($form2->addDiv($form->makeField("submit", "", "", "Save Changes", array('class' => 'submit')))); }
$salestatuses[0] = ''; $lettingstatuses[0] = ''; $sql = "SELECT * FROM cstatus"; $q = $db->query($sql); while ($row = $q->fetchRow()) { if ($row["cst_scope"] == 'Sales') { $salestatuses[$row["cst_id"]] = $row["cst_title"]; } else { $lettingstatuses[$row["cst_id"]] = $row["cst_title"]; } } $formData1 = array('scope' => array('type' => 'radio', 'label' => 'Sales or Lettings', 'value' => $_GET["scope"], 'default' => 'Sales', 'options' => array('Sales' => 'sale', 'Lettings' => 'let'), 'attributes' => array('onClick' => 'javascript:disableTermField(\'scope\',\'term\');showHideStatusRow(\'scope\');')), 'keyword' => array('type' => 'text', 'label' => 'Name or Email', 'value' => $_GET["keyword"], 'attributes' => array('class' => 'addr')), 'feature' => array('type' => 'text', 'label' => 'Keywords(s)', 'value' => $_GET["feature"], 'attributes' => array('class' => 'addr'), 'tooltip' => 'Areas, postcodes, and any specific property requirements. e.g. Garden'), 'price' => array('type' => 'text', 'label' => 'Price', 'value' => $_GET["price"], 'group' => 'Price', 'attributes' => array('style' => 'width:120px')), 'term' => array('type' => 'select', 'label' => 'Term', 'value' => $_GET["term"], 'group' => 'Price', 'last_in_group' => '1', 'attributes' => $term_attributes, 'options' => array('pw' => 'per week', 'pcm' => 'per month')), 'bedmin' => array('type' => 'select_number', 'label' => 'Bedrooms', 'value' => $_GET["bedmin"], 'group' => 'Bedrooms'), 'bedmax' => array('type' => 'select_number', 'label' => 'Bedrooms', 'value' => $_GET["bedmax"], 'group' => 'Bedrooms', 'last_in_group' => 1), 'date_range' => array('type' => 'select', 'label' => 'Registered', 'value' => $_GET["date_range"], 'attributes' => array('style' => 'width:200px'), 'options' => array('' => 'Anytime', $past_week => 'in the past week', $past_month => 'in the past month', $past_month6 => 'in the past 6 months', $past_year => 'in the past 12 months')), 'cli_neg' => array('type' => 'select_neg', 'label' => 'Assigned Negotiator', 'value' => $_GET["cli_neg"], 'options' => array('' => ''), 'attributes' => array('style' => 'width:200px')), 'cli_branch' => array('type' => 'select_branch', 'label' => 'Assigned Branch', 'value' => $_GET["cli_branch"], 'options' => array('' => ''), 'attributes' => array('style' => 'width:200px')), 'cli_method' => array('type' => 'select', 'label' => 'Initial Contact Method', 'value' => $_GET["cli_method"], 'options' => array('' => '', 'Website' => 'Self-registration on our site', 'Telephone' => 'Telephone', 'Email' => 'Email', 'Internet' => 'Internet (portal)', 'Walk-in' => 'Walk-in'), 'attributes' => array('style' => 'width:200px')), 'cli_salestatus' => array('type' => 'select', 'label' => 'Current Status (Sales)', 'value' => $_GET["cli_salestatus"], 'options' => $salestatuses, 'attributes' => array('style' => 'width:200px')), 'cli_letstatus' => array('type' => 'select', 'label' => 'Current Status (Lettings)', 'value' => $_GET["cli_letstatus"], 'options' => $lettingstatuses, 'attributes' => array('style' => 'width:200px')), 'has_email' => array('type' => 'radio', 'label' => 'Has email address?', 'value' => $_GET["has_email"], 'options' => array('Yes' => 'Yes', 'No' => 'No'))); $form = new Form(); $form->addForm("client_form", "GET", $PHP_SELF); $form->addHtml("<div id=\"standard_form\">\n"); $form->addField("hidden", "stage", "", "1"); $form->addField("hidden", "action", "", "advanced_search"); $form->addHtml("<fieldset>\n"); $form->addHtml('<div class="block-header">Search Applicants</div>'); $form->addData($formData1, $_GET); $form->addSeperator(); $ptype_data = ptype("sale", explode("|", $_GET["cli_saleptype"])); $form->addHtml('<div id="sale" style="display:' . $sale_display . '">'); // $form->addHtml($form->addLabel('type', 'Houses', $ptype_data['house'], 'javascript:checkAll(document.forms[0], \'sale1\');')); // $form->addHtml($form->addLabel('type', 'Apartments', $ptype_data['apartment'], 'javascript:checkAll(document.forms[0], \'sale2\');')); // $form->addHtml($form->addLabel('type', 'Others', $ptype_data['other'], 'javascript:checkAll(document.forms[0], \'sale3\');')); $buttons = $form->makeField("submit", "", "", "Search", array('class' => 'submit')); $buttons .= $form->makeField("button", "", "", "Reset", array('class' => 'button', 'onClick' => 'javascript:location.href=\'' . $PHP_SELF . '\';')); $form->addHtml($form->addDiv($buttons)); $form->addHtml("</fieldset>\n"); if (!$_GET["viewForm"]) {
public function getForm($type, $action, $request, $isPost = false, $errors = array()) { $form = new Form($id = 'form-user', $name = 'form-user', $action, 'POST', 'form-horizontal', $isPost); $form->addField('id', Lang::_('Id'), 'text', $this->_getfieldvalue('id', $type, $request), true, '', @$errors['id']); $form->addField('firstname', Lang::_('Firstname'), 'text', $this->_getfieldvalue('firstname', $type, $request), true, '', @$errors['firstname']); $form->addField('lastname', Lang::_('Lastname'), 'text', $this->_getfieldvalue('lastname', $type, $request), true, '', @$errors['lastname']); $form->addField('pseudo', Lang::_('Pseudo'), 'text', $this->_getfieldvalue('pseudo', $type, $request), true, '', @$errors['pseudo']); $form->addField('email', Lang::_('Email'), 'email', $this->_getfieldvalue('email', $type, $request), true, '', @$errors['email']); $form->addField('confirm_email', Lang::_('Confirm email'), 'email', $this->_getfieldvalue('confirm_email', $type, $request), true, '', @$errors['confirm_email']); $form->addField('password', Lang::_('Password'), 'password', '', true, '', @$errors['password']); $form->addField('confirm_password', Lang::_('Confirm password'), 'password', '', true, '', @$errors['confirm_password']); $form->addField('newsletter', Lang::_('Subscribe to the newsletter'), 'checkbox', $this->_getfieldvalue('newsletter', $type, $request), false, ''); $form->addField('cgu', Lang::_('Accept the terms of service'), 'checkbox', $this->_getfieldvalue('cgu', $type, $request), true, '', @$errors['cgu']); return $form->render(); }
/** * @abstract Processes the registration * @access public */ public function process_registration() { $form = new Form('users', false, array('groups')); $form->addField('password_confirm'); if ($form->isSubmitted()) { if ($form->save()) { $this->mail->AddAddress($form->cv('username')); $this->mail->From = $this->config('email_sender'); $this->mail->FromName = $this->config('email_sender_name'); $this->mail->Mailer = "mail"; $this->mail->ContentType = 'text/html'; $this->mail->Subject = $this->website_title() . " Registration Confirmation"; $body = $this->config('registration_email_body'); $body = str_replace('{website}', $this->website_title(), $body); $body = str_replace('{user}', $form->cv('username'), $body); $body = str_replace('{pass}', post()->getRaw('password'), $body); $this->mail->Body = $body; $this->mail->Send(); $this->mail->ClearAddresses(); // send to thanks page $thanks = $this->cms_lib->url($this->config('registration_thanks_page_id')); header("Location: " . (empty($thanks) ? 'index.php' : $thanks)); exit; } } return $form; }
break; ########################################################### # stage 3 - areas ########################################################### ########################################################### # stage 3 - areas ########################################################### case 3: # build data arrays $formData1 = array(); $areas = area($_GET["cli_area"]); if (!$_GET["action"]) { $form = new Form(); $form->addForm("", "get", $PHP_SELF); $form->addHtml("<div id=\"standard_form\">\n"); $form->addField("hidden", "action", "", "update"); $form->addField("hidden", "stage", "", "3"); $form->addField("hidden", "cli_id", "", $cli_id); ///////////////////////////////////////////////////////////////////////////////// $form->addHtml("<fieldset>\n"); $form->addHtml('<div class="block-header">Areas</div>'); //$form->addHtml($form->addLabel('East Dulwich','<table><tr>'.$render[1].'</tr></table>')); $form->addHtml(' <a href="javascript:checkToggle(document.forms[0], \'branch1\');"><strong>Camberwell Branch</strong></a>'); $form->addHtml('<table width="100%" cellspacing="0" cellpadding="0"><tr>' . $areas[1] . '</tr></table>'); $form->addHtml(' <a href="javascript:checkToggle(document.forms[0], \'branch2\');"><strong>Sydenham Branch</strong></a>'); $form->addHtml('<table width="100%" cellspacing="0" cellpadding="0"><tr>' . $areas[2] . '</tr></table>'); $form->addHtml($form->addDiv($form->makeField("submit", "", "", "Save Changes", array('class' => 'submit')))); $form->addHtml("</fieldset>\n"); $page->setTitle("Client > Add"); $page->addStyleSheet(getDefaultCss()); $page->addScript('js/global.js');
if ($_SESSION["auth"]["use_branch"] == 4) { $branch = 3; } else { $branch = $_SESSION["auth"]["use_branch"]; } // show (unassigned) if user is not a neg if (!in_array('Negotiator', $_SESSION["auth"]["roles"])) { $user = 0; } else { $user = $_SESSION["auth"]["use_id"]; } $formData1 = array('calendarID' => array('type' => 'select_branch_2', 'label' => 'Branch', 'value' => $branch, 'attributes' => array('class' => 'medium')), 'app_user' => array('type' => 'select_user', 'label' => 'Negotiator', 'value' => $user, 'attributes' => array('class' => 'medium'), 'options' => array('' => '(unassigned)')), 'app_date' => array('type' => 'datetime', 'label' => 'Date', 'value' => $app_date, 'attributes' => array('class' => 'medium', 'readonly' => 'readonly'), 'tooltip' => 'Today\'s date is selected by default'), 'app_time' => array('type' => 'time', 'label' => 'Start Time', 'value' => $app_time), 'app_duration' => array('type' => 'select_duration', 'label' => 'Estimated Duration', 'value' => $duration, 'attributes' => array('class' => 'medium'), 'tooltip' => 'Duration is estimated at ' . $default_viewing_duration . ' minutes per property'), 'notes' => array('type' => 'textarea', 'label' => 'Notes', 'value' => $app["notes"], 'attributes' => array('class' => 'noteInput'))); $form = new Form(); $form->addHtml("<div id=\"standard_form\">\n"); $form->addForm("", "get"); $form->addField("hidden", "stage", "", "appointment"); $form->addField("hidden", "action", "", "update"); $form->addField("hidden", "cli_id", "", $cli_id); $form->addField("hidden", "app_id", "", $_GET["app_id"]); $form->addField("hidden", "dea_id", "", $dea_id); $form->addField("hidden", "searchLink", "", $searchLink); $form->addField("hidden", "skip", "", $_GET["skip"]); $form->addHtml("<fieldset class=\"" . ($DIT ? "DIT-property" : "") . "\">\n"); $form->addHtml('<div class="block-header">Appointment</div>'); if ($DIT) { $form->addHtml('<div class="dit-notification">This is an appointment for DIT instruction.</div>'); } $form->addData($formData1, $_GET); $form->addHtml($form->addDiv($form->makeField("submit", "submit", "", "Save Changes", array('class' => 'submit')))); $form->addHtml("</fieldset>\n"); $form->addHtml("</div>\n");
include DOCROOT . '/skin/header.php'; $form = new Form('nbssv2login'); $form->class = 'neoAdminForm'; $form->validationerrormsg = 'The following fields must be completed:'; if ($form->submitted && $form->submiterrors == 0) { $user = getUserLogin(md5(strtoupper(trim(ltrim($request->get('post', 'membershipno'), '0')))), md5(strtoupper(str_replace(' ', '', $request->get('post', 'postcode'))))); if ($user !== false) { Session::set('user', $user); Session::set('welcomed', false); getQueryResults('UPDATE ' . $config->get('database', 'tablePrefix') . 'user SET lastlogin='******'YmdHis', time()) . ' WHERE id=' . $user['id']); header('Location: ' . $config->get('web', 'root') . '/'); exit; } else { $form->submiterrormsg .= 'Invalid membership number, postcode or inactive account.'; } } $form->addFieldsetOpen('Login'); $form->addField('membershipno', 'text', $request->get('post', 'membershipno')); $form->addLabel('Membership Number'); $form->addFieldValidation('required'); $form->addHelp('Please use the membership number from your CAMRA membership card.'); $form->addField('postcode', 'text', $request->get('post', 'postcode')); $form->addLabel('Postcode'); $form->addFieldValidation('required'); $form->addHelp('Enter your postcode from your normal residence (You know, where CAMRA sends your "What\'s Brewing".)'); $form->addFieldsetClose(); $form->addField('login', 'submit', 'Login'); $form->addInputClass('btnSubmit'); $form->addContent('<div class="reset"><a href="' . $config->get('web', 'root') . '/signup/" class="btnSubmit fleft" title="sign up for an account">Sign up for an account</a></div>'); echo $form->submiterrormsg . $form->display(); include DOCROOT . '/skin/loginfooter.php';
} if ($matched_areas) { $formDataArea = array('pro_area' => array('type' => 'radio', 'label' => 'Area', 'value' => $default_area, 'options' => $matched_areas), 'pro_areanew' => array('type' => 'button', 'label' => 'New Area', 'value' => 'New Area', 'attributes' => array('class' => 'button', 'onClick' => 'javascript:addArea(\'' . $pc1 . '\',\'' . urlencode($_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING']) . '\')'))); } else { $formDataArea = array('pro_areanew' => array('type' => 'button', 'label' => 'New Area', 'value' => 'New Area', 'attributes' => array('class' => 'button', 'onClick' => 'javascript:addArea(\'' . $pc1 . '\',\'' . urlencode($_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING']) . '\')'))); } # build data arrays for property particulars $formData = array('dea_ptype' => array('type' => 'select_multi', 'label' => 'Property Type', 'required' => 2, 'options' => array('dd1' => $ptype['dd1'], 'dd2' => $ptype['dd2'])), 'dea_bedroom' => array('type' => 'select_number', 'label' => 'Bedrooms', 'value' => $dea_bedroom, 'attributes' => array('class' => 'narrow'), 'options' => array('blank' => 'blank')), 'dea_reception' => array('type' => 'select_number', 'label' => 'Receptions', 'value' => $dea_reception, 'attributes' => array('class' => 'narrow'), 'options' => array('blank' => 'blank')), 'dea_bathroom' => array('type' => 'select_number', 'label' => 'Bathrooms', 'value' => $dea_bathroom, 'attributes' => array('class' => 'narrow'), 'options' => array('blank' => 'blank')), 'dea_floor' => array('type' => 'select', 'label' => 'Floor', 'value' => $dea_floor, 'options' => join_arrays(array(array('blank' => ''), db_enum("deal", "dea_floor", "array"))), 'attributes' => array('class' => 'medium')), 'dea_floors' => array('type' => 'select_number', 'label' => 'Floors', 'options' => array('blank' => '', 'min' => '1'), 'value' => $dea_floors, 'attributes' => array('class' => 'narrow'))); // remove area from the equation #$formData = join_arrays(array($formDataArea,$formData)); if (!$_GET["action"]) { // start new form object $form = new Form(); $form->addForm("form", "get", $PHP_SELF); $form->addHtml("<div id=\"standard_form\">\n"); $form->addField("hidden", "stage", "", "particulars"); $form->addField("hidden", "action", "", "update"); $form->addField("hidden", "cli_id", "", $cli_id); $form->addField("hidden", "pro_id", "", $pro_id); $form->addField("hidden", "dea_id", "", $dea_id); $form->addHtml("<fieldset>\n"); $form->addLegend('Property Particulars'); $form->addData($formDataArea, $_GET); $form->addData($formData, $_GET); $form->addHtml($form->addDiv($form->makeField("submit", "", "", "Save Changes", array('class' => 'submit')))); $form->addHtml("</fieldset>\n"); $navbar_array = array('back' => array('title' => 'Back', 'label' => 'Back', 'link' => $searchLink), 'search' => array('title' => 'Property Search', 'label' => 'Property Search', 'link' => 'property_search.php')); $navbar = navbar2($navbar_array); $page->setTitle("New Instruction"); $page->addStyleSheet('css/styles.css'); $page->addScript('js/global.js');
} $results .= '</table> '; } else { // no results $results = ' <table cellpadding="5"> <tr> <td>Your search returned no matches, please <strong><a href="' . urldecode($returnLink) . '">try again</a></strong></td> </tr> </table>'; } $form = new Form(); $form->addHtml("<div id=\"standard_form\">\n"); $form->addForm("", "get", $_SERVER['PHP_SELF']); $form->addField("hidden", "searchLink", "", $searchLink); $form->addHtml("<fieldset>\n"); $form->addHtml('<div class="block-header">Users</div>'); $form->addHtml('<div id="results_table">'); $form->addHtml($header); $form->addHtml($results); $form->addHtml($footer); $form->addHtml('</div>'); $form->addHtml("</fieldset>\n"); $form->addHtml('</div>'); $navbar_array = array('back' => array('title' => 'Back', 'label' => 'Back', 'link' => $returnLink), 'print' => array('title' => 'Print', 'label' => 'Print', 'link' => 'javascript:windowPrint();')); $navbar = navbar2($navbar_array); $page->setTitle('Users'); $page->addStyleSheet(getDefaultCss()); $page->addScript('js/global.js'); $page->addBodyContent($header_and_menu);
// 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"); $form->addField("hidden", "action", "", "update"); $form->addField("hidden", "dir_id", "", $dir_id); $form->addField("hidden", "pro_id", "", $pro_id); ///////////////////////////////////////////////////////////////////////////////// $form->addHtml("<fieldset>\n"); $form->addLegend('Edit Entry'); $form->addData($formData1, $_POST); $form->addHtml("</fieldset>\n"); ///////////////////////////////////////////////////////////////////////////////// $form->addHtml("<fieldset>\n"); $form->addLegend('Address'); if (!$pro_pcid) { $form->ajaxPostcode("by_freetext", "pro"); } else { $form->addData($formData2, $_POST); $form->addHtml($form->addDiv($form->makeField("submit", "", "", "Save Changes", array('class' => 'submit'))));
public function getForm($type, $action, $request, $isPost = false, $errors = array()) { $form = new Form($id = 'form-quarter', $name = 'form-quarter', $action, 'POST', 'form-horizontal', $isPost); $form->addField('id', Lang::_('User Id'), 'text', $this->_getfieldvalue('id', $type, $request), true, '', @$errors['user_id']); $form->addField('name', Lang::_('Name'), 'text', $this->_getfieldvalue('name', $type, $request), false, '', @$errors['quarter_id']); $form->addField('type', Lang::_('Type'), 'text', $this->_getfieldvalue('type', $type, $request), false, '', @$errors['type']); $form->addField('description', Lang::_('Content'), 'text', $this->_getfieldvalue('description', $type, $request), true, '', @$errors['description']); $form->addField('map', Lang::_('Map'), 'text', $this->_getfieldvalue('map', $type, $request), false); return $form->render(); }
} else { $status_attributes = array('style' => 'width:300px'); } // reset status attributes for LETTINGS if ($_SESSION["auth"]["default_scope"] == 'Lettings') { $status_attributes = array('style' => 'width:300px'); } $formData4 = array('dea_status' => array('type' => 'select', 'label' => 'Status', 'value' => $dea_status, 'options' => $statuses, 'attributes' => $status_attributes), 'dea_notes_sot' => array('type' => 'textarea', 'label' => 'Add Status Note', 'attributes' => array('class' => 'noteInput', 'viewform' => 3))); } // viewing arrangements $formData5 = array('dea_key' => array('type' => 'text', 'label' => 'Key Number', 'value' => $dea_key, 'attributes' => array('class' => 'wide')), 'dea_notes_arr' => array('type' => 'textarea', 'label' => 'Add Viewing Info', 'attributes' => array('class' => 'noteInput'))); if (!$_GET["action"]) { $form = new Form(); $form->addForm("", "GET", $PHP_SELF); $form->addHtml("<div id=\"standard_form\">\n"); $form->addField("hidden", "stage", "", "1"); $form->addField("hidden", "action", "", "update"); $form->addField("hidden", "dea_id", "", $dea_id); $form->addField("hidden", "pro_id", "", $pro_id); $form->addField("hidden", "searchLink", "", urlencode($searchLink)); $form->addHtml('<h1>' . $pro_addr . ' (' . $dea_type . ')</h1>'); $formName = 'form1'; $form->addHtml("<fieldset>\n"); $form->addLegend('Summary', array('style' => 'cursor:pointer', 'onClick' => 'javascript:showHide(\'' . $formName . '\');')); $form->addHtml('<div id="' . $formName . '" style="display:none">'); $form->addHtml($form->addHtml($summary_table)); //$form->addHtml($form->addDiv($form->makeField("textarea",$formName,"General Notes","",array('class'=>'noteInput')))); $form->addHtml($form->addRow('textarea', 'dea_notes', 'Add General Note', '', array('class' => 'noteInput'), '', '')); $form->addHtml(renderNotes('deal_general', $dea_id, array('viewform' => '1', 'label' => 'General Notes'))); $buttons = $form->makeField("submit", $formName, "", "Save Changes", array('class' => 'submit')); if (in_array('Production', $_SESSION["auth"]["roles"]) || in_array('Editor', $_SESSION["auth"]["roles"])) {
// 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"); $form2->addField("hidden", "action", "", "move"); $form2->addField("hidden", "id", "", $node_id); $form2->addHtml("<fieldset>\n"); $form2->addLegend('Move Node'); $form2->addData($formData2, $_GET); $form2->addHtml($form2->addDiv($form2->makeField("submit", "", "", "Save Changes", array('class' => 'submit')))); $form2->addHtml("</fieldset>\n"); $form2->addHtml("</div>\n"); } elseif ($_GET["action"] == "edit") { $id = $_GET["id"]; $title = trim(ucwords($_GET["title"])); $sql = "UPDATE category SET cat_title = '{$title}' WHERE cat_id = {$id}"; $result = mysql_query($sql); header("Location:tree.php"); } elseif ($_GET["action"] == "move") { $id = $_GET["id"];
if (DB::isError($q)) { die("db error: " . $q->getMessage()); } while ($row = $q->fetchRow()) { $ctype[$row["cty_id"]] = $row["cty_title"]; } $form1 = array('com_title' => array('type' => 'text', 'label' => 'Company Name', 'value' => $com_title, 'required' => 2, 'attributes' => array('style' => 'width:320px')), 'com_type' => array('type' => 'select', 'label' => 'Business Type', 'value' => $com_type, 'required' => 2, 'attributes' => array('style' => 'width:320px'), 'options' => $ctype), 'con_tel' => array('type' => 'tel', 'label' => 'Telephone', 'value' => $telephone), 'con_email' => array('type' => 'text', 'label' => 'Email', 'value' => $con_email, 'required' => 3, 'attributes' => array('style' => 'width:320px', 'maxlength' => 255), 'tooltip' => 'Must be a valid email address'), 'con_web' => array('type' => 'text', 'label' => 'Website', 'value' => $con_web, 'init' => 'http://', 'required' => 1, 'attributes' => array('style' => 'width:320px', 'maxlength' => 255))); // address, this is only used for manual input resulting from ajax input (validation only) $form2 = 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')); // form is not submitted, show the form if (!$_POST["action"]) { // start new form object $form = new Form(); $form->addForm("testForm", "post", $PHP_SELF); $form->addHtml("<div id=\"standard_form\">\n"); $form->addField("hidden", "action", "", "update"); $form->addField("hidden", "con_id", "", $con_id); $form->addField("hidden", "searchLink", "", $searchLink); //$form->addHtml('<input type="hidden" name="action" value="update">'); $form->addHtml('<h1>' . $con_fname . ' ' . $con_sname . '</h1>'); ///////////////////////////////////////////////////////////////////////////////// $formName = 'form1'; $form->addHtml("<fieldset>\n"); $form->addHtml('<div class="block-header"><u>C</u>ontact</div>'); $form->addHtml('<div id="' . $formName . '">'); $form->addData(${$formName}, $_POST); $form->addHtml($form->addDiv($form->makeField("submit", $formName, "", "Save Changes", array('class' => 'submit')))); $form->addHtml("</div>\n"); $form->addHtml("</fieldset>\n"); ///////////////////////////////////////////////////////////////////////////////// $formName = 'form2';
pageAccess($_SESSION["auth"]["roles"], array('SuperAdmin', 'Administrator')); $page = new HTML_Page2($page_defaults); $sql = "SELECT use_id,use_fname,use_sname FROM user"; $q = $db->query($sql); if (DB::isError($q)) { die("db error: " . $q->getMessage()); } while ($row = $q->fetchRow()) { $users[$row["use_id"]] = $row["use_fname"] . ' ' . $row["use_sname"]; } $formData1 = array('use_id' => array('type' => 'select', 'label' => 'User', 'value' => $use_id, 'options' => $users, 'attributes' => array('class' => 'addr'), 'required' => 2), 'use_password' => array('type' => 'text', 'label' => 'Password', 'value' => $use_password, 'attributes' => array('class' => 'addr'), 'required' => 2, 'tooltip' => 'Passwords must be at least 8 characters, and contain at least one number and one UPPER CASE letter')); if (!$_GET["action"]) { $form = new Form(); $form->addForm("", "get", $PHP_SELF); $form->addHtml("<div id=\"standard_form\">\n"); $form->addField("hidden", "action", "", "reset"); ///////////////////////////////////////////////////////////////////////////////// $form->addHtml("<fieldset>\n"); $form->addHtml('<div class="block-header">Reset Password</div>'); $form->addData($formData1, $_GET); $form->addHtml($form->addDiv($form->makeField("submit", "", "", "Save Changes", array('class' => 'submit')))); $form->addHtml("</fieldset>\n"); $form->addHtml('<pre>'); for ($i = 1; $i <= 5; ++$i) { $form->addHtml(random_string(16, 'safe') . "\n"); } $form->addHtml('</pre>'); $page->setTitle("Change Password"); $page->addStyleSheet(getDefaultCss()); $page->addScript(GLOBAL_URL . 'js/global.js'); $page->addBodyContent($header_and_menu);