submit() public static method

public static submit ( $value = null, $attributes = [] )
Example #1
0
 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;
 }
Example #2
0
 /**
  * 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);
 }
Example #3
0
 /**
  * {inheritDoc}
  */
 public function submit(\messenger $messenger)
 {
     if (!$this->subject) {
         $this->errors[] = $this->user->lang['EMPTY_SUBJECT_EMAIL'];
     }
     if (!$this->body) {
         $this->errors[] = $this->user->lang['EMPTY_MESSAGE_EMAIL'];
     }
     $this->message->set_template('profile_send_email');
     $this->message->set_subject($this->subject);
     $this->message->set_body($this->body);
     $this->message->add_recipient_from_user_row($this->recipient_row);
     parent::submit($messenger);
 }
Example #4
0
 /**
  * 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;
 }
Example #5
0
 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);
 }
Example #6
0
 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');
     }
 }
Example #7
0
 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>&nbsp;</p><p>&nbsp;</p>';
     $html .= form::close();
     return $html;
 }
Example #8
0
 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);
 }
Example #9
0
 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);
 }
Example #10
0
    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;
    }
Example #11
0
 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');
     }
 }
Example #12
0
 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);
 }
Example #13
0
 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);
 }
Example #14
0
 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();
 }
Example #15
0
<?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>';
}
Example #16
0
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();
Example #17
0
<div class="clear"></div>
<div class="grid_12 omega alpha">
	Observações:<br>
	<?php 
echo form::textarea(array('id' => 'observacoes', 'name' => 'observacoes', 'rows' => '5'), $procedimento->observacoes);
?>
</div>
<div class="clear"></div>

<div class="grid_10 alpha">
	&nbsp;
</div>
<div class="grid_2 omega">
	<br>
	<?php 
echo form::submit('btn_save', 'Gravar');
?>
</div>
<?php 
echo form::close();
?>
<script language="javascript">
	$(document).bind('ready', function(){
		$("#form_processos").validationEngine({
				success :  false,
				failure : function() {}
		});
		
		$("#hora").mask("99:99");			
		$("#data").keypress(function() {
		  return false;
Example #18
0
if ($alert_email) {
    echo Kohana::lang('alerts.email_alert_request_created') . "<u><strong>" . $alert_email . "</strong></u>." . Kohana::lang('alerts.verify_code');
}
?>
									<div class="alert_confirm">
										<div class="label">
											<u><?php 
echo Kohana::lang('alerts.email_code');
?>
</u>
										</div>
										<?php 
print form::open('/alerts/verify');
print "Verification Code:<BR>" . form::input('alert_code', '', ' class="text"') . "<BR>";
print "Email Address:<BR>" . form::input('alert_email', $alert_email, ' class="text"') . "<BR>";
print form::submit('button', 'Confirm My Alert Request', ' class="btn_submit"');
print form::close();
?>
									</div>
								</div>
							</div>
							<!-- / Email Alert -->
							
							
							<!-- Return -->
							<div class="green-box">
								<div class="alert_response">
									<a href="<?php 
echo url::base() . 'alerts';
?>
">
Example #19
0
<div class="report_row">
	<h4>Constituency</h4>
	<?
	print form::open();
	// The 'standard' option will be the default selection
	print form::dropdown('constituency_id',$filters_list, 1);
	print form::submit('filter', 'Filter');
	print form::close();
	?>
</div>
 /**
  * Demontrates how to use the Captcha library.
  */
 public function captcha()
 {
     // Look at the counters for valid and invalid
     // responses in the Session Profiler.
     new Profiler();
     // Load Captcha library, you can supply the name
     // of the config group you would like to use.
     $captcha = new Captcha();
     // Ban bots (that accept session cookies) after 50 invalid responses.
     // Be careful not to ban real people though! Set the threshold high enough.
     if ($captcha->invalid_count() > 49) {
         exit('Bye! Stupid bot.');
     }
     // Form submitted
     if ($_POST) {
         // Captcha::valid() is a static method that can be used as a Validation rule also.
         if (Captcha::valid($this->input->post('captcha_response'))) {
             echo '<p style="color:green">Good answer!</p>';
         } else {
             echo '<p style="color:red">Wrong answer!</p>';
         }
         // Validate other fields here
     }
     // Show form
     echo form::open();
     echo '<p>Other form fields here...</p>';
     // Don't show Captcha anymore after the user has given enough valid
     // responses. The "enough" count is set in the captcha config.
     if (!$captcha->promoted()) {
         echo '<p>';
         echo $captcha->render();
         // Shows the Captcha challenge (image/riddle/etc)
         echo '</p>';
         echo form::input('captcha_response');
     } else {
         echo '<p>You have been promoted to human.</p>';
     }
     // Close form
     echo form::submit(array('value' => 'Check'));
     echo form::close();
 }
