Example #1
0
 /**
  * @covers Form::textarea
  */
 public function testTextarea()
 {
     $textZone = $this->myForm->textarea('text');
     $this->assertInstanceOf('TextArea', $textZone);
     $this->assertEquals('text', $textZone->getName());
     $this->assertSame($this->myForm, $textZone->getForm());
 }
Example #2
0
 private function parseFields()
 {
     if (!empty($this->fields)) {
         foreach ($this->fields as $key => $value) {
             switch ($value['type']) {
                 case 'text':
                     $obj = Form::text($key);
                     break;
                 case 'long_text':
                     $obj = Form::textarea($key);
                     break;
                 case 'multiple_choice':
                     $obj = Form::checkboxes($key . "[]");
                     // create a collection of checkboxeseaa
                     foreach ($value['options'] as $o => $v) {
                         $obj->add($o, $v);
                     }
                     break;
                 default:
                     $obj = Form::text($key);
             }
             $obj->setLabel($value['label']);
             $this->add($obj);
         }
     }
     $this->init();
 }
Example #3
0
 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;
 }
 /**
  * @dataProvider getFieldProvider
  *
  * @param $fieldName
  * @param $fieldTitle
  * @param $fieldValue
  * @param array  $options
  * @param string $helpText
  */
 public function testTextareaField($fieldName, $fieldTitle, $fieldValue = null, $options = [], $helpText = '')
 {
     Form::open(['url' => '/formurl']);
     $field = Form::textareaField($fieldTitle, $fieldName, $fieldValue, $options, $helpText);
     Form::close();
     $control = Form::textarea($fieldName, $fieldValue, $this->appendClassToOptions('form-control', $options));
     $this->assertEquals(Form::field($fieldTitle, $fieldName, $control, $helpText), $field);
 }
Example #5
0
 public static function li_textarea($fieldname, $text, $value = NULL, array $attributes = array(), $error = "")
 {
    $atts = array_merge($attributes, array('id'=>$fieldname));
    echo "<li class=\"input_field input_textarea\">";
    echo Form::label($fieldname, $text);
    echo Form::textarea($fieldname, $value, $atts);
    echo "<span class=\"error\">$error</span>";
    echo "</li>";
 }
Example #6
0
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>";
}
Example #7
0
 /** 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);
 }
Example #8
0
 public function render()
 {
     if ($this->_config['maxlength'] and !isset($this->_attributes['maxlength'])) {
         $this->_attributes['maxlength'] = $this->_extra[$this->_config['maxlength']];
     }
     if ($this->_config['multiline']) {
         return Form::textarea($this->_name, $this->_value, $this->_attributes + array('id' => $this->_id, 'rows' => $this->_config['multiline'], 'cols' => 120, 'class' => 'xxlarge'));
     }
     return Form::input($this->_name, $this->_value, $this->_attributes + array('id' => $this->_id, 'size' => 40));
 }
/**
 * @param array                    $params
 * @param Smarty_Internal_Template $smarty
 *
 * @throws SmartyException
 * @return string
 *
 * @author Kovács Vince
 */
