layout_form.tpl
11.3 KB
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
<?php echo $header; ?><?php echo $column_left; ?>
<div id="content">
<div class="page-header">
<div class="container-fluid">
<div class="pull-right">
<button type="submit" form="form-layout" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button>
<a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
<h1><?php echo $heading_title; ?></h1>
<ul class="breadcrumb">
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
<?php } ?>
</ul>
</div>
</div>
<div class="container-fluid">
<?php if ($error_warning) { ?>
<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?>
<button type="button" class="close" data-dismiss="alert">×</button>
</div>
<?php } ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_form; ?></h3>
</div>
<div class="panel-body">
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-layout" class="form-horizontal">
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-name"><?php echo $entry_name; ?></label>
<div class="col-sm-10">
<input type="text" name="name" value="<?php echo $name; ?>" placeholder="<?php echo $entry_name; ?>" id="input-name" class="form-control" />
<?php if ($error_name) { ?>
<div class="text-danger"><?php echo $error_name; ?></div>
<?php } ?>
</div>
</div>
<table id="route" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<td class="text-left"><?php echo $entry_store; ?></td>
<td class="text-left"><?php echo $entry_route; ?></td>
<td></td>
</tr>
</thead>
<tbody>
<?php $route_row = 0; ?>
<?php foreach ($layout_routes as $layout_route) { ?>
<tr id="route-row<?php echo $route_row; ?>">
<td class="text-left"><select name="layout_route[<?php echo $route_row; ?>][store_id]" class="form-control">
<option value="0"><?php echo $text_default; ?></option>
<?php foreach ($stores as $store) { ?>
<?php if ($store['store_id'] == $layout_route['store_id']) { ?>
<option value="<?php echo $store['store_id']; ?>" selected="selected"><?php echo $store['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $store['store_id']; ?>"><?php echo $store['name']; ?></option>
<?php } ?>
<?php } ?>
</select></td>
<td class="text-left"><input type="text" name="layout_route[<?php echo $route_row; ?>][route]" value="<?php echo $layout_route['route']; ?>" placeholder="<?php echo $entry_route; ?>" class="form-control" /></td>
<td class="text-left"><button type="button" onclick="$('#route-row<?php echo $route_row; ?>').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>
</tr>
<?php $route_row++; ?>
<?php } ?>
</tbody>
<tfoot>
<tr>
<td colspan="2"></td>
<td class="text-left"><button type="button" onclick="addRoute();" data-toggle="tooltip" title="<?php echo $button_route_add; ?>" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td>
</tr>
</tfoot>
</table>
<table id="module" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<td class="text-left"><?php echo $entry_module; ?></td>
<td class="text-left"><?php echo $entry_position; ?></td>
<td class="text-right"><?php echo $entry_sort_order; ?></td>
<td></td>
</tr>
</thead>
<tbody>
<?php $module_row = 0; ?>
<?php foreach ($layout_modules as $layout_module) { ?>
<tr id="module-row<?php echo $module_row; ?>">
<td class="text-left"><select name="layout_module[<?php echo $module_row; ?>][code]" class="form-control">
<?php foreach ($extensions as $extension) { ?>
<?php if (!$extension['module']) { ?>
<?php if ($extension['code'] == $layout_module['code']) { ?>
<option value="<?php echo $extension['code']; ?>" selected="selected"><?php echo $extension['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $extension['code']; ?>"><?php echo $extension['name']; ?></option>
<?php } ?>
<?php } else { ?>
<optgroup label="<?php echo $extension['name']; ?>">
<?php foreach ($extension['module'] as $module) { ?>
<?php if ($module['code'] == $layout_module['code']) { ?>
<option value="<?php echo $module['code']; ?>" selected="selected"><?php echo $module['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $module['code']; ?>"><?php echo $module['name']; ?></option>
<?php } ?>
<?php } ?>
</optgroup>
<?php } ?>
<?php } ?>
</select></td>
<td class="text-left"><select name="layout_module[<?php echo $module_row; ?>][position]" class="form-control">
<?php if ($layout_module['position'] == 'content_top') { ?>
<option value="content_top" selected="selected"><?php echo $text_content_top; ?></option>
<?php } else { ?>
<option value="content_top"><?php echo $text_content_top; ?></option>
<?php } ?>
<?php if ($layout_module['position'] == 'content_bottom') { ?>
<option value="content_bottom" selected="selected"><?php echo $text_content_bottom; ?></option>
<?php } else { ?>
<option value="content_bottom"><?php echo $text_content_bottom; ?></option>
<?php } ?>
<?php if ($layout_module['position'] == 'column_left') { ?>
<option value="column_left" selected="selected"><?php echo $text_column_left; ?></option>
<?php } else { ?>
<option value="column_left"><?php echo $text_column_left; ?></option>
<?php } ?>
<?php if ($layout_module['position'] == 'column_right') { ?>
<option value="column_right" selected="selected"><?php echo $text_column_right; ?></option>
<?php } else { ?>
<option value="column_right"><?php echo $text_column_right; ?></option>
<?php } ?>
</select></td>
<td class="text-right"><input type="text" name="layout_module[<?php echo $module_row; ?>][sort_order]" value="<?php echo $layout_module['sort_order']; ?>" placeholder="<?php echo $entry_sort_order; ?>" class="form-control" /></td>
<td class="text-left"><button type="button" onclick="$('#module-row<?php echo $module_row; ?>').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>
</tr>
<?php $module_row++; ?>
<?php } ?>
</tbody>
<tfoot>
<tr>
<td colspan="3"></td>
<td class="text-left"><button type="button" onclick="addModule();" data-toggle="tooltip" title="<?php echo $button_module_add; ?>" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td>
</tr>
</tfoot>
</table>
</form>
</div>
</div>
</div>
<script type="text/javascript"><!--
var route_row = <?php echo $route_row; ?>;
function addRoute() {
html = '<tr id="route-row' + route_row + '">';
html += ' <td class="text-left"><select name="layout_route[' + route_row + '][store_id]" class="form-control">';
html += ' <option value="0"><?php echo $text_default; ?></option>';
<?php foreach ($stores as $store) { ?>
html += '<option value="<?php echo $store['store_id']; ?>"><?php echo addslashes($store['name']); ?></option>';
<?php } ?>
html += ' </select></td>';
html += ' <td class="text-left"><input type="text" name="layout_route[' + route_row + '][route]" value="" placeholder="<?php echo $entry_route; ?>" class="form-control" /></td>';
html += ' <td class="text-left"><button type="button" onclick="$(\'#route-row' + route_row + '\').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>';
html += '</tr>';
$('#route tbody').append(html);
route_row++;
}
var module_row = <?php echo $module_row; ?>;
function addModule() {
html = '<tr id="module-row' + module_row + '">';
html += ' <td class="text-left"><select name="layout_module[' + module_row + '][code]" class="form-control">';
<?php foreach ($extensions as $extension) { ?>
<?php if (!$extension['module']) { ?>
html += ' <option value="<?php echo $extension['code']; ?>"><?php echo addslashes($extension['name']); ?></option>';
<?php } else { ?>
html += ' <optgroup label="<?php echo addslashes($extension['name']); ?>">';
<?php foreach ($extension['module'] as $module) { ?>
html += ' <option value="<?php echo $module['code']; ?>"><?php echo addslashes($module['name']); ?></option>';
<?php } ?>
html += ' </optgroup>';
<?php } ?>
<?php } ?>
html += ' </select></td>';
html += ' <td class="text-left"><select name="layout_module[' + module_row + '][position]" class="form-control">';
html += ' <option value="content_top"><?php echo $text_content_top; ?></option>';
html += ' <option value="content_bottom"><?php echo $text_content_bottom; ?></option>';
html += ' <option value="column_left"><?php echo $text_column_left; ?></option>';
html += ' <option value="column_right"><?php echo $text_column_right; ?></option>';
html += ' </select></td>';
html += ' <td class="text-left"><input type="text" name="layout_module[' + module_row + '][sort_order]" value="" placeholder="<?php echo $entry_sort_order; ?>" class="form-control" /></td>';
html += ' <td class="text-left"><button type="button" onclick="$(\'#module-row' + module_row + '\').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>';
html += '</tr>';
$('#module tbody').append(html);
module_row++;
}
//--></script></div>
<?php echo $footer; ?>