/** inheritdoc */ 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 form-control'); if (!isset($input_attributes['id'])) { $input_attributes['id'] = 'form_' . $settings['mapping']['fieldName']; } $attributes = array('class' => 'controls control-group' . ($has_errors ? ' error' : '') . ' field-type-' . $class::type($settings)); $label_text = $settings['title'] . ($required ? ' *' : ''); // Build the input $input = '<input type="text" name="' . $settings['mapping']['fieldName'] . '" ' . array_to_attr($input_attributes) . ' value="' . \Security::htmlentities(strval($value), ENT_QUOTES) . '" />'; // Build the label $label = !$include_label ? '' : \Form::label($label_text . ($has_errors ? ' - ' . $errors[0] : ''), $settings['mapping']['fieldName'], array('class' => 'item-label')); // Wrap it in an input group $input = html_tag('div', array('class' => 'input-append'), $input . html_tag('span', array('class' => 'add-on'), ' ')); // Don't wrap the input if wrap is set to false if (isset($settings['wrap']) && $settings['wrap'] === false) { return $label . $input; } return html_tag('div', $attributes, $label . $input); }
/** @inheritdoc */ public static function displayForm($value, &$settings, $model) { // No point in ever showing this field if lang isn't enabled if (!\CMF::$lang_enabled) { return ''; } \Lang::load('languages', true, 'en', true, true); $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'); if ($settings['active_only']) { $options = array_map(function ($lang) { return \Arr::get(\Lang::$lines, 'en.languages.' . $lang['code'], \Lang::get('admin.errors.language.name_not_found')); }, \CMF\Model\Language::select('item.code', 'item', 'item.code')->orderBy('item.pos', 'ASC')->where('item.visible = true')->getQuery()->getArrayResult()); } else { $options = \Arr::get(\Lang::$lines, 'en.languages', array()); } // Whether to allow an empty option if (isset($settings['mapping']['nullable']) && $settings['mapping']['nullable'] && !$required && $settings['allow_empty']) { $options = array('' => '') + $options; } $label = !$include_label ? '' : \Form::label($settings['title'] . ($required ? ' *' : '') . ($has_errors ? ' - ' . $errors[0] : ''), $settings['mapping']['fieldName'], array('class' => 'item-label')); $input = \Form::select($settings['mapping']['fieldName'], $value, $options, $input_attributes); if (isset($settings['wrap']) && $settings['wrap'] === false) { return $label . $input; } return html_tag('div', array('class' => 'controls control-group' . ($has_errors ? ' error' : '')), $label . $input); }
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 input($name, $display = null) { if ($display == null) { $display = ucfirst($name); } $data = array('name' => "cliente[{$name}]"); return Form::text($name, null, $data) . Form::label($name, $display) . '<br>'; }
/** * 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>'; }
/** * @covers Form::label * @covers Form::removeEndColon * @covers Form::addFieldError */ public function testLabelRequired() { $this->myForm = new \Form(); $this->myForm->addConstraint('login', \ConstraintFactory::REQUIRED); $this->myForm->addFieldError("login", "Wrong login"); $elt = $this->myForm->label('login', 'my label'); $this->assertInstanceOf('HtmlElement', $elt); $this->assertEquals('<label class="required error">my label</label>', $elt->__toString()); }
public function testLabel() { $data = Form::label(); $this->assertEquals('<label></label>', $data); $data = Form::label('Some text'); $this->assertEquals('<label>Some text</label>', $data); $data = Form::label('Some text', ['id' => 'ID', 'class' => 'Class', 'for' => 'for']); $this->assertEquals('<label id="ID" class="Class" for="for">Some text</label>', $data); }
public static function li_checkbox($input, $text, $checked = FALSE, array $attributes = array(), $error = "") { $atts = array_merge($attributes, array('id'=>$input)); echo "<li class=\"input_field input_text\">"; echo Form::label($input, $text); echo Form::checkbox($input, NULL, $checked, $atts); echo "<span class=\"error\">$error</span>"; echo "</li>"; }
function textAreaGroup($name, $value = NULL, $errors) { $errorClass = $errors->first($name) ? "has-error" : ""; $output = "<div class='form-group {$errorClass}'>"; $output .= Form::label($name, ucwords($name)); $output .= Form::textarea($name, $value, ['class' => 'form-control', 'placeholder' => "Enter {$name}"]); $output .= $errors->first($name, '<label>:message</label>'); return "{$output}</div>"; }
/** inheritdoc */ public static function displayForm($value, &$settings, $model) { $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; // Check stylesSet URL $stylesSet = \Arr::get($settings, 'stylesSet'); if (!empty($stylesSet) && substr($stylesSet, 0, 1) == '/') { // Add an absolute URL to the start $settings['stylesSet'] = rtrim(\Uri::base(false), '/') . $stylesSet; } // Add ckeditor to the class for the field $input_attributes = isset($settings['input_attributes']) ? $settings['input_attributes'] : array('class' => 'input-xxlarge'); $input_attributes['class'] = $input_attributes['class'] . " ckeditor-cmf"; $label = !$include_label ? '' : \Form::label($settings['title'] . ($required ? ' *' : '') . ($has_errors ? ' - ' . $errors[0] : ''), $settings['mapping']['fieldName'], array('class' => 'item-label')); $input = \Form::textarea($settings['mapping']['fieldName'], strval($value), $input_attributes); // Set up required information for any links specified if (isset($settings['links']) && is_array($settings['links'])) { $links = array(); foreach ($settings['links'] as $link_type => $link) { if (!class_exists($link_type)) { continue; } $link['table_name'] = \CMF\Admin::getTableForClass($link_type); $link['singular'] = $link_type::singular(); $link['plural'] = $link_type::plural(); $link['icon'] = $link_type::icon(); $links[$link_type] = $link; } $settings['links'] = $links; } if (isset($settings['stylesSet'])) { if (file_exists(DOCROOT . ltrim($settings['stylesSet'], '/'))) { $settings['stylesSet'] = 'default:' . \Uri::base(false) . ltrim($settings['stylesSet'], '/'); } else { unset($settings['stylesSet']); } } if (isset($settings['contentsCss'])) { if (strpos($settings['contentsCss'], '.php') === false && !file_exists(DOCROOT . ltrim($settings['contentsCss'], '/'))) { unset($settings['contentsCss']); } } // Return only the field and label if no wrap is required if (isset($settings['wrap']) && $settings['wrap'] === false) { return $label . $input; } // Return the widget if (isset($settings['widget']) && $settings['widget'] === true) { return array('assets' => array(), 'content' => $input, 'widget' => true, 'widget_title' => $settings['title'], 'widget_icon' => 'align-left', 'js_data' => $settings); } // Return the normal field return array('assets' => array(), 'content' => html_tag('div', array('class' => 'control-group ' . ($has_errors ? ' error' : '')), $label . $input), 'widget' => false, 'js_data' => $settings); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $usuario = new User(); $roles = Role::all()->lists('display_name', 'id'); $myroles = []; $title = 'Agregar usuario'; $form_data = ['route' => 'usuario.store', 'class' => 'form-horizontal']; $password_field = \Form::label('password', 'Contraseña') . \Form::password('password', ['class' => 'form-control']); return view('usuario.form')->with(compact('title', 'usuario', 'form_data', 'password_field', 'roles', 'myroles')); }
/** inheritdoc */ public static function displayForm($value, &$settings, $model) { $id = isset($value) ? $value->id : ''; $settings = static::settings($settings); $settings['cid'] = 'field_' . md5($settings['mapping']['fieldName'] . static::type()); $required = isset($settings['required']) ? $settings['required'] : false; $include_label = isset($settings['label']) ? $settings['label'] : true; $target_class = $settings['mapping']['targetEntity']; $target_table = \CMF\Admin::getTableForClass($target_class); $target_prop = $settings['mapping']['isOwningSide'] === true ? $settings['mapping']['inversedBy'] : $settings['mapping']['mappedBy']; if (empty($target_prop) || is_null($model->id)) { $target_prop = false; } $add_link = \Uri::create('/admin/' . $target_table . '/create?_mode=inline&_cid=' . $settings['cid'] . ($target_prop !== false ? '&' . $target_prop . '=' . $model->id : '')); $options = $target_class::options(\Arr::get($settings, 'filters', array()), array(), null, null, null, is_array($settings['select2']), \Arr::get($settings, 'group_by')); $has_controls = $settings['create'] !== false; // Description? $description = isset($settings['description']) ? '<span class="help-block">' . $settings['description'] . '</span>' : ''; if ($settings['allow_empty']) { $options = array('' => '') + $options; } $errors = $model->getErrorsForField($settings['mapping']['fieldName']); $has_errors = count($errors) > 0; $input_attributes = $settings['input_attributes']; $label = !$include_label ? '' : \Form::label($settings['title'] . ($required ? ' *' : '') . ($has_errors ? ' - ' . $errors[0] : ''), $settings['mapping']['fieldName'], array('class' => 'item-label')); $add_link = html_tag('a', array('href' => $add_link, 'class' => 'btn btn-mini btn-create'), '<i class="fa fa-plus"></i> create ' . strtolower($target_class::singular())); // Permissions $settings['can_edit'] = \CMF\Auth::can('edit', $target_class); $settings['can_create'] = \CMF\Auth::can('create', $target_class) && $settings['can_edit']; $settings['create'] = $settings['create'] && $settings['can_create']; $settings['edit'] = $settings['edit'] && $settings['can_edit']; if ($settings['create'] === false) { $add_link = " "; } $controls_top = html_tag('div', array('class' => 'controls-top'), $add_link); if (is_array($settings['select2'])) { $input_attributes['class'] .= 'input-xxlarge select2'; $input = \Form::select($settings['mapping']['fieldName'], $id, $options, $input_attributes); $settings['select2']['placeholder'] = 'click to select ' . strtolower($target_class::singular()) . '...'; $settings['select2']['target_table'] = $target_table; // Permissions $settings['select2']['create'] = $settings['create']; $settings['select2']['edit'] = $settings['edit']; if (!$required) { $settings['select2']['allowClear'] = true; } return array('content' => html_tag('div', array('class' => 'controls control-group' . ($has_controls ? ' field-with-controls' : '') . ($has_errors ? ' error' : ''), 'id' => $settings['cid']), $label . $description . $input . $controls_top) . '<div class="clear"><!-- --></div>', 'widget' => false, 'assets' => array('css' => array('/admin/assets/select2/select2.css'), 'js' => array('/admin/assets/select2/select2.min.js', '/admin/assets/js/fields/select2.js')), 'js_data' => $settings['select2']); } $input_attributes['class'] .= ' input-xxlarge'; $input = \Form::select($settings['mapping']['fieldName'], $id, $options, $input_attributes); if (isset($settings['wrap']) && $settings['wrap'] === false) { return $label . $input; } return html_tag('div', array('class' => 'controls control-group' . ($has_controls ? ' field-with-controls' : '') . ($has_errors ? ' error' : ''), 'id' => $settings['cid']), $label . $description . $input . $controls_top) . '<div class="clear"><!-- --></div>'; }
public function inputs($attributes = NULL) { $out = array(); foreach ($this->_stream as $name => $value) { $input = Facebook_Stream::$input_prefix . $name . Facebook_Stream::$input_suffix; if ($this->_inputs[$name]['hidden']) { $out[] = $this->input($name, $attributes); } else { $out[] = strtr(Facebook_Stream::$form_template, array(':label' => Form::label($input, $this->_inputs[$name]['label'], $attributes), ':description' => $this->_inputs[$name]['description'], ':input' => $this->input($name, $attributes))); } } return implode("\n", $out); }
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); }
/** 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; $attributes = array('class' => 'controls control-group' . ($has_errors ? ' error' : '')); $label = !$include_label ? '' : \Form::label($settings['title'] . ($has_errors ? ' - ' . $errors[0] : ''), $settings['mapping']['fieldName']); $input = $value instanceof \CMF\Model\Base ? strval($value->display()) : strval($value); if (isset($settings['wrap']) && $settings['wrap'] === false) { return $label . $input; } return html_tag('div', $attributes, $label . $input); }
/** * @param array $params * @param string $content * @param Smarty_Internal_Template $smarty * @param boolean $repeat * * @throws SmartyException * @return string * * @author Kovács Vince */ function smarty_block_form_label($params, $content, Smarty_Internal_Template &$smarty, &$repeat) { if (is_null($content)) { return ''; } if (!isset($params['_name'])) { throw new SmartyException('Missing _name attribute for form_label tag'); } $name = $params['_name']; $content = trim($content); unset($params['_name']); return Form::label($name, Lang::get($content), $params); }
/** inheritdoc */ public static function displayForm($value, &$settings, $model) { $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; $attributes = array('class' => 'controls control-group ' . ($has_errors ? ' error' : '')); $input_attributes = isset($settings['input_attributes']) ? $settings['input_attributes'] : array('class' => 'input-xxlarge'); //add redactor to the class for the field $input_attributes['class'] = $input_attributes['class'] . " redactor"; $label_text = $settings['title'] . ($required ? ' *' : ''); $input = \Form::textarea($settings['mapping']['fieldName'], strval($value), $input_attributes); // Translation? if (\CMF::$lang_enabled && !\CMF::langIsDefault() && $model->isTranslatable($settings['mapping']['columnName'])) { // If there is no translation if (!$model->hasTranslation($settings['mapping']['columnName'])) { $attributes['class'] .= ' no-translation'; $label_text = '<span class="no-translation"><img class="lang-flag" src="' . \Uri::create('/admin/assets/img/lang/' . \CMF::defaultLang() . '.png') . '" /> ' . $label_text . '</span>'; } else { $label_text = '<img class="lang-flag" src="' . \Uri::create('/admin/assets/img/lang/' . \CMF::lang() . '.png') . '" /> ' . $label_text; } } // Build the label $label = !$include_label ? '' : \Form::label($label_text . ($has_errors ? ' - ' . $errors[0] : ''), $settings['mapping']['fieldName'], array('class' => 'item-label')); // Set up required information for any links specified if (isset($settings['links']) && is_array($settings['links'])) { $links = array(); foreach ($settings['links'] as $link_type => $link) { if (!class_exists($link_type)) { continue; } $link['table_name'] = \CMF\Admin::getTableForClass($link_type); $link['singular'] = $link_type::singular(); $link['plural'] = $link_type::plural(); $link['icon'] = $link_type::icon(); $links[$link_type] = $link; } $settings['links'] = $links; } // Return only the field and label if no wrap is required if (isset($settings['wrap']) && $settings['wrap'] === false) { return $label . $input; } // Return the widget if (isset($settings['widget']) && $settings['widget'] === true) { return array('assets' => array(), 'content' => $input, 'widget' => true, 'widget_title' => $label_text, 'widget_icon' => 'align-left', 'js_data' => $settings); } // Return the normal field return array('assets' => array(), 'content' => html_tag('div', $attributes, $label . $input), 'widget' => false, 'js_data' => $settings); }
/** inheritdoc */ public static function displayForm($value, &$settings, $model) { $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'); $label = !$include_label ? '' : \Form::label($settings['title'] . ($required ? ' *' : '') . ($has_errors && !empty($errors[0]) ? ' - ' . $errors[0] : ''), $settings['mapping']['fieldName']); $input = \Form::password($settings['mapping']['fieldName'], strval($value), $input_attributes); if (isset($settings['wrap']) && $settings['wrap'] === false) { return $label . $input; } return html_tag('div', array('class' => 'controls control-group' . ($has_errors ? ' error' : '')), $label . $input); }
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 getContent() { //@todo automate module simple configuration for Model's columns or settings (conf) if (Input::get('illuminatocomments_conf')) { $this->conf->set(['GRADES' => Input::has('enable_grades')]); $this->conf->set(['COMMENTS' => Input::has('enable_comments')]); } $html = Form::open(['id' => 'illuminatocomments_form', 'enctype' => 'multipart/form-data', 'url' => URL::full()]); $html .= Form::label('enable_grades', 'Enable grades'); $html .= Form::checkbox('enable_grades', '1', $this->conf->get('GRADES')); $html .= Form::label('enable_comments', 'Enable comments'); $html .= Form::checkbox('enable_comments', '1', $this->conf->get('COMMENTS')); $html .= Form::submit('Save', ['name' => 'illuminatocomments_conf', 'id' => 'illuminatocomments_conf']); $html .= Form::close(); return $html; }
/** * List of Pl's report for datatable * * @return type */ public function orderList($status) { $baseUrl = \URL::to('/'); if (Auth::user()->hasRole('admin') || Auth::user()->hasRole('manager')) { $tempSequence = 1; // Get listing for Admin or Manager $skuData = DB::table('order_list')->leftJoin('pcs_made', 'pcs_made.orderlist_id', '=', 'order_list.id')->leftJoin('part_number', 'part_number.id', '=', 'order_list.part_id')->leftJoin('purchase_order', 'purchase_order.id', '=', 'order_list.po_id')->leftJoin('po_images', 'po_images.order_id', '=', 'order_list.id')->leftJoin('customers', 'customers.id', '=', 'order_list.customer_id')->select(array('order_list.adminSequence', 'purchase_order.po_number', 'customers.comp_name', 'part_number.SKU', 'po_images.approved_image as fileName', 'order_list.size_qty', 'purchase_order.require_date', DB::raw("IF(order_list.ESDate IS NULL or order_list.ESDate = '','',order_list.ESDate) as estDate"), 'order_list.qty', DB::raw("IF(SUM(pcs_made.qty) IS NULL or SUM(pcs_made.qty) = '', '0', SUM(pcs_made.qty)) as pcsMade"), DB::raw("(order_list.qty - (IF(SUM(pcs_made.qty) IS NULL or SUM(pcs_made.qty) = '', '0', SUM(pcs_made.qty)))) as amount"), 'order_list.pl_status', 'order_list.production_status', 'order_list.id as orderId'))->where('purchase_order.is_deleted', '!=', 1)->where('order_list.pl_status', '=', $status)->groupBy('order_list.id')->orderBy('order_list.adminSequence', 'ASC'); // Return datatable $statusStr = '<select id="plStatusChange" class="form-control" olId="{{$orderId}}"><option value="0" {{ $pl_status == 0 ? "selected" : "" }}>Open</option><option value="1" {{ $pl_status == 1 ? "selected" : "" }}>Closed</option></select>'; return Datatables::of($skuData)->editColumn("adminSequence", '@if($pl_status) 0 @else {{$adminSequence}} @endif')->editColumn("fileName", '@if($fileName == NULL) <img height="32" class="img-rounded" src="' . $baseUrl . '/files/poMultiImage/noImage.png"></img> @else <img height="32" class="img-rounded" src="' . $baseUrl . '/images/blog/{{$fileName}}"></img> @endif')->editColumn("pcsMade", '<button type="button" class="btn btn-primary btn-sm btnPcsMade" data-toggle="modal" data-target="#myModal" onclick="getpcsDetails(\'{{$orderId}}\',\'{{$po_number}}\',\'{{$SKU}}\',\'{{$amount}}\')">{{$pcsMade}}</button>')->editColumn("estDate", '<input id="ESDate" type="text" olId="{{$orderId}}" value="{{$estDate}}" size="12" class="form-control default-date-picker ESDate" placeholder="YYYY-MM-DD">')->editColumn("pl_status", $statusStr)->editColumn("production_status", function ($row) { $data = ProductionSequence::where('isDelete', '!=', 1)->orWhere('id', '=', $row->production_status)->orWhereNull('isDelete')->lists('title', 'id'); return \Form::select('production_status', $data, $row->production_status, ['class' => 'production_status form-control', 'id' => $row->orderId]); })->editColumn("size_qty", function ($row) { $string = ''; $sizeArray = json_decode($row->size_qty, true); if (count($sizeArray) > 0) { foreach ($sizeArray as $size) { foreach ($size as $key => $val) { $string .= $key . ":" . $val . ","; } } } return trim($string, ","); })->make(); } else { // Get listing for Local user $customer = DB::table('customers')->where('user_id', Auth::user()->id)->first(); $skuData = DB::table('order_list')->leftJoin('part_number', 'part_number.id', '=', 'order_list.part_id')->leftJoin('purchase_order', 'purchase_order.id', '=', 'order_list.po_id')->leftJoin('pcs_made', 'pcs_made.orderlist_id', '=', 'order_list.id')->leftJoin('po_images', 'po_images.order_id', '=', 'order_list.id')->leftJoin('customers', 'customers.id', '=', 'order_list.customer_id')->select('order_list.localSequence', 'purchase_order.po_number', 'customers.comp_name', 'part_number.SKU', 'po_images.approved_image as fileName', 'order_list.size_qty', 'purchase_order.require_date', DB::raw("IF(order_list.ESDate IS NULL or order_list.ESDate = '','',order_list.ESDate) as estDate"), 'order_list.qty', DB::raw("IF(SUM(pcs_made.qty) IS NULL or SUM(pcs_made.qty) = '', '0', SUM(pcs_made.qty)) as pcsMade"), 'order_list.amount', 'order_list.pl_status', 'order_list.production_status', 'order_list.id as orderId')->where('order_list.customer_id', '=', $customer->id)->where('purchase_order.is_deleted', '!=', 1)->where('order_list.pl_status', '=', $status)->groupBy('order_list.id')->orderBy('order_list.localSequence', 'ASC'); // Return datatable $statusStr = '{{ $pl_status == 0 ? "Open" : "Close" }}'; return Datatables::of($skuData)->editColumn("localSequence", '@if($pl_status) 0 @else {{$localSequence}} @endif')->editColumn("fileName", '@if($fileName == NULL) <img height="32" class="img-rounded" src="' . $baseUrl . '/files/poMultiImage/noImage.png"></img> @else <img height="32" class="img-rounded" src="' . $baseUrl . '/images/blog/{{$fileName}}"></img> @endif')->editColumn("pcsMade", '<button type="button" class="btn btn-primary btn-sm">{{$pcsMade}}</button>')->editColumn("size_qty", function ($row) { $string = ''; $sizeArray = json_decode($row->size_qty, true); if (count($sizeArray) > 0) { foreach ($sizeArray as $size) { foreach ($size as $key => $val) { $string .= $key . ":" . $val . ","; } } } return trim($string, ","); })->editColumn("estDate", '{{$estDate}}')->editColumn("pl_status", $statusStr)->editColumn("production_status", function ($row) { $data = ProductionSequence::where('isDelete', '!=', 1)->orWhere('id', '=', $row->production_status)->orWhereNull('isDelete')->first(); return \Form::label('', !is_null($data) ? $data->title : ''); })->make(); } }
/** 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(), ''); }
/** inheritdoc */ public static function displayForm($value, &$settings, $model) { $required = isset($settings['required']) ? $settings['required'] : false; $include_label = isset($settings['label']) ? $settings['label'] : true; $errors = $model->getErrorsForField($settings['mapping']['fieldName']); $has_errors = count($errors) > 0; $input_attributes = array('class' => 'input-xxlarge'); $attributes = array('class' => 'field-type-startpage controls control-group' . ($has_errors ? ' error' : '')); $id = isset($value) ? $value->id : ''; $label = !$include_label ? '' : \Form::label($settings['title'] . ($required ? ' *' : '') . ($has_errors ? ' - ' . $errors[0] : ''), $settings['mapping']['fieldName']); // DROPDOWN CONTENT $options = static::getOptions($settings, $model); $input = \Form::select($settings['mapping']['fieldName'], $id, $options, $input_attributes); if (isset($settings['wrap']) && $settings['wrap'] === false) { return $label . $input; } return html_tag('div', array('class' => 'controls control-group' . ($has_errors ? ' error' : '')), $label . $input); }
public function render() { $render = ''; if (!is_array($this->_config['options'])) { $this->_config['options'] = array_combine($this->_extra[$this->_config['options']], $this->_extra[$this->_config['options']]); } switch ($this->_config['format']) { case 'select': // Multiple if ($this->_config['multiple']) { $render = Form::select($this->_name . '[]', $this->_config['options'], (array) $this->_value, $this->_attributes + array('id' => $this->_id)); break; } // Multichoice if ($this->_config['multichoice']) { $render = ZForm::multichoice($this->_name, $this->_config['options'], $this->_value, $this->_attributes + array('id' => $this->_id)); break; } // Single $render = Form::select($this->_name, $this->_config['options'], $this->_value, $this->_attributes + array('id' => $this->_id)); break; default: $first = true; $i = 0; foreach ($this->_config['options'] as $option => $label) { $render .= '<span class="enum-item">'; $id = $first ? $this->_id : $this->_id . '_' . $i++; // Multiple (checkboxes) if ($this->_config['multiple']) { $render .= Form::checkbox($this->_name . '[' . $option . ']', $option, in_array($option, $this->_value), $this->_attributes + array('id' => $id)); } else { $render .= Form::radio($this->_name, $option, $this->_value == $option or $first and !$this->_value, $this->_attributes + array('id' => $id)); } $render .= Form::label($id, $label); $render .= '</span>'; $first = false; } $render = '<div class="enum">' . $render . '</div>'; } return $render; }
public static function open($action, $method = 'post', $fields = []) { echo \Form::open(array('url' => $action, 'method' => $method, 'files' => true)); foreach ($fields as $key => $value) { $class = !empty($value[3]) ? $value[3] : ''; $default = !empty($value[2]) ? $value[2] : ''; echo '<div class="form-group ' . $class . '">'; echo \Form::label($key, $value[0]); echo "<br />"; switch ($value[1]) { case 'file': echo \Form::{$value[1]}($key); break; case 'select': echo \Form::{$value[1]}($key, $default, $class, array('class' => 'form-control')); break; default: echo \Form::{$value[1]}($key, $default, array('class' => 'form-control')); } echo '</div>'; } }
/** * @param FormSchema $field * @param bool $useLabels * @return string the Element to return */ public static function getElement(FormSchema $field, $useLabels = true) { $returnElement = null; $types = \Config::get('formbuilder::config.form-types'); $options = \Config::get('formbuilder::config.form-options'); $options = array_key_exists($field->getType(), $options) ? $options[$field->getType()] : null; if ($useLabels) { $returnElement .= \Form::label($field->getName(), ucfirst($field->getName())); } if (method_exists('\\Illuminate\\Html\\FormBuilder', $field->getName())) { $method = $field->getName(); $returnElement .= \Form::$method($field->getName(), null); } elseif (method_exists('\\Illuminate\\Html\\FormBuilder', $field->getType()) && $field->getType() != 'text') { $method = $field->getType(); $returnElement .= \Form::$method($field->getName(), null); } elseif ($field->getType() == 'text') { $returnElement .= \Form::textarea($field->getName(), null); } else { $returnElement .= \Form::input($types[$field->getType()], $field->getName(), $field->getType() == 'boolean' ? 0 : null, $options); } return $returnElement; }
/** @inheritdoc */ public static function displayForm($value, &$settings, $model) { $settings = static::settings($settings); if (!isset($value) || !$value) { $value = !is_null($settings['default']) ? \DateTime::createFromFormat($settings['format'], $settings['default']) : new \DateTime(); if (!is_null($settings['default_offset'])) { $value->modify($settings['default_offset']); } } $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-large'); $label = !$include_label ? '' : \Form::label($settings['title'] . ($required ? ' *' : '') . ($has_errors ? ' - ' . $errors[0] : ''), $settings['mapping']['fieldName'], array('class' => 'item-label')); $input = \Form::input($settings['mapping']['fieldName'], $value->format($settings['format']), $input_attributes); $input = $input = html_tag('div', array('class' => 'input-prepend'), html_tag('span', array('class' => 'add-on'), '<i class="fa fa-calendar"></i>') . $input); if (isset($settings['wrap']) && $settings['wrap'] === false) { return $label . $input; } return html_tag('div', array('class' => 'controls control-group field-type-datetime' . ($has_errors ? ' error' : '')), $label . $input); }
public static function input($name, $value = NULL, array $attributes = NULL, $label = NULL, $help = NULL, $inline_help = false) { $return = ''; $help = is_null($help) ? '' : ($inline_help ? '<span class="help-inline">' . $help . '</span>' : '<p class="help-block">' . $help . '</p>'); $label = is_null($label) ? __(ucfirst($name)) : __($label); switch (self::$type) { case self::HORIZONTAL: $attributes['id'] = $name; $return .= '<div class="control-group">'; $return .= parent::label($name, $label, array('class' => 'control-label')); $return .= '<div class="controls">'; $return .= parent::input($name, $value, $attributes); $return .= $help; $return .= '</div>'; $return .= '</div>'; break; default: $return .= parent::input($name, $value, $attributes); $return .= $help; break; } return $return; }
function wrap_field($formField, $name, $label, $errors, $default = null, $classes = array()) { $html = []; $class = 'form-group ' . implode(' ', $classes); if ($errors && $errors->has($name)) { $class .= ' has-error has-feedback'; } if (is_null($default)) { $default = Input::old($name); } array_push($html, '<div class="' . $class . '">'); if ($label != '<none>') { array_push($html, Form::label($name, $label, array('class' => 'control-label'))); } array_push($html, $formField); if ($errors && $errors->has($name)) { array_push($html, '<span class="glyphicon glyphicon-remove form-control-feedback"></span>'); array_push($html, '<div class="help-block">'); array_push($html, $errors->first($name)); array_push($html, '</div>'); } array_push($html, '</div>'); return implode("\n", $html); }
<?php isset($request->numOfUsers) ? $n = $request->numOfUsers : ($n = 1); echo Form::selectRange('numOfUsers', 1, 20, $n) . " "; echo Form::label('lNumOfUsers', 'Number of Users'); echo '<br><br>'; isset($request->birthdate) ? $selected = true : ($selected = false); echo Form::checkbox('birthdate', 'birthdate', $selected); echo Form::label('lBirthdate', 'Birthdate'); echo '<br>'; isset($request->address) ? $selected = true : ($selected = false); echo Form::checkbox('address', 'address', $selected); echo Form::label('lAddress', 'Address'); echo '<br>'; isset($request->profile) ? $selected = true : ($selected = false); echo Form::checkbox('profile', 'profile', $selected); echo Form::label('lProfile', 'Profile'); echo '<br><br>'; echo Form::submit('Submit'); ?> {!! Form::close() !!} <p> @if(isset($users)) @foreach($users as $user) <h3> {{ $user->name }} </h3> <?php if (isset($request->birthdate)) { echo '   <b>Birthdate: </b>' . $user->date($format = 'Y-m-d', $max = "now"); echo '<br>'; }