function search_form_widget_form($num = 1) { $widget = 'search_form_widget_' . $num; // имя для формы и опций = виджет + номер // получаем опции $options = mso_get_option($widget, 'plugins', array()); if (!isset($options['header'])) { $options['header'] = ''; } if (!isset($options['text'])) { $options['text'] = t('Что искать?'); } if (!isset($options['submit'])) { $options['submit'] = t('Поиск'); } if (!isset($options['style_text'])) { $options['style_text'] = ''; } if (!isset($options['style_submit'])) { $options['style_submit'] = ''; } if (!isset($options['text_posle'])) { $options['text_posle'] = ''; } // вывод самой формы $CI =& get_instance(); $CI->load->helper('form'); $form = mso_widget_create_form(t('Заголовок'), form_input(array('name' => $widget . 'header', 'value' => $options['header']))); $form .= mso_widget_create_form(t('Текст подсказки'), form_input(array('name' => $widget . 'text', 'value' => $options['text']))); $form .= mso_widget_create_form(t('Текст на кнопке'), form_input(array('name' => $widget . 'submit', 'value' => $options['submit']))); $form .= mso_widget_create_form(t('CSS-стиль текста'), form_input(array('name' => $widget . 'style_text', 'value' => $options['style_text']))); $form .= mso_widget_create_form(t('CSS-стиль кнопки'), form_input(array('name' => $widget . 'style_submit', 'value' => $options['style_submit']))); $form .= mso_widget_create_form(t('Текст внизу'), form_textarea(array('name' => $widget . 'text_posle', 'value' => $options['text_posle'], 'rows' => '3'))); return $form; }
/** * build (only) the field (widhout labels or borders) * * @access public * @return void */ function build() { $output = ""; if (!isset($this->cols)) { $this->cols = 42; } if (!isset($this->rows)) { $this->rows = 15; } $this->_getValue(); switch ($this->status) { case "disabled": case "show": if (!isset($this->value)) { $output = RAPYD_FIELD_SYMBOL_NULL; } elseif ($this->value == "") { $output = ""; } else { $output = '<span style="font-size:9px; width: 100%; height:100px; overflow: auto">' . nl2br(htmlspecialchars($this->value)) . '</span>'; //I know I know.. } break; case "create": case "modify": $attributes = array('name' => $this->name, 'id' => $this->name, 'cols' => $this->cols, 'rows' => $this->rows, 'onclick' => $this->onclick, 'onchange' => $this->onchange, 'class' => $this->css_class, 'style' => $this->style); $output = form_textarea($attributes, $this->value) . $this->extra_output; break; case "hidden": $output = form_hidden($this->name, $this->value); break; default: } $this->output = $output; }
function generateForm() { $output = form_hidden('edit[step]', 'confirm'); $player = $this->registration->user(); if (!$player) { return false; } $noneditable = array(); $noneditable[] = array('Name', l($player->fullname, url("person/view/{$player->id}"))); $noneditable[] = array('Member ID', $player->member_id); $noneditable[] = array('Event', l($this->event->name, url("event/view/{$this->event->registration_id}"))); $noneditable[] = array('Registered Price', $this->registration->total_amount); $form = '<div class="pairtable">' . table(NULL, $noneditable) . '</div>'; $pay_opts = getOptionsFromEnum('registrations', 'payment'); array_shift($pay_opts); $form .= form_select('Registration Status', 'edit[payment]', $this->registration->payment, $pay_opts); $form .= form_textarea('Notes', 'edit[notes]', $this->registration->notes, 45, 5); $output .= form_group('Registration details', $form); if ($this->formbuilder) { $this->formbuilder->bulk_set_answers_sql('SELECT qkey, akey FROM registration_answers WHERE order_id = ?', array($this->registration->order_id)); if (count($this->formbuilder->_answers) > 0) { $output .= form_group('Registration answers', $this->formbuilder->render_editable(true)); } else { $output .= form_group('Registration answers', $this->formbuilder->render_editable(false)); } } $output .= form_submit('Submit') . form_reset('Reset'); return form($output); }
function form_control(&$setting) { switch ($setting->type) { default: case 'text': $form_control = form_input(array('id' => $setting->slug, 'name' => $setting->slug, 'value' => $setting->value, 'class' => 'text width-20')); break; case 'textarea': $form_control = form_textarea(array('id' => $setting->slug, 'name' => $setting->slug, 'value' => $setting->value, 'class' => 'width-20')); break; case 'password': $form_control = form_password(array('id' => $setting->slug, 'name' => $setting->slug, 'value' => $setting->value, 'class' => 'text width-20')); break; case 'select': $form_control = form_dropdown($setting->slug, $this->_format_options($setting->options), $setting->value, 'class="width-20"'); break; case 'checkbox': case 'radio': $func = $setting->type == 'checkbox' ? 'form_checkbox' : 'form_radio'; $form_control = ''; foreach ($this->_format_options($setting->options) as $value => $label) { $form_control .= ' ' . form_radio(array('id' => $setting->slug, 'name' => $setting->slug, 'checked' => $setting->value == $value, 'value' => $value)) . ' ' . $label; } break; } return $form_control; }
function foundation_form_input($name, $args = array()) { $isValid = form_error($name) ? false : true; if (!empty($args['default_value'])) { $default_value = $args['default_value']; } else { $default_value = null; } $class = !empty($args['class']) ? $args['class'] : ''; $node = "<label>" . humanize($name); if (!empty($args['as'])) { switch ($args['as']) { case 'collection': if (!empty($args['collection'])) { if ($args['allow_blank']) { $args['collection'] = array_merge(array(" " => " "), $args['collection']); } $node .= form_dropdown($name, $args['collection'], set_value($name)); } break; case 'text': $node .= form_textarea($name, set_value($name, $default_value)); break; default: # ... break; } } else { $node .= form_input($name, set_value($name, $default_value)); } $node .= form_error($name, '<div class="error">', '</div>'); $node .= "</label>"; return $node; }
/** * build (only) the field (widhout labels or borders) * * @access public * @return void */ function build() { $output = ""; if (!isset($this->cols)) { $this->cols = 42; } if (!isset($this->rows)) { $this->rows = 15; } $this->_getValue(); switch ($this->status) { case "disabled": case "show": if (!isset($this->value)) { $output = RAPYD_FIELD_SYMBOL_NULL; } elseif ($this->value == "") { $output = ""; } else { $output = '<div style=" font: 11px \'courier new\',tahoma; color: #111; width: 100%; overflow: auto"><pre>' . htmlspecialchars($this->value) . '</pre></div>'; } break; case "create": case "modify": $attributes = array('name' => $this->name, 'id' => $this->name, 'cols' => $this->cols, 'rows' => $this->rows, 'onclick' => $this->onclick, 'onchange' => $this->onchange, 'class' => $this->css_class, 'style' => 'font-size:9px;font: 11px \'courier new\',tahoma; color: #111;'); $output = form_textarea($attributes, $this->value) . $this->extra_output; break; case "hidden": $output = ""; //form_hidden($this->name, $this->value); break; default: } $this->output = $output; }
function centinelas() { $this->load->helper('directory'); $this->load->library('table'); $tmpl = array('row_start' => '<tr valign="top">'); $this->table->set_template($tmpl); $map = directory_map('./system/logs/'); $lista = array(); foreach ($map as $file) { if ($file != 'index.html') { $lista[] = anchor("supervisor/mantenimiento/borracentinela/{$file}", 'X') . " <a href='javascript:void(0)' onclick=\"carga('{$file}')\" >{$file}</a>"; } } $copy = "<br><a href='javascript:void(0)' class='mininegro' onclick=\"copiar()\" >Copiar texto</a>"; $tadata = array('name' => 'sql', 'id' => 'log', 'rows' => '20', 'cols' => '60'); $form = form_open('ejecutasql/filteredgrid/process') . form_textarea($tadata) . '<br>' . form_submit('mysubmit', 'Ejecutar como SQL') . form_close(); $this->table->add_row(ul($lista), '<b id="fnom">Seleccione un archivo de centinela</b><br>' . $form); $link = site_url('supervisor/mantenimiento/vercentinela'); $data['script'] = "<script>\n\t\t function carga(arch){\n\t\t link='{$link}'+'/'+arch;\n\t\t //alert(link);\n\t\t \$('#fnom').text(arch);\n\t\t \$('#log').load(link);\n\t\t };\n\t\t function copiar(){\n\t\t \$('#log').copy();\n\t\t };\n\t\t</script>"; $data['content'] = $this->table->generate(); $data['title'] = " Centinelas "; //script('plugins/jquery.clipboard.pack.js') $data["head"] = script("jquery.pack.js") . script('plugins/jquery.copy.min.js') . $this->rapyd->get_head() . style('marcos.css') . style('estilos.css'); $this->load->view('view_ventanas', $data); }
/** * Display settings sub-form for this variable type * * @param mixed $var_id The id of the variable: 'new' or numeric * @param array $var_settings The settings of the variable * @return array */ function display_settings($var_id, $var_settings) { // ------------------------------------- // Init return value // ------------------------------------- $r = array(); // ------------------------------------- // Build setting: options // ------------------------------------- $options = $this->get_setting('options', $var_settings); $r[] = array($this->setting_label(lang('variable_options'), lang('variable_options_help')), form_textarea(array('name' => $this->input_name('options'), 'value' => $options, 'rows' => '7', 'cols' => '40', 'style' => 'width:75%'))); // ------------------------------------- // Build setting: multiple? // ------------------------------------- $multiple = $this->get_setting('multiple', $var_settings); $r[] = array($this->setting_label(lang('allow_multiple_items')), '<label class="low-checkbox">' . form_checkbox($this->input_name('multiple'), 'y', $multiple == 'y', 'class="low-allow-multiple"') . lang('allow_multiple_items_label') . '</label>'); // ------------------------------------- // Build setting: separator // ------------------------------------- $separator = $this->get_setting('separator', $var_settings); $r[] = array($this->setting_label(lang('separator_character')), $this->separator_select($separator)); // ------------------------------------- // Build setting: multi interface // ------------------------------------- $multi_interface = $this->get_setting('multi_interface', $var_settings); $r[] = array($this->setting_label(lang('multi_interface')), $this->interface_select($multi_interface)); // ------------------------------------- // Return output // ------------------------------------- return $r; }
/** * Output form input * * @param array * @param array * @return string */ public function form_output($data) { $options['name'] = $data['form_slug']; $options['id'] = $data['form_slug']; $options['value'] = $data['value']; return form_textarea($options); }
function form_fckeditor($data = '', $value = '', $extra = '') { $CI =& get_instance(); $fckeditor_basepath = $CI->config->item('fckeditor_basepath'); require_once $_SERVER["DOCUMENT_ROOT"] . '/' . $fckeditor_basepath . 'fckeditor.php'; $instanceName = is_array($data) && isset($data['name']) ? $data['name'] : $data; $fckeditor = new FCKeditor($instanceName); if ($fckeditor->IsCompatible()) { $fckeditor->Value = html_entity_decode($value); $fckeditor->BasePath = $fckeditor_basepath; if ($fckeditor_toolbarset = $CI->config->item('fckeditor_toolbarset_default')) { $fckeditor->ToolbarSet = $fckeditor_toolbarset; } if (is_array($data)) { if (isset($data['value'])) { $fckeditor->Value = html_entity_decode($data['value']); } if (isset($data['basepath'])) { $fckeditor->BasePath = $data['basepath']; } if (isset($data['toolbarset'])) { $fckeditor->ToolbarSet = $data['toolbarset']; } if (isset($data['width'])) { $fckeditor->Width = $data['width']; } if (isset($data['height'])) { $fckeditor->Height = $data['height']; } } return $fckeditor->CreateHtml(); } else { return form_textarea($data, $value, $extra); } }
function display_field($data) { // Set a boolean telling if we're in Grid AND this textarea has // markItUp enabled $grid_markitup = $this->content_type() == 'grid' && isset($this->settings['show_formatting_buttons']) && $this->settings['show_formatting_buttons'] == 1; if ($grid_markitup) { // Load the Grid cell display binding only once if (!ee()->session->cache(__CLASS__, 'grid_js_loaded')) { ee()->javascript->output(' Grid.bind("textarea", "display", function(cell) { var textarea = $("textarea.markItUp", cell); // Only apply file browser trigger if a field was found if (textarea.size()) { textarea.markItUp(mySettings); EE.publish.file_browser.textarea(cell); } }); '); ee()->session->set_cache(__CLASS__, 'grid_js_loaded', TRUE); } } return form_textarea(array('name' => $this->name(), 'value' => $data, 'rows' => $this->settings['field_ta_rows'], 'dir' => $this->settings['field_text_direction'], 'class' => $grid_markitup ? 'markItUp' : '')); }
public function test_form_textarea() { $expected = <<<EOH <textarea name="notes" cols="40" rows="10" >Notes</textarea> EOH; $this->assertEquals($expected, form_textarea('notes', 'Notes')); }
function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id) { $angeltypes_select = ['' => _('All')]; foreach ($angeltypes as $angeltype) { $angeltypes_select[$angeltype['id']] = $angeltype['name']; } return page_with_title($shifttype_id ? _('Edit shifttype') : _('Create shifttype'), [msg(), buttons([button(page_link_to('shifttypes'), shifttypes_title(), 'back')]), form([form_text('name', _('Name'), $name), form_select('angeltype_id', _('Angeltype'), $angeltypes_select, $angeltype_id), form_textarea('description', _('Description'), $description), form_info('', _('Please use markdown for the description.')), form_submit('submit', _('Save'))])]); }
/** * Display form for adding/editing a shift entry. * @param string $angel * @param string $date * @param string $location * @param string $title * @param string $type * @param string $comment * * @return string */ function ShiftEntry_edit_view($angel, $date, $location, $title, $type, $comment, $freeloaded, $freeload_comment, $user_admin_shifts = false) { if ($user_admin_shifts) { $freeload_form = array(form_checkbox('freeloaded', _("Freeloaded"), $freeloaded), form_textarea('freeload_comment', _("Freeload comment (Only for shift coordination):"), $freeload_comment)); } else { $freeload_form = array(); } return page_with_title(_("Edit shift entry"), array(form(array(form_info(_("Angel:"), $angel), form_info(_("Date, Duration:"), $date), form_info(_("Location:"), $location), form_info(_("Title:"), $title), form_info(_("Type:"), $type), form_textarea('comment', _("Comment (for your eyes only):"), $comment), join("", $freeload_form), form_submit('submit', _("Save")))))); }
function bsText($title, $name, $value = '', $rows = 0, $cols = 0) { $cols = $cols == 0 ? 60 : $cols; $rows = $rows == 0 ? 3 : $rows; $data = array('name' => $name, 'id' => 'input_' . $name, 'value' => $value, 'class' => 'form-control', 'rows' => $rows, 'cols' => $cols); $inp = form_textarea($data); $str = '<div class="form-group"> <label for="input_' . $name . '">' . $title . '</label>' . $inp . '</div>'; return $str; }
function rss_get_widget_form($num = 1) { $widget = 'rss_get_widget_' . $num; // имя для формы и опций = виджет + номер // получаем опции $options = mso_get_option($widget, 'plugins', array()); if (!isset($options['header'])) { $options['header'] = t('RSS', 'plugins'); } if (!isset($options['url'])) { $options['url'] = 'http://www.google.com/search?q="MaxSite%20CMS"&hl=ru&client=news&tbm=blg&output=rss'; } if (!isset($options['count'])) { $options['count'] = 5; } if (!isset($options['time_cache'])) { $options['time_cache'] = 180; } if (!isset($options['max_word_description'])) { $options['max_word_description'] = '40'; } if (!isset($options['format'])) { $options['format'] = '<p><a rel="nofollow" target="_blank" href="[link]">[link-host]</a><br><em>[title]</em><br>[dc:date]</p>'; } if (!isset($options['format_date'])) { $options['format_date'] = 'd/m/Y H:i'; } if (!isset($options['footer'])) { $options['footer'] = ''; } if (!isset($options['fields'])) { $options['fields'] = 'title link description dc:date'; } if (!isset($options['fields_items'])) { $options['fields_items'] = 'items'; } if (!isset($options['charset'])) { $options['charset'] = 'UTF-8'; } // вывод самой формы $CI =& get_instance(); $CI->load->helper('form'); $form = mso_widget_create_form(t('Заголовок'), form_input(array('name' => $widget . 'header', 'value' => $options['header'])), ''); $form .= mso_widget_create_form(t('Адрес'), form_input(array('name' => $widget . 'url', 'value' => $options['url'])), ''); $form .= mso_widget_create_form(t('Количество записей'), form_input(array('name' => $widget . 'count', 'value' => $options['count'])), ''); $form .= mso_widget_create_form(t('Поля RSS'), form_input(array('name' => $widget . 'fields', 'value' => $options['fields'])), 'Поля, по которым будет строится формат вывода в виде [поле] или для вложенных [поле:субполе]'); $form .= mso_widget_create_form(t('Поле с записями'), form_input(array('name' => $widget . 'fields_items', 'value' => $options['fields_items'])), 'Обычно items'); $form .= mso_widget_create_form(t('Формат вывода'), form_textarea(array('name' => $widget . 'format', 'value' => $options['format'])), ''); $form .= mso_widget_create_form(t('Формат даты'), form_input(array('name' => $widget . 'format_date', 'value' => $options['format_date'])), ''); $form .= mso_widget_create_form(t('Количество слов'), form_input(array('name' => $widget . 'max_word_description', 'value' => $options['max_word_description'])), ''); $form .= mso_widget_create_form(t('Текст в конце блока'), form_textarea(array('name' => $widget . 'footer', 'value' => $options['footer'])), ''); $form .= mso_widget_create_form(t('Время кэша (минуты)'), form_input(array('name' => $widget . 'time_cache', 'value' => $options['time_cache'])), ''); $form .= mso_widget_create_form(t('Кодировка RSS'), form_input(array('name' => $widget . 'charset', 'value' => $options['charset'])), ''); return $form; }
function form_textarea_and_label($name, $value = '', $label = '', $extra = '', $div = 'pure-control-group') { $label = empty($label) ? lang($name) : $label; $extra = $extra . ' placeholder="' . $label . '" id="' . $name . '"'; $value = $value || $value == 0 ? $value : ''; $div_start = empty($div) ? '' : '<div class="' . $div . '">'; $label = form_label($label, $name); $error_box = form_error($name); $input = form_textarea($name, set_value($name, $value), $extra . ' rows="5" cols="75"'); $div_end = empty($div) ? '' : '</div>'; return $div_start . $label . $input . $error_box . $div_end; }
function smarty_function_textarea($params, $template) { $CI =& get_instance(); $attr = get_attr($params, $template); $value = $attr['value']; if (isset($template->block_data)) { $f = $template->block_data; } if ($f->state == 'readonly') { return create_tag('div', array('class' => array('form-element', 'textarea', 'readonly')), array(), $value); } return form_textarea($attr, $value); }
public function generate($data, $value = "") { // variavel de config para achar a base do site, usado no kcfinder if ($this->ci->config->item('assets.js_opener') == "\$(document).ready(function(){\n") { Assets::add_js("});var site_url = '" . base_url() . "'; \$(document).ready(function(){", "inline", true); } else { Assets::add_js("var site_url = '" . base_url() . "'; ", "inline", true); } $value = empty($value) ? isset($data['value']) ? $data['value'] : "" : $value; Assets::add_js("../plugins/ckeditor/ckeditor.js"); $data["class"] = "ckeditor"; return form_textarea($data, $value); }
/** * Output form input * * @param array * @param array * @return string */ public function form_output($data) { // Set editor type if (isset($data['custom']['editor_type'])) { $options['class'] = 'wysiwyg-' . $data['custom']['editor_type']; } else { $options['class'] = 'wysiwyg-simple'; } $options['name'] = $data['form_slug']; $options['id'] = $data['form_slug']; $options['value'] = html_entity_decode($data['value'], null, 'UTF-8'); return form_textarea($options); }
function Questions_view($open_questions, $answered_questions, $ask_action) { foreach ($open_questions as &$question) { $question['actions'] = '<a href="' . page_link_to("user_questions") . '&action=delete&id=' . $question['QID'] . '">' . _("delete") . '</a>'; $question['Question'] = str_replace("\n", '<br />', $question['Question']); } foreach ($answered_questions as &$question) { $question['Question'] = str_replace("\n", '<br />', $question['Question']); $question['Answer'] = str_replace("\n", '<br />', $question['Answer']); $question['actions'] = '<a href="' . page_link_to("user_questions") . '&action=delete&id=' . $question['QID'] . '">' . _("delete") . '</a>'; } return page_with_title(questions_title(), array(msg(), '<h2>' . _("Open questions") . '</h2>', table(array('Question' => _("Question"), 'actions' => ""), $open_questions), '<h2>' . _("Answered questions") . '</h2>', table(array('Question' => _("Question"), 'answer_user' => _("Answered by"), 'Answer' => _("Answer"), 'actions' => ""), $answered_questions), '<h2>' . _("Ask an archangel") . '</h2>', form(array(form_textarea('question', _("Your Question:"), ""), form_submit('submit', _("Save"))), $ask_action))); }
function catclouds_widget_form($num = 1) { $widget = 'catclouds_widget_' . $num; // имя для формы и опций = виджет + номер // получаем опции $options = mso_get_option($widget, 'plugins', array()); if (!isset($options['header'])) { $options['header'] = ''; } if (!isset($options['block_start'])) { $options['block_start'] = '<div class="mso-catclouds">'; } if (!isset($options['block_end'])) { $options['block_end'] = '</div>'; } if (!isset($options['min_size'])) { $options['min_size'] = 90; } else { $options['min_size'] = (int) $options['min_size']; } if (!isset($options['max_size'])) { $options['max_size'] = 230; } else { $options['max_size'] = (int) $options['max_size']; } if (!isset($options['cat_id'])) { $options['cat_id'] = 0; } else { $options['cat_id'] = (int) $options['cat_id']; } if (!isset($options['format'])) { $options['format'] = '<span style="font-size: [SIZE]%"><a href="[URL]">[CAT]</a><sub style="font-size: 12px;">[COUNT]</sub></span>'; } if (!isset($options['sort'])) { $options['sort'] = 0; } else { $options['sort'] = (int) $options['sort']; } // вывод самой формы $CI =& get_instance(); $CI->load->helper('form'); $form = mso_widget_create_form(t('Заголовок'), form_input(array('name' => $widget . 'header', 'value' => $options['header'])), ''); $form .= mso_widget_create_form(t('Формат'), form_textarea(array('name' => $widget . 'format', 'value' => $options['format'])), '[SIZE] [URL] [CAT] [COUNT]'); $form .= mso_widget_create_form(t('Мин. размер (%)'), form_input(array('name' => $widget . 'min_size', 'value' => $options['min_size'])), ''); $form .= mso_widget_create_form(t('Макс. размер (%)'), form_input(array('name' => $widget . 'max_size', 'value' => $options['max_size'])), ''); $form .= mso_widget_create_form(t('Номер рубрики'), form_input(array('name' => $widget . 'cat_id', 'value' => $options['cat_id'])), ''); $form .= mso_widget_create_form(t('Начало блока'), form_input(array('name' => $widget . 'block_start', 'value' => $options['block_start'])), ''); $form .= mso_widget_create_form(t('Конец блока'), form_input(array('name' => $widget . 'block_end', 'value' => $options['block_end'])), ''); $form .= mso_widget_create_form(t('Сортировка'), form_dropdown($widget . 'sort', array('0' => t('По количеству записей (обратно)'), '1' => t('По количеству записей'), '2' => t('По алфавиту'), '3' => t('По алфавиту (обратно)')), $options['sort']), ''); return $form; }
function showForm() { $this->output = form_open_multipart($this->data['segment'] . $this->data['id']); if (isset($this->data['id']) and $this->data['id'] != 0) { $this->output .= form_hidden('id', $this->data['id']); } foreach ($this->data['fields'] as $key => $value) { $this->output .= "\n" . '<div id="ssForm_' . $key . '">'; switch ($value['type']) { case 'hidden': $this->output .= "\n\t" . form_hidden($key, $value['value']); break; case 'text': $this->output .= "\n\t" . form_label($value['desc'], $key); $this->output .= "\n\t" . form_input($key, $value['value']); $this->output .= "\n" . form_error($key); break; case 'date': $this->output .= "\n\t" . form_label($value['desc'], $key); $this->output .= "\n\t" . form_input($key, $value['value'], 'class="ssDate"'); $this->output .= "\n" . form_error($key); break; case 'textarea': $this->output .= "\n\t" . form_label($value['desc'], $key); $this->output .= "\n\t" . form_textarea($key, $value['value']); $this->output .= "\n" . form_error($key); break; case 'dropdown': $this->output .= "\n\t" . form_label($value['desc'], $key); $this->output .= "\n\t" . form_dropdown($key, $value['options'], $value['value']); $this->output .= "\n" . form_error($key); break; case 'checkbox': $this->output .= "\n\t" . form_label($value['desc'], $key); $this->output .= "\n\t" . form_checkbox($key, $value['value'], $value['checked']); $this->output .= "\n" . form_error($key); break; case 'upload': $this->output .= "\n\t" . form_label($value['desc'], $key); $this->output .= "\n\t" . form_upload($key, $value['value']); $this->output .= "\n" . is_array($this->upload_error) ? '<p>Err:' . $this->upload_error[$key] . '</p>' : '<p></p>'; break; default: break; } $this->output .= '</div>'; } $this->output .= "\n" . '<div>' . "\n\t" . form_submit('submit', $this->button, 'class="submit"') . "\n" . '</div>'; $this->output .= "\n" . form_close(); return $this->output; }
/** * Displays the field in publish form * * @param string * @param bool * @return string */ public function display_field($data, $cell = false) { $this->insertJS(); $textarea = form_textarea(array('class' => 'source', 'name' => $this->field_name, 'id' => $this->field_id, 'value' => $data)); $klass = ''; if ($this->settings['reformat']) { $klass .= ' reformat'; } if ($this->settings['friendly']) { $klass .= ' friendly'; } $html = '<div class="json-field ' . $klass . '">' . $textarea . '<pre class="result"></pre></div>'; return $html; }
/** * Display input field for regular user * * @param int $var_id The id of the variable * @param string $var_data The value of the variable * @param array $var_settings The settings of the variable * @return string */ function display_input($var_id, $var_data, $var_settings) { // ------------------------------------- // Check current value from settings // ------------------------------------- $rows = $this->get_setting('rows', $var_settings); // ------------------------------------- // Set class name for textarea // ------------------------------------- $class = 'large' . ($this->get_setting('code_format', $var_settings) ? ' low_code_format' : ''); // ------------------------------------- // Return input field // ------------------------------------- return form_textarea(array('name' => "var[{$var_id}]", 'value' => $var_data, 'rows' => $rows, 'cols' => '40', 'class' => $class, 'dir' => $this->get_setting('text_direction', $var_settings))); }
function admin_news() { global $user; if (!isset($_GET["action"])) { redirect(page_link_to("news")); } else { $html = '<div class="col-md-12"><h1>' . _("Edit news entry") . '</h1>' . msg(); if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}\$/", $_REQUEST['id'])) { $id = $_REQUEST['id']; } else { return error("Incomplete call, missing News ID.", true); } $news = sql_select("SELECT * FROM `News` WHERE `ID`='" . sql_escape($id) . "' LIMIT 1"); if (count($news) > 0) { switch ($_REQUEST["action"]) { default: redirect(page_link_to('news')); case 'edit': list($news) = $news; $user_source = User($news['UID']); if ($user_source === false) { engelsystem_error("Unable to load user."); } $html .= form(array(form_info(_("Date"), date("Y-m-d H:i", $news['Datum'])), form_info(_("Author"), User_Nick_render($user_source)), form_text('eBetreff', _("Subject"), $news['Betreff']), form_textarea('eText', _("Message"), $news['Text']), form_checkbox('eTreffen', _("Meeting"), $news['Treffen'] == 1, 1), form_submit('submit', _("Save"))), page_link_to('admin_news&action=save&id=' . $id)); $html .= '<a class="btn btn-danger" href="' . page_link_to('admin_news&action=delete&id=' . $id) . '"><span class="glyphicon glyphicon-trash"></span> ' . _("Delete") . '</a>'; break; case 'save': list($news) = $news; sql_query("UPDATE `News` SET \n `Datum`='" . sql_escape(time()) . "', \n `Betreff`='" . sql_escape($_POST["eBetreff"]) . "', \n `Text`='" . sql_escape($_POST["eText"]) . "', \n `UID`='" . sql_escape($user['UID']) . "', \n `Treffen`='" . sql_escape($_POST["eTreffen"]) . "' \n WHERE `ID`='" . sql_escape($id) . "'"); engelsystem_log("News updated: " . $_POST["eBetreff"]); success(_("News entry updated.")); redirect(page_link_to("news")); break; case 'delete': list($news) = $news; sql_query("DELETE FROM `News` WHERE `ID`='" . sql_escape($id) . "' LIMIT 1"); engelsystem_log("News deleted: " . $news['Betreff']); success(_("News entry deleted.")); redirect(page_link_to("news")); break; } } else { return error("No News found.", true); } } return $html . '</div>'; }
function favorites_widget_form($num = 1) { $widget = 'favorites_widget_' . $num; // имя для формы и опций = виджет + номер // получаем опции $options = mso_get_option($widget, 'plugins', array()); if (!isset($options['header'])) { $options['header'] = ''; } if (!isset($options['favorites'])) { $options['favorites'] = ''; } // вывод самой формы $CI =& get_instance(); $CI->load->helper('form'); $form = mso_widget_create_form(t('Заголовок'), form_input(array('name' => $widget . 'header', 'value' => $options['header'])), ''); $form .= mso_widget_create_form(t('Ссылки'), form_textarea(array('name' => $widget . 'favorites', 'value' => $options['favorites'])), t('Указывайте по одной ссылке в каждом абзаце в формате: <strong>тип/ссылка | название</strong><br><strong>тип/ссылка</strong> - указывается от адреса сайта, например<br><strong>page/about</strong>, <strong>category/news</strong><br>Для главной страницы укажите: <strong> / | Главная</strong>')); return $form; }
function links_widget_form($num = 1) { $widget = 'links_widget_' . $num; // имя для формы и опций = виджет + номер // получаем опции $options = mso_get_option($widget, 'plugins', array()); if (!isset($options['header'])) { $options['header'] = ''; } if (!isset($options['links'])) { $options['links'] = ''; } // вывод самой формы $CI =& get_instance(); $CI->load->helper('form'); $form = mso_widget_create_form(t('Заголовок'), form_input(array('name' => $widget . 'header', 'value' => $options['header'])), ''); $form .= mso_widget_create_form(t('Ссылки'), form_textarea(array('name' => $widget . 'links', 'value' => $options['links'])), t('Указывайте по одной ссылке в каждом абзаце в формате:<br><strong>http://links/ | название | описание | noindex | _blank</strong><br><strong>noindex</strong> - обрамить ссылку в nofollow, если не нужно - указать пробел<br><strong>_blank</strong> - открыть ссылку в новом окне, если не нужно - указать пробел')); return $form; }
function show_object_edit_page($object, $key) { global $DIA, $db; $salsa_fields = $DIA->describe($object); $data = $DIA->get($object, $key); echo '<form class="form">'; foreach ($salsa_fields as $obj) { echo '<div class="row">'; if ($obj['Type'] == 'blob' or $obj['Type'] == 'text') { echo form_textarea(form_clean_field_name($obj['Field']), $obj['Field'], $data[$obj['Field']]); } elseif ($obj['Type'] == 'tinyint(1)' or $obj['Type'] == 'bool') { echo form_checkbox(form_clean_field_name($obj['Field']), $obj['Field'], $data[$obj['Field']]); } else { echo form_text(form_clean_field_name($obj['Field']), $obj['Field'], $data[$obj['Field']]); } echo '</div>'; } echo '</form>'; }
function eb_input_textarea($name, $label = '', $tags = false) { if ($tags) { extract($tags); } $forCIForm = $tags; $forCIForm['name'] = $name; unset($forCIForm['sublabel']); echo '<span class="field ' . @$class . '">'; if (@$label) { echo form_label($label . ':'); } echo '<div class="textarea">'; echo form_textarea($forCIForm); if (@$sublabel) { echo '<div class="sublabel">' . @$sublabel . '</div>'; } echo '</div>'; echo '</span>'; }