input() public static method

public static input ( $type, $name, $value = '', $attributes = [] )
Example #1
0
 public function html_element()
 {
     // Import base data
     $data = $this->data;
     $input = '';
     foreach ($this->parts as $type => $val) {
         isset($data['value']) or $data['value'] = '';
         $temp = $data;
         $temp['name'] = $this->data['name'] . '[' . $type . ']';
         $offset = strlen($data['value']) == 10 ? 0 : 3;
         switch ($type) {
             case 'area_code':
                 if (strlen($data['value']) == 10) {
                     $temp['value'] = substr($data['value'], 0, 3);
                 } else {
                     $temp['value'] = '';
                 }
                 $temp['class'] = 'area_code';
                 $input .= form::input(array_merge(array('value' => $val), $temp)) . '-';
                 break;
             case 'exchange':
                 $temp['value'] = substr($data['value'], 3 - $offset, 3);
                 $temp['class'] = 'exchange';
                 $input .= form::input(array_merge(array('value' => $val), $temp)) . '-';
                 break;
             case 'last_four':
                 $temp['value'] = substr($data['value'], 6 - $offset, 4);
                 $temp['class'] = 'last_four';
                 $input .= form::input(array_merge(array('value' => $val), $temp));
                 break;
         }
     }
     return $input;
 }
 public function __toString()
 {
     $field = $this->field_name;
     $smax = @$this->args->max;
     $smin = @$this->args->min;
     $length = @$this->args->decimal_length;
     return form::input($this->field_name, $this->field_value, 'class="SpinnerNumber" spinnermax="' . $smax . '" spinnermin="' . $smin . '" decimal_length="' . $length . '"');
 }
Example #3
0
 public function input($fieldKey, $fieldData, $view = 'default')
 {
     $fieldData->options = self::$value;
     if ($view == 'val') {
         return self::$value[$fieldData->value];
     } else {
         return parent::input('inputSelect', $fieldKey, $fieldData, 'input');
     }
 }
Example #4
0
 private function __form()
 {
     $form = "";
     $form .= form::open();
     $form .= form::label('filename', 'Title');
     $form .= form::input('filename', '', 'class="fullWidth"');
     $form .= form::submit('submit', 'Save', 'class="submit"');
     $form .= form::close();
     return $form;
 }
Example #5
0
 public function input($fieldKey, $fieldData)
 {
     $fieldData->options = array('1' => '-1-');
     $items = $this->CI->Pak_Model->count($fieldData->table, $fieldData->where);
     if ($items > 0) {
         for ($i = 2; $i < $items + 2; $i++) {
             $fieldData->options[$i] = "-{$i}-";
         }
     }
     return parent::input('inputSelect', $fieldKey, $fieldData, 'input');
 }
Example #6
0
 public function input($fieldKey, $fieldData, $view = 'default')
 {
     $fieldData->cate_type = isset($fieldData->cate_type) ? $fieldData->cate_type : 'art';
     $items = $this->CI->Pak_Model->categoryTable($fieldData->cate_type, 0, 1, 1);
     // 		bug($items); exit;
     $fieldData->options = array('*' => '- ' . lang('No Category') . ' -');
     foreach ($items as $cate) {
         $fieldData->options[$cate[0]] = $cate[1];
     }
     return parent::input('inputSelect', $fieldKey, $fieldData, $view, false);
 }
Example #7
0
 private function __paypal()
 {
     $PAYPAL_ID = ORM::factory('setting', 'PAYPAL_ID');
     if (isset($_POST['PAYPAL_ID'])) {
         $PAYPAL_ID->value = $_POST['PAYPAL_ID'];
         $PAYPAL_ID->save();
     }
     $html = form::open();
     $html .= form::label('PAYPAL_ID', 'Change paypal account');
     $html .= form::input('PAYPAL_ID', $PAYPAL_ID->value, 'class="fullWidth"');
     $html .= form::submit('submit', 'Save', 'class="submit"') . '<p>&nbsp;</p><p>&nbsp;</p>';
     $html .= form::close();
     return $html;
 }