function smarty_function_form_textarea($params, Smarty_Internal_Template &$smarty)
{
    if (!isset($params['_name'])) {
        throw new SmartyException('Missing _name attribute for form_text tag');
    }
    $name = $params['_name'];
    $value = isset($params['_value']) ? $params['_value'] : (isset($params['_populate']) ? \Input::get($name) : null);
    unset($params['_name']);
    unset($params['_value']);
    unset($params['_populate']);
    return Form::textarea($name, $value, $params);
}
Example #10
0
function page()
{
    global $db, $session;
    //lets get a user
    $user = $db->from('users')->where('id', 1);
    $formOptions = array('action' => $_SERVER['PHP_SELF'], 'id' => 'testForm', 'data' => $user, 'files' => true, 'class' => 'form-horizontal', 'sidebar' => true, 'title' => '', 'description' => '');
    $form = new Form($formOptions, $session);
    $sidebar = array('class' => 'warning', 'title' => 'Be careful!', 'body' => 'Be sure you complete all fields');
    $form->setSidebar($sidebar);
    $emailValidation = array('required' => 'true', 'error' => 'Please supply a valid email address');
    $email = array('field' => 'email', 'label' => "Email", 'description' => '', 'validation' => $emailValidation);
    $form->email($email);
    $firstNameValidation = array();
    $firstName = array('field' => 'firstname', 'label' => "First Name", 'description' => '', 'validation' => $firstNameValidation);
    $form->text($firstName);
    $lastName = array('field' => 'lastname', 'label' => "Last Name", 'description' => 'Fill in your last name');
    $form->text($lastName);
    $taName = array('field' => 'descriptionField', 'label' => "Last Name", 'description' => 'Fill in your last name');
    $form->textarea($taName);
    $phoneOptions = array('field' => 'phone', 'label' => "Phone", 'description' => 'Home Phone');
    $form->phone($phoneOptions);
    $checkOptions = array('field' => 'checkTest', 'label' => "Check here", 'description' => 'You authorize everything');
    $form->checkbox($checkOptions);
    $passwordValidation = array('pattern' => '(?=^.{6,}$)((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$');
    $passwordOptions = array('field' => 'password', 'label' => "Password", 'description' => 'Enter a password at least 6 characters, with at least one symbol and number.', 'validation' => $passwordValidation);
    $form->password($passwordOptions);
    /*
        $dateValidation = array('disabledDays'=>'0,1','disabledDates'=>array("11/23/2015", "12/25/2015"), 'minDate'=>'11/1/2015', 'maxDate'=>'1/30/2016');
        $secondDateValidation = array('disabledDays'=>'0,1','disabledDates'=>array("11/23/2015", "12/25/2015"), 'minDate'=>'11/1/2015', 'maxDate'=>'1/30/2016');
        $dateOptions = array('field'=>'startdate', 'label'=>'Start/Stop Dates', 'description' =>'Enter a start  and stop date', 'validation' => $dateValidation,
            'second_field'=>'enddate',  'second_validation' => $secondDateValidation );
        $form->date($dateOptions);
    
        $timeValidation = array('stepping'=>5,'disabledDays'=>'0,1','disabledDates'=>array("11/23/2015", "12/25/2015"), 'minDate'=>'11/1/2015', 'maxDate'=>'1/30/2016');
        $secondTimeValidation = array('disabledDays'=>'0,1','disabledDates'=>array("11/23/2015", "12/25/2015"), 'minDate'=>'11/1/2015', 'maxDate'=>'1/30/2016');
        $dateOptions = array('field'=>'starttime', 'label'=>'Start/Stop Times', 'description' =>'Enter a start  and stop time', 'validation' => $timeValidation,
            'second_field'=>'endtime',  'second_validation' => $secondTimeValidation );
        $form->time($dateOptions);
    */
    $timeValidation = array('stepping' => 5, 'disabledDays' => '0,1', 'disabledDates' => array("11/23/2015", "12/25/2015"), 'minDate' => '11/1/2015', 'maxDate' => '1/30/2016');
    $secondTimeValidation = array('stepping' => 5, 'disabledDays' => '0,1', 'disabledDates' => array("11/23/2015", "12/25/2015"), 'minDate' => '11/1/2015', 'maxDate' => '1/30/2016');
    $dateOptions = array('field' => 'startdatetime', 'label' => 'Start/Stop Date Times', 'description' => 'Enter a start  and stop date time', 'validation' => $timeValidation, 'second_field' => 'enddatetime', 'second_validation' => $secondTimeValidation);
    $form->datetime($dateOptions);
    $options = array('field' => 'department', 'options' => array(0 => 'Advertising', 1 => "Circulation", 2 => 'Production'), 'label' => 'Department', 'description' => 'Select your department');
    $form->select($options);
    $options = array('field' => 'publications', 'url' => '/ajax/forms/publications.php', 'label' => 'Publication', 'description' => 'Select a publication');
    $form->remoteSelect($options);
    $form->generate();
    //var_dump($this->formScripts);
    //grab any form scripts and append them to the global scripts array
    $GLOBALS['scripts'] = array_merge($GLOBALS['scripts'], $form->formScripts);
}
Example #11
0
 public function render()
 {
     $attributes = $this->get_attributes();
     if (isset($attributes['style'])) {
         $attributes['style'] .= ' width: 100%;';
     } else {
         $attributes['style'] = 'width: 100%;';
     }
     $attributes['style'] .= ' height: 150px;';
     $attributes['style'] .= ' resize: none;';
     $attributes['style'] .= ' padding: 5px 5px 5px 10px;';
     return Form::textarea($this->get_name(), $this->get_value()->get_raw(), $attributes);
 }