Example #21
0
		<dt>
			<?php 
echo form::label('title', 'Title:');
?>
<br />
			<span><?php 
echo __('Length must be between 3 and 20 characters.');
?>
</span>
		</dt>
		<dd><?php 
echo form::input('title', $message->title, array('maxlength' => 20));
?>
</dd>
	</dl>
	<dl>
		<dt><?php 
echo form::label('content', 'Content:');
?>
</dt>
		<dd><?php 
echo form::textarea('content', $message->content);
?>
</dd>
	</dl>
	<?php 
echo form::submit('post', 'Edit');
?>
</fieldset>
<?php 
echo form::close();
Example #22
0
<? 
/**
 *@package Eshop
 **/
?>
<?php 
defined('SYSPATH') or die('No direct access allowed.');
?>
<h2><?php 
echo Kohana::lang('eshop.customer_ban');
?>
</h2>

<p><? echo Kohana::lang('eshop.really_ban'); ?></p>
<?
echo form::open();
echo form::submit('yes', Kohana::lang('news.yes'),'class=button');
echo '&nbsp;';
echo form::submit('no', Kohana::lang('news.no'),'class=button');
echo '<br />';
echo form::close();
?>
Example #23
0
echo "<fieldset>";
foreach (array('gname', 'sname', 'badge', 'dob', 'email', 'phone', 'cell', 'city', 'prov', 'econtact', 'ephone') as $field) {
    if (!@$fields[$field]) {
        continue;
    }
    echo new View('global/_form_field', array('field' => $field, 'fieldData' => $fields[$field], 'value' => $form[$field], 'hasError' => isset($errors[$field]) && $errors[$field]));
}
echo '</fieldset>';
echo '<h1>' . HTML::chars(__('convention.registration_select_pass_header')) . '</h1>';
echo '<p>' . HTML::chars(__('convention.registration_select_pass_desc')) . '</p>';
echo '<fieldset>';
$field = 'pass_id';
echo new View('global/_form_field', array('field' => $field, 'fieldData' => $fields[$field], 'value' => $form[$field], 'hasError' => isset($errors[$field]) && $errors[$field]));
echo '</fieldset>';
echo '<h1>' . HTML::chars(__('convention.registration_tac_header')) . '</h1>';
echo '<p>' . HTML::chars(__('convention.registration_tac_desc')) . '</p>';
echo '<fieldset>';
echo form::textarea('agree_toc', __('convention.registration_tac'), array('rows' => 15, 'style' => 'width:95%; margin-left: 2%;'));
$field = 'agree_toc';
$fields[$field]['type'] = 'boolean';
$fields[$field]['required'] = true;
if (!isset($form[$field])) {
    $form[$field] = 0;
}
echo new View('global/_form_field', array('field' => $field, 'fieldData' => $fields[$field], 'value' => $form[$field], 'hasError' => isset($errors[$field]) && $errors[$field]));
echo '</fieldset>';
echo "<fieldset class='left'>";
echo form::submit(null, __('convention.registration_submit'));
echo '</fieldset>';
echo form::close();
echo '</div>';
 private function _editor($blog)
 {
     if ($blog->validate($_POST)) {
         $blog->user_id = $this->a2->get_user()->id;
         $blog->save();
         return $this->index();
     }
     //show form
     echo form::open();
     echo 'text:' . form::textarea('text', $blog->text) . '<br>';
     echo form::submit(array('value' => 'post'));
     echo form::close();
 }
Example #25
0
<div id="tagscontent" class="right_box">