Example #8
0
 public function input($fieldKey, $fieldData)
 {
     if (!method_exists($this->CI, 'Category_Model')) {
         $this->CI->load->model('Category_Model');
     }
     $fieldData->cate_type = isset($fieldData->cate_type) ? $fieldData->cate_type : 'art';
     $items = $this->CI->Category_Model->load_items($fieldData->cate_type);
     // 		bug($items); exit;
     $fieldData->options = array('0' => '- ' . lang('No Category') . ' -');
     foreach ($items as $cate) {
         $fieldData->options[$cate[0]] = $cate[1];
     }
     return parent::input('inputSelect', $fieldKey, $fieldData);
 }
function parse_array($arr)
{
    foreach ($arr as $key => $value) {
        $db = DB::select()->from('categories')->where('id', '=', $key)->execute();
        echo '<ul><li>';
        echo '<b>Название:</b> ' . form::input('name[]', $db[0]['name'], array('onkeyup' => 'translit(\'name[]\', \'url[]\');')) . form::hidden('cid[]', $db[0]['id']) . '&nbsp;';
        echo '<b>URL:</b> ' . form::input('url[]', $db[0]['url']) . '&nbsp;';
        echo '<b>Удалить?</b> ' . form::checkbox('delete[]', $db[0]['id']);
        echo '</li>';
        if (is_array($value)) {
            parse_array($value);
        }
        echo '</ul>';
    }
}
Example #10
0
 protected function html_element()
 {
     // Import the data
     $data = $this->data;
     if (empty($data['checked'])) {
         // Not checked
         unset($data['checked']);
     } else {
         // Is checked
         $data['checked'] = 'checked';
     }
     if ($label = arr::remove('label', $data)) {
         // There must be one space before the text
         $label = ' ' . ltrim($label);
     }
     return '<label>' . form::input($data) . $label . '</label>';
 }
Example #11
0
		protected function _generate_body_cell($index, $key)
		{
			// variables
				$body	= $this->body_data;
				$value	= $body[$index][$key];
				$name	= $this->post_id . '[' .$body[$index][$this->data_id]. '][' .$key. ']';
				
			// data
				$type	= $this->default_type;
				$data	= NULL;
				if(array_key_exists($key, $this->control_types))
				{
					$type	= $this->control_types[$key][0];
					$data	= $this->control_types[$key][1];
				}
			
			// html
				$str	= '';
				switch($type)
				{
					case 'text':
						$str = form::input($name, $value);
						break;
						
					case 'dropdown':
						$str = form::dropdown($name, $data, $value);
						break;
						
					case 'radio':
					case 'checkbox':
						foreach($data as $d)
						{
							$str .= form::$type($name, $d, $value == $d, 'style="width:auto"') . ' ' . ucwords($d) . ' ';
							if($type == 'checkbox')
							{
								$str .= '<br />';
							}
						}
						break;
						
					default:
						$str = $value;
				}
				
				return '<td>' . $str . '</td>';
		}
Example #12
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 #13
0
 public function input($fieldKey, $fieldData)
 {
     $fieldData->options = array();
     foreach (self::$opt as $k => $alias) {
         $title = str_replace('-', ' & ', $alias);
         $title = str_replace('+', ' ', $title);
         $fieldData->options[$k] = ucwords($title);
     }
     //		$fieldData->options = array(
     //				1=>lang('Crocodile'),
     //				2=>lang('Stingray'),
     //				12=>lang('Crocodie & Stingray'),
     //				3=>lang('Snake'),
     //				23=>lang('Stingray & Snake'),
     //				4=>lang('Ostrich'),
     //				5=>lang('Buffalo'),
     //				6=>lang('Cow'),
     //		);
     return parent::input('inputSelect', $fieldKey, $fieldData);
 }
 public function login()
 {
     if ($this->a2->logged_in()) {
         //cannot create new accounts when a user is logged in
         return $this->index();
     }
     $post = Validation::factory($_POST)->pre_filter('trim')->add_rules('username', 'required', 'length[4,127]')->add_rules('password', 'required');
     if ($post->validate()) {
         if ($this->a1->login($post['username'], $post['password'])) {
             // login succesful
             url::redirect('a2demo/index');
         }
     }
     //show form
     echo form::open();
     echo 'username:'******'username') . '<br>';
     echo 'password:'******'password') . '<br>';
     echo form::submit(array('value' => 'login'));
     echo form::close();
 }
