public static function displayForm($value, &$settings, $model) { $settings = static::settings($settings); if (!is_array($value)) { $value = array(); } // Search input or $searchInput = \Form::input($settings['mapping']['fieldName'] . '[search]', null, array('class' => 'input input-xxlarge search-input', 'placeholder' => \Lang::get('admin.common.map_search_placeholder'))); $searchButton = \Form::button('mapsearch', \Lang::get('admin.verbs.search'), array('class' => 'btn btn-primary')); $searchInput = html_tag('div', array('class' => 'form form-inline search-form'), $searchInput . $searchButton); // Hidden inputs $latInput = \Form::hidden($settings['mapping']['fieldName'] . '[lat]', \Arr::get($value, 'lat'), array('class' => 'lat')); $lngInput = \Form::hidden($settings['mapping']['fieldName'] . '[lng]', \Arr::get($value, 'lng'), array('class' => 'lng')); $zoomInput = \Form::hidden($settings['mapping']['fieldName'] . '[zoom]', \Arr::get($value, 'zoom'), array('class' => 'zoom')); // Other elements $required = isset($settings['required']) ? $settings['required'] : false; $label_text = $settings['title'] . ($required ? ' *' : ''); $label = \Form::label($label_text); $mapDiv = html_tag('div', array('class' => 'map', 'id' => \Inflector::friendly_title($settings['mapping']['fieldName'], '-', true) . '-bing-map'), ' '); // Check that we have an API key if (empty($settings['api_key'])) { $content = $label . '<div class="well"><p>' . \Lang::get('admin.bing.api_key_not_set') . '</p></div>'; } else { $content = $label . $searchInput . $latInput . $lngInput . $zoomInput . $mapDiv; } $content = html_tag('div', array('class' => 'controls control-group field-type-bing-map', 'data-field-name' => $settings['mapping']['fieldName']), $content); return array('content' => $content, 'js_data' => $settings); }
function do_private_post($content, $results) { global $config, $speak; $results = Mecha::O($results); $results = $config->is->post ? Get::postHeader($results->path, POST . DS . $config->page_type, '/', $config->page_type . ':') : false; if ($results === false) { return $speak->plugin_private_post->description; } $s = isset($results->fields->pass) ? $results->fields->pass : ""; if (strpos($s, ':') !== false) { $s = explode(':', $s, 2); if (isset($s[1])) { $speak->plugin_private_post->hint = ltrim($s[1]); } // override password hint $s = $s[0]; } $hash = md5($s . PRIVATE_POST_SALT); $html = Notify::read(false) . '<div class="overlay--' . File::B(__DIR__) . '"></div><form class="form--' . File::B(__DIR__) . '" action="' . $config->url . '/' . File::B(__DIR__) . '/do:access" method="post">' . NL; $html .= TAB . Form::hidden('token', Guardian::token()) . NL; $html .= TAB . Form::hidden('_', $hash) . NL; $html .= TAB . Form::hidden('kick', $config->url_current) . NL; $html .= TAB . '<p>' . $speak->plugin_private_post->hint . '</p>' . NL; $html .= TAB . '<p>' . Form::text('access', "", $speak->password . '…', array('autocomplete' => 'off')) . ' ' . Form::button($speak->submit, null, 'submit') . '</p>' . NL; $html .= '</form>' . O_END; if ($results && isset($results->fields->pass) && trim($results->fields->pass) !== "") { if (!Guardian::happy() && Session::get('is_allow_post_access') !== $hash) { return $html; } } return $content; }
public function process($only_fields = FALSE) { if (empty($this->_fields_required['pos_id']) && empty($this->_fields_required['pos_auth_key'])) { $this->_set_active_pos(); } foreach ($this->_fields_required as $field) { if (empty($field)) { return FALSE; } } $this->_fields['ts'] = time(); $fields = array_merge($this->_fields_required, $this->_fields); $data = array('pos_id' => $fields['pos_id'], 'pay_type' => $fields['pay_type'], 'session_id' => $fields['session_id'], 'pos_auth_key' => $fields['pos_auth_key'], 'amount' => $fields['amount'], 'desc' => $fields['desc'], 'desc2' => $fields['desc2'], 'order_id' => $fields['order_id'], 'first_name' => $fields['first_name'], 'last_name' => $fields['last_name'], 'payback_login' => $fields['payback_login'], 'street' => $fields['street'], 'street_hn' => $fields['street_hn'], 'street_an' => $fields['street_an'], 'city' => $fields['city'], 'post_code' => $fields['post_code'], 'country' => $fields['country'], 'email' => $fields['email'], 'phone' => $fields['phone'], 'language' => $fields['language'], 'client_ip' => $fields['client_ip'], 'ts' => $fields['ts'], 'key' => $this->_pos_data['key']); $fields['sig'] = $this->_get_sig($data); unset($fields['key']); if (!$only_fields) { $form = Form::open(self::PAYMENT_URL . $this->_codepage . '/' . self::PAYMENT_NEW, array('method' => 'post', 'name' => 'platnoscipl')); } foreach ($fields as $key => $value) { if (!empty($value)) { $form .= Form::hidden($key, $value); } } if (!$only_fields) { $form .= Form::button('platnosci', __("Przejdź do Płatności.pl"), array('type' => 'submit')); $form .= Form::close(); $form .= '<script type="text/javascript">document.platnoscipl.submit();</script>'; } return $form; }
/** * @covers Form::hidden */ public function testHidden() { $hidden = $this->myForm->hidden('find out'); $this->assertInstanceOf('Hidden', $hidden); $this->assertEquals('find out', $hidden->getName()); $this->assertSame($this->myForm, $hidden->getForm()); }
/** * Create simple HTML form using paypal documentation * @return string */ public function createForm() { // Form to submit to PayPal // https://www.x.com/developers/paypal/documentation-tools/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables $form = '<form action="' . $this->paymentConnfigData['url'] . '" method="post" id="payment_form" target="_parent">'; // Technical HTML Variables // $form .= \Form::hidden('cmd', '_cart'); $form .= \Form::hidden('cmd', '_xclick'); $form .= \Form::hidden('notify_url', $this->paymentConnfigData['notify_url']); // HTML Variables for Payment Transactions $form .= \Form::hidden('invoice', $this->order->id); $form .= \Form::hidden('currency_code', 'AUD'); // HTML Variables for Shopping Carts $form .= \Form::hidden('business', $this->paymentConnfigData['business']); //$form .= \Form::hidden('upload', '1'); // foreach ($this->order->products as $key => $product) // { // $form .= \Form::hidden('item_name_' . ($key+1), $product->product_name); // //$form .= \Form::hidden('item_number_' . $key, $product->id); // $form .= \Form::hidden('amount_' . ($key+1), $product->price); // $form .= \Form::hidden('quantity_' . ($key+1), $product->qty); // // } $form .= \Form::hidden('amount', $this->order->total_price + $this->order->shipping_price); //$form .= \Form::hidden('handling_cart', ); $form .= \Form::hidden('first_name', $this->order->billing_first_name); $form .= \Form::hidden('last_name', $this->order->billing_last_name); // HTML Variables for Displaying PayPal Checkout Pages $form .= \Form::hidden('lc', 'AU'); $form .= \Form::hidden('return', $this->paymentConnfigData['return']); $form .= \Form::hidden('rm', 2); $form .= '</form>'; return $form; }
public function process($only_fields = FALSE) { $this->_fields_required['id'] = $this->_pos_data['id']; if (empty($this->_fields['URL'])) { $this->_fields['URL'] = url::site($this->action_return()); } foreach ($this->_fields_required as $field) { if (empty($field)) { return FALSE; } } $fields = array_merge($this->_fields_required, $this->_fields); $form = ''; if (!$only_fields) { $form .= Form::open(self::PAYMENT_URL, array('method' => 'post', 'name' => 'dotpay')); } foreach ($fields as $key => $value) { if (!empty($value)) { $form .= Form::hidden($key, $value); } } if (!$only_fields) { $form .= Form::button('platnosci', __("Przejdź do Dotpay.pl"), array('type' => 'submit')); $form .= Form::close(); $form .= '<script type="text/javascript">document.dotpay.submit();</script>'; } return $form; }
public function view() { // Group's inputs. $name_group_inputs = [View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('name', $this->requested_aircraft->name, ['class' => 'form-control', 'type' => 'text']), 'label' => 'A/C Name'], false)]; $general_group_1_inputs = [View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('basic_empty_weight', $this->requested_aircraft->basic_empty_weight, ['class' => 'form-control', 'type' => 'number']) . "kg", 'label' => 'Basic Empty Weight'], false), View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('cg_position', $this->requested_aircraft->cg_position, ['class' => 'form-control', 'type' => 'number']) . "aft of datum", 'label' => 'C of G Position'], false)]; $description_group_inputs = [View::forge('form/group/input', ['label_coltype' => 'col-xs-12', 'input_coltype' => 'col-xs-12', 'input' => Form::textarea('description', $this->requested_aircraft->description, ['class' => 'form-control']), 'label' => 'Description', 'label_left' => true], false)]; $weight_limits_group_1_inputs = [View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('max_ramp_weight', $this->requested_aircraft->max_ramp_weight, ['class' => 'form-control', 'type' => 'text']), 'label' => 'Max Ramp Weight'], false), View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('mctow', $this->requested_aircraft->mctow, ['class' => 'form-control', 'type' => 'text']), 'label' => 'MCTOW'], false)]; $weight_limits_group_2_inputs = [View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('mlw', $this->requested_aircraft->mlw, ['class' => 'form-control', 'type' => 'text']), 'label' => 'MLW'], false), View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('mzfw', $this->requested_aircraft->mzfw, ['class' => 'form-control', 'type' => 'text']), 'label' => 'MZFW'], false)]; $arms_table_template = View::forge('widgets/tablewithactions/template', ['duplicate_action' => false, 'cells' => [View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_name', '', ['class' => 'form-control'])], false), View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_position', '', ['class' => 'form-control'])], false), View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_value', '', ['class' => 'form-control']) . Form::hidden('_type', 'arm')], false)]]); $arms_table = View::forge('widgets/tablewithactions', ['template_row' => $arms_table_template, 'name' => '_arms', 'coltype' => 'col-xs-12 col-md-6', 'headings' => ['<th>Label</th>', '<th>Arm (aft of datum)</th>', '<th>Max Weight</th>'], 'rows' => $this->arms_table_rows], false); $cglimits_table_template = View::forge('widgets/tablewithactions/template', ['duplicate_action' => false, 'cells' => [View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_position', '', ['class' => 'form-control'])], false), View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_value', '', ['class' => 'form-control']) . Form::hidden('_type', 'maxweight') . Form::hidden('_name', 'limit')], false)]]); $cglimits_table = View::forge('widgets/tablewithactions', ['template_row' => $cglimits_table_template, 'name' => '_arms', 'coltype' => 'col-xs-6', 'headings' => ['<th>Arm (aft of datum)</th>', '<th>Weight Limit</th>'], 'rows' => $this->cglimits_table_rows], false); $button_group_1_inputs = [Asset::js('tablewithactions.js', false), View::forge('form/button', ['coltype' => 'col-xs-offset-5 col-xs-2', 'link' => 'submit/aircraft/' . $this->id, 'response_target' => './aircraft_form', 'class' => 'form-control btn-success', 'label' => 'Save Changes'], false)]; // Headings $general_heading = View::forge('form/heading', ['text' => 'General', 'size' => 4], false); $weight_limits_heading = View::forge('form/heading', ['text' => 'Weight Limits', 'size' => 4], false); $arms_heading = View::forge('form/heading', ['text' => 'Arms', 'size' => 4], false); $cg_limits_heading = View::forge('form/heading', ['text' => 'C of G Limits', 'size' => 4], false); // Groups $name_group = View::forge('form/group', ['inputs' => $name_group_inputs], false); $general_group_1 = View::forge('form/group', ['inputs' => $general_group_1_inputs], false); $description_group = View::forge('form/group', ['inputs' => $description_group_inputs], false); $weight_limits_group_1 = View::forge('form/group', ['inputs' => $weight_limits_group_1_inputs]); $weight_limits_group_2 = View::forge('form/group', ['inputs' => $weight_limits_group_2_inputs]); $buttons_group = View::forge('form/group', ['inputs' => $button_group_1_inputs], false); $cg_limits_group = View::forge('form/group', ['inputs' => ['<div class="col-xs-6">' . $cglimits_table . '</div>' . '<div class="col-xs-6">' . 'Graph here' . '</div>']], false); $weightandbalance_section_data = ['heading' => 'Weight and Balance Data', 'unique_id' => Str::random('uuid'), 'groups' => [$general_heading, $name_group, $general_group_1, $description_group, $weight_limits_heading, $weight_limits_group_1, $weight_limits_group_2, $arms_heading, $arms_table, $cg_limits_heading, $cg_limits_group, $buttons_group]]; $weightandbalance_section = View::forge('form/section', $weightandbalance_section_data, false); $this->aircraft_form = $weightandbalance_section; }
/** * Event select form. * * @return string */ public function event() { ob_start(); // Event search date range if ($this->flyer->stamp_begin) { $year = Arr::get(getdate($this->flyer->stamp_begin), 'year'); $event_options = array('filter' => 'date:' . mktime(0, 0, 0, 1, 1, $year) . '-' . mktime(0, 0, 0, 1, 1, $year + 1)); } else { $event_options = null; } // Form echo Form::open(null, array('id' => 'form-flyer-edit-event')); echo Form::input_wrap('event', null, array('id' => 'field-known-event', 'title' => __('Existing event'), 'placeholder' => __('Add to an existing event'))); echo Form::submit('save', __('Save'), array('class' => 'btn btn-default')); echo Form::hidden('event_id', $this->flyer->event_id); echo Form::csrf(); echo Form::close(); ?> <script> head.ready('anqh', function() { $('#field-known-event').autocompleteEvent(<?php echo json_encode($event_options); ?> ); }); </script> <?php return ob_get_clean(); }
/** * Form Component */ public static function formComponent() { $_templates = Themes::getTemplates(); foreach ($_templates as $template) { $templates[basename($template, '.template.php')] = basename($template, '.template.php'); } echo '<div class="col-xs-3">' . Form::open() . Form::hidden('csrf', Security::token()) . Form::label('sandbox_form_template', __('Sandbox template', 'sandbox')) . Form::select('sandbox_form_template', $templates, Option::get('sandbox_template'), array('class' => 'form-control')) . Html::br() . Form::submit('sandbox_component_save', __('Save', 'sandbox'), array('class' => 'btn btn-default')) . Form::close() . '</div>'; }
/** * @access private * @param array $array * @return array */ protected function setHiddenVars(array $array) { $attributes = []; if (count($array)) { foreach ($array as $key => $value) { $attributes[] = \Form::hidden($key, $value); } } return implode("\n", $attributes); }
/** * Creates a radio form input. * @param string $name * @param null $value * @param bool $checked * @param array $attributes * @return string */ public static function radio($name, $value = null, $checked = false, array $attributes = null) { if (isset($attributes['uncheck'])) { // Add a hidden field so that if the radio button is not selected, it still submits a value $hidden = Form::hidden($name, $attributes['uncheck']); unset($attributes['uncheck']); } else { $hidden = ''; } return $hidden . parent::radio($name, $value, $checked, $attributes); }
/** * @param array $params * @param Smarty_Internal_Template $smarty * * @throws SmartyException * @return string * * @author Kovács Vince */ function smarty_function_form_hidden($params, Smarty_Internal_Template &$smarty) { if (!isset($params['_name'])) { throw new SmartyException('Missing _name attribute for form_hidden tag'); } $name = $params['_name']; $value = isset($params['_value']) ? $params['_value'] : (isset($params['_populate']) && $params['_populate'] ? \Input::get($name) : null); unset($params['_name']); unset($params['_value']); return Form::hidden($name, $value, $params); }
public function input($name, $attributes = NULL) { $input = Facebook_Stream::$input_prefix . $name . Facebook_Stream::$input_suffix; if ($name == 'attachment') { return $this->_attachment->inputs($attributes); } if ($this->_inputs[$name]['hidden']) { return Form::hidden($input, $this->_stream[$name], $attributes); } return Form::input($input, $this->_stream[$name], $attributes); }
protected function buildHiddenFields() { if (count($this->hiddenFields) < 1) { return ''; } $hidden = ['']; foreach ($this->hiddenFields as $fieldName => $fieldValue) { $hidden[] = \Form::hidden($fieldName, $this->replaceTokens($fieldValue)); } return implode(PHP_EOL, $hidden); }
/** * Renders the field's form element for editing in the admin site * @see \Admin::getFieldSettings() * @param mixed $value The current value of the property, if there is one * @param array $settings Field settings, created through \Admin::getFieldSettings() * @param object $model The model, if it is being edited. * @return string The form control */ public static function displayForm($value, &$settings, $model) { $class = get_called_class(); $settings = static::settings($settings); $include_label = isset($settings['label']) ? $settings['label'] : true; $required = isset($settings['required']) ? $settings['required'] : false; $errors = $model->getErrorsForField($settings['mapping']['fieldName']); $has_errors = count($errors) > 0; $input_attributes = isset($settings['input_attributes']) ? $settings['input_attributes'] : array('class' => 'input-xxlarge'); $input_attributes['class'] .= ' form_' . $settings['mapping']['fieldName']; $attributes = array('class' => 'controls control-group' . ($has_errors ? ' error' : '') . ' field-type-' . $class::type($settings)); $label_text = $settings['title'] . ($required ? ' *' : ''); // Translation? if (\CMF::$lang_enabled && !\CMF::langIsDefault() && isset($settings['mapping']['columnName']) && $model->isTranslatable($settings['mapping']['columnName'])) { // If there is no translation if (!$model->hasTranslation($settings['mapping']['columnName'])) { $attributes['class'] .= ' no-translation'; $input_attributes['class'] .= ' no-translation'; $label_text = '<img class="lang-flag" src="' . \Uri::create('/admin/assets/img/lang/' . \CMF::defaultLang() . '.png') . '" /> ' . $label_text; } else { $label_text = '<img class="lang-flag" src="' . \Uri::create('/admin/assets/img/lang/' . \CMF::lang() . '.png') . '" /> ' . $label_text; } } // Description? $description = isset($settings['description']) ? '<span class="help-block">' . $settings['description'] . '</span>' : ''; // Build the input $input = '<input type="text" name="' . $settings['mapping']['fieldName'] . '[place_name]" ' . array_to_attr($input_attributes) . ' value="' . \Security::htmlentities(strval($value['place_name']), ENT_QUOTES) . '" />'; $input .= '<input type="hidden" data-ref="place-id" name="' . $settings['mapping']['fieldName'] . '[place_id]" ' . array_to_attr($input_attributes) . ' value="' . \Security::htmlentities(strval($value['place_id']), ENT_QUOTES) . '" />'; $input .= '<input type="hidden" data-ref="address_components" name="' . $settings['mapping']['fieldName'] . '[address_components]" ' . array_to_attr($input_attributes) . ' value="' . \Security::htmlentities(strval($value['address_components']), ENT_QUOTES) . '" />'; // Build the label $label = !$include_label ? '' : html_tag('label', array('class' => 'item-label', 'for' => $settings['mapping']['fieldName']), $label_text . ($has_errors ? ' - ' . $errors[0] : '')); // Prepend or append things... if (isset($settings['prepend'])) { $input = html_tag('div', array('class' => 'input-prepend'), html_tag('span', array('class' => 'add-on'), $settings['prepend']) . $input); } if (isset($settings['append'])) { $input = html_tag('div', array('class' => 'input-append'), $input . html_tag('span', array('class' => 'add-on'), $settings['append'])); } // Don't wrap the input if wrap is set to false if (isset($settings['wrap']) && $settings['wrap'] === false) { return $label . $input; } // Add the 'keep updated' control if the field has a template if (isset($settings['template']) && !empty($settings['template'])) { $attributes['class'] .= ' field-with-controls field-with-template'; $auto_update_setting = 'settings[' . $settings['mapping']['fieldName'] . '][auto_update]'; $auto_update_content = \Form::hidden($auto_update_setting, '0', array()) . html_tag('label', array('class' => 'checkbox auto-update-label'), \Form::checkbox($auto_update_setting, '1', \Arr::get($settings, 'auto_update', true), array('class' => 'auto-update')) . strtolower(\Lang::get('admin.common.auto_update'))); $auto_update = html_tag('div', array('class' => 'controls-top'), $auto_update_content); $label .= $auto_update; return array('content' => html_tag('div', $attributes, $label . $description . $input) . '<div class="clear"><!-- --></div>', 'widget' => false, 'assets' => array('js' => array('/admin/assets/js/twig.min.js', '/admin/assets/js/fields/template.js')), 'js_data' => $settings); } return html_tag('div', $attributes, $label . $description . $input); }
/** * Execute the helper * * @param \Handlebars\Template $template The template instance * @param \Handlebars\Context $context The current context * @param array $args The arguments passed the the helper * @param string $source The source * * @return mixed */ public function execute(Template $template, Context $context, $args, $source) { $default = array('route' => 'subbly.postcontroller.address'); // edit recorded address // ------------------------ $props = $this->parseProps($args, $context); $args = $template->parseArguments($args); $settings = $props ? array_merge($default, $props) : $default; $html = \Form::open($settings); $html .= \Form::hidden('addressId', $context->get('inputs.addressId')); return $html; }
function crud_delete_form($routeParams, $confirmed = false, $label = 'Delete') { $form = Form::open(['method' => 'DELETE', 'route' => $routeParams]); if ($confirmed) { $form .= Form::hidden('confirmed', true); } $form .= '<button type="submit" class="btn btn-danger" aria-label="Left Align"> <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> Delete </button>'; return $form .= Form::close(); }
public function open($url = NULL, array $attr = array()) { $expiration = Kohana::config('torn.token_expiration'); $seed = md5(md5(Request::current()->uri() . time()) . Text::random('alnum', 32)); if (is_string($expiration)) { $expiration = strtotime($expiration); } else { $expiration = time() + (int) $expiration; } Session::instance()->set($seed, $expiration); return Form::open($url, $attr) . Form::hidden('__SEED__', $seed); }
/** * @param $params * @return string */ public static function getField($params) { $text = $params['text'] ? $params['text'] : 'Select File'; $class = $params['class'] ? $params['class'] : 'btn btn-default'; $field_name = isset($params['field_name']) ? $params['field_name'] : 'image'; $default = isset($params['default']) ? $params['default'] : \Input::old($params['field_name']); if (!empty($default)) { $image = '<img src="' . route('showthumb', $default) . '" class="imageManagerImage" />'; } else { $image = '<img src="" style="display:none" class="imageManagerImage" />'; } return '<div class="ImageManager">' . $image . '<br /><br />' . '<button class="fileManager ' . $class . '" type="Button" data-url="' . route('ImageManager') . '" data-multi="false">' . $text . '</button>' . \Form::hidden($field_name, $default, ['class' => 'inputFile']) . '</div>'; }
public static function anti_forgery_token($new = FALSE) { $session = Session::instance(); $config = Kohana::$config->load('security'); $token_name = $config->get('csrf_token_name', 'request-verification-token'); $csrf_token = $session->get($token_name); if ($new === TRUE or !$csrf_token) { $csrf_key = $config->get('csrf_key', Security::token(TRUE)); $csrf_token = Crypto_Hash_Simple::compute_hash($csrf_key); $session->set($token_name, $csrf_token); } return Form::hidden($token_name, $csrf_token, array('id' => $token_name)); }
protected function _media_type($input, $attributes) { $type = Facebook_Attachment::$input_prefix . 'media-type' . Facebook_Attachment::$input_suffix; $src = Facebook_Attachment::$input_prefix . 'media-src' . Facebook_Attachment::$input_suffix; $upload = Facebook_Attachment::$input_prefix . 'upload' . Facebook_Attachment::$input_suffix; $href = Facebook_Attachment::$input_prefix . 'media-href' . Facebook_Attachment::$input_suffix; $out = array(); $out[] = Form::hidden($type, 'image'); $out[] = strtr(Facebook_Stream::$form_template, array(':label' => Form::label($src, 'Image Location URL', $attributes), ':description' => 'Each record must contain a src key, which maps to the photo URL', ':input' => Form::input($src, NULL, $attributes))); $out[] = strtr(Facebook_Stream::$form_template, array(':label' => Form::label($upload, 'Image Upload', $attributes), ':description' => 'Upload a file to use as the image src', ':input' => Form::file($upload, $attributes))); $out[] = strtr(Facebook_Stream::$form_template, array(':label' => Form::label($href, 'Image Hyperlink Destination', $attributes), ':description' => 'Maps to the URL where a user should be taken if he or she clicks the photo.', ':input' => Form::input($href, NULL, $attributes))); return implode("\n", $out); }
protected function debug() { $url = Core::url('/opendebugger/login'); $str = ''; if (isset($_GET['forward']) && $_GET['forward']) { $str = Form::hidden('forward', $_GET['forward']); } $view = new View('opendebugger'); $view->str = $str; $view->url = $url; $view->open = true; $view->render(); }
function get_form_select_lang($is_admin = 1) { $form = Form::open(["method" => "post", "action" => 'Palmabit\\Multilanguage\\Controllers\\LangController@swapLang', "id" => "form-select-lang"]); // prelievo dati per la lingua $lang_list = Config::get('multilanguage::lang_list'); $current_lang = $is_admin ? L::get_admin() : L::get(); // select language $form .= Form::label("lang", "Cambia lingua"); $form .= Form::select("lang", $lang_list, $current_lang, ["class" => "form-control", "id" => "select-lang"]); // soo see check which type of lang needs to change $form .= Form::hidden("is_admin", $is_admin); $form .= Form::close(); return $form; }
public function input($name, $value, array $attr = NULL) { $model = Sprig::factory($this->model); // All available options $options = $model->select_list($model->pk()); // Convert the selected options $value = $this->value($value); $inputs = array(); foreach ($options as $id => $label) { $inputs[] = '<label>' . Form::checkbox("{$name}[]", $id, isset($value[$id])) . ' ' . $label . '</label>'; } // Hidden input is added to force $_POST to contain a value for // this field, even when nothing is selected. return Form::hidden($name, '') . '<ul><li>' . implode('</li><li>', $inputs) . '</li></ul>'; }
/** inheritdoc */ public static function displayForm($value, &$settings, $model) { $include_label = isset($settings['label']) ? $settings['label'] : true; $errors = $model->getErrorsForField($settings['mapping']['fieldName']); $has_errors = count($errors) > 0; $input_attributes = isset($settings['input_attributes']) ? $settings['input_attributes'] : array(); $off_input = \Form::hidden($settings['mapping']['fieldName'], '0'); $input = \Form::checkbox($settings['mapping']['fieldName'], '1', $value, $input_attributes); $title = $settings['title'] . ($has_errors ? ' - ' . $errors[0] : ''); $label = !$include_label ? $input : html_tag('label', array('class' => 'checkbox'), $input . '<span class="item-label"> ' . $title . '</span>'); $description = isset($settings['description']) ? '<span class="help-block">' . $settings['description'] . '</span>' : ''; if (isset($settings['wrap']) && $settings['wrap'] === false) { return $label; } return html_tag('div', array('class' => 'field-type-checkbox controls control-group' . ($has_errors ? ' error' : '')), $off_input . $label . $description) . '<div class="clear"></div>'; }
/** inheritdoc */ public static function displayForm($value, &$settings, $model) { $required = isset($settings['required']) ? $settings['required'] : false; $errors = $model->getErrorsForField($settings['mapping']['fieldName']); $has_errors = count($errors) > 0; $input_attributes = array('class' => 'input input-xxlarge'); $attributes = array('class' => 'field-type-link controls control-group' . ($has_errors ? ' error' : '')); $href_name = $settings['mapping']['fieldName'] . '[href]'; $value['href'] = isset($value['href']) ? $value['href'] : null; $label_text = $settings['title'] . ($required ? ' *' : ''); // Translation? if (\CMF::$lang_enabled && !\CMF::langIsDefault() && isset($settings['mapping']['columnName']) && $model->isTranslatable($settings['mapping']['columnName'])) { // If there is no translation if (!$model->hasTranslation($settings['mapping']['columnName'])) { $attributes['class'] .= ' no-translation'; $input_attributes['class'] .= ' no-translation'; $label_text = '<img class="lang-flag" src="' . \Uri::create('/admin/assets/img/lang/' . \CMF::defaultLang() . '.png') . '" /> ' . $label_text; } else { $label_text = '<img class="lang-flag" src="' . \Uri::create('/admin/assets/img/lang/' . \CMF::lang() . '.png') . '" /> ' . $label_text; } } // EXTERNAL CHECKBOX $external_name = $settings['mapping']['fieldName'] . '[external]'; $external_value = \Arr::get($value, 'external', false); $external = \Form::hidden($external_name, '0') . html_tag('label', array('class' => 'checkbox external-checkbox'), \Form::checkbox($external_name, '1', $external_value, array()) . ' custom'); $label = \Form::label($label_text . ($has_errors ? ' - ' . $errors[0] : ''), $href_name, array('class' => 'item-label')) . $external . html_tag('div', array('class' => 'clear'), ' '); if ($external_value) { $attributes['class'] .= ' external'; } // EXTERNAL INPUT CONTENT $href_value_ext = $external_value ? $value['href'] : ''; $ext_input = \Form::input($href_name, $href_value_ext, $input_attributes); $ext_content = html_tag('div', array('class' => 'external-link'), $ext_input); // INTERNAL DROPDOWN CONTENT $options = static::getOptions($settings, $model); $href_value_int = $external_value ? '' : $value['href']; // Check if the value is actually an alias if (!empty($href_value_int)) { $url_value = \CMF\Model\URL::find($href_value_int); if ($url_value && ($alias = $url_value->alias)) { $href_value_int = $alias->id; } } $input = \Form::select($href_name, $href_value_int, $options, $input_attributes); $int_content = html_tag('div', array('class' => 'internal-link'), $input); return html_tag('div', $attributes, $label . $int_content . $ext_content) . html_tag('div', array(), ''); }
/** * Render view. * * @return string */ public function content() { ob_start(); echo Form::open(); ?> <fieldset> <legend><?php echo __('Almost there!'); ?> </legend> <?php echo Form::control_group(Form::input('username', $this->user->userame, array('class' => 'input-small', 'placeholder' => __('JohnDoe'))), array('username' => __('Username')), Arr::get($this->errors, 'username'), __('Choose a unique username with at least <var>:length</var> characters. No special characters, thank you.', array(':length' => Kohana::$config->load('visitor.username.length_min')))); ?> <?php echo Form::control_group(Form::password('password'), array('password' => __('Password')), Arr::get($this->errors, 'password')); ?> <?php echo Form::control_group(Form::password('password_confirm'), array('password_confirm' => __('Confirm')), Arr::get($this->errors, 'password_confirm'), __('Try to use letters, numbers and special characters for a stronger password, with at least <var>8</var> characters.')); ?> <?php echo Form::control_group(Form::input('email', $this->user->email, array('disabled' => 'disabled', 'class' => 'input-xxlarge', 'placeholder' => __('*****@*****.**'))), array('email' => __('Email')), Arr::get($this->errors, 'email'), __('Please remember: sign up is available only with a valid, invited email.')); ?> </fieldset> <fieldset> <?php echo Form::hidden('code', $this->code); ?> <?php echo Form::button('register', __('Sign up!'), array('type' => 'submit', 'class' => 'btn btn-primary btn-large')); ?> <?php echo HTML::anchor(Request::back('/', true), __('Cancel'), array('class' => 'cancel')); ?> </fieldset> <?php echo Form::close(); return ob_get_clean(); }
public function index(Request $request) { if ($request->ajax()) { $patient = Patient::select(['id', 'name', 'mobile', 'date_of_birth', 'image'])->get(); return Datatables::of($patient)->addColumn('Image', function ($item) { return '<img src="' . $item->image . ' " alt="Smiley face" height="42" width="42">'; })->addColumn('Operations', function ($item) { $form = \Form::open(['method' => 'DELETE', 'url' => 'patient/' . $item->id, 'class' => 'table-form-inline', 'data-bb' => 'confirm']); $form .= \Form::hidden('id', $item->id); $form .= \Form::button('<i class="glyphicon glyphicon-trash"></i> Delete', ['class' => 'btn btn-danger btn-xs', 'type' => 'submit']); $form .= \Form::close(); $form .= ' ' . link_to('patient/' . $item->id . '/edit', $title = "Edit", $attributes = ['class' => 'btn btn-primary btn-xs glyphicon glyphicon-edit'], $secure = null); return $form; })->removeColumn('id')->removeColumn('image')->make(); } return view('patient.list'); }
public function view() { $type = str_replace('_id', '', $this->id); // Input group $name_group_inputs = [Form::hidden($this->id, '_new'), View::forge('form/group/input', ['label' => 'Option Text', 'input' => Form::input('name', '', ['class' => 'form-control'])], false)]; $name_group = View::forge('form/group', ['inputs' => $name_group_inputs], false); // Submit button $submit_button = View::forge('form/button', ['label' => 'Add Option', 'link' => 'submit/common_blank', 'class' => 'btn btn-success', 'response_target' => './.', 'custom_attributes' => 'data-dismiss="modal"']); // Form build $form_container = View::forge('form/container', ['name' => $type, 'sections' => [$name_group], 'buttons' => [$submit_button]]); // Create modal body $modal_content = View::forge('modal/content', ['title' => 'Add Option', 'body' => $form_container]); // Set modal content to configured content. $modal_small = View::forge('modal/small', ['content' => $modal_content]); // Set the view to the modal ready to send back to client. $this->add_modal = $modal_small; }
public function build($view = '') { $this->initJsWidget(); $view == '' and $view = 'datatree::datatree'; $this->open = \Form::open($this->attributes); $this->close = \Form::hidden('save', 1) . \Form::close(); // we save on POST and only if the widget's own input variable is filled // because sometimes we have more than a tree widget on the same page // but just one save if (\Request::method() == 'POST' && \Input::get($this->name)) { $this->lockAndSave(); } $this->data = $this->source->find($this->source->getKey())->getDescendants()->toHierarchy(); Persistence::save(); $this->rows = $this->makeRowsRecursive($this->data); return \View::make($view, array('dg' => $this, 'buttons' => $this->button_container, 'label' => $this->label)); }