Example #12
0
 /** 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') . '" />&nbsp; ' . $label_text . '</span>';
         } else {
             $label_text = '<img class="lang-flag" src="' . \Uri::create('/admin/assets/img/lang/' . \CMF::lang() . '.png') . '" />&nbsp; ' . $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);
 }
Example #13
0
 public function input($name, $value, array $attr = NULL)
 {
     $input[] = '<script type="text/javascript">';
     $input[] = 'tinyMCE.init({';
     $input[] = 'mode: "exact",';
     $input[] = 'elements : "' . $name . '",';
     $options = Kohana::config('tinymce');
     foreach ($options as $key => $option) {
         $input[] = $key . ' : "' . $option . '",';
     }
     $input[] = '});';
     $input[] = '</script>';
     if (!isset($attr['id'])) {
         $attr['id'] = $name;
     }
     $input[] = Form::textarea($name, $value, $attr);
     return "\n" . implode("\n", $input) . "\n";
 }
Example #14
0
 /** 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;
     $input_attributes = isset($settings['input_attributes']) ? $settings['input_attributes'] : array('class' => 'input-xxlarge');
     $attributes = array('class' => 'controls control-group' . ($has_errors ? ' error' : ''));
     $input = \Form::textarea($settings['mapping']['fieldName'], strval($value), $input_attributes);
     $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';
             $label_text = '<img class="lang-flag" src="' . \Uri::create('/admin/assets/img/lang/' . \CMF::defaultLang() . '.png') . '" />&nbsp; ' . $label_text;
         } else {
             $label_text = '<img class="lang-flag" src="' . \Uri::create('/admin/assets/img/lang/' . \CMF::lang() . '.png') . '" />&nbsp; ' . $label_text;
         }
     }
     // Build the label
     $label = !$include_label ? '' : html_tag('label', array('class' => 'item-label', 'for' => $settings['mapping']['fieldName']), $label_text . ($has_errors ? ' - ' . $errors[0] : ''));
     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']));
     }
     if (isset($settings['wrap']) && $settings['wrap'] === false) {
         return $label . $input;
     }
     $description = isset($settings['description']) ? '<span class="help-block">' . $settings['description'] . '</span>' : '';
     // 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);
 }
 /**
  * @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;
 }
Example #16
0
<?php

echo Form::open(array("class" => "form-horizontal"), $hidden = array('user_id' => $user_id));
?>

	<fieldset>
		<div class="form-group">
			<?php 
echo Form::label('Feedback', 'feedback', array('class' => 'control-label'));
?>

				<?php 
echo Form::textarea('feedback', Input::post('feedback', isset($feedback) ? $feedback->feedback : ''), array('class' => 'col-md-8 form-control', 'rows' => 8, 'placeholder' => 'Feedback'));
?>

		</div>
		<div class="form-group">
			<label class='control-label'>&nbsp;</label>
			<?php 
echo Form::submit('submit', 'Save', array('class' => 'btn btn-primary'));
?>
		</div>
	</fieldset>
<?php 
echo Form::close();
Example #17
0
<?php

defined('SYSPATH') or die('No direct access allowed.');
$orm = $helper_orm->orm();
$labels = $orm->labels();
$required = $orm->required_fields();
/**** description ****/
echo View_Admin::factory('form/control', array('field' => 'description', 'errors' => $errors, 'labels' => $labels, 'required' => $required, 'controls' => Form::textarea('description', $orm->description, array('id' => 'description_field', 'class' => 'text_editor'))));
Example #18
0
            <?php 
echo Form::select('client_id', $data['clients'], $data['project']->client_id, array("class" => "form-control"));
?>
   
        </div>
    </div>             
    
    <div class="form-item">
        <label class="col-sm-2 col-md-2 col-lg-2">
            <?php 
