public function label($name) { $field = $this->_meta->fields($name); if ($field) { return form::label('field-' . $name, $field->label); } return ucfirst($name); }
private function buildForm() { $options = array('method' => "POST", 'enctype' => "multipart/form-data", 'action' => '/blog/formular/add', 'width' => '400px'); $form = new \form('testing', $options); $form->label('checkbox'); $form->checkbox('checkbox test', 'testcheckbox', 'check', ''); $form->checkbox('checkbox test2', 'testcheckbox', 'check2', true); $form->label('radio'); $form->radio('radio test', 'testradio', 'radio', ''); $form->radio('radio test 2', 'testradio', 'radio2', true); $form->label('textarea'); $form->text('textarea', ' ', ['error' => $this->error['textarea']]); $form->select('autos', ['a' => 'audi', 'b' => 'vw', 'c' => 'toyota'], 'b', ['label' => 'auto select']); $form->text('username', '', ['placeholder' => 'username', 'label' => 'Username', 'error' => $this->error['username']]); $form->password('password', '', ['label' => 'Password', 'error' => $this->error['password']]); $form->button('senden', ['type' => 'submit']); return $form; }
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); }
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; }
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; }
<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', ' '); 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>
$html .= "<tr>"; } $html .= "<td>"; $set_default = FALSE; if (!empty($multi_defaults)) { foreach ($multi_defaults as $key => $def) { $set_default = trim($option) == trim($def); if ($set_default) { break; } } } $option = trim($option); $html .= "<span class=\"custom-field-option\">"; $html .= form::checkbox("custom_field[" . $field_id . '-' . $cnt . ']', $option, $set_default, $id_name); $html .= form::label("custom_field[" . $field_id . ']', " " . $option); $html .= "</span>"; $html .= "</td>"; if ($cnt % 2 == 1 or $cnt == count($options) - 1) { $html .= "</tr>"; } $cnt++; } // XXX Hack to deal with required checkboxes that are submitted with nothing checked $html .= "</table>"; $html .= form::hidden("custom_field[" . $field_id . "-BLANKHACK]", '', $id_name); break; case 7: $ddoptions = array(); // Semi-hack to deal with dropdown boxes receiving a range like 0-100 if (preg_match("/[0-9]+-[0-9]+/", $defaults[0]) and count($options == 1)) {
/** * Sets or returns the input label. * * @chainable * @param string label to set * @return string|object */ public function label($val = NULL) { if ($val === NULL) { if (isset($this->data['name']) and isset($this->data['label'])) { return form::label($this->data['name'], $this->data['label']); } return FALSE; } else { $this->data['label'] = $val === TRUE ? utf8::ucwords(inflector::humanize($this->name)) : $val; return $this; } }
?> " alt="<?php Kohana::lang('settings.site.banner'); ?> " /><br/> <?php } ?> <?php echo form::upload('banner_image', '', ''); ?> (<= 250k) <br/> <?php echo form::checkbox('delete_banner_image', '1'); echo form::label('delete_banner_image', Kohana::lang("settings.site.delete_banner_image")); ?> </div> <div class="row"> <h4><a href="#" class="tooltip" title="<?php echo Kohana::lang("tooltips.settings_site_email"); ?> "><?php echo Kohana::lang('settings.site.email_site'); ?> </a> <br /><?php echo Kohana::lang('settings.site.email_notice'); ?> </h4> <?php
/** * Demonstrates how to use the form helper with the Validation libraryfor file uploads . */ function form() { // Anything submitted? if ($_POST) { // Merge the globals into our validation object. $post = Validation::factory(array_merge($_POST, $_FILES)); // Ensure upload helper is correctly configured, config/upload.php contains default entries. // Uploads can be required or optional, but should be valid $post->add_rules('imageup1', 'upload::required', 'upload::valid', 'upload::type[gif,jpg,png]', 'upload::size[1M]'); $post->add_rules('imageup2', 'upload::required', 'upload::valid', 'upload::type[gif,jpg,png]', 'upload::size[1M]'); // Alternative syntax for multiple file upload validation rules //$post->add_rules('imageup.*', 'upload::required', 'upload::valid', 'upload::type[gif,jpg,png]', 'upload::size[1M]'); if ($post->validate()) { // It worked! // Move (and rename) the files from php upload folder to configured application folder upload::save('imageup1'); upload::save('imageup2'); echo 'Validation successfull, check your upload folder!'; } else { // You got validation errors echo '<p>validation errors: ' . var_export($post->errors(), TRUE) . '</p>'; echo Kohana::debug($post); } } // Display the form echo form::open('examples/form', array('enctype' => 'multipart/form-data')); echo form::label('imageup', 'Image Uploads') . ':<br/>'; // Use discrete upload fields // Alternative syntax for multiple file uploads // echo form::upload('imageup[]').'<br/>'; echo form::upload('imageup1') . '<br/>'; echo form::upload('imageup2') . '<br/>'; echo form::submit('upload', 'Upload!'); echo form::close(); }
?> <?php echo empty($title->error) ? form::input($title->name, $title->value) : form::input($title->name, $title->value, 'class="error"'); ?> <?php if (!empty($title->error)) { ?> <br /><span class="error"><?php echo $title->error; ?> </span><?php } ?> </p> <p><?php echo form::label($blog_content->name, $blog_content->label) . form::textarea($blog_content->name, $blog_content->value); ?> </p> <p><?php echo form::label($tags->name, $tags->label) . form::input($tags->name, $tags->value); ?> </p> </div> </div> <p><?php echo form::submit($submit->name, $submit->label); ?> </p> <?php echo form::close();
<div class="form-fields"> <?php echo form::label('shipping[state]', 'State'); ?> <?php echo form::input('shipping[state]'); ?> </div> <div class="form-fields"> <?php echo form::label('shipping[postal_code]', 'Zip/Postal Code'); ?> <?php echo form::input('shipping[postal_code]'); ?> </div> <div class="form-fields"> <?php echo form::label('shipping[country]', 'Country'); ?> <?php echo form::input('shipping[country]'); ?> </div> </fieldset> <div class="clear"></div> <?php echo form::submit('submit_billing', 'Continue to Order Review'); echo form::close();
echo form::dropdown('vendor_id', ORM::factory('vendor')->select_list('id', 'name'), $product->vendor); ?> </div> <div class="form-fields" id="categories"> <?php echo form::label('categories', 'Categories'); ?> <?php echo form::many_to_many($product, ORM::factory('category')->find_all(), 'categories', 'name', 'table'); ?> </div> <div class="form-fields"> <?php echo form::label('options', 'Options'); ?> <?php echo form::many_to_many($product, ORM::factory('option')->find_all(), 'options'); ?> </div> <div class="form-fields"> <h5>Product Images</h5> <div id="admin-product-image"> <?php foreach ($product->images as $image) { ?> <?php echo html::image($image->thumburl); ?>
?> <?php echo form::input_wrap(array('name' => 'name', 'maxlength' => 100), $values, '', __('Name'), $errors); ?> <?php echo form::input_wrap(array('name' => 'homepage', 'maxlength' => 100, 'title' => 'http://'), $values, '', __('Homepage'), $errors); ?> <li class="horizontal"> <?php echo form::checkbox('event_host', '1', !empty($values['event_host'])); ?> <?php echo form::label('event_host', __('Event host')); ?> </li> </ul> </fieldset> <fieldset> <legend><?php echo __('Contact information'); ?> </legend> <ul> <?php echo form::input_wrap(array('name' => 'address', 'maxlength' => 50), $values, '', __('Address'), $errors);
<span><?php echo Kohana::lang('endtime.applicable_description'); ?> </span></div> </h4> <!--<div style = "border: 1px solid black; margin-left:10px;">--> <div id="endtime_form" style="margin-left:30px; <?php echo $applicable == "1" ? "" : "display:none;"; ?> " > <?php print form::label('remain_on_map', Kohana::lang('decayimage.remain_on_map')); print form::radio('remain_on_map', 0, $remain_on_map == 0) . "<br />\n"; print form::label('remain_on_map', Kohana::lang('decayimage.decay_from_map')); print form::radio('remain_on_map', 2, $remain_on_map == 2) . "<br />\n"; print form::label('remain_on_map', Kohana::lang('decayimage.remove_from_map')); print form::radio('remain_on_map', 1, $remain_on_map == 1) . "<br />\n"; ?> <?php print form::input('end_incident_date', $form['end_incident_date'], ' class="text"'); ?> <?php print $date_picker_js; ?> <br/> <br/> <div class="time"> <?php
</div> <div id="choose-inventory-options-<?php echo $index; ?> " <?php if (!$variant->track_stock) { ?> class="hide"<?php } ?> > <div class="form-fields"> <?php echo form::label('variant[' . $index . '][track]', 'How many in Stock?'); ?> <?php echo form::input('variant[' . $index . '][stock]', $variant->stock); ?> </div> <div class="form-fields"> <?php echo form::label('variant[' . $index . '][track]', 'Out of Inventory'); ?> <?php echo form::dropdown('variant[' . $index . '][allow_out_of_stock_purchases]', array(true => 'Allow Purchases', false => 'Do not Allow Purchases'), $variant->allow_out_of_stock_purchases); ?> </div> </div> </div>
<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();
<?php if (isset($activefeaturecode['exten'])) { $selectedClass = numbering::getAssignedPoolByNumber($activefeaturecode['exten']); } else { $selectedClass = NULL; } echo numbering::poolsDropdown(array('name' => 'activefeaturecode_class_type', 'forDependent' => TRUE), $selectedClass); echo " named "; echo numbering::numbersDropdown(array('id' => 'activefeaturecode_inbound', 'name' => 'activefeaturecode[exten]', 'useNames' => TRUE, 'optGroups' => FALSE, 'forDependent' => TRUE), isset($activefeaturecode['exten']) ? $activefeaturecode['exten'] : NULL); jquery::addQuery('#activefeaturecode_inbound')->dependent('{ parent: \'activefeaturecode_class_type\', group: \'common_class\' }'); ?> </div> <div class="field"> <?php echo form::label('activefeaturecode[leg]', 'Allow feature code from: '); echo form::dropdown('activefeaturecode[leg]', array('b' => 'Callee', 'a' => 'Caller')); ?> </div> </div> <script type="text/javascript"> $(function() { <?php if (!arr::get($activefeaturecode, 'type') || arr::get($activefeaturecode, 'type') == '0') { echo "\$('#active_feature_code_options').hide();"; } ?> $('#activefeaturecode_type').change(function() {
?> <?php echo form::open_section('Location Information'); ?> <div class="field"> <?php echo form::label('location[name]', 'Location Name:'); echo form::input('location[name]'); ?> </div> <div class="field"> <?php echo form::label('location[domain]', 'Domain Name/Realm:'); echo form::input('location[domain]'); ?> </div> <?php echo form::close_section(); ?> <?php if (isset($views)) { echo subview::renderAsSections($views); } ?> <?php
echo form::open('sessions/authenticate'); ?> <fieldset> <legend>Login</legend> <div class="formFields"> <?php echo form::label('username', 'Username'); ?> <?php echo form::input('username'); ?> </div> <div class="formFields"> <?php echo form::label('password', 'Password'); ?> <?php echo form::password('password'); ?> </div> <div class="formFields"> <?php echo form::submit('submit', 'Login'); ?> </div> </fieldset> <?php echo form::close();
<?php echo form::open_section('Welcome Mail'); ?> <div class="field"> <?php echo form::label(array('for' => 'welcomemail[flag]'), 'Send welcome email'); echo form::checkbox(array('class' => 'determinant agent_for_welcomemail', 'name' => 'welcomemail[flag]')); ?> </div> <div class="field"> <?php echo form::label(array('for' => 'welcomemail[address]'), 'Email address'); echo form::input(array('class' => 'dependent_positive rely_on_welcomemail', 'name' => 'welcomemail[emailaddress]')); ?> </div> <?php echo form::close_section();
<th colspan="2"> Add new role </th> </thead> <tr> <td><?php echo form::label('name', 'Role name:'); ?> </td> <td><?php echo form::input('name', empty($_POST['name']) ? '' : $_POST['name'], array('id' => 'name')); ?> </tr> <tr> <td><?php echo form::label('description', 'Description:'); ?> </td> <td><?php echo form::input('description', empty($_POST['description']) ? '' : $_POST['description'], array('id' => 'description')); ?> </tr> <tr> <td colspan="2" align="center"> <?php echo form::submit('submit', 'Add Role'); ?> </td> </tr> </table> <?php
<strong><?php echo Kohana::lang('ui_main.description'); ?> :</strong><br /> <?php print form::input('description', '', ' class="text long"'); ?> </div> <div style="clear:both;"></div> <div class="tab_form_item"> <?php $i = 0; foreach ($permissions as $permission => $permission_desc) { echo "<div style=\"width:200px;float:left;margin-bottom:3px;\">"; echo form::checkbox($permission, '1'); echo form::label($permission, $permission_desc); echo " "; echo "</div>"; $i++; } ?> </div> <div style="clear:both;"></div> <div class="tab_form_item"> <br /> <input type="image" src="<?php echo url::base(); ?> media/img/admin/btn-save-settings.gif" class="save-rep-btn" /> </div> <?php
?> </td> </tr> <tr> <td><?php echo form::label('ngay_sinh', 'Ngày sinh:'); ?> </td> <td><?php echo form::input('ngay_sinh', empty($_POST['ngay_sinh']) ? date("d-m-Y", strtotime($people['ngay_sinh'])) : $_POST['ngay_sinh'], $attributes = array('id' => 'ngay_sinh')); ?> </td> </tr> <tr> <td><?php echo form::label('mieu_ta', 'Miêu tả:'); ?> </td> <td><?php echo form::textarea('mieu_ta', empty($_POST['mieu_ta']) ? $people['mieu_ta'] : $_POST['mieu_ta'], array('id' => 'mieu_ta', 'class' => 'editor')); ?> </td> </tr> <?php if (isset($errors)) { print_r($errors); ?> <tr> <td colspan="3"> <ul class="error">
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();
<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>
<?php print $new_category_toggle_js; ?> <!--category_add form goes here--> <div id="category_add" class="category_add"> <?php print '<p>' . Kohana::lang('ui_main.add_new_category') . '<hr/></p>'; print form::label(array("id" => "category_name_label", "for" => "category_name"), Kohana::lang('ui_main.name')); print '<br/>'; print form::input('category_name', $new_categories_form['category_name'], 'class=""'); print '<br/>'; print form::label(array("id" => "description_label", "for" => "description"), Kohana::lang('ui_main.description')); print '<br/>'; print form::input('category_description', $new_categories_form['category_description'], 'class=""'); print '<br/>'; print form::label(array("id" => "color_label", "for" => "color"), Kohana::lang('ui_main.color')); print '<br/>'; print form::input('category_color', $new_categories_form['category_color'], 'class=""'); print $color_picker_js; print '<br/>'; print '<span>'; print '<a href="#" id="add_new_category">' . Kohana::lang('ui_main.add') . '</a>'; print '</span>'; ?> </div> <div class="report_category"> <?php $selected_categories = array(); if (!empty($form['incident_category']) && is_array($form['incident_category'])) {
<?php echo form::close_section(); ?> <?php echo form::open_section('Default Settings'); ?> <div class="field"> <?php echo form::label('simpleroute[caller_id_name]', 'Caller ID Name:'); echo form::input('simpleroute[caller_id_name]'); ?> </div> <div class="field"> <?php echo form::label('simpleroute[caller_id_number]', 'Caller ID Number:'); echo form::input('simpleroute[caller_id_number]'); ?> </div> <div class="field"> <?php echo form::label(array('for' => 'simpleroute[continue_on_fail]', 'hint' => 'If this route fails progress to the next'), 'Continue on fail:'); echo form::checkbox('simpleroute[continue_on_fail]'); ?> </div> <?php echo form::close_section();
<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();
</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> </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();