本文整理汇总了PHP中FORM类的典型用法代码示例。如果您正苦于以下问题:PHP FORM类的具体用法?PHP FORM怎么用?PHP FORM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FORM类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ckeditor
public static function ckeditor($name, array $options = array())
{
self::$_form_id++;
$errors = self::get_errors($name);
$form_element = FORM::textarea($name, Arr::get(self::$_values, $name), array('id' => 'text'));
return View::factory('ckeditor')->set('name', $name)->set('values', self::$_values)->set('errors', $errors)->set('form_element', $form_element)->set('options', $options)->set('form_id', self::$_form_id)->render();
}
示例2: __construct
/**
* @param FORM $form The form to which these commands belong.
* @param string $field_name The name of the field to select/de-select.
*/
public function __construct($form, $field_name)
{
$this->assert(isset($form), "[form] cannot be empty.", '__construct', 'SELECTION_COMMANDS');
parent::__construct($form->context);
$ctrl_name = $form->js_name($field_name);
$command = $this->app->make_command();
$command->id = 'select_all';
$command->caption = 'Select all';
$command->link = '#';
$command->executable = true;
$command->on_click = "select_all ({$ctrl_name})";
$this->append($command);
$command = $this->app->make_command();
$command->id = 'select_none';
$command->caption = 'Select none';
$command->link = '#';
$command->executable = true;
$command->on_click = "select_none ({$ctrl_name})";
$this->append($command);
}
示例3: DISTINCT
}
// Suche itself
$sql = "SELECT DISTINCT(e.id), title, filename, date, link FROM press_entries AS e " . $join . " " . $where;
$res = $SQL->select($sql);
}
// head
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n" . "<html>" . "\t<head>" . "\t\t<title>Suche Pressesystem</title>\n" . "\t\t<meta name=\"author\" content=\"Christoph Becker\" >" . "\t\t<meta name=\"keywords\" content=\"Pressesystem Suche Uni Rostock Fakultät für Informatik und Elektrotechnik\" >" . "\t\t<meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\" >" . "\t\t<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" >" . "\t\t<style>" . "\t\t\t.presstitle{ font-family:Verdana,Geneva,sans;" . "\t\t\t\t\t\t font-size:14pt;" . "\t\t\t\t\t\t color:black; " . "\t\t\t}" . "\t\t\ttd {font-family:Verdana,Geneva,sans;" . "\t\t\t\t\t\tfont-size:10pt;" . "\t\t\t\t\t\tcolor:black;" . "\t\t\t\t\t\tmargin-top:10pt;" . "\t\t\t\t\t\t" . "\t\t\t}" . "\t\t\ttd.presssearchtitle {" . "\t\t\t\t\tfont-weight: bold;" . "\t\t\t}" . "\t\t\ta.presslink:hover {" . "\t\t\t\t\tcolor:red;\t" . "\t\t\t}" . "\t\t</style>" . "\t\t" . "\t</head>" . "\t<body link=\"#090851\" text=\"#000000\" bgcolor=\"#ffffff\">";
// content
if ($search_debug == true) {
echo "<pre>Sites_selected: ";
var_export($sites);
echo "\nSQL: {$sql} \n Results:\n";
var_export($res);
echo "\n<hr noshade=noshade />";
}
echo "<div class='presstitle'>Suche</div>" . "<form name=\"sform\" method=\"POST\" action =\"" . $abs_path . "\">" . "<table>" . "<tr><td colspan='2' class='presssearchtitle'>Volltextsuche</td><td> </td></tr>" . "<tr><td> </td><td colspan='2'>" . FORM::text("fulltext", $fulltext, "", 70) . "</td></tr>" . "<tr><td colspan='2' class='presssearchtitle'>Zeige alle Einträge</td><td> </td></tr>" . "<tr><td align='right'><table><tr><td>" . FORM::radio("range", "before", "", $range) . "vor</td>" . "<td rowspan='2'>" . FORM::text("date", $date, "", 10) . "</td></tr>" . "<tr><td>" . FORM::radio("range", "after", "", $range) . "nach </td></tr>" . "</table></td>" . "<td colspan='2'>" . "<b>oder</b> " . FORM::radio("range", "all", "", $range) . "egal, wann sie erstellt wurden</td>" . "<tr><td valign='top' class='presssearchtitle' colspan='2'>Suche auf bestimmte Institute beschränken</td><td> </td></tr>" . "\t<td> </td><td>" . FORM::select("sites[]", $PS->get_all(1), $sites, 6) . "</td></tr>" . "<tr><td> </td><td colspan='2'>" . FORM::submit("send", "suche!") . "</td></tr> " . "</table>" . "</form>" . "\t\t</div>";
// footer
echo "\t</body>" . "</html>";
// close debug
require "init.php";
//----
function set_date($d, $dateform = "german")
{
//$ret = $d;
//$dateform = "german"; // what do i suppose, which form i got
$buffer = $d;
// save for error_msg
$preset_year = strftime("%Y");
// with current year
$d = trim($d);
if (strlen($d) < 3) {
示例4: curl_setopt
if (isset($_POST['mobile_phone']) and strlen($_POST['mobile_phone']) > 0) {
if ($curl = curl_init()) {
curl_setopt($curl, CURLOPT_URL, 'http://w.qiwi.ru/setInetBill.do?from=9492&to=' . $mobile_phone . '&summ=' . $total_cost . '&com=' . $course_name . '&lifetime=96');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$out = curl_exec($curl);
//echo $out;
echo $total_cost;
curl_close($curl);
}
}
}
if (isset($fields['mobile_phone'])) {
echo $fields['mobile_phone'];
}
defined('SYSPATH') or die('No direct script access.');
echo FORM::open();
function get_message_to_alert()
{
$result['str'] = 'Привет Мир!';
echo json_encode($result);
return true;
}
?>
<?php
if (isset($_POST['mobile_phone'])) {
$mobile_phone = $_POST['mobile_phone'];
$total_cost = 1000;
echo 'Отправка тестового счета на номер: ' . $mobile_phone;
if ($curl = curl_init()) {
curl_setopt($curl, CURLOPT_URL, 'http://w.qiwi.ru/setInetBill.do?from=9492&to=' . $mobile_phone . '&summ=' . $total_cost . '&com=тестовый счет&lifetime=96');
示例5: __
echo Form::errors();
?>
<div class="form-group">
<div class="col-md-offset-4 col-md-8">
<img src="<?php
echo $user->get_profile_image();
?>
" class="img-rounded ticket_image" alt="<?php
echo __('Profile Picture');
?>
" width="120" height="120">
</div>
</div>
<div class="form-group">
<?php
echo FORM::label('profile_img', __('Profile picture'), array('class' => 'col-md-4 control-label', 'for' => 'profile_img'));
?>
<div class="col-md-8">
<input class="form-control" type="file" name="profile_image" id="profile_img" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-4 col-md-8">
<button type="submit" class="btn btn-primary"><?php
echo __('Update');
?>
</button>
<?php
if ($user->has_image) {
?>
<button type="submit"
示例6: defined
<?php
defined('SYSPATH') or die('No direct script access.');
?>
<form id="fileupload" action="/rest/companyimage" method="POST" enctype="multipart/form-data">
<?php
echo FORM::hidden('company_id', $service->id);
?>
<div class="fileupload-buttonbar">
<a class="btn btn-success fileinput-button">
<i class="icon-plus icon-white"></i>
<span>Добавить изображение</span>
<input type="file" name="files[]" multiple>
</a>
<button type="submit" class="btn btn-primary start">
<i class="icon-upload icon-white"></i>
Загрузить
</button>
<button type="reset" class="btn btn-warning cancel">Отмена</button>
</div>
<table role="presentation" class="table table-striped">
<thead>
<tr>
<th>Превью</th>
<th></th>
<th>Заголовок</th>
<th>Операции</th>
</tr>
</thead>
示例7: array
" name="form_widget_<?php
echo $widget->id_name();
?>
" method="post" action="<?php
echo Route::url('oc-panel', array('controller' => 'widget', 'action' => 'save'));
?>
" >
<div class="form-group">
<label class="control-label col-sm-4" for="placeholder_form"><?php
echo __('Where do you want the widget displayed?');
?>
</label>
<div class="col-sm-5">
<?php
echo FORM::select('placeholder', array_combine(widgets::get_placeholders(TRUE), widgets::get_placeholders(TRUE)), $widget->placeholder);
?>
</div>
</div>
<?php
foreach ($tags as $tag) {
?>
<div class="form-group">
<?php
echo $tag;
?>
</div>
<?php
}
?>
示例8: array
</div>
</div>
<?endif?>
<form class="form-horizontal" enctype="multipart/form-data" method="post" action="<?php
echo Route::url('oc-panel', array('controller' => 'category', 'action' => 'icon', 'id' => $form->object->id_category));
?>
">
<?php
echo Form::errors();
?>
<div class="form-group">
<div class="col-sm-12">
<?php
echo FORM::label('category_icon', __('Select from files'), array('for' => 'category_icon'));
?>
<input type="file" name="category_icon" class="form-control" id="category_icon" />
</div>
</div>
<button type="submit" class="btn btn-primary"><?php
echo __('Submit');
?>
</button>
<?if (( $icon_src = $category->get_icon() )!==FALSE ):?>
<button type="submit"
class="btn btn-danger index-delete index-delete-inline"
onclick="return confirm('<?php
echo __('Delete icon?');
?>
示例9: foreach
<button name="map_mode[]" value="<?php
echo $city->img_metro_map;
?>
" class="btn btn-small">Оригинал (С надписями)</button>
</div>
<div class="alert alert-success" style="display: none;"></div>
</div>
<div class="list">
<div class="controls">
<?php
foreach ($metro_stations as $m) {
?>
<div class="item" style="position: relative; height: 30px;">
<label class="checkbox" style="width: 150px; position: absolute;">
<?php
echo FORM::checkbox('metro[]', $m->id, FALSE, array('data-metro-name' => $m->name));
?>
<?php
echo $m->name;
?>
</label>
<div class="btn-group" data-toggle="buttons-radio" style="position: absolute; right: 0px;">
<button name="drag_mode[]" data-metro-id="<?php
echo $m->id;
?>
" class="btn btn-small active" value="outline">F</button>
<button name="drag_mode[]" data-metro-id="<?php
echo $m->id;
?>
" class="btn btn-small" value="inline">I</button>
</div>
示例10: defined
<?php
defined('SYSPATH') or die('No direct script access.');
$form_actions_attr = array();
if (!Arr::get($options, 'horizontal', TRUE)) {
$form_actions_attr['style'] = 'padding-left: 0;';
}
?>
<div class="form-actions" <?php
echo HTML::attributes($form_actions_attr);
?>
>
<?php
foreach ($actions as $type => $params) {
?>
<?php
echo FORM::button(Arr::get($params, 'name'), __($params['text']), array('type' => $type) + Arr::get($params, 'attributes', array()));
?>
<?php
}
?>
</div>
示例11: check_form
function check_form()
{
$this->DBG->enter_method();
#while (list($key, $val)=each($this->fieldlist)) {
foreach ($this->fieldlist as $val) {
$formval = init($val['name'], "r", false);
// wert holen aus "request"
$this->DBG->watch_var("!!Found " . $val['type'], $formval);
if (array_key_exists('optional', $val) && $val['optional'] == true) {
if (!($formval != "" || array_key_exists('minmax', $val))) {
$this->DBG->send_message("-optional field ignored");
continue;
}
$this->DBG->send_message("-optional field processed!");
}
switch ($val['type']) {
case "file":
$this->DBG->watch_var("-File uploaded/" . $formval . " ex?", file_exists("uploaded/" . $formval));
if (strlen($formval) > 1) {
if (!file_exists("uploaded/" . $formval)) {
$this->DBG->send_message("-file upload error [file1]");
$this->fielderrors[$val['name']] = "Fehler beim Hochladen?";
} else {
$this->DBG->send_message("-file already uploaded [file2]");
array_push($this->results, array($val['name'] => $formval));
}
continue;
} else {
$reti = FORM::upload_file($val['name'], "uploaded/");
if (substr($reti, 0, 5) == "ERROR") {
// error occured with uploaded file
$this->DBG->send_message("-error during file upload [file3]");
$this->fielderrors[$val['name']] = substr($reti, 6);
} else {
//echo $reti; // is filename
$this->DBG->send_message("-file successfully uploaded [file4]");
array_push($this->results, array($val['name'] => $reti));
}
}
break;
case "link":
if (eregi("^http\\:", $formval)) {
$this->fielderrors[$val['name']] = "Links bitte ohne Protokoll (http://) angeben.";
} else {
array_push($this->results, array($val['name'] => trim($formval)));
}
break;
case "date":
$this->DBG->watch_var("-input", $formval);
$r = $this->check_date($formval);
$this->DBG->watch_var("-output", $r);
if (!eregi("^[0-9]", $r)) {
$this->DBG->send_message("-invalid date!");
$this->fielderrors[$val['name']] = $r;
} else {
array_push($this->results, array($val['name'] => $r));
$_REQUEST[$val['name']] = $r;
}
break;
case "site_select":
$formval = init(substr($val['name'], 0, -2), "r");
// wert holen aus "request"
$this->DBG->watch_var("-SiteSelect:" . $val['name'], $formval);
// trivial
if (is_array($formval)) {
array_push($this->results, array($val['name'] => $formval));
break;
}
$this->fielderrors[$val['name']] = "Bitte wählen Sie mindestens einen Bereich aus!";
break;
case "source_select":
// trivial
$this->DBG->watch_var("-F:" . $val['name'], $formval);
if ($formval > 0) {
array_push($this->results, array($val['name'] => $formval));
break;
}
$this->fielderrors[$val['name']] = "Bitte wählen Sie eine Quelle aus oder erstellen eine neue!";
break;
default:
$this->DBG->watch_var("-Default, Type is", $val['type']);
case "text":
// trivial
$this->DBG->watch_var("-Text-Field", $val);
$this->DBG->watch_var("-OR-Field", $val['_or']);
/* Bedingungsliste */
// wert?
(bool) ($wert = strlen(trim($formval)) > 0);
$this->DBG->watch_var("wert", $wert);
// abhängigkeit
(bool) ($or = array_key_exists('_or', $val));
$this->DBG->watch_var("or", $or);
// abhängiges feld hat wert (hat keinen fehler)
(bool) ($or_wert = $or ? !array_key_exists($val['_or'], $this->fielderrors) : false);
$this->DBG->watch_var("or_wert", $or_wert);
// besteht eine min/max bedingung?
(bool) ($minmax = array_key_exists('minmax', $val) ? true : false);
// ist feld optional? (dann darf es leer sein, oder muss die min/max bedingung erfüllen)
(bool) ($optional = array_key_exists('optional', $val) && $val['optional'] == true ? true : false);
// wert vorhanden, schreiben!
//.........这里部分代码省略.........
示例12: apply
public static function apply()
{
Output\OUTPUT::set_static_file();
if (self::has_attribute(self::get("primary_database")[0], "alias", true)) {
CONFIG::$primarydatabase = self::get("primary_database")[0]["@attributes"]["alias"];
}
foreach (self::get("rewrite_rules") as $value) {
REQUEST::translate($value);
}
foreach (self::get("links") as $value) {
self::set_table_links($value);
}
if (REQUEST::$is_static == true && !empty(Output\OUTPUT::$static_file)) {
Output\OUTPUT::static_file();
}
if (REQUEST::redirect()) {
header("Location: " . REQUEST::root() . "/" . REQUEST::redirect_uri());
}
foreach (self::get("accounttypes") as $value) {
ACCOUNT::translate($value);
}
foreach (self::get("database") as $value) {
if (self::has_attribute($value, "alias", true)) {
$alias = $value["@attributes"]["alias"];
unset($value["@attributes"]["alias"]);
$config = $value["@attributes"];
unset($value["@attributes"]);
if (!isset($config["tablelinks"]) && isset(self::$table_links[$alias])) {
$config["tablelinks"] = self::$table_links[$alias];
}
Database\DATABASE::register_database($alias, $config);
foreach (self::get("table") as $subvalue) {
if (!self::find_previous_config("table:", $subvalue) && !empty($subvalue)) {
if (isset($value["@attributes"]["database_alias"]) && $value["@attributes"]["database_alias"] == $alias) {
self::configure_database($subvalue);
}
}
}
}
}
foreach (self::get("form") as $value) {
if (self::has_attribute($value, "name", true)) {
FORM::translate($value["@attributes"]["name"], $value);
}
}
foreach (self::get("project") as $value) {
foreach ($value as $subkey => $subvalue) {
if (self::startswith(strtolower($subkey), "include:") && self::has_attribute($subvalue, "file", true)) {
$file = $subvalue["@attributes"]["file"];
if (file_exists(self::$projectdir . "/" . $file . ".php")) {
include self::$projectdir . "/" . $file . ".php";
}
}
}
}
ACCOUNT::set_database_config();
REQUEST::init();
ACCOUNT::access();
if (ACCOUNT::redirect()) {
header("Location: " . REQUEST::root() . "/" . REQUEST::redirect_uri());
}
REQUEST::access();
}
示例13: array
echo FORM::input('full_name', Arr::get($values, 'full_name'), array('class' => 'span5'));
?>
<span class="help-inline"><?php
echo Arr::get($errors, 'full_name');
?>
</span>
<p class="help-block">напр. юго западный административный округ</p>
</div>
</div>
<div class="control-group">
<label for="name" class="control-label">Аббревиатура</label>
<div class="controls">
<?php
echo FORM::input('abbreviation', Arr::get($values, 'abbreviation'), array('class' => 'span5'));
?>
<span class="help-inline"><?php
echo Arr::get($errors, 'abbreviation');
?>
</span>
<p class="help-block">напр. ЮЗАО</p>
</div>
</div>
<div class="form-actions">
<?php
echo FORM::submit(NULL, 'Сохранить', array('class' => 'btn btn-large btn-success'));
?>
<?php
echo FORM::submit('edit_content', 'Сохранить и перейти к редактированию страницы', array('class' => 'btn btn-large btn-primary'));
?>
</div>
</fieldset>
示例14: foreach
echo Request::current()->uri();
?>
" method="post" class="form-horizontal" enctype="multipart/form-data">
<div class="panel panel-default">
<div class="panel-body">
<div class="form-horizontal">
<?php
foreach ($options as $field => $attributes) {
?>
<div class="form-group">
<?php
echo FORM::form_tag($field, $attributes, isset($data[$field]) ? $data[$field] : NULL);
?>
</div>
<?php
}
?>
<div class="form-group">
<div class="col-sm-offset-5 col-sm-7">
<?php
echo FORM::button('submit', __('Update'), array('type' => 'submit', 'class' => 'btn btn-primary'));
?>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
示例15: load_from_object
/**
* @param TEST_SUITE $obj
*/
public function load_from_object($obj)
{
parent::load_from_object($obj);
$names = $obj->test_names();
if (!empty($names)) {
$this->set_value('test_name', $names[0]);
}
}