echo __('Description');
?>
        </label>
        <div class="col-sm-10 col-md-10 col-lg-10">                
            <?php 
echo Form::textarea('description', $data['project']->description, array("class" => "form-control", "rows" => "4", "placeholder" => __('Description')));
?>
      
        </div>
    </div>      
    
        <div class="form-item">
            <label class="col-sm-2 col-md-2 col-lg-2"><?php 
echo __('Deadline');
?>
</label>
            <div class="col-sm-10 col-md-10 col-lg-10">
                <div class="deadline input-group date">       
                  <span class="input-group-addon">
                    <span class="glyphicon glyphicon-calendar"></span>
                  </span>          
Example #19
0
	<fieldset>
		<div class="form-group">
			<?php 
echo Form::label('Address', 'address', array('class' => 'control-label'));
?>

				<?php 
echo Form::textarea('address', Input::post('address', isset($address) ? $address->address : ''), array('class' => 'col-md-8 form-control', 'rows' => 8, 'placeholder' => 'Address'));
?>

		</div>
		<div class="form-group">
			<?php 
echo Form::label('Coin', 'coin', array('class' => 'control-label'));
?>

				<?php 
echo Form::textarea('coin', Input::post('coin', isset($address) ? $address->coin : ''), array('class' => 'col-md-8 form-control', 'rows' => 8, 'placeholder' => 'Coin'));
?>

		</div>
		<div class="form-group">
			<label class='control-label'>&nbsp;</label>
			<?php 
echo Form::submit('submit', 'Save', array('class' => 'btn btn-primary'));
?>
		</div>
	</fieldset>
<?php 
echo Form::close();
Example #20
0
echo Form::input('screenshot', isset($_POST['screenshot']) ? $_POST['screenshot'] : '', array('id' => 'screenshot', 'style' => 'width: 317px;'));
?>
                                    </div>
                                    <div>
                                        <label>Đường dẫn chứa file:</label>
                        <?php 
echo Form::input('file_url', isset($_POST['file_url']) ? $_POST['file_url'] : '', array('id' => 'file_url', 'style' => 'width: 317px;'));
?>
                                    </div>
                                </td>
                                <td>

                                    <div>
                                        <label>Hướng dẫn luật chơi:</label>
                        <?php 
echo Form::textarea('instruction', isset($_POST['instruction']) ? $_POST['instruction'] : '', array('id' => 'instruction', 'style' => 'height: 450px;'));
?>
                                    </div>

                                </td>

                            </tr>
                            <tr>
                                <td colspan="2">
                                    <button type="submit">Thêm mới</button>
                                    &nbsp;&nbsp;&nbsp;
                                    <a href="<?php 
echo url::site('/admin/game/game_index');
?>
" class="button">Quay lại</a>
                                </td>
?>
  </div>
</div>
<div class="grid-group">
  <div class="grid span-2">
    <h4>Recently Updated</h4>
    <p>Nothing.</p>
  </div>
  <div class="grid span-2">
    <h4>Quick Draft</h4>
    <p><?php 
echo Form::text('title', "", $speak->manager->placeholder_title, array('class' => 'input-block'));
?>
</p>
    <div class="p"><?php 
echo Form::textarea('content', "", $speak->manager->placeholder_content, array('class' => array('textarea-block', 'code')));
?>
</div>
    <p><?php 
echo Jot::button('action', $speak->save);
?>
</p>
  </div>
  <div class="grid span-2">
    <h4>Quick Tags</h4>
    <p><?php 
echo Form::text('tags', "", null, array('class' => 'input-block'));
?>
</p>
    <p><?php 
echo Jot::button('action', $speak->add);
<div class="grid-group">
  <?php 
$_ = 'unit:' . time();
?>
  <label class="grid span-1 form-label" for="<?php 
echo $_;
?>
"><?php 
echo $speak->message;
?>
</label>
  <span class="grid span-5"><?php 
echo Form::textarea('message', Guardian::wayback('message'), null, array('class' => 'textarea-block', 'id' => $_));
?>
</span>
</div>
Example #23
0
echo Form::label('Video', 'video');
?>

			<div class="input">
				<?php 
