本文整理汇总了PHP中form类的典型用法代码示例。如果您正苦于以下问题:PHP form类的具体用法?PHP form怎么用?PHP form使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了form类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form
function form($object)
{
$i18n = exponent_lang_loadFile('database/inbox_contactbanned.php');
if (!defined('SYS_FORMS')) {
require_once BASE . 'subsystems/forms.php';
}
exponent_forms_initialize();
$form = new form();
if (!defined('SYS_USERS')) {
require_once BASE . 'subsystems/users.php';
}
$users = array();
foreach (exponent_users_getAllUsers() as $u) {
// Get the current user.
$thisuser = $_SESSION['/']['user'];
if ($u->is_acting_admin == 0 && $u->id != $thisuser->id) {
$users[$u->id] = $u->firstname . ' ' . $u->lastname . ' (' . $u->username . ')';
}
}
global $db;
foreach ($db->selectObjects('inbox_contactbanned', 'owner=' . $thisuser->id) as $b) {
unset($users[$b->user_id]);
}
$form->register('uid', $i18n['uid'], new dropdowncontrol(0, $users));
$form->register('submit', '', new buttongroupcontrol($i18n['save'], '', $i18n['cancel']));
return $form;
}
示例2: displayContent
protected function displayContent()
{
$html = '<p>' . nl2br($this->pageInfo['content']) . '</p>';
$html = '<br/>';
$html .= '<img src="images/image1.png" class="left">' . "\n";
//instantiate the form
include 'classes/formsClass.php';
$form = new form($this->model);
if (!isset($_POST['join'])) {
//call sign up form in the form class
$html .= $form->signUpForm();
$html .= '<p>If you have an existing account, <a href="index.php?page=login"';
$html .= $this->pageInfo['page'] == 'login' ? '' : '';
$html .= '> LOGIN</a> here</p>' . "\n";
} else {
//run the validation function
$result = $this->model->validateSignUp();
if ($result) {
$html .= $form->signUpForm($result, 'add');
} else {
//add new user
$fail = $this->model->processSignUp();
if ($fail) {
$html .= '<p>Sorry, something went wrong please contact us <a href="index.php?page=contact">here</a></p>';
} else {
$html .= '<h3>Thanks for joining us!</h3>';
}
}
}
//if the user has not yet submitted the form show the form
$html .= '</form>';
$html .= '</div>';
// Return HTML back to displayPage in viewClass
return $html;
}
示例3: form_search_dns
function form_search_dns()
{
$form_search_dns = new form(array('FORM_NAME' => 'form_search_dns'));
$form_search_dns->db_data('dns_zones.type, dns_zones.name, dns_zones.status');
$form_search_dns->db_data_search();
return $form_search_dns;
}
示例4: form
function form($object)
{
$i18n = exponent_lang_loadFile('datatypes/contact_contact.php');
if (!defined('SYS_FORMS')) {
require_once BASE . 'subsystems/forms.php';
}
exponent_forms_initialize();
$type = 0;
$default = 0;
$form = new form();
if (!isset($object->id)) {
$object->user_id = 0;
$object->addressbook_contact_id = 0;
$object->email = '';
$object->contact_info = '';
} else {
$form->meta('id', $object->id);
if ($object->user_id != 0) {
$type = 0;
$default = $object->user_id;
} else {
$type = 1;
$default = $object->email;
}
}
$form->register('contact', $i18n['contact'], new contactcontrol($default, $type));
$form->register('submit', '', new buttongroupcontrol($i18n['save'], '', $i18n['cancel']));
return $form;
}
示例5: CreateNew
public function CreateNew($input)
{
$header = "اضافه خبر جديد";
include "views/form.php";
$form = new form("index.php", "title");
$form->addElement('Subject', "", "text", "عنوان الخير");
$form->addImage('Image', "group", "صوره الخبر");
global $db;
$What = "*";
$innerJoin = "";
$db->select('groups', "", $limit = false, $order = false, $where_mode = "AND", $print_query = false, $What, $innerJoin);
$result = $db->result_array();
$groups = array("-1" => "الرئيسية");
foreach ($result as $key) {
//array_push($group,$key["Gname"]);
$groups[$key["Gid"]] = $key["Gname"];
}
$form->addElement('GroupID', $groups, "select", "القبيله");
$allowComments = array('1' => "نعم", '0' => "لا");
$form->addElement('AllowComments', $allowComments, "select", "السماح بالتعليقات");
$form->addElement('Description', "", "textarea", "تفاصيل الخبر");
$form->addElement('i', "0", "hidden", "");
$form->addElement('fn', "insert", "hidden", "");
$form->addElement('c', "news", "hidden", "");
$body = $form->RenderForm();
// $body="fields that will create the new group is here";
include "views/single.php";
}
示例6: populate_from
public function populate_from(form $f)
{
if ($f->submitted() && $f->verify()) {
$this->name = $f['person_name']->value();
$this->phonenumber = $f['person_phonenumber']->value();
}
}
示例7: form_zone
function form_zone()
{
global $db, $vars, $main;
$form_zone = new form(array('FORM_NAME' => 'form_zone'));
$form_zone->db_data('dns_zones.name, dns_zones.info, dns_zones_nameservers.nameserver_id, dns_zones.status');
$form_zone->db_data_values("dns_zones", "id", get('zone'));
$form_zone->db_data_pickup("dns_zones_nameservers.nameserver_id", "dns_nameservers", $db->get('dns_nameservers.id AS value, CONCAT(dns_nameservers.name, ".", nodes.name_ns, ".", "' . $vars['dns']['ns_zone'] . '") AS output', "dns_zones_nameservers, dns_nameservers, nodes", "dns_nameservers.node_id = nodes.id AND dns_nameservers.id = dns_zones_nameservers.nameserver_id AND dns_zones_nameservers.zone_id = '" . get('zone') . "'"), TRUE);
$tmp = $db->get('users.email, users_nodes.owner', 'users, users_nodes, dns_zones', "users_nodes.user_id = users.id AND users_nodes.node_id = dns_zones.node_id AND dns_zones.id = '" . get("zone") . "'");
foreach ((array) $tmp as $key => $value) {
$form_zone->info['email_all'] .= $value['email'] . ', ';
if ($value['owner'] == 'Y') {
$form_zone->info['email_owner'] .= $value['email'] . ', ';
}
}
$form_zone->info['email_all'] = substr($form_zone->info['email_all'], 0, -2);
$form_zone->info['email_owner'] = substr($form_zone->info['email_owner'], 0, -2);
$t = $db->get('nodes.id, nodes.name', 'nodes, dns_zones', "dns_zones.node_id = nodes.id AND dns_zones.id = '" . get('zone') . "'");
$form_zone->info['node_name'] = $t[0]['name'];
$form_zone->info['node_id'] = $t[0]['id'];
$form_zone->info['hostmaster_username'] = $main->userdata->info['username'];
$form_zone->info['hostmaster_name'] = $main->userdata->info['name'];
$form_zone->info['hostmaster_surname'] = $main->userdata->info['surname'];
$t = $db->get('type', 'dns_zones', "id = '" . get('zone') . "'");
if ($t[0]['type'] == 'forward') {
$form_zone->data[0]['value'] .= "." . $vars['dns']['root_zone'];
}
return $form_zone;
}
示例8: showForm
public function showForm($mes)
{
$ns = e107::getRender();
$frm = new form();
$text = $frm->form_open('post', e_SELF);
$text .= "<table class='table adminform'>";
$text .= "<tr><td>" . LAN_RADIUS_01 . "</td><td>";
$text .= $frm->form_text('radius_server', 35, vartrue($this->radius['radius_server']), 120);
$text .= "</td></tr>\n";
$text .= "<tr><td>" . LAN_RADIUS_02 . "</td><td>";
$text .= $frm->form_text('radius_secret', 35, vartrue($this->radius['radius_secret']), 200);
$text .= "</td></tr>\n";
$tmp = $this->alt_auth_get_field_list('radius', $frm, $this->radius, FALSE);
if ($tmp) {
$text .= "<tr><td class='forumheader2' colspan='2'>" . LAN_ALT_27 . "</td></tr>\n" . $tmp;
unset($tmp);
}
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
// $text .= $frm -> form_button("submit", "update", LAN_ALT_2);
$text .= e107::getForm()->admin_button('update', LAN_UPDATE, 'update');
$text .= "</td></tr>\n";
$text .= "</table>\n";
$text .= $frm->form_close();
$ns->tablerender(LAN_RADIUS_06, $mes->render() . $text);
$ns->tablerender(LAN_ALT_40 . LAN_ALT_41, $this->alt_auth_test_form('radius', $frm));
}
示例9: add
public function add()
{
# Start the HTML
$html = '';
# Determine the recipients
$recipients = array();
$recipients[] = $this->settings['administratorEmail'];
// Ensure this is first, i.e. the To: address
foreach ($this->administrators as $administrator) {
$recipients[] = $administrator['email'];
}
$recipients = array_unique($recipients);
# Create a new form
$form = new form(array('div' => 'lines form', 'displayRestrictions' => false, 'nullText' => '', 'formCompleteText' => $this->tick . ' Thank you for your submission. We will be in touch shortly.', 'autofocus' => true, 'databaseConnection' => $this->databaseConnection, 'picker' => true, 'usersAutocomplete' => false, 'rows' => 10, 'cols' => 70));
$form->heading('', "<p>Proposed projects can be submitted using this form.</p>");
$form->dataBinding(array('database' => $this->settings['database'], 'table' => $this->settings['table'], 'includeOnly' => $this->userIsAdministrator ? array() : array('name', 'client', 'description'), 'intelligence' => true, 'size' => 70, 'attributes' => $this->formDataBindingAttributes()));
#!# Reply-to field needs to be fully-qualified with e-mail domain
$form->setOutputEmail($recipients, $this->settings['administratorEmail'], $this->settings['applicationName'] . ': project submission', NULL, 'client');
$form->setOutputScreen();
if ($result = $form->process($html)) {
# Set fixed fields
$result['client'] = $this->user;
# Insert into the database
$this->databaseConnection->insert($this->settings['database'], $this->settings['table'], $result);
}
# Show the HTML
echo $html;
}
示例10: form
function form($object)
{
if (!defined('SYS_FORMS')) {
require_once BASE . 'subsystems/forms.php';
}
pathos_forms_initialize();
$form = new form();
if (!isset($object->id)) {
$object->name = '';
$object->lang = '';
$object->charset = '';
$object->author = '';
$object->locale = '';
$object->default_view = '';
} else {
$form->meta('id', $object->id);
}
$form->register('name', 'Name', new textcontrol($object->name));
$form->register('author', 'Author(s)', new textcontrol($object->author));
$form->register('lang', 'Lang Code', new textcontrol($object->lang, 5));
$form->register('charset', 'Character Set', new textcontrol($object->charset, 15));
$form->register('locale', 'Locale', new textcontrol($object->locale));
$form->register('default_view', 'Default View Name', new textcontrol($object->default_view));
$form->register('submit', '', new buttongroupcontrol('Save', '', 'Cancel'));
return $form;
}
示例11: form_getrange
function form_getrange()
{
global $db;
$form_getrange = new form(array('FORM_NAME' => 'form_getrange'));
$form_getrange->db_data('ip_ranges.info');
return $form_getrange;
}
示例12: form
function form($object)
{
if (!defined('SYS_FORMS')) {
require_once BASE . 'subsystems/forms.php';
}
pathos_forms_initialize();
$form = new form();
if (!isset($object->id)) {
$object->sort = 'asc_name';
} else {
switch ($object->orderhow) {
case 0:
// ascending
$object->sort = 'asc_' . $object->orderby;
break;
case 1:
// descending
$object->sort = 'desc_' . $object->orderby;
break;
case 2:
// random
$object->sort = 'random_';
break;
default:
$object->sort = 'asc_name';
break;
}
$form->meta('id', $object->id);
}
$order_options = array('random_' => 'Randomly', 'asc_name' => 'Alphabetical By Name', 'desc_name' => 'Reverse Alphabetical By Name');
$form->register('orderby', 'Sorting', new dropdowncontrol($object->sort, $order_options));
$form->register('submit', '', new buttongroupcontrol('Save', '', 'Cancel'));
return $form;
}
示例13: updatesuggestselectfield
public function updatesuggestselectfield($parameters = array())
{
$result = array();
$view = new ui($this);
if ($parameters['value'] != '') {
$controller = $parameters['callbackcontroller'] . 'Controller';
$function = $parameters['callbackfunction'];
$extra = $parameters['extraparams'];
$extralist = explode(',', $extra);
$extraparams = array();
foreach ($extralist as $extraparam) {
list($key, $value) = explode('|', $extraparam);
$extraparams[$key] = $value;
}
$theController = new $controller();
$result = $theController->{$function}(rawurldecode($parameters['value']), $extraparams);
$form = new form($parameters);
list($id, $name) = explode('_', $parameters['id'], 2);
$form->setId($id);
$select = new selectField(str_replace('_text', '', $name), '', '', true);
$form->addField($select);
foreach ($result as $row) {
$select->addOption(new selectoptionField($row, $row, false));
}
$view->assign('form', $form);
$view->assign('field', $select);
$this->response->assign(str_replace('_text', '', $parameters['id']) . '_container', 'innerHTML', $view->fetch('selectField.tpl'));
} else {
$form = new form($parameters);
$select = new selectField($parameters['id'], '', '', true);
$view->assign('form', $form);
$view->assign('field', $select);
$this->response->assign(str_replace('_text', '', $parameters['id']) . '_container', 'innerHTML', $view->fetch('selectField.tpl'));
}
}
示例14: form_range
function form_range()
{
global $construct, $db, $vars, $main;
if (!$this->has_edit_access()) {
$main->message->set_fromlang('info', 'no_privilege');
}
$form_range = new form(array('FORM_NAME' => 'form_range'));
$form_range->db_data('ip_ranges.ip_start, ip_ranges.ip_end, ip_ranges.info, ip_ranges.status');
#removed: ip_ranges.nodeid #bug
$form_range->db_data_values("ip_ranges", "id", get('iprange'));
$form_range->data[0]['value'] = long2ip($form_range->data[0]['value']);
$form_range->data[1]['value'] = long2ip($form_range->data[1]['value']);
$tmp = $db->get('users.email, users_nodes.owner', 'users, users_nodes, ip_ranges', "users_nodes.user_id = users.id AND users_nodes.node_id = ip_ranges.node_id AND ip_ranges.id = '" . get("iprange") . "'");
$form_range->info['email_all'] = null;
$form_range->info['email_owner'] = null;
foreach ((array) $tmp as $key => $value) {
$form_range->info['email_all'] .= $value['email'] . ', ';
if ($value['owner'] == 'Y') {
$form_range->info['email_owner'] .= $value['email'] . ', ';
}
}
$form_range->info['email_all'] = isset($form_range->info['email_all']) ? substr($form_range->info['email_all'], 0, -2) : null;
$form_range->info['email_owner'] = isset($form_range->info['email_owner']) ? substr($form_range->info['email_owner'], 0, -2) : null;
$t = $db->get('nodes.id, nodes.name', 'nodes, ip_ranges', "ip_ranges.node_id = nodes.id AND ip_ranges.id = '" . get('iprange') . "'");
$form_range->info['node_name'] = $t[0]['name'];
$form_range->info['node_id'] = $t[0]['id'];
$form_range->info['hostmaster_username'] = $main->userdata->info['username'];
$form_range->info['hostmaster_name'] = $main->userdata->info['name'];
$form_range->info['hostmaster_surname'] = $main->userdata->info['surname'];
return $form_range;
}
示例15: form_getrange_v6
function form_getrange_v6()
{
global $db;
$form_getrange_v6 = new form(array('FORM_NAME' => 'form_getrange_v6'));
$form_getrange_v6->db_data('ip_ranges_v6.info');
return $form_getrange_v6;
}