print errors_for($this->user, 'role'); ?> </div> </div> <?php } ?> <div class="form-group"> <label class="col-lg-2 control-label" for="user-description"><?php print t('Description'); ?> </label> <div class="col-lg-10"> <textarea id="user-description" class="form-control" name="user[description]" class="wysiwygize"><?php print wysiwyg($this->user->description); ?> </textarea> <?php print errors_for($this->user, 'description'); ?> </div> </div> <div class="pull-right"> <a href="<?php print h($this->user->is_new_record() ? $router->users_url() : $router->user_url($this->user)); ?> " class="btn btn-default"> <span class="glyphicon glyphicon-arrow-left"></span> <?php
function formfield($field) { $class = 'form-control'; if ($field['required']) { $class .= ' required'; } if (!empty($field['class'])) { $class .= ' ' . $field['class']; } if (empty($field['id'])) { $field['id'] = slug($field['key']) . 'Input'; } switch ($field['type']) { case "html": return wysiwyg($field['id'], $field['key'], $field['value']); break; case 'textarea': $rows = !empty($field['rows']) ? $field['rows'] : 5; return '<textarea id="' . $field['id'] . '" name="' . $field['key'] . '" class="' . $class . '" rows="' . $rows . '">' . $field['value'] . '</textarea>'; break; case "multitext": $html = '<div class="input-group"><input type="text" data-key="' . $field['key'] . '" data-target="' . $field['id'] . '" value="" placeholder="' . $field['label'] . '" id="input-' . $field['id'] . '" class="form-control" /><span class="input-group-btn"> <button data-target="' . $field['id'] . '" class="btn btn-primary btn-add-multitext" type="button"><i class="fa fa-plus"></i></button> </span></div>'; $html .= '<div id="' . $field['id'] . '" class="well well-sm autocomplete-list" style="height: 150px; overflow: auto;">'; //$html .= print_r($field['value'], 1); foreach ($field['value'] as $k => $val) { $html .= '<div class="list-group-item" id="' . $field['id'] . '-' . $k . '"><div class="input-group"><span class="input-group-btn"><button class="btn btn-default btn-minus-circle" type="button"><i class="fa fa-minus-circle text-danger"></i></button></span><input class="form-control" type="text" name="' . $field['key'] . '[]" value="' . $val . '"></div></div>'; } /* * <div id="downloadsInput1"><i class="fa fa-minus-circle text-danger"></i> TenXIcon<input type="hidden" name="downloads[]" value="1"></div> */ $html .= '</div>'; return $html; break; case "autocomplete": return '<input type="hidden" name="' . $field['key'] . '" value="' . @$field['value']['id'] . '" id="' . $field['id'] . '"><input data-target="' . $field['id'] . '" data-limit="1" data-url="' . $field['url'] . '" type="' . $field['type'] . '" name="' . $field['key'] . '_display" class="' . $class . '" value="' . @$field['value']['name'] . '" />'; break; case 'autocomplete_list': $html = '<input type="autocomplete" data-limit="0" data-key="' . $field['key'] . '" data-target="' . $field['id'] . '" data-url="' . $field['url'] . '" value="" placeholder="' . $field['label'] . '" id="input-' . $field['id'] . '" class="form-control" />'; $html .= '<div id="' . $field['id'] . '" class="well well-sm autocomplete-list" style="height: 150px; overflow: auto;">'; //$html .= print_r($field['value'], 1); if (!empty($field['value']) && is_array($field['value'])) { foreach ($field['value'] as $download) { $html .= '<div class="list-group-item" id="' . $field['id'] . '-' . $download['id'] . '"><div class="input-group"><span class="input-group-btn"><button class="btn btn-default btn-minus-circle" type="button"><i class="fa fa-minus-circle text-danger"></i></button></span><span class="form-control"> ' . $download['name'] . '</span><input type="hidden" name="' . $field['key'] . '[]" value="' . $download['id'] . '"></div></div>'; } } /* * <div id="downloadsInput1"><i class="fa fa-minus-circle text-danger"></i> TenXIcon<input type="hidden" name="downloads[]" value="1"></div> */ $html .= '</div>'; return $html; break; case 'scrollbox': $return = '<div class="scrollbox"> <ul class="list-group">'; foreach ($field['options'] as $option) { $return .= '<li class="list-group-item">'; if (in_array($option['ams_page_id'], $field['value'])) { $return .= '<input type="checkbox" name="' . $field['key'] . '[]" value="' . $option['ams_page_id'] . '" checked="checked">' . $option['name']; } else { $return .= '<input type="checkbox" name="' . $field['key'] . '[]" value="' . $option['ams_page_id'] . '">' . $option['name']; } $return .= '</li>'; } $return .= '</ul></div>'; return $return; break; case "select": $return = '<select name="' . $field['key'] . '" id="' . $field['key'] . 'Input" class="form-control">'; foreach ($field['options'] as $ok => $ov) { if ($ok == $field['value']) { $return .= '<option selected value="' . $ok . '">' . $ov . '</option>'; } else { $return .= '<option value="' . $ok . '">' . $ov . '</option>'; } } $return .= '</select>'; return $return; break; case "image": return '<a href="" id="thumb-' . slug($field['key']) . '" data-toggle="image" class="img-thumbnail">' . '<img src="' . $field['thumb'] . '" alt="" title="" data-placeholder="' . $field['placeholder'] . '" /></a>' . '<input type="hidden" name="' . $field['key'] . '" value="' . $field['value'] . '" id="input-' . slug($field['key']) . '" />'; break; case "date": registry('document')->addScript('view/plugins/datetimepicker/moment.min.js'); \Core\Registry::getInstance()->get('document')->addScript('view/plugins/datetimepicker/bootstrap-datetimepicker.min.js'); \Core\Registry::getInstance()->get('document')->addStyle('view/plugins/datetimepicker/bootstrap-datetimepicker.min.css'); $dateformat = dateformat_PHP_to_MomentJs(\Core\Registry::getInstance()->get('language')->get('date_format_short')); $id = !empty($field['id']) ? $field['id'] : slug('input-' . $field['key']); return '<input id="' . $id . '" data-date-format="' . $dateformat . '" type="text" name="' . $field['key'] . '" class="' . $class . ' dateinput" value="' . $field['value'] . '" />' . '' . '<script>docReady(function () {' . '$(\'#' . $id . '\').datepicker({format: "' . $dateformat . '"});});' . '</script>'; break; case "datetime": registry('document')->addScript('view/plugins/datetimepicker/moment.min.js'); \Core\Registry::getInstance()->get('document')->addScript('view/plugins/datetimepicker/bootstrap-datetimepicker.min.js'); \Core\Registry::getInstance()->get('document')->addStyle('view/plugins/datetimepicker/bootstrap-datetimepicker.min.css'); $dateformat = dateformat_PHP_to_MomentJs(\Core\Registry::getInstance()->get('language')->get('date_time_format_short')); $id = !empty($field['id']) ? $field['id'] : slug('input-' . $field['key']); return '<input id="' . $id . '" data-date-format="' . $dateformat . '" type="text" name="' . $field['key'] . '" class="' . $class . ' datetimeinput" value="' . $field['value'] . '" />' . '' . '<script>docReady(function () {' . '$(\'#' . $id . '\').datetimepicker({format: "' . $dateformat . '"});});' . '</script>'; break; case "display": return '<span class="' . $class . '">' . $field['value'] . '</span><input type="hidden" name="' . $field['key'] . '" class="' . $class . '" value="' . $field['value'] . '" />'; break; case "text": default: return '<input type="' . $field['type'] . '" name="' . $field['key'] . '" class="' . $class . '" value="' . $field['value'] . '" />'; } }