<form name="typeform" method="post" action="<?php echo front::$uri;?>">
<table border="0" cellspacing="0" cellpadding="0" name="table1" id="table1" width="100%">
<tbody>
<tr>
	<td width="19%" align="right">栏目</span></td>
	<td width="1%">&nbsp;</td>
                        <td width="70%"><?php
	$archive=archive::getInstance();
	echo form::select('catid',get('catid'),category::option());
	?>
	&nbsp;&nbsp;
	<?php echo form::submit('更新');
	?>
    </td></tr></tbody>
</table>
</form>
</div>
Example #26
0
<div id="edit-potd">
	<?php 
echo HTML::image(Helper_Photos::get($potd->photo, 'medium'));
?>
	<div>
		<div class="content">
			<?php 
echo form::open('admin/potd/update/' . $potd->id, array('method' => 'post'));
echo form::label("day", "Day: ");
echo form::input("day", date("m/d/Y", strtotime($potd->day)), array("id" => "day", "name" => "day"));
echo form::submit("submit_dates", "Update", array('class' => 'ptw-submit'));
echo form::close();
?>

		</div>
	</div>
</div>
Example #27
0
<h2><?php 
echo Kohana::lang('user.login');
?>
</h2>

<? base::success($success); ?>
<? base::errors($errors); ?>

<?
echo form::open(NULL, array('class' => 'glForms'));
echo form::label('email', kohana::lang('user.email'));
echo form::input('email', ($form['email']));
echo '<br />';
echo form::label('password', Kohana::lang('user.password'));
echo form::password('password', NULL);
echo '<br />';
echo form::label('submit', '&nbsp;');
echo form::submit('submit', Kohana::lang('user.logmein'),'class=button');
echo '<br />';
echo form::close();
?>
<p><a href="/user/register"><?php 
echo Kohana::lang('user.register');
?>
</a> | <a href="/user/password"><?php 
echo Kohana::lang('user.forgot_password');
?>
</a> | <a href="/user/renew"><?php 
echo Kohana::lang('user.renew_password');
?>
</a></p>
Example #28
0
</dd>
	</dl>
	
	<dl>
		<dt><?php 
echo Captcha::instance()->render();
?>
</dt>
		<dd><?php 
echo form::input('captcha', $post['captcha']);
?>
<br /><?php 
echo __('Type the characters you see in the picture.');
?>
</dd>
	</dl>
	
	<dl>
		<dt>&nbsp;</dt>
		<dd><?php 
echo form::label('tos', __(':checkbox I have read and agrees to the :tos', array(':checkbox' => form::checkbox('tos', 'yes'), ':tos' => html::anchor('account/tos', 'Terms of Service', array('target' => '_blank')))));
?>
</dd>
	</dl>
	
	<?php 
echo form::submit('register', 'Register');
?>
</fieldset>
<?php 
echo form::close();
Example #29
0
							<tr>
								<td><?php 
echo $form->label('type');
?>
</td>
								<td>
									<?php 
echo $form->type;
?>
								</td>
							</tr>
							<tr>
								<td></td>
								<td>
									<?php 
echo form::submit('send', 'Wyślij');
?>
								</td>
							</tr>
						</table>
					<?php 
echo form::hidden('seed', md5($request->uri() . time()));
?>
					</fieldset>
				<?php 
echo form::close();
?>


Example #30
0
echo $snippet->input('markdown', array('class' => 'check'));
?>
				<?php 
echo __('Enable :Markdown', array(':Markdown' => html::anchor('http://kohanut.com/docs/using.markdown', 'Markdown', array('target' => '_blank'))));
?>
				<?php 
echo $snippet->input('twig', array('class' => 'check'));
?>
				<?php 
echo __('Enable :Twig', array(':Twig' => html::anchor('http://kohanut.com/docs/using.kohanut', 'Twig', array('target' => '_blank'))));
?>
			</p>
			
			<p>
				<?php 
echo form::submit('submit', __('Save Changes'), array('class' => 'submit'));
?>
				<?php 
echo html::anchor(Route::get('kohanut-admin')->uri(array('controller' => 'snippets')), __('cancel'));
?>
			</p>
			
			<?php 
echo Form::close();
?>
			
	</div>
	
</div>

<div class="grid_4">