Example #15
0
File: a2demo.php Project: sars/rp
 public function action_login()
 {
     if ($this->user) {
         //cannot create new accounts when a user is logged in
         return $this->action_index();
     }
     $post = Validate::factory($_POST)->filter(TRUE, 'trim')->rule('username', 'not_empty')->rule('username', 'min_length', array(4))->rule('username', 'max_length', array(127))->rule('password', 'not_empty');
     if ($post->check()) {
         if ($this->a1->login($post['username'], $post['password'], isset($_POST['remember']) ? (bool) $_POST['remember'] : FALSE)) {
             $this->request->redirect('a2demo/index');
         }
     }
     //show form
     echo form::open();
     echo 'username:'******'username') . '<br>';
     echo 'password:'******'password') . '<br>';
     echo 'remember me:' . form::checkbox('remember', TRUE) . '<br>';
     echo form::submit('login', 'login');
     echo form::close();
     echo Kohana::debug($post->errors());
 }
Example #16
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 #17
0
echo form::input(array('id' => 'manual_entry_kill', 'value' => '', 'size' => '80', 'type' => 'hidden'));
?>
		<?php 
echo form::input(array('id' => 'manual_entry_park', 'value' => '', 'size' => '80', 'type' => 'hidden'));
?>
		<?php 
echo form::input(array('id' => 'manual_entry_xfer', 'value' => '', 'size' => '80', 'type' => 'hidden'));
?>
		<?php 
echo form::input(array('id' => 'manual_entry_hold', 'value' => '', 'size' => '80', 'type' => 'hidden'));
?>
		<?php 
echo form::input(array('id' => 'manual_entry_sound', 'value' => '', 'size' => '80', 'type' => 'hidden'));
?>
		<?php 
echo form::input(array('id' => 'manual_entry_record', 'value' => '', 'size' => '80', 'type' => 'hidden'));
?>
		
		<?php 
echo form::button(array('id' => 'manual_entry', 'param' => 'version', 'class' => 'switchboardEvent', 'value' => 'Send', 'style' => 'display:none'));
?>
				
		<?php 
echo form::button(array('id' => 'manual_kill', 'param' => 'version', 'class' => 'switchboardEvent', 'value' => '--Kill--'));
?>
		<?php 
echo form::button(array('id' => 'manual_park', 'param' => 'version', 'class' => 'switchboardEvent', 'value' => '--Park--'));
?>
		<?php 
echo form::button(array('id' => 'manual_hold', 'param' => 'version', 'class' => 'switchboardEvent', 'value' => '--Put On Hold--'));
?>
Example #18
0
?>
<?php 
defined('SYSPATH') or die('No direct access allowed.');
?>
<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');
?>
Example #19
0
								<?php 
print form::input('twitter_hashtags', $form['twitter_hashtags'], ' class="text"');
?>
							</div>
						</div>
						<div class="row">
							<h4><?php 
echo Kohana::lang('settings.site.api_akismet');
?>
</h4>
							<?php 
echo Kohana::lang('settings.site.kismet_notice');
?>
.
							<?php 
print form::input('api_akismet', $form['api_akismet'], ' class="text"');
?>
						</div>
					</div>
		
					<div class="simple_border"></div>
		
					<input type="image" src="<?php 
echo url::base();
?>
media/img/admin/btn-save-settings.gif" class="save-rep-btn" />
					<input type="image" src="<?php 
echo url::base();
?>
media/img/admin/btn-cancel.gif" class="cancel-btn" />
				</div>
Example #20
0
echo Kohana::lang('ui_main.last_name');
?>
</span>
										<?php 
print form::input('person_last', $form['person_last'], ' class="text"');
?>
									</label>
								</div>
								<div class="row">
									<label>
										<span><?php 
echo Kohana::lang('ui_main.email_address');
?>
</span>
										<?php 
