本文整理汇总了PHP中form::input方法的典型用法代码示例。如果您正苦于以下问题:PHP form::input方法的具体用法?PHP form::input怎么用?PHP form::input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类form
的用法示例。
在下文中一共展示了form::input方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: html_element
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;
}
示例2: __toString
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 . '"');
}
示例3: input
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');
}
}
示例4: __form
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;
}
示例5: input
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');
}
示例6: input
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);
}
示例7: __paypal
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> </p><p> </p>';
$html .= form::close();
return $html;
}
示例8: input
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);
}
示例9: parse_array
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']) . ' ';
echo '<b>URL:</b> ' . form::input('url[]', $db[0]['url']) . ' ';
echo '<b>Удалить?</b> ' . form::checkbox('delete[]', $db[0]['id']);
echo '</li>';
if (is_array($value)) {
parse_array($value);
}
echo '</ul>';
}
}
示例10: html_element
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>';
}
示例11: _generate_body_cell
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>';
}
示例12: _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;
}
示例13: input
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);
}
示例14: login
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:' . form::input('username') . '<br>';
echo 'password:' . form::password('password') . '<br>';
echo form::submit(array('value' => 'login'));
echo form::close();
}
示例15: action_login
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:' . form::input('username') . '<br>';
echo 'password:' . form::password('password') . '<br>';
echo 'remember me:' . form::checkbox('remember', TRUE) . '<br>';
echo form::submit('login', 'login');
echo form::close();
echo Kohana::debug($post->errors());
}