本文整理汇总了PHP中form::submit方法的典型用法代码示例。如果您正苦于以下问题:PHP form::submit方法的具体用法?PHP form::submit怎么用?PHP form::submit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类form
的用法示例。
在下文中一共展示了form::submit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index($page = 1)
{
$db = new Database();
// You can assign anything variable to a view by using standard OOP
// methods. In my welcome view, the $title variable will be assigned
// the value I give it here.
$this->template->title = 'Welcome to YAG demo!';
$grid = Grid::factory()->set('display_head', true)->set('display_foot', true)->set('display_body', true)->set('table_attributes', array('id' => 'demo_table_1', 'width' => '100%'));
$grid->CheckboxField('id')->set('title', 'ID')->set('checked', array(2, 3, 4, 6, 9))->set('sortable', true)->set('foot', form::checkbox('checkall', 'yes', false, "onclick=\"check_all('id[]');\"") . form::dropdown('action', array('edit' => 'Edit', 'delete' => 'Delete'), 'edit') . form::submit('submit', 'OK'))->set('extra', array("onclick" => "checkbox_check('id[]')"));
$grid->TextField('id')->set('title', 'ID')->set('sortable', true);
$grid->TextField('text')->set('title', 'Text')->set('sortable', true);
$grid->DateField('date')->set('title', 'Date')->set('format', 'Y-m-d')->set('sortable', true);
$grid->ActionField()->set('title', 'Action')->add_action('edit', 'id', 'Edit', 'http://www.path.to/my/controller')->add_action('delete', 'id', 'Delete');
$offset = (int) ($page - 1) * 10;
$offset = $offset < 0 ? 0 : $offset;
$order_field = 'id';
$order_direction = 'asc';
if ($this->input->get('order_by') and $grid->field_exists($order_field, true)) {
$order_field = $this->input->get('order_by');
}
if ($this->input->get('order_direction') and in_array(strtoupper($this->input->get('order_direction')), array('ASC', 'DESC'))) {
$order_direction = strtoupper($this->input->get('order_direction'));
}
$data = $db->select($grid->get_fields(true))->from('demotable')->limit(10)->offset($offset)->orderby($order_field, $order_direction)->get();
$count = $db->query('SELECT FOUND_ROWS() AS rows;')->current();
$this->pagination = new Pagination(array('total_items' => $count->rows, 'items_per_page' => 10));
$grid->set('extra_row_foot', '<td colspan="' . count($grid->fields) . '">' . $this->pagination->render() . '</td>');
$grid->set('data', $data);
$html = $grid->render();
// Get Javascript for checkbox gimmicks
$this->template->checkall_js = $grid->render_js('checkall');
$this->template->content = $html;
}
示例2: testSubmitLinkCreation
/**
* Test submit link creation
*/
function testSubmitLinkCreation()
{
$SUT = new Grid_Link('submit');
$SUT->text('someText');
$link = $SUT->__tostring();
$expected = form::submit('submit', 'someText');
$this->assertEquals($expected, $link);
}
示例3: render
/**
* Render the link as an HTML string
*
* @return string
*/
public function render()
{
switch ($this->type) {
case 'submit':
$link = form::submit('submit', $this->text);
break;
case 'button':
$link = html::anchor($this->action, '<button type="button">' . $this->text . '</button>');
break;
case 'link':
default:
$link = html::anchor($this->action, $this->text);
}
return $link;
}
示例4: edit
public function edit($url)
{
$display_name = ucwords(str_replace('_', ' ', $url));
$this->__set_heading("Editing Theme file - " . $display_name);
$view = new View('zest/content');
$content = form::open('admin/snippets/save/' . $url);
$html = zest::template_to_html(THEME_PATH . $url);
$content .= form::label('content', 'Code');
$content .= '<p><small>This is only for advanced users. To edit <a onclick="$(\'#content\').toggle();return false;" href="#">click here</a></small></p>';
$content .= form::textarea('content', $html, 'id="content" class="fullWidth no-editor hside"');
$content .= form::submit('submit', 'Save', 'class="submit"');
$content .= form::close();
$view->content = $content;
$this->__set_content($view);
}
示例5: run
public function run()
{
try {
$form = new form();
$form->post('new_email')->val('is_email', '', 'Please enter a valid email address');
$form->post('new_user')->val('minlength', 5, 'Username is too short')->val('maxlength', 15, 'now it\'s too long!');
$form->post('new_pass')->val('minlength', 7, 'password is too short');
$to_check = $form->fetch('new_pass');
$form->post('new_pass_check')->val('confirm', $to_check, 'passwords do not match bruvnaar');
$form->submit();
$data = $form->fetch();
$this->model->createUser($data);
} catch (Exception $e) {
session::set('error_message', $e->getMessage());
header('Location: ../register');
}
}
示例6: __under_development
private function __under_development()
{
$UNDER_DEVELOPMENT = ORM::factory('setting', 'UNDER_DEVELOPMENT');
if (isset($_POST['UNDER_DEVELOPMENT'])) {
$UNDER_DEVELOPMENT->value = $_POST['UNDER_DEVELOPMENT'];
$UNDER_DEVELOPMENT->save();
}
$data = array("name" => "UNDER_DEVELOPMENT", "class" => "fullWidth");
$options = array(null => "YES", "1" => "NO");
$selected = $UNDER_DEVELOPMENT->value;
$html = form::open();
$html .= form::label('UNDER_DEVELOPMENT', 'Under Development');
$html .= form::dropdown($data, $options, $selected);
$html .= form::submit('submit', 'Save', 'class="submit"') . '<p> </p><p> </p>';
$html .= form::close();
return $html;
}
示例7: array
function addNew_exec()
{
$response_array = array();
try {
$form = new form();
$form->post('comp_name')->val('Individual / Company Name', 'minlength')->post('comp_reg_no')->post('comp_address')->val('Address', 'minlength')->post('comp_postcode')->val('Poscode', 'minlength')->post('comp_state')->val('State', 'minlength')->post('state_other')->val('State', 'minlength')->post('comp_country')->val('Country', 'minlength')->post('comp_phone1')->val('Phone 1', 'minlength')->post('comp_phone2')->post('comp_fax')->post('website')->post('category')->val('Category', 'minlength')->post('tag')->val('Keyword Tag', 'minlength')->post('desc')->val('Description', 'minlength')->post('salutation')->val('Salutation', 'minlength')->post('p_fullname')->val('Fullname', 'minlength')->post('p_pos')->post('p_phone')->post('p_mobile')->val('Mobile No.', 'minlength')->post('p_gender')->val('Gender', 'minlength')->post('comp_email')->val('Email', 'minlength')->post('regdate');
$form->submit();
$data = $form->fetch();
$result = $this->model->addNew_exec($data);
$response_array['r'] = $result['r'];
$response_array['msg'] = $result['msg'];
} catch (Exception $e) {
$response_array['r'] = 'false';
$response_array['msg'] = $e->getMessage();
}
echo json_encode($response_array);
}
示例8: forgotPass
function forgotPass()
{
$response_array = array();
try {
$form = new form();
$form->post('email')->val('Email', 'email');
$form->submit();
$data = $form->fetch();
$result = $this->model->forgotPass_exec($data);
$response_array['r'] = $result['r'];
$response_array['msg'] = $result['msg'];
} catch (Exception $e) {
$response_array['r'] = 'false';
$response_array['msg'] = $e->getMessage();
}
echo json_encode($response_array);
}
示例9: _form
public function _form($user)
{
$html = "";
$html .= form::open(null, array('class' => 'valid_form'));
$html .= form::input(array('email', 'Email'), $user->email, 'class="fullWidth required email"');
$html .= form::label('New Password');
$html .= form::password('password[]', '', 'class="fullWidth"');
$html .= form::label('Repeat Password');
$html .= form::password('password[]', '', 'class="fullWidth"');
$html .= "<hr/>";
$html .= form::label('openid', 'OpenID <img src="http://www.plaxo.com/images/openid/login-bg.gif" />');
$html .= '<p><small><a href="http://www.openid.net" target="_BLANK">What is an OpenID?</a></small></p>
<p><small>Please remember the "http://"</small></p>';
$html .= form::input('openid', $user->openid, 'class="fullWidth url"');
$html .= form::submit('submit', 'Save', 'class="submit"');
$html .= form::close();
return $html;
}
示例10: run
public function run()
{
try {
$form = new form();
$form->post('username')->val('asci_check', '', 'No strange characters mind..');
$form->post('password');
if (isset($_POST['remember'])) {
$form->post('remember');
}
$form->submit();
$data = $form->fetch();
//print_r($data);die;
$this->model->link($data);
} catch (Exception $e) {
$_SESSION = array();
$_SESSION['errors'] = $e->getMessage();
header('Location: ../login');
}
}
示例11: exec
function exec()
{
$response_array = array();
try {
$form = new form();
$form->post('salutation')->val('Salutation', 'minlength')->post('fullname')->val('Fullname', 'minlength')->post('username')->val('Username', 'minlength')->post('dob')->val('Date Of Birth', 'minlength')->post('email')->val('Email', 'minlength')->post('cemail')->val('Confirm Email', 'minlength')->post('acc_type')->val('Account Type', 'minlength')->post('subscribe')->post('chkusername')->post('dt_join')->post('sponsor_id')->val('Refferal ID', 'minlength');
$form->submit();
$data = $form->fetch();
$result = $this->model->join_exec($data);
if ($result['r'] == 'true') {
$response_array['r'] = $result['r'];
$response_array['msg'] = $result['msg'];
} else {
$response_array['r'] = $result['r'];
$response_array['msg'] = $result['msg'];
}
} catch (Exception $e) {
$response_array['r'] = 'false';
$response_array['msg'] = $e->getMessage();
}
echo json_encode($response_array);
}
示例12: exec
function exec()
{
$response_array = array();
try {
$form = new form();
$form->post('name')->val('Name', 'minlength')->post('email')->val('Email', 'email')->post('phone')->post('message')->val('Message', 'minlength');
$form->submit();
$data = $form->fetch();
$result = $this->model->exec($data);
if ($result['r'] == 'true') {
$response_array['r'] = $result['r'];
$response_array['msg'] = $result['msg'];
} else {
$response_array['r'] = $result['r'];
$response_array['msg'] = $result['msg'];
}
} catch (Exception $e) {
$response_array['r'] = 'false';
$response_array['msg'] = $e->getMessage();
}
echo json_encode($response_array);
}
示例13: render
public function render(&$render_variables, $errors = array())
{
// Load base template and attributes
$result = parent::render($render_variables, $errors);
// Discover the type
switch ($this->type) {
case 'input':
$result['template']->element = form::input($result['attributes'], $this->value);
break;
case 'password':
$result['template']->element = form::password($result['attributes'], $this->value);
break;
case 'submit':
$result['template']->element = form::submit($result['attributes'], $this->value);
$render_variables['submit'] = TRUE;
break;
case 'radio':
$result['template']->element = form::radio($result['attributes'], $this->value);
break;
case 'checkbox':
$result['attributes']['value'] = $this->value;
if ($this->value = Input::instance()->post($this->name)) {
$result['template']->element = form::checkbox($result['attributes'], $this->value, TRUE);
} else {
$result['template']->element = form::checkbox($result['attributes'], $this->value);
}
break;
case 'hidden':
$result['template']->element = form::hidden($this->name, $this->value);
break;
case 'file':
$result['template']->element = form::upload($result['attributes'], $this->value);
$render_variables['enctype'] = 'multipart/form-data';
break;
}
// Return the resulting output
return (string) $result['template']->render();
}
示例14: Field
<?php
require_once '_toolkit/main.php';
//var_export($_FILES);
if ($_FILES) {
$file = file::upload('image', 'data/image/' . $_FILES['image']['name']);
$ext = $file->getExtension();
$file->rename('background' . $ext);
$file->move('backgrounds/1/');
echo $file->getBaseName() . html::br();
echo $file->getFolder() . html::br();
echo $file->getPath() . html::br();
$img = $file->getImage();
if ($img !== false) {
$img->resize(100, 75);
}
//echo $img->htmlTag();
echo html::img($file);
//$file->delete();
} else {
echo form::init(NULL, NULL, 'multipart/form-data');
echo new Field('image', 'file');
echo form::submit();
echo '</form>';
}
示例15: array
echo $item->price;
?>
</li>
<li>Ammount in store: <?php
echo $item->amount;
?>
</li>
</ul>
<?php
echo form::open();
?>
<fieldset>
<dl>
<dt style="width: 60px;">
<?php
echo form::label('amount', 'Amount:');
?>
<br />
</dt>
<dd><?php
echo form::input('amount', '1', array('style' => 'width: 40px'));
?>
</dd>
</dl>
<?php
echo form::submit('buy', 'Buy');
?>
</fieldset>
<?php
echo form::close();