print form::input('person_email', $form['person_email'], ' class="text"');
?>
									</label>
								</div>
							</div>
							<!-- f-col-bottom-1 -->
							<div class="f-col-bottom-1">
								<h4><?php 
echo Kohana::lang('ui_main.information_evaluation');
?>
</h4>
								<div class="row">
									<div class="f-col-bottom-1-col"><?php 
echo Kohana::lang('ui_main.approve_this_report');
?>
?</div>
Example #21
0
 public function view()
 {
     return form::input($this->name, $this->type, $this->value, true, NULL, $this->options);
     // (isset($this->options['selected'])) ? $this->options : NULL
 }
Example #22
0
						<div class="tab_form_item2">
							<strong>Organization Email:</strong><br />
							<?php 
print form::input('organization_email', $form['organization_email'], ' class="text long"');
?>
						</div>
						<div class="tab_form_item2">
							<strong>Organization Phone 1:</strong><br />
							<?php 
print form::input('organization_phone1', $form['organization_phone1'], ' class="text long"');
?>
						</div>
						<div class="tab_form_item2">
							<strong>Organization Phone 2:</strong><br />
							<?php 
print form::input('organization_phone2', $form['organization_phone2'], ' class="text long"');
?>
						</div>
						<div class="tab_form_item">
							&nbsp;<br />
							<input type="image" src="<?php 
echo url::base();
?>
media/img/admin/btn-save.gif" class="save-rep-btn" />
						</div>
						<?php 
print form::close();
?>
					</div>
				</div>
				
					<?php 
echo form::input("submit");
?>
				</div>
			</div>
		</div>
		<div class="col-md-6">
			<div class="row">
				<div class="col-md-12">
					<?php 
echo form::input("mail_html");
?>
				</div>
				<div class="col-md-12">
					<?php 
echo form::input("mail_text");
?>
				</div>
			</div>
		</div>
		<div class="col-md-2">
			<p>Usable subscriber fields in letter:<br>
				[id] - identity number<br>
				[name] - name<br>
				[email] - e-mail address<br>
				[link] - webpage or link<br>
				[category] - the category to subscribe for<br>
				[subscribe_date] - the date and time of subscribe<br>
				[unsubscribe] - the link of unsubscribe<br>
			</p>
		</div>
									<span class="sel-holder nofloat">
									<?php 
print form::dropdown('locale', $locale_array, $form['locale']);
?>
									</span>
								</div>						
							</div>
							<div class="row">
								<h4>Original Title</h4>
								<?php 
print form::input('orig_title', $orig_title, ' readonly="readonly" class="text title"');
?>
								<div class="translation">
									<h4>Translated Title</h4>
									<?php 
print form::input('incident_title', $form['incident_title'], ' class="text title nofloat"');
?>
									<div style="clear:both;"></div>
								</div>
							</div>
							<div class="row">
								<h4>Original Description <span>Please include as much detail as possible.</span></h4>
								<?php 
print form::textarea('orig_description', $orig_description, ' readonly="readonly" rows="12" cols="40" ');
?>
								<div class="translation">
									<h4>Translated Description</h4>
									<?php 
print form::textarea('incident_description', $form['incident_description'], ' rows="12" cols="40" class="nofloat"');
?>
									<div style="clear:both;"></div>
Example #25
0
?>
</option></select></span>
								<div class="location-info">
									<span><?php 
echo Kohana::lang('ui_main.latitude');
?>
:</span>
									<?php 
print form::input('default_lat', $form['default_lat'], ' readonly="readonly" class="text"');
?>
									<span><?php 
echo Kohana::lang('ui_main.longitude');
?>
:</span>
									<?php 
print form::input('default_lon', $form['default_lon'], ' readonly="readonly" class="text"');
?>
								</div>
							</div>
							<div style="clear:both;"></div>
							<h4><?php 
echo Kohana::lang('ui_main.preview');
?>
</h4>
							<p class="bold_desc"><?php 
echo Kohana::lang('settings.set_location');
?>
.</p>

							<div id="map_holder">
								<div id="map" class="mapstraction"></div>    