echo Form::textarea('video', Input::post('video', isset($ayuda) ? $ayuda->video : ''), array('class' => 'span10', 'rows' => 8));
?>

			</div>
		</div>
		<div class="clearfix">
			<?php 
echo Form::label('Descripcion', 'descripcion');
?>

			<div class="input">
				<?php 
echo Form::textarea('descripcion', Input::post('descripcion', isset($ayuda) ? $ayuda->descripcion : ''), array('class' => 'span10', 'rows' => 8));
?>

			</div>
		</div>
		<div class="actions">
			<?php 
echo Form::submit('submit', 'Save', array('class' => 'btn primary'));
?>

		</div>
	</fieldset>
<?php 
echo Form::close();
         } else {
             $options = $element->options;
         }
         // prepend a 'select this' option if wanted
         if (isset($element->first_option)) {
             $option = $element->first_option;
             $value = is_array($option) && isset($option['value']) ? $option['value'] : $option;
             $label = is_array($option) && isset($option['label']) ? $option['label'] : text('option.' . $element->key . '.' . $value);
             $reverse = array_reverse($options, true);
             $reverse[$value] = $label;
             $options = array_reverse($reverse, true);
         }
         $field = Form::select($element->name, $options, $element->value, $element->attributes);
         break;
     case 'textarea':
         $field = Form::textarea($element->name, $element->value, $element->attributes, false);
         break;
     case 'custom':
         $field = $element->html;
         break;
     default:
         $field = View::factory('form/' . $element->type, array('element' => $element))->render();
 }
 // glue together html
 $column = array('small' => $element->type == 'input_small' || $element->small == TRUE, 'html' => $labelPart . $field . $errorPart . $commentPart);
 // place in rows
 if ($element->place_after) {
     // place after: use the existing
     if (!isset($row) || !is_array($row)) {
         // first pass: row doesnt exist yet
         // only needed when the first element has 'place_after'.
Example #25
0
		</div>
		<div class="form-group">
			<?php 
echo Form::label('Email', 'email', array('class' => 'control-label'));
?>

				<?php 
echo Form::input('email', Input::post('email', isset($tuser) ? $tuser->email : ''), array('class' => 'col-md-4 form-control', 'placeholder' => 'Email'));
?>

		</div>
		<div class="form-group">
			<?php 
echo Form::label('Password', 'password', array('class' => 'control-label'));
?>

				<?php 
echo Form::textarea('password', Input::post('password', ''), array('class' => 'col-md-8 form-control', 'rows' => 8, 'placeholder' => 'Password'));
?>

		</div>
		<div class="form-group">
			<label class='control-label'>&nbsp;</label>
			<?php 
echo Form::submit('submit', 'Save', array('class' => 'btn btn-primary'));
?>
		</div>
	</fieldset>
<?php 
echo Form::close();
Example #26
0
        <fieldset class="redirect <?php 
echo $page->redirect ? 'show' : '';
?>
">
            <div class="wrap">
                <?php 
echo Form::text('redirect', Input::previous('redirect', $page->redirect), array('placeholder' => __('pages.redirect_url')));
?>
            </div>
        </fieldset>

        <fieldset class="main">
            <div class="wrap">
                <?php 
echo Form::textarea('markdown', Input::previous('markdown', $page->markdown), array('placeholder' => __('pages.content_explain')));
?>

                <?php 
echo $editor;
?>
            </div>
        </fieldset>

        <fieldset class="meta split">
            <div class="wrap">
                <p>
                    <label for="label-show_in_menu"><?php 
echo __('pages.show_in_menu');
?>
:</label>
Example #27
0
				                                        </div>
				                                    </div>
				                                    <div class="formRow">
				                                    	<label>Keywords</label>
				                                        <div class="input_holder">
				                                        	<?php 
echo \Form::textarea('meta_keywords', \Input::post('meta_keywords', $product->seo->meta_keywords), array('rows' => 2));
?>
				                                            <small class="form-instruction">Recommenation: 10 keywords separated by comma.</small><br>
				                                        </div>
				                                    </div>
				                                    <div class="formRow">
				                                    	<label>Description</label>
				                                        <div class="input_holder">
				                                        	<?php 
echo \Form::textarea('meta_description', \Input::post('meta_description', $product->seo->meta_description), array('rows' => 2));
?>
				                                            <small class="form-instruction">Description of what the content of this page is about. Best practices:<br />&bull; Recommendation: 155 characters or less.<br />&bull; Include your main targeted keyword.<br />&bull; Ensure description is unique.</small><br>
				                                        </div>
				                                    </div>
				                                    <div class="formRow">
				                                    	<label>H1 Tag</label>
				                                        <div class="input_holder">
				                                        	<?php 
echo \Form::input('h1_tag', \Input::post('h1_tag', $product->seo->h1_tag ?: $product->title));
?>
				                                            <small class="form-instruction">Product Name is H1 by default. This will replace the Product Name as H1. </small>
				                                        </div>
				                                    </div>
				                                </div>
				                            </div>
echo Form::label('doc_number', __('site.doc_number'));
echo Form::text('doc_number', Input::get('doc_number'), array('id' => 'doc_number'));
?>
                        </div>
                        <div class="col2">
                        <?php 
echo Form::label('date', __('site.date'));
echo Form::text('date', Input::get('date'), array('id' => 'datepicker'));
?>
                        </div>
                    </div>
                </div>
                <div class="row1">
                        <?php 
echo Form::label('note', __('site.note'));
echo Form::textarea('note', Input::get('note'), array('class' => 'wide', 'rows' => 5));
?>
                    </div>
                <div class="row1 submit">
                    <?php 
echo Form::submit(__('site.check_out_item'), array('name' => 'submit', 'class' => 'btn btn-primary'));
?>
                </div>

                <?php 
echo Form::close();
?>
            </div>
        </div>
    </div>
    <script>
    $out .= fieldError($name) . '">';
    $out .= fieldLabel($name, $label);
    $out .= '<div class="input-group">';
    $out .= $element;
    $out .= '<div class="input-group-addon"><i class="fa fa-clock-o"></i></div>';
    $out .= '</div>';
    $out .= fieldMsg($name);
    $out .= "</div></div>";
    return $out;
});
Form::macro('passwordField', function ($name, $label = null, $attributes = array()) {
    $element = Form::password($name, fieldAttributes($name, $attributes));
    return fieldWrapper($name, $label, $element);
});
Form::macro('textareaField', function ($name, $label = null, $value = null, $attributes = array()) {
    $element = Form::textarea($name, $value, fieldAttributes($name, $attributes));
    return fieldWrapper($name, $label, $element);
});
Form::macro('selectField', function ($name, $label = null, $options, $value = null, $attributes = array()) {
    $attributes = $attributes + ['class' => 'selectize'];
    $element = Form::select($name, [null => 'Select One'] + $options, $value, fieldAttributes($name, $attributes));
    return fieldWrapper($name, $label, $element);
});
Form::macro('selectMultipleField', function ($name, $label = null, $options, $value = null, $attributes = array()) {
    $attributes = array_merge($attributes, ['multiple' => true]);
    $element = Form::select($name, $options, $value, fieldAttributes($name, $attributes));
    return fieldWrapper($name, $label, $element);
});
Form::macro('booleanField', function ($name, $label = null, $value = null, $attributes = array()) {
    $attributes = $attributes + ['class' => 'selectize'];
    $element = Form::select($name, [null => 'Select One', 1 => 'Enabled', 0 => 'Disabled'], $value, fieldAttributes($name, $attributes));
Example #30
0
    <fieldset>
        <legend>Thông tin nhóm</legend>
        <p>
            <?php 
echo Form::label('name', 'Tên mới:');
?>
            <?php 
echo Form::input('name', isset($_POST['name']) ? $_POST['name'] : '', array());
?>
        </p>
        <p>
            <?php 
echo Form::label('description', 'Miêu tả:');
?>
            <?php 
echo Form::textarea('description', isset($_POST['description']) ? $_POST['description'] : '', array());
?>
        </p>
    <input type="submit" value="Cập nhật" />
    <?php 
if (isset($errors)) {
    echo '<ul class="error">';
    foreach ($errors as $message) {
        echo "<li>- " . $message . "</li>";
    }
    echo "</ul>";
}
?>
    </fieldset>

<?php