1 | @extends('crudbooster::admin_template') |
||
2 | @section('content') |
||
3 | @push('bottom') |
||
4 | <script src="{{asset('vendor/laravel-filemanager/js/lfm.js')}}"></script> |
||
5 | <script src="//cdn.tinymce.com/4/tinymce.min.js"></script> |
||
6 | <script> |
||
7 | $(function () { |
||
8 | $('.label-setting').hover(function () { |
||
9 | $(this).find('a').css("visibility", "visible"); |
||
10 | }, function () { |
||
11 | $(this).find('a').css("visibility", "hidden"); |
||
12 | }) |
||
13 | }) |
||
14 | var editor_config = { |
||
15 | path_absolute: "{{asset('/')}}", |
||
16 | selector: ".wysiwyg", |
||
17 | height: 250, |
||
18 | {{ ($disabled)?"readonly:1,":"" }} |
||
19 | plugins: [ |
||
20 | "advlist autolink lists link image charmap print preview hr anchor pagebreak", |
||
21 | "searchreplace wordcount visualblocks visualchars code fullscreen", |
||
22 | "insertdatetime media nonbreaking save table contextmenu directionality", |
||
23 | "emoticons template paste textcolor colorpicker textpattern" |
||
24 | ], |
||
25 | toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media", |
||
26 | relative_urls: false, |
||
27 | file_browser_callback: function (field_name, url, type, win) { |
||
28 | var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth; |
||
29 | var y = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight; |
||
30 | |||
31 | var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name=' + field_name; |
||
32 | if (type == 'image') { |
||
33 | cmsURL = cmsURL + "&type=Images"; |
||
34 | } else { |
||
35 | cmsURL = cmsURL + "&type=Files"; |
||
36 | } |
||
37 | |||
38 | tinyMCE.activeEditor.windowManager.open({ |
||
39 | file: cmsURL, |
||
40 | title: 'Filemanager', |
||
41 | width: x * 0.8, |
||
42 | height: y * 0.8, |
||
43 | resizable: "yes", |
||
44 | close_previous: "no" |
||
45 | }); |
||
46 | } |
||
47 | }; |
||
48 | |||
49 | tinymce.init(editor_config); |
||
50 | |||
51 | </script> |
||
52 | @endpush |
||
53 | |||
54 | <div style="width:750px;margin:0 auto "> |
||
55 | |||
56 | <p align="right"><a title='Add Field Setting' class='btn btn-sm btn-primary' href='{{route("SettingsControllerGetAdd")."?group_setting=".$page_title}}'><i |
||
57 | class='fa fa-plus'></i> Add Field Setting</a></p> |
||
58 | |||
59 | <div class="panel panel-default"> |
||
60 | <div class="panel-heading"> |
||
61 | <i class='fa fa-cog'></i> {{$page_title}} |
||
62 | </div> |
||
63 | <div class="panel-body"> |
||
64 | <form method='post' id="form" enctype="multipart/form-data" action='{{CRUDBooster::mainpath("save-setting?group_setting=$page_title")}}'> |
||
65 | <input type="hidden" name="_token" value="{{ csrf_token() }}"> |
||
66 | <div class="box-body"> |
||
67 | <?php |
||
68 | $set = DB::table('cms_settings')->where('group_setting', $page_title)->get(); |
||
69 | foreach($set as $s): |
||
70 | |||
71 | $value = $s->content; |
||
72 | |||
73 | if (! $s->label) { |
||
74 | $label = ucwords(str_replace('_', ' ', $s->name)); |
||
75 | DB::table('cms_settings')->where('id', $s->id)->update(['label' => $label]); |
||
76 | $s->label = $label; |
||
77 | } |
||
78 | |||
79 | $dataenum = explode(',', $s->dataenum); |
||
80 | if ($dataenum) { |
||
0 ignored issues
–
show
|
|||
81 | array_walk($dataenum, 'trim'); |
||
82 | } |
||
83 | |||
84 | ?> |
||
85 | <div class='form-group'> |
||
86 | <label class='label-setting' title="{{$s->name}}">{{$s->label}} |
||
87 | <a style="visibility:hidden" href='{{CRUDBooster::mainpath("edit/$s->id")}}' title='Edit This Meta Setting' |
||
88 | class='btn btn-box-tool'><i class='fa fa-pencil'></i></a> |
||
89 | <a style="visibility:hidden" href='javascript:;' title='Delete this Setting' class='btn btn-box-tool' |
||
90 | onClick='swal({ title: "Are you sure?", text: "You will not be able to recover {{$s->label}} and may be can cause some errors on your system !", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", closeOnConfirm: false }, function(){ location.href="{{CRUDBooster::mainpath("delete/$s->id")}}" });' |
||
91 | ><i class='fa fa-trash'></i></a> |
||
92 | </label> |
||
93 | <?php |
||
94 | switch ($s->content_input_type) { |
||
95 | case 'text': |
||
96 | echo "<input type='text' class='form-control' name='$s->name' value='$value'/>"; |
||
97 | break; |
||
98 | case 'number': |
||
99 | echo "<input type='number' class='form-control' name='$s->name' value='$value'/>"; |
||
100 | break; |
||
101 | case 'email': |
||
102 | echo "<input type='email' class='form-control' name='$s->name' value='$value'/>"; |
||
103 | break; |
||
104 | case 'textarea': |
||
105 | echo "<textarea name='$s->name' class='form-control'>$value</textarea>"; |
||
106 | break; |
||
107 | case 'wysiwyg': |
||
108 | echo "<textarea name='$s->name' class='form-control wysiwyg'>$value</textarea>"; |
||
109 | break; |
||
110 | case 'upload': |
||
111 | case 'upload_image': |
||
112 | if ($value) { |
||
113 | echo "<p><a href='".asset($value)."' target='_blank' title='Download the file of $s->label'><i class='fa fa-download'></i> Download the File of $s->label</a></p>"; |
||
114 | echo "<input type='hidden' name='$s->name' value='$value'/>"; |
||
115 | echo "<div class='pull-right'><a class='btn btn-danger btn-xs' onclick='if(confirm(\"Are you sure want to delete ?\")) location.href=\"".CRUDBooster::mainpath("delete-file-setting?id=$s->id")."\"' title='Click here to delete'><i class='fa fa-trash'></i></a></div>"; |
||
0 ignored issues
–
show
The type
CRUDBooster was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
116 | } else { |
||
117 | echo "<input type='file' name='$s->name' class='form-control'/>"; |
||
118 | } |
||
119 | echo "<div class='help-block'>File support only jpg,png,gif, Max 10 MB</div>"; |
||
120 | break; |
||
121 | case 'upload_file': |
||
122 | if ($value) { |
||
123 | echo "<p><a href='".asset($value)."' target='_blank' title='Download the file of $s->label'><i class='fa fa-download'></i> Download the File of $s->label</a></p>"; |
||
124 | echo "<input type='hidden' name='$s->name' value='$value'/>"; |
||
125 | echo "<div class='pull-right'><a class='btn btn-danger btn-xs' onclick='if(confirm(\"Are you sure want to delete ?\")) location.href=\"".CRUDBooster::mainpath("delete-file-setting?id=$s->id")."\"' title='Click here to delete'><i class='fa fa-trash'></i></a></div>"; |
||
126 | } else { |
||
127 | echo "<input type='file' name='$s->name' class='form-control'/>"; |
||
128 | } |
||
129 | echo "<div class='help-block'>File support only doc,docx,xls,xlsx,ppt,pptx,pdf,zip,rar, Max 20 MB</div>"; |
||
130 | break; |
||
131 | case 'datepicker': |
||
132 | echo "<input type='text' class='datepicker form-control' name='$s->name' value='$value'/>"; |
||
133 | break; |
||
134 | case 'radio': |
||
135 | if ($dataenum): |
||
136 | echo "<br/>"; |
||
137 | foreach ($dataenum as $enum) { |
||
138 | $checked = ($enum == $value) ? "checked" : ""; |
||
139 | echo "<label class='radio-inline'>"; |
||
140 | echo "<input type='radio' name='".$s->name."' value='$enum' $checked > $enum"; |
||
141 | echo "</label>"; |
||
142 | } |
||
143 | endif; |
||
144 | break; |
||
145 | case 'select': |
||
146 | echo "<select name='$s->name' class='form-control'><option value=''>** Please select $s->label</option>"; |
||
147 | if ($dataenum): |
||
148 | foreach ($dataenum as $enum) { |
||
149 | $selected = ($enum == $value) ? "selected" : ""; |
||
150 | echo "<option $selected value='$enum'>$enum</option>"; |
||
151 | } |
||
152 | endif; |
||
153 | echo "</select>"; |
||
154 | break; |
||
155 | } |
||
156 | ?> |
||
157 | |||
158 | <div class='help-block'>{{$s->helper}}</div> |
||
159 | </div> |
||
160 | <?php endforeach;?> |
||
161 | </div><!-- /.box-body --> |
||
162 | <div class="box-footer"> |
||
163 | <div class='pull-right'> |
||
164 | <input type='submit' name='submit' value='Save' class='btn btn-success'/> |
||
165 | </div> |
||
166 | </div><!-- /.box-footer--> |
||
167 | </form> |
||
168 | </div> |
||
169 | </div> |
||
170 | |||
171 | </div> |
||
172 | |||
173 | @endsection |
||
174 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.