本文整理汇总了PHP中get_form函数的典型用法代码示例。如果您正苦于以下问题:PHP get_form函数的具体用法?PHP get_form怎么用?PHP get_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_form函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_poll_place
/**
*
* @param type $params['id_poll']
* @param type $params['one_poll_place']
* @return html
*/
function show_poll_place($id_poll, $one_poll_place)
{
$CI =& get_instance();
$CI->load->model('Polls_model');
$id_user = $CI->session->userdata('user_id');
$denied_polls = $CI->Polls_model->get_denied_polls($id_user);
// Show precise poll
if ($id_poll) {
// Check polls existence
if ($CI->Polls_model->is_exists($id_poll)) {
// If current user may pass the poll
if (!in_array($id_poll, $denied_polls)) {
return get_form($id_poll, $one_poll_place);
} else {
// Template will decide whether to show results or just a text message
if ($one_poll_place || $CI->Polls_model->show_results($id_poll)) {
return get_results($id_poll, $one_poll_place);
}
// else show random poll
}
}
//else show random poll
} elseif ($one_poll_place) {
return false;
}
// If we reached here, show random poll
// Get language and user type
$language = $CI->pg_language->current_lang_id;
$user_type = $CI->session->userdata("user_type");
// Pick a random poll...
$id_poll_rnd = $CI->Polls_model->get_random_id(null, $language, $user_type, $denied_polls);
if ($id_poll_rnd) {
return get_form($id_poll_rnd, $one_poll_place);
} else {
// ...or results
$id_poll_rnd = $CI->Polls_model->get_random_id(true);
if ($id_poll_rnd) {
return get_results($id_poll_rnd, $one_poll_place);
}
}
}
示例2: set_form
function set_form(&$dbh, $form)
{
$old_form = get_form($dbh, $form['id']);
if (!$old_form) {
return false;
}
$update_clauses = array();
foreach (array('form_url', 'http_method', 'action_url', 'title', 'user_id') as $field) {
if (!is_null($form[$field])) {
if ($form[$field] != $old_form[$field]) {
$update_clauses[] = sprintf('%s = %s', $field, $dbh->quoteSmart($form[$field]));
}
}
}
if (empty($update_clauses)) {
error_log("skipping form {$form['id']} update since there's nothing to change");
} else {
$update_clauses = join(', ', $update_clauses);
$q = "UPDATE forms\n SET {$update_clauses}\n WHERE id = " . $dbh->quoteSmart($form['id']);
error_log(preg_replace('/\\s+/', ' ', $q));
$res = $dbh->query($q);
if (PEAR::isError($res)) {
die_with_code(500, "{$res->message}\n{$q}\n");
}
}
return get_form($dbh, $form['id']);
}
示例3: dirname
<?php
require_once dirname(__FILE__) . '/admin.php';
$index = "newmedia";
?>
<?php
if (exist_cookie()) {
?>
<?php
get_admin_header();
?>
<?php
get_form(false, $index);
?>
<?php
if (isset($_POST['Add'])) {
$tmp_name = $_FILES['upload']['tmp_name'];
$media_name = $_FILES['upload']['name'];
$media_path = "image/" . $media_name;
$insert = array("media_name" => "{$media_name}", "media_path" => "{$media_path}");
if (upload_media($tmp_name, $media_path)) {
$result = request_insert($index, $insert);
if ($result) {
echo "successfully";
}
// end if
}
示例4: mini_search
<aside>
<?php
mini_search('Search Events by Keyword', 0);
?>
</aside>
</header>
<nav>
<?php
build_breadcrumb($crumbs);
?>
</nav>
<section id="events">
<article>
<?php
get_form();
?>
</article>
<aside>
<?php
mini_cal_month();
get_side();
?>
</aside>
</section>
<?php
get_footer();
示例5: while
case "list_sports":
switch ($_POST["usertype"]){
case "Deportista":
$rst = $data->query("SELECT DISTINCT s.codsport,s.name FROM list_sports s
INNER JOIN profile_sport p ON s.codsport=p.codsport ORDER BY s.name");
?>
<? while( $row=mysql_fetch_array($rst) ){?>
<option value="<? echo $row["codsport"];?>"><? echo utf8_encode($row["name"]);?></option>
<? }?>
<?php break;
case "Representante":
$rst = $data->query("SELECT s.codsport, s.name FROM list_sports s
INNER JOIN users_representatives_to_sport r ON s.codsport = r.codsport ORDER BY s.name");
?>
<? while( $row=mysql_fetch_array($rst) ){?>
<option value="<? echo $row["codsport"];?>"><? echo utf8_encode($row["name"]);?></option>
<? }
break;
}?>
<?php
die();
break;
case "show_fields_advancedsearch":
get_form($_POST["usertype"]);
die();
break;
}
die("ok");
?>
示例6: GetNode
function GetNode($id)
{
if ($result = $this->DB->GetRow('SELECT n.*,
inet_ntoa(n.ipaddr) AS ip, inet_ntoa(n.ipaddr_pub) AS ip_pub,
lc.name AS city_name ' . ',(SELECT 1 FROM monitnodes WHERE monitnodes.id = n.id AND monitnodes.active = 1) AS monitoring ' . ',(SELECT 1 FROM monitnodes WHERE monitnodes.id = n.id AND monitnodes.active = 1 AND monitnodes.signaltest=1) AS monitoringsignal ' . ',(SELECT name FROM invprojects WHERE invprojects.id = n.invprojectid) AS projectname ' . ', (CASE WHEN ls.name2 IS NOT NULL THEN ' . $this->DB->Concat('ls.name2', "' '", 'ls.name') . ' ELSE ls.name END) AS street_name, lt.name AS street_type
FROM vnodes n
LEFT JOIN location_cities lc ON (lc.id = n.location_city)
LEFT JOIN location_streets ls ON (ls.id = n.location_street)
LEFT JOIN location_street_types lt ON (lt.id = ls.typeid)
WHERE n.id = ?', array($id))) {
$result['typeofdevicename'] = $this->DB->GetOne('SELECT type FROM dictionary_devices_client WHERE id = ? ' . $this->DB->Limit('1') . ' ;', array($result['typeofdevice']));
$result['owner'] = $this->GetCustomerName($result['ownerid']);
$result['createdby'] = $this->GetUserName($result['creatorid']);
$result['modifiedby'] = $this->GetUserName($result['modid']);
$result['creationdateh'] = date('Y/m/d, H:i', $result['creationdate']);
$result['moddateh'] = date('Y/m/d, H:i', $result['moddate']);
if ($result['access_from']) {
$result['access_from'] = date('Y/m/d', $result['access_from']);
} else {
$result['access_from'] = '';
}
if ($result['access_to']) {
$result['access_to'] = date('Y/m/d', $result['access_to']);
} else {
$result['acces_to'] = '';
}
$result['lastonlinedate'] = lastonline_date($result['lastonline']);
if ($result['netid']) {
$tmp = $this->DB->GetRow('SELECT n.name AS networkname, h.name AS hostname
FROM networks n
LEFT JOIN hosts h ON (h.id = n.hostid)
WHERE n.id = ? LIMIT 1;', array($result['netid']));
$result['networkname'] = $tmp['networkname'];
$result['hostname'] = $tmp['hostname'];
}
if ($result['netid_pub']) {
$tmp = $this->DB->GetRow('SELECT n.name AS networkname, h.name AS hostname
FROM networks n
LEFT JOIN hosts h ON (h.id = n.hostid)
WHERE n.id = ? LIMIT 1;', array($result['netid_pub']));
$result['networkname_pub'] = $tmp['networkname'];
$result['hostname_pub'] = $tmp['hostname'];
}
if ($result['nasid'] && get_form('nodes.nas')) {
$result['nasname'] = $this->DB->GetOne('SELECT name FROM nas WHERE id = ? LIMIT 1;', array($result['nasid']));
}
$result['mac'] = preg_split('/,/', $result['mac']);
foreach ($result['mac'] as $mac) {
$result['macs'][] = array('mac' => $mac, 'producer' => get_producer($mac));
}
unset($result['mac']);
$result = $this->exechook('lms_getnode_after', $result);
return $result;
} else {
return FALSE;
}
}
示例7: enforce_master_on_off_switch
<?php
require_once '../lib/lib.everything.php';
enforce_master_on_off_switch($_SERVER['HTTP_ACCEPT_LANGUAGE']);
$context = default_context(True);
/**** ... ****/
$scan_id = $_GET['id'] ? $_GET['id'] : null;
$scan = get_scan($context->db, $scan_id);
$context->sm->assign('scan', $scan);
$print = get_print($context->db, $scan['print_id']);
$context->sm->assign('print', $print);
$notes = get_scan_notes($context->db, array('scan' => $scan['id']));
$context->sm->assign('notes', $notes);
$form = get_form($context->db, $print['form_id']);
$context->sm->assign('form', $form);
if (preg_match('#^(\\w+)/(\\d+)$#', $scan['print_id'], $matches)) {
$print_id = $matches[1];
$page_number = $matches[2];
$context->sm->assign('page_number', $page_number);
}
$user = get_user($context->db, $scan['user_id']);
if ($user['name']) {
$context->sm->assign('user_name', $user['name']);
} else {
$context->sm->assign('user_name', 'Anonymous');
}
if ($context->type == 'text/html') {
header("Content-Type: text/html; charset=UTF-8");
print $context->sm->fetch("scan-polygon.html.tpl");
} elseif ($context->type == 'application/paperwalking+xml') {
header("Content-Type: application/paperwalking+xml; charset=UTF-8");
示例8: enforce_master_on_off_switch
<?php
require_once '../lib/lib.everything.php';
enforce_master_on_off_switch($_SERVER['HTTP_ACCEPT_LANGUAGE']);
enforce_api_password($_POST['password']);
$context = default_context(False);
/**** ... ****/
// Getting the correct form id
$form_id = $_GET['id'] ? $_GET['id'] : null;
$form = get_form($context->db, $form_id);
if (!$form) {
die_with_code(400, "I don't know that form");
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$context->db->query('START TRANSACTION');
foreach ($_POST['fields'] as $_field) {
$field = add_form_field($context->db, $form['id'], $_field['name']);
if (!$field) {
die_with_code(400, "I don't know that field");
}
$field['type'] = $_field['type'];
$field['label'] = $_field['label'];
set_form_field($context->db, $field);
}
// manually-defined form title from add-form.php wins here
$form['title'] = $form['title'] ? $form['title'] : $_POST['title'];
$form['http_method'] = $_POST['http_method'];
$form['action_url'] = $_POST['action_url'];
set_form($context->db, $form);
finish_form($context->db, $form['id']);
$context->db->query('COMMIT');
示例9: fpassthru
fpassthru($fp);
fclose($fp);
}
# Cleanup
$pdf_dir = dirname(dirname($filename));
SureRemoveDir($pdf_dir);
@rmdir($pdf_dir);
}
}
}
}
}
}
}
xml_cleanup($xml);
exit;
} else {
# Show the form
if (!defined('MEDIAWIKI')) {
# Stand-alone
header('Content-type: text/html; charset=utf-8');
print "\n<html><head></head><body>\n<h1>Magnus' magic MediaWiki-to-XML-to-stuff converter</h1>\n<p>All written in PHP - so portable, <s>so incredibly slow...</s> <i>about as fast as the original MediaWiki parser!</i> <small>(For the source, see <a href='http://www.mediawiki.org/wiki/Subversion'>here</a>, trunk 'wiki2xml', directory 'php')</small></p>";
$xmlg["useapi"] = 1;
print get_form();
print "</body></html>";
} else {
# MediaWiki extension
$out = get_form(true);
}
}
#<input type='checkbox' name='resolvetemplates' value='1' checked>Automatically resolve templates</input><br/>
示例10: include
$SMARTY->assign('customers', $LMS->GetCustomerNames());
}
$nodeinfo = $LMS->ExecHook('node_edit_init', $nodeinfo);
include(MODULES_DIR . '/nodexajax.inc.php');
$annex_info = array('section'=>'customer','ownerid'=>$customerid);
$SMARTY->assign('annex_info',$annex_info);
include(MODULES_DIR.'/customer_xajax.inc.php');
$LMS->RegisterXajaxFunction(array('get_list_annex','delete_file_annex'));
$SMARTY->assign('xajax', $LMS->RunXajax());
if (get_form('nodes.nas'))
$SMARTY->assign('naslist',$LMS->getNasList());
$SMARTY->assign('devicestype',$LMS->GetDictionaryDevicesClientofType());
$SMARTY->assign('netdevices', $LMS->GetNetDevNames());
$SMARTY->assign('networks', $LMS->GetNetworks(false));
$SMARTY->assign('nodegroups', $LMS->GetNodeGroupNamesByNode($nodeid));
$SMARTY->assign('othernodegroups', $LMS->GetNodeGroupNamesWithoutNode($nodeid));
$SMARTY->assign('projectlist',$DB->getAll('SELECT id,name FROM invprojects WHERE type = 0 ORDER BY name ASC;'));
$SMARTY->assign('hostlist',$DB->GetAll('SELECT id,name FROM hosts ORDER BY name'));
$SMARTY->assign('error', $error);
$SMARTY->assign('nodeinfo', $nodeinfo);
$SMARTY->assign('nodeauthtype',$nodeauthtype);
$SMARTY->display('nodeedit.html');
?>
示例11: redirect
$_SESSION['pefi_user'] = $user;
// will redirect page
redirect(isset($_GET['redirect_to']) ? $_GET['redirect_to'] : '');
} else {
$_PEFI->view->content .= get_form("Try again!");
}
} elseif ($todo == 'logout') {
unset($_SESSION['pefi_user']);
redirect(isset($_GET['redirect_to']) ? $_GET['redirect_to'] : '');
} elseif (strpos($todo, 'manage') === 0) {
if (!$_PEFI->crdntls->can('user', 'list')) {
redirect_to_login($_PEFI->route->page);
}
include "{$_PEFI->path}/form/form.php";
if ($todo == 'manage_pass') {
$label = 'Manage User Passwords';
$elements = array(new PrimaryKeyElement(array('prop' => 'id', 'label' => 'PrimKey', 'isOrderable' => true)), new TextElement(array('prop' => 'name', 'label' => 'User', 'isEditable' => false, 'isOrderable' => true, 'isDefOrder' => true, 'isFilterable' => true, 'isOrderable' => true, 'allowEmpty' => false)), new PasswordElement(array('prop' => 'pass', 'label' => 'Password', 'isListable' => false, 'allowEmpty' => false, 'defVal' => 'Abcd123!')));
} else {
$label = 'Manage Users';
$elements = array(new PrimaryKeyElement(array('prop' => 'id', 'label' => 'PrimKey', 'isOrderable' => true)), new TextElement(array('prop' => 'name', 'label' => 'User', 'isOrderable' => true, 'isDefOrder' => true, 'isFilterable' => true, 'allowEmpty' => false)), new TextElement(array('prop' => 'lang', 'label' => 'Default Language', 'isFilterable' => true, 'isOrderable' => true, 'defSearchOp' => '=', 'allowEmpty' => false, 'defVal' => 'en')), new ScolonSepListGroupElement(array('prop' => 'perms', 'label' => 'Permissions', 'items' => getPerms(), 'isSearchMulti' => true)));
}
$form = new TableForm(array('label' => $label, 'elements' => $elements, 'table' => new OneTableDB($_PEFI->db, "{$_PEFI->dbpref}user"), 'lock' => $_PEFI->lock, 'logger' => new Logger(Logger::INFO, array(new FileLoggerOutput('_log/user.log'))), 'credentials' => $_PEFI->crdntls, 'canDelete' => true, 'filter' => $_GET, 'decorator' => isset($_GET['json']) ? JsonDecorator::get() : HtmlDecorator::get()));
$_PEFI->view->head = $_PEFI->form->head;
$_PEFI->view->head .= '<script type="text/javascript">PEFI.CRUD.edit_mode="popup";</script>';
$_PEFI->view->content = $form->handle($_SERVER['REQUEST_METHOD'], $_POST);
} elseif ($_PEFI->user) {
// will redirect page
redirect();
} else {
$_PEFI->view->content .= get_form();
}
示例12: log_in_form
function log_in_form($o = ''){
$o = setDefaults($o);
$output = 'There was a problem with your log in form options. Please make sure things are set correctly and try again.';
if($o['get'] == 'form'){
$output = get_form($o);
} else if($o['get'] == 'pieces'){
$output = get_pieces($o);
}
return $output;
}
示例13: compose_from_postvars
/**
* Convert an array of form fields to an atlas composition and queue it up.
*/
function compose_from_postvars(&$dbh, $post, $user_id)
{
$extents = $post['pages'];
$paper_size = isset($post['paper_size']) ? $post['paper_size'] : 'letter';
$orientation = isset($post['orientation']) ? $post['orientation'] : 'portrait';
$layout = isset($post['layout']) ? $post['layout'] : 'full-page';
$provider = $post['provider'];
$title = $post['atlas_title'];
$grid = filter_var($post['grid'], FILTER_VALIDATE_BOOLEAN) ? 1 : 0;
$redcross = filter_var($post['redcross'], FILTER_VALIDATE_BOOLEAN) ? 1 : 0;
$private = filter_var($post['private'], FILTER_VALIDATE_BOOLEAN) ? 1 : 0;
if (!is_array($extents)) {
return null;
}
//
// "orientation" above refers to the *map*, so if we want half-size
// we'll need to flip the orientation of the overall printed sheet
// to accommodate it.
//
if ($orientation == 'landscape' && $layout == 'half-page') {
$orientation = 'portrait';
} elseif ($orientation == 'portrait' && $layout == 'half-page') {
$orientation = 'landscape';
}
list($printed_width, $printed_height) = get_printed_dimensions($paper_size, $orientation, $layout);
$printed_aspect = $printed_width / $printed_height;
// We have all of the information. Make some pages.
$message = array('action' => 'compose', 'paper_size' => strtolower($paper_size), 'orientation' => $orientation, 'provider' => $provider, 'layout' => $layout, 'pages' => array());
$print = add_print($dbh, $user_id);
$print['title'] = $title;
$print['text'] = trim($post['atlas_text']);
$print['paper_size'] = $message['paper_size'];
$print['orientation'] = $message['orientation'];
$print['layout'] = $message['layout'];
$print['private'] = $private;
// build up bounds for each page in the message
$print['north'] = -90;
$print['east'] = -180;
$print['south'] = 90;
$print['west'] = 180;
foreach ($extents as $key => $value) {
list($north, $west, $south, $east) = array_map('floatval', explode(',', $value));
$mmap = create_mmap_from_bounds($paper_size, $orientation, $north, $west, $south, $east, $layout);
$bounds = get_mmap_bounds($mmap);
$text = trim(sprintf("%s\n\n%s", $post['atlas_title'], $post['atlas_text']));
$message['pages'][] = array('zoom' => $mmap->coordinate->zoom, 'number' => $key, 'provider' => $provider, 'bounds' => $bounds, 'text' => $text);
$print['north'] = max($print['north'], $bounds[0]);
$print['south'] = min($print['south'], $bounds[2]);
$print['west'] = min($print['west'], $bounds[1]);
$print['east'] = max($print['east'], $bounds[3]);
}
// prepare the index page and add it to the message for safekeeping.
if (count($extents) > 1) {
$mmap = create_mmap_from_bounds($paper_size, $orientation, $print['north'], $print['west'], $print['south'], $print['east'], $layout);
$index = array('number' => 'i', 'zoom' => $mmap->coordinate->zoom, 'bounds' => get_mmap_bounds($mmap, 0.1), 'provider' => $provider, 'role' => 'index', 'text' => '');
array_unshift($message['pages'], $index);
}
// create pages based on message contents
foreach ($message['pages'] as $i => $value) {
$page = add_print_page($dbh, $print['id'], $value['number']);
$page['zoom'] = $value['zoom'];
$_page = $value['bounds'];
$page['north'] = $_page[0];
$page['south'] = $_page[2];
$page['west'] = $_page[1];
$page['east'] = $_page[3];
$page['provider'] = $value['provider'];
set_print_page($dbh, $page);
// add grid overlay to the printed output of each non-index page:
if ($value['role'] != 'index' && $grid) {
$message['pages'][$i]['provider'] = "{$value['provider']},http://tile.stamen.com/utm/{Z}/{X}/{Y}.png";
}
if ($redcross) {
$message['pages'][$i]['provider'] = "{$value['provider']},http://a.tiles.mapbox.com/v3/americanredcross.HAIYAN_Atlas_Bounds/{Z}/{X}/{Y}.png";
}
}
// Deal with WOEIDs
$place = latlon_placeinfo(0.5 * ($print['north'] + $print['south']), 0.5 * ($print['west'] + $print['east']), $post['page_zoom'] - 3);
$print['country_name'] = $place[0];
$print['country_woeid'] = $place[1];
$print['region_name'] = $place[2];
$print['region_woeid'] = $place[3];
$print['place_name'] = $place[4];
$print['place_woeid'] = $place[5];
if ($post['form_id'] && ($form = get_form($dbh, $post['form_id']))) {
$print['form_id'] = $form['id'];
if ($form['parsed']) {
$message['form_fields'] = get_form_fields($dbh, $form['id']);
} else {
// The form hasn't been parsed yet, probably because
// compose-atlas.php was called with just a form_url.
$message['form_id'] = $form['id'];
$message['form_url'] = $form['form_url'];
}
}
$print['progress'] = 0.0;
set_print($dbh, $print);
//.........这里部分代码省略.........
示例14: get_image_main
?>
</h1>
<?php
get_image_main('220x', true, true, '660x', 'imgLeft');
?>
<?php
get_description();
?>
<div class="clear"></div>
<div class="formContainer">
<?php
if (isset($_GET['send']) && $_GET['send'] == true) {
get_form_success();
} else {
get_form('contactForm', $this->rootLevelId, get_elementId(true));
}
?>
</div>
<?php
get_text_blocks('220x', true, true, '660x');
?>
<?php
get_internal_links();
?>
<?php
get_video('540', '304');
?>
示例15: get_form
<?php
include "dbdefine.php";
include "formfunctions.php";
$debugme = 0;
$form = get_form();
#miro si estoy ya en un team
$sdata = array($form["room"]);
$stmt = $dbhchat->prepare("select * from teams where team_seed = ? ");
$stmt->execute($sdata);
$rows = $stmt->fetchAll();
foreach ($rows as $peer) {
$mates = $mates . " " . $peer["user"] . ",";
}
print substr($mates, 0, strlen($mates) - 1);