aboutsummaryrefslogtreecommitdiff
path: root/srcs/phpmyadmin/templates/table/search/selection_form.twig
blob: 2ba4d603516c81fbc35e00405d5593b948d4a97e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
{% if search_type == 'zoom' %}
    {% include 'table/search/form_tag.twig' with {
        'script_name': 'tbl_zoom_select.php',
        'form_id': 'zoom_search_form',
        'db': db,
        'table': table,
        'goto': goto
    } only %}
    <fieldset id="fieldset_zoom_search">
        <fieldset id="inputSection">
            <legend>
                {% trans 'Do a "query by example" (wildcard: "%") for two different columns' %}
            </legend>
            {% include 'table/search/fields_table.twig' with {
                'self': self,
                'search_type': search_type,
                'geom_column_flag': geom_column_flag,
                'column_names': column_names,
                'column_types': column_types,
                'column_collations': column_collations,
                'keys' : keys,
                'criteria_column_names': criteria_column_names,
                'criteria_column_types': criteria_column_types
            } only %}<table class="data">
                {# Select options for data label #}
                <tr>
                    <td>
                        <label for="dataLabel">
                            {% trans 'Use this column to label each point' %}
                        </label>
                    </td>
                    <td>
                        <select name="dataLabel" id="dataLabel" >
                            <option value = "">
                                {% trans 'None' %}
                            </option>
                            {% for i in 0..column_names|length - 1 %}
                                {% if data_label is defined and data_label == column_names[i]|e %}
                                    <option value="{{ column_names[i] }}" selected="selected">
                                        {{ column_names[i] }}
                                    </option>
                                {% else %}
                                    <option value="{{ column_names[i] }}" >
                                        {{ column_names[i] }}
                                    </option>
                                {% endif %}
                            {% endfor %}
                        </select>
                    </td>
                </tr>
                {# Inputbox for changing default maximum rows to plot #}
                <tr>
                    <td>
                        <label for="maxRowPlotLimit">
                            {% trans 'Maximum rows to plot' %}
                        </label>
                    </td>
                    <td>
                        <input type="number"
                            name="maxPlotLimit"
                            id="maxRowPlotLimit"
                            required="required"
                            value="{{ max_plot_limit }}">
                    </td>
                </tr>
            </table>
        </fieldset>
    </fieldset>
{% elseif search_type == 'normal' %}
    {% include 'table/search/form_tag.twig' with {
        'script_name': 'tbl_select.php',
        'form_id': 'tbl_search_form',
        'db': db,
        'table': table,
        'goto': goto
    } only %}
    <fieldset id="fieldset_table_search">
        <fieldset id="fieldset_table_qbe">
            <legend>
                {% trans 'Do a "query by example" (wildcard: "%")' %}
            </legend>
            <div class="responsivetable jsresponsive">
                {% include 'table/search/fields_table.twig' with {
                    'self': self,
                    'search_type': search_type,
                    'geom_column_flag': geom_column_flag,
                    'column_names': column_names,
                    'column_types': column_types,
                    'column_collations': column_collations,
                    'criteria_column_names': criteria_column_names,
                    'criteria_column_types': criteria_column_types
                } only %}
            </div>
            <div id="gis_editor"></div>
            <div id="popup_background"></div>
        </fieldset>
        {% include 'div_for_slider_effect.twig' with {
            'id': 'searchoptions',
            'message': 'Options'|trans,
            'initial_sliders_state': default_sliders_state
        } only %}

        {# Displays columns select list for selecting distinct columns in the search #}
        <fieldset id="fieldset_select_fields">
            <legend>
                {% trans 'Select columns (at least one):' %}
            </legend>
            <select name="columnsToDisplay[]"
                size="{{ min(column_names|length, 10) }}"
                multiple="multiple">
                {% for each_field in column_names %}
                    <option value="{{ each_field }}"
                        selected="selected">
                        {{ each_field }}
                    </option>
                {% endfor %}
            </select>
            <input type="checkbox" name="distinct" value="DISTINCT" id="oDistinct">
            <label for="oDistinct">DISTINCT</label>
        </fieldset>

        {# Displays input box for custom 'Where' clause to be used in the search #}
        <fieldset id="fieldset_search_conditions">
            <legend>
                <em>{% trans 'Or' %}</em>
                {% trans 'Add search conditions (body of the "where" clause):' %}
            </legend>
            {{ show_mysql_docu('Functions') }}
            <input type="text" name="customWhereClause" class="textfield" size="64">
        </fieldset>

        {# Displays option of changing default number of rows displayed per page #}
        <fieldset id="fieldset_limit_rows">
            <legend>{% trans 'Number of rows per page' %}</legend>
            <input type="number"
                name="session_max_rows"
                required="required"
                min="1"
                value="{{ max_rows }}"
                class="textfield">
        </fieldset>

        {# Displays option for ordering search results by a column value (Asc or Desc) #}
        <fieldset id="fieldset_display_order">
            <legend>{% trans 'Display order:' %}</legend>
            <select name="orderByColumn"><option value="--nil--"></option>
                {% for each_field in column_names %}
                    <option value="{{ each_field }}">
                        {{ each_field }}
                    </option>
                {% endfor %}
            </select>

            {{ get_radio_fields(
                'order',
                {
                    'ASC': 'Ascending'|trans,
                    'DESC': 'Descending'|trans
                },
                'ASC',
                false,
                true,
                'formelement'
            ) }}

        </fieldset>
        <div class="clearfloat"></div>
    </fieldset>
{% elseif search_type == 'replace' %}
    {% include 'table/search/form_tag.twig' with {
        'script_name': 'tbl_find_replace.php',
        'form_id': 'find_replace_form',
        'db': db,
        'table': table,
        'goto': goto
    } only %}
    <fieldset id="fieldset_find_replace">
        <fieldset id="fieldset_find">
            <legend>
                {% trans 'Find and replace' %}
            </legend>{% trans 'Find:' %}
            <input type="text" value="" name="find" required>
            {% trans 'Replace with:' %}
            <input type="text" value="" name="replaceWith">

            {% trans 'Column:' %}
            <select name="columnIndex">
                {% for i in 0..column_names|length - 1 %}
                    {% set type = types[column_names[i]] %}

                    {% if sql_types.getTypeClass(type) == 'CHAR' %}
                        <option value="{{ i }}">
                            {{- column_names[i] -}}
                        </option>
                    {% endif %}
                {% endfor %}
            </select>

            {% include 'checkbox.twig' with {
                'html_field_id': 'useRegex',
                'html_field_name': 'useRegex',
                'label': 'Use regular expression'|trans,
                'checked': false,
                'onclick': false
            } only %}
        </fieldset>
    </fieldset>
{% else %}
    {% include 'table/search/form_tag.twig' with {
        'script_name': '',
        'form_id': '',
        'db': db,
        'table': table,
        'goto': goto
    } only %}
{% endif %}

{# Displays selection form's footer elements #}
    <fieldset class="tblFooters">
        <input class="btn btn-primary" type="submit"
            name="{{ search_type == 'zoom' ? 'zoom_submit' : 'submit' }}"
            {{ search_type == 'zoom' ? 'id="inputFormSubmitId"' }}
            value="{% trans 'Go' %}">
    </fieldset>
</form>
<div id="sqlqueryresultsouter"></div>