public function build() { $output = ""; if (parent::build() === false) { return; } switch ($this->status) { case "disabled": case "show": if ($this->type == 'hidden' || $this->value == "") { $output = ""; } elseif (!isset($this->value)) { $output = $this->layout['null_label']; } else { $output = nl2br(htmlspecialchars($this->value)); } $output = "<div class='help-block'>" . $output . " </div>"; break; case "create": case "modify": Rapyd::js('redactor/jquery.browser.min.js'); Rapyd::js('redactor/redactor.min.js'); Rapyd::css('redactor/css/redactor.css'); $output = Form::textarea($this->name, $this->value, $this->attributes); Rapyd::script("\$('#" . $this->name . "').redactor();"); break; case "hidden": $output = Form::hidden($this->name, $this->value); break; default: } $this->output = "\n" . $output . "\n" . $this->extra_output . "\n"; }
public function build() { $output = ""; if (parent::build() === false) { return; } switch ($this->status) { case "disabled": case "show": if ($this->type == 'hidden' || $this->value == "") { $output = ""; } elseif (!isset($this->value)) { $output = $this->layout['null_label']; } else { $output = nl2br(htmlspecialchars($this->value)); } $output = "<div class='help-block'>" . $output . " </div>"; break; case "create": case "modify": Rapyd::js('tinymce/tinymce.min.js'); Rapyd::js('tinymce/tinymce_editor.js'); $output = Form::textarea($this->name, $this->value, $this->attributes); Rapyd::script("function elFinderBrowser (field_name, url, type, win) {" . "tinymce.activeEditor.windowManager.open({" . "file: '" . route('elfinder.tinymce4') . "'," . "title: 'elFinder 2.0'," . "width: 900," . "height: 450," . "resizable: 'yes'" . "}, {" . "setUrl: function (url) {" . "win.document.getElementById(field_name).value = url;" . "}" . "});" . "return false;" . "}"); Rapyd::script("tinymce.init({selector: '#" . $this->name . "', file_browser_callback : elFinderBrowser, plugins: 'image', convert_urls: false});"); break; case "hidden": $output = Form::hidden($this->name, $this->value); break; default: } $this->output = "\n" . $output . "\n" . $this->extra_output . "\n"; }
public function build() { $output = ""; if (parent::build() === false) { return; } switch ($this->status) { case "show": $output = $this->value; $output = "<div class='help-block' style='background-color:" . $output . "'> </div>"; break; case "create": case "modify": Rapyd::css('colorpicker/css/bootstrap-colorpicker.min.css'); Rapyd::js('colorpicker/js/bootstrap-colorpicker.min.js'); $output = Form::text($this->name, $this->value, $this->attributes); $output .= Rapyd::script("\n \$('#" . $this->name . "').colorpicker({\n format: 'hex'\n });"); break; case "hidden": $output = Form::hidden($this->name, $this->value); break; default: } $this->output = $output; }
public function build() { $output = ""; $this->attributes["class"] = "form-control"; if (parent::build() === false) { return; } switch ($this->status) { case "disabled": case "show": if ($this->type == 'hidden' || $this->value == "") { $output = ""; } elseif (!isset($this->value)) { $output = $this->layout['null_label']; } else { $output = nl2br(htmlspecialchars($this->value)); } $output = "<div class='help-block'>" . $output . "</div>"; break; case "create": case "modify": Rapyd::js('packages/zofe/rapyd/assets/tinymce/tinymce.min.js'); $output = Form::textarea($this->db_name, $this->value, $this->attributes); $output .= Rapyd::script("\n tinymce.init({\n selector: 'textarea#" . $this->name . "',\n plugins: [\n 'advlist autolink link image lists charmap print preview hr anchor pagebreak',\n 'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',\n 'save table contextmenu directionality emoticons template paste textcolor responsivefilemanager'\n ],\n toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | responsivefilemanager | print preview media fullpage | forecolor backcolor emoticons', \n image_advtab: true ,\n external_filemanager_path:'" . URL::to('/') . "/packages/filemanager/',\n filemanager_title:'Upload',\n });"); break; case "hidden": $output = Form::hidden($this->db_name, $this->value); break; default: } $this->output = "\n" . $output . "\n" . $this->extra_output . "\n"; }
public function build() { $output = ""; unset($this->attributes['type']); if (parent::build() === false) { return; } switch ($this->status) { case "show": if (!isset($this->value)) { $value = $this->layout['null_label']; } else { $value = $this->isoDateToHuman($this->value); } $output = $value; $output = "<div class='help-block'>" . $output . " </div>"; break; case "create": case "modify": if ($this->value != "") { if (!$this->is_refill) { $this->value = $this->isoDateToHuman($this->value); } } Rapyd::css('datepicker/datepicker3.css'); Rapyd::js('datepicker/bootstrap-datepicker.js'); if ($this->language != "en") { Rapyd::js('datepicker/locales/bootstrap-datepicker.' . $this->language . '.js'); } unset($this->attributes['id']); //$this->attributes['class'] = "form-control"; $from = Form::text($this->name . '[]', @$this->values[0], $this->attributes); $to = Form::text($this->name . '[]', @$this->values[1], $this->attributes); $output = ' <div id="range_' . $this->name . '_container"> <div class="input-daterange"> <div class="input-group"> <div class="input-group-addon">≥</div> ' . $from . ' </div> <div class="input-group"> <div class="input-group-addon">≤</div> ' . $to . ' </div> </div> </div>'; Rapyd::pop_script(); Rapyd::script("\n \$('#range_{$this->name}_container .input-daterange').datepicker({\n format: '{$this->formatToDate()}',\n language: '{$this->language}',\n todayBtn: 'linked',\n autoclose: true\n });"); break; case "hidden": $output = Form::hidden($this->name, $this->value); break; default: } $this->output = $output; }
public function get() { Rapyd::getContainer('url')->to($this->current()); if ($this->url == '') { return $this->current(); } else { $url = $this->url; $this->url = ''; return $url; } }
/** * Register the service provider. * * @return void */ public function register() { Rapyd::setContainer($this->app); $this->app->booting(function () { $loader = \Illuminate\Foundation\AliasLoader::getInstance(); $loader->alias('Rapyd', 'Zofe\\Rapyd\\Facades\\Rapyd'); $loader->alias('DataSet', 'Zofe\\Rapyd\\Facades\\DataSet'); $loader->alias('DataGrid', 'Zofe\\Rapyd\\Facades\\DataGrid'); $loader->alias('DataForm', 'Zofe\\Rapyd\\Facades\\DataForm'); $loader->alias('DataEdit', 'Zofe\\Rapyd\\Facades\\DataEdit'); $loader->alias('DataFilter', 'Zofe\\Rapyd\\Facades\\DataFilter'); $loader->alias('Documenter', 'Zofe\\Rapyd\\Facades\\Documenter'); }); }
/** * Register the service provider. * * @return void */ public function register() { $this->app->register('Illuminate\\Html\\HtmlServiceProvider'); Rapyd::setContainer($this->app); $this->app->booting(function () { $loader = \Illuminate\Foundation\AliasLoader::getInstance(); $loader->alias('Rapyd', 'Zofe\\Rapyd\\Facades\\Rapyd'); //deprecated .. and more facade are really needed ? $loader->alias('DataSet', 'Zofe\\Rapyd\\Facades\\DataSet'); $loader->alias('DataGrid', 'Zofe\\Rapyd\\Facades\\DataGrid'); $loader->alias('DataForm', 'Zofe\\Rapyd\\Facades\\DataForm'); $loader->alias('DataEdit', 'Zofe\\Rapyd\\Facades\\DataEdit'); $loader->alias('DataFilter', 'Zofe\\Rapyd\\Facades\\DataFilter'); $loader->alias('Documenter', 'Zofe\\Rapyd\\Facades\\Documenter'); }); }
public function build() { $output = ""; if (parent::build() === false) return; switch ($this->status) { case "disabled": case "show": if ($this->type =='hidden' || $this->value == "") { $output = ""; } elseif ( (!isset($this->value)) ) { $output = $this->layout['null_label']; } else { $output = nl2br(htmlspecialchars($this->value)); } $output = "<div class='help-block'>".$output." </div>"; break; case "create": case "modify": Rapyd::js('tinymce/tinymce.min.js'); $output = Form::textarea($this->name, $this->value, $this->attributes); Rapyd::script("tinymce.init({selector: '#".$this->name."'});"); break; case "hidden": $output = Form::hidden($this->name, $this->value); break; default:; } $this->output = "\n".$output."\n". $this->extra_output."\n"; }
public function build() { $output = ""; unset($this->attributes['type']); if (parent::build() === false) return; switch ($this->status) { case "show": if (!isset($this->value)) { $value = $this->layout['null_label']; } else { $value = $this->isoDateToHuman($this->value); } $output = $value; $output = "<div class='help-block'>".$output." </div>"; break; case "create": case "modify": if ($this->value != "") { if (!$this->is_refill) { $this->value = $this->isoDateToHuman($this->value); } } Rapyd::css('datepicker/datepicker3.css'); Rapyd::js('datepicker/bootstrap-datepicker.js'); if ($this->language != "en") { Rapyd::js('datepicker/locales/bootstrap-datepicker.'.$this->language.'.js'); } $output = Form::text($this->name, $this->value, $this->attributes); Rapyd::script(" $('#".$this->name."').datepicker({ format: '{$this->formatToDate()}', language: '{$this->language}', todayBtn: 'linked', autoclose: true });"); break; case "hidden": $output = Form::hidden($this->db_name, $this->value); break; default:; } $this->output = $output; }
/** * build form output and prepare form partials (header / footer / ..) * @param string $view */ public function build($view = '') { if (isset($this->attributes['class']) and strpos($this->attributes['class'], 'form-inline') !== false) { $this->view = 'rapyd::dataform_inline'; $this->orientation = 'inline'; } if ($this->output != '') { return; } if ($view != '') { $this->view = $view; } $this->process(); //callable if ($this->form_callable && $this->process_status == "success") { $callable = $this->form_callable; $result = $callable($this); if ($result && is_a($result, 'Illuminate\\Http\\RedirectResponse')) { $this->redirect = $result; } //reprocess if an error is added in closure if ($this->process_status == 'error') { $this->process(); } } //cleanup submits if success if ($this->process_status == 'success') { $this->removeType('submit'); } $this->buildButtons(); $this->buildFields(); $dataform = $this->buildForm(); $this->output = $dataform->render(); $sections = $dataform->renderSections(); $this->header = $sections['df.header']; $this->footer = $sections['df.footer']; $this->body = @$sections['df.fields']; Rapyd::setForm($this); }
public function build() { $output = ""; Rapyd::css('autocomplete/autocomplete.css'); Rapyd::js('autocomplete/typeahead.bundle.min.js'); Rapyd::js('template/handlebars.js'); unset($this->attributes['type']); if (parent::build() === false) { return; } switch ($this->status) { case "disabled": case "show": if (!isset($this->value)) { $output = $this->layout['null_label']; } elseif ($this->value == "") { $output = ""; } else { if ($this->relation != null) { $name = $this->rel_field; $value = @$this->relation->get()->first()->{$name}; } else { $value = $this->value; } $output = nl2br(htmlspecialchars($value)); } $output = "<div class='help-block'>" . $output . " </div>"; break; case "create": case "modify": if (Input::get("auto_" . $this->name)) { $autocomplete = Input::get("auto_" . $this->name); } elseif ($this->relation != null) { $name = $this->rel_field; $autocomplete = @$this->relation->get()->first()->{$name}; } elseif (count($this->local_options)) { $autocomplete = $this->description; } else { $autocomplete = $this->value; } $output = Form::text("auto_" . $this->name, $autocomplete, array_merge($this->attributes, array('id' => "auto_" . $this->name))) . "\n"; $output .= Form::hidden($this->name, $this->value, array('id' => $this->name)); $output = '<span id="th_' . $this->name . '">' . $output . '</span>'; if ($this->remote) { $script = <<<acp var blod_{$this->name} = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('auto_{$this->name}'), queryTokenizer: Bloodhound.tokenizers.whitespace, remote: '{$this->remote}?q=%QUERY' }); blod_{$this->name}.initialize(); \$('#th_{$this->name} .typeahead').typeahead(null, { name: '{$this->name}', displayKey: '{$this->record_label}', highlight: true, minLength: {$this->min_chars}, source: blod_{$this->name}.ttAdapter(), templates: { suggestion: Handlebars.compile('{{{$this->record_label}}}') } }).on("typeahead:selected typeahead:autocompleted", function (e,data) { \$('#{$this->name}').val(data.{$this->record_id}); }).on("typeahead:closed", function (e,data) { if (\$(this).val() == '') { \$('#{$this->name}').val(''); } }); acp; Rapyd::script($script); } elseif (count($this->options)) { $options = json_encode($this->local_options); //options $script = <<<acp var {$this->name}_options = {$options}; var blod_{$this->name} = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Bloodhound.tokenizers.whitespace, local: {$this->name}_options }); blod_{$this->name}.initialize(); \$('#th_{$this->name} .typeahead').typeahead({ hint: true, highlight: true, minLength: {$this->min_chars} }, { name: '{$this->name}', displayKey: 'value', source: blod_{$this->name}.ttAdapter() }).on("typeahead:selected typeahead:autocompleted", function (e,data) { \$('#{$this->name}').val(data.key); }).on("typeahead:closed", function (e,data) { if (\$(this).val() == '') { \$('#{$this->name}').val(''); } }); acp; Rapyd::script($script); } break; case "hidden": $output = Form::hidden($this->db_name, $this->value); break; default: } $this->output = "\n" . $output . "\n" . $this->extra_output . "\n"; }
public function build() { $output = ""; //typeahead Rapyd::css('autocomplete/autocomplete.css'); Rapyd::js('autocomplete/typeahead.bundle.min.js'); Rapyd::js('template/handlebars.js'); //tagsinput Rapyd::css('autocomplete/bootstrap-tagsinput.css'); Rapyd::js('autocomplete/bootstrap-tagsinput.min.js'); unset($this->attributes['type']); if (parent::build() === false) { return; } switch ($this->status) { case "disabled": case "show": if (!isset($this->value)) { $output = $this->layout['null_label']; } else { $output = $this->description; } $output = "<div class='help-block'>" . $output . " </div>"; break; case "create": case "modify": $output = Form::text($this->name, '', array_merge($this->attributes, array('id' => "" . $this->name))) . "\n"; if ($this->remote) { $script = <<<acp \$('#{$this->name}').tagsinput({ itemValue: '{$this->record_id}', itemText: '{$this->record_label}' }); {$this->fill_tags} var blod_{$this->name} = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('{$this->name}'), queryTokenizer: Bloodhound.tokenizers.whitespace, remote: '{$this->remote}?q=%QUERY' }); blod_{$this->name}.initialize(); \$('#{$this->name}').tagsinput('input').typeahead(null, { name: '{$this->name}', displayKey: '{$this->record_label}', highlight: true, minLength: {$this->min_chars}, source: blod_{$this->name}.ttAdapter() }).bind('typeahead:selected', \$.proxy(function (obj, data) { this.tagsinput('add', data); this.tagsinput('input').typeahead('val', ''); }, \$('#{$this->name}'))); acp; Rapyd::script($script); } elseif (count($this->options)) { $options = json_encode($this->local_options); //options $script = <<<acp var {$this->name}_options = {$options}; \$('#{$this->name}').tagsinput({ itemValue: 'key', itemText: 'value' }); {$this->fill_tags} var blod_{$this->name} = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Bloodhound.tokenizers.whitespace, local: {$this->name}_options }); blod_{$this->name}.initialize(); \$('#{$this->name}').tagsinput('input').typeahead({ hint: true, highlight: true, minLength: {$this->min_chars} }, { name: '{$this->name}', displayKey: 'value', source: blod_{$this->name}.ttAdapter() }).bind('typeahead:selected', \$.proxy(function (obj, data) { this.tagsinput('add', data); this.tagsinput('input').typeahead('val', ''); }, \$('#{$this->name}'))); acp; Rapyd::script($script); } break; case "hidden": $output = Form::hidden($this->db_name, $this->value); break; default: } $this->output = "\n" . $output . "\n" . $this->extra_output . "\n"; }
/** * * * @static */ public static function getForm() { return \Zofe\Rapyd\Rapyd::getForm(); }