:</strong><br />
		<?php 
print form::textarea('comment_description', $form['comment_description'], ' rows="4" cols="40" class="textarea long" ');
?>
	</div>
	<div class="report_row">
		<strong><?php 
echo Kohana::lang('ui_main.security_code');
?>
:</strong><br />
		<?php 
print $captcha->render();
?>
<br />
		<?php 
print form::input('captcha', $form['captcha'], ' class="text"');
?>
	</div>
	<?php 
// Action::comments_form - Runs right before the end of the comment submit form
Event::run('ushahidi_action.comment_form');
?>
	<div class="report_row">
		<input name="submit" type="submit" value="<?php 
echo Kohana::lang('ui_main.reports_btn_submit');
?>
 <?php 
echo Kohana::lang('ui_main.comment');
?>
" class="btn_blue" />
	</div>
Example #27
0
        <div class="field">
        <?php 
echo form::label('ami_host', 'Manager Host:');
echo form::input('ami_host');
?>
        </div>

        <div class="field">
        <?php 
echo form::label('ami_port', 'Manager Port:');
echo form::input('ami_port');
?>
        </div>

        <div class="field">
        <?php 
echo form::label('ami_user', 'Manager Username:'******'ami_user');
?>
        </div>

        <div class="field">
        <?php 
echo form::label('ami_pass', 'Manager Password:'******'ami_pass');
?>
        </div>

    <?php 
echo form::close_section();
Example #28
0
')">+<?php 
                echo Kohana::lang('ui_main.request_location');
                ?>
</a>&nbsp;&nbsp;&nbsp;<a href="javascript:cannedReply('2', 'message_<?php 
                echo $message_id;
                ?>
')">+<?php 
                echo Kohana::lang('ui_main.request_information');
                ?>
</a></div>
														<div id="replyerror_<?php 
                echo $message_id;
                ?>
" class="reply_error"></div>
														<div class="reply_input"><?php 
                print form::input('message_' . $message_id, '', ' class="text long2" onkeyup="limitChars(this.id, \'160\', \'replyleft_' . $message_id . '\')" ');
                ?>
</div>
														<div class="reply_input"><a href="javascript:sendMessage('<?php 
                echo $message_id;
                ?>
' , 'sending_<?php 
                echo $message_id;
                ?>
')" title="Submit Message"><img src="<?php 
                echo url::base();
                ?>
media/img/admin/btn-send.gif" alt="Submit" border="0" /></a></div>
														<div class="reply_input" id="sending_<?php 
                echo $message_id;
                ?>
Example #29
0
		For other payment options, please <?php 
echo HTML::mailto('*****@*****.**', 'email me');
?>
.</h1>

	<?php 
echo form::open(NULL);
?>

		<?php 
include Kohana::find_file('views', 'template/errors');
?>

		<p>I would like to pay
			$<?php 
echo form::input('amount', $post['amount']);
?>
 on invoice
			#<?php 
echo Form::input('invoice', $post['invoice']);
?>
 using:</p>

		<ul class="gateway">
			<li><label><?php 
echo Form::radio('gateway', 'paypal', $post['gateway'] === 'paypal');
?>
 <?php 
echo HTML::image('https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif', array('alt' => 'PayPal'));
?>
</label></li>
Example #30
0
:</strong><br/><small><?php 
echo Kohana::lang('ui_main.identify_you');
?>
</small><br />
						<?php 
print form::input('name', $form['name'], 'class="login_text new_name"');
?>
</td>
					</tr>
					<tr>
						<td><strong><?php 
echo Kohana::lang('ui_main.email');
?>
:</strong><br />
						<?php 
print form::input('email', $form['email'], 'class="login_text new_email"');
?>
</td>
					</tr>
					<tr class="riverid_email_already_set" style="display:none;">
						<td class="riverid_email_already_set_copy"></td>
					</tr>
					<tr>
						<td><strong><?php 
echo Kohana::lang('ui_main.password');
?>
:</strong><br />
						<?php 
print form::password('password', $form['password'], 'class="login_text new_password"');
?>
</td>