summaryrefslogtreecommitdiff
path: root/views/mods/mod_gutschein/index.phtml
blob: 03518d2219d7c4444cc95a57d4c5cf2a75253567 (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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
<?php

	/**
	 * Template für die Übersicht der Gutschein
	 */

?>

<script type="text/javascript">/* <![CDATA[ */

		var wpsg_order = '<?php echo $this->view['filter']['order']; ?>';
		var wpsg_ascdesc = '<?php echo $this->view['filter']['ascdesc']; ?>';
    	
		function wpsg_setOrder(order)
		{
	
			if (order == wpsg_order)
			{
	
				// Nur Richtung ändern
				if (wpsg_ascdesc == 'asc') jQuery('#wpsg_ascdesc').val('desc');
				else jQuery('#wpsg_ascdesc').val('asc');
				
			}
			else
			{
	
				jQuery('#wpsg_order').val(order);
				jQuery('#wpsg_ascdesc').val('asc');
				
			}
	 
			jQuery('#seite').val(1);
			jQuery('#filter_form').submit();
			
			return false;
			
		} // function wpsg_setOrder(order)
    
		function goPage(page)
		{

			if (page <= 0 || page == <?php echo $this->view['page']; ?> || page > <?php echo $this->view['pages']; ?>) return;			
			
			jQuery('#seite').val(page);
			
			jQuery('#filter_form').submit();

			return false;
			
		} // function goPage(page)

		function goStatus(status)
		{

			jQuery('#status').val(status);
			jQuery('#seite').val('1');

			jQuery('#filter_form').submit();

			return false;
			
		} // public function goStatus(status)

		function wpsg_doExport()
		{

			var action_alt = jQuery('#filter_form').attr('action'); 

			jQuery('#wpsg_voucher_export').val('1');
			jQuery('#filter_form').attr('target', '_blank');
			jQuery('#filter_form').attr('action', jQuery('#filter_form').attr('action') + '&noheader=1');
			
			jQuery('#filter_form').submit();			

			jQuery('#filter_form').attr('action', action_alt);
			jQuery('#filter_form').attr('target', '');
			jQuery('#wpsg_voucher_export').val('0');

			return false;
			
		} // function wpsg_doExport()
		
	/* ]]> */</script>

<div class="wrap wpsg_mod_gutschein">
	<?php /*?>
	<div class="icon32 icon32-posts-post" id="icon-edit"><br></div>
	<h2>
		<?php echo __('Gutscheinverwaltung', 'wpsg'); ?>			
		<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Voucher&amp;action=add" class="add-new-h2"><?php echo __("Hinzufügen", "wpsg"); ?></a>
		<a href="#" onclick="return wpsg_doExport();" class="add-new-h2"><?php echo __('CSV Export', 'wpsg'); ?></a>
		<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Voucher&amp;action=import" class="add-new-h2"><?php echo __('CSV Import', 'wpsg'); ?></a>
	</h2>
	<?php */ ?>
	
	<nav class="navbar navbar-default">
		<div class="container-fluid">
			<div class="navbar-header">
				<a class="navbar-brand" href="#"><?php echo __('wpShopGermany', 'wpsg'); ?></a>
			</div>
			<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
				<ul class="nav navbar-nav">
					<li role="presentation" class="<?php echo ((!isset($_REQUEST['action']))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt"><?php echo __("Gutscheinverwaltung", "wpsg"); ?></a></li>
					<li role="presentation" class="wpsg_showhide_filter <?php echo (($this->view['hasFilter'] === true)?'active':''); ?>"><a href="#" onclick="return false;"><span class="glyphicon glyphicon-search"></span><?php echo __("Gutscheinsuche", "wpsg"); ?></a></li>
			 		<li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'add'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=add"><span class="glyphicon glyphicon-plus"></span><?php echo __("Hinzufügen", "wpsg"); ?></a></li>
				</ul>
				<ul class="nav navbar-nav navbar-right">
					<li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'import'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=import&noheader=1"><span class="glyphicon glyphicon-import"></span><?php echo __("Import", "wpsg"); ?></a></li>
					<?php if (wpsg_isSizedArray($this->view['data'])) { ?>
					<li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'export'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=export&noheader=1"><span class="glyphicon glyphicon-export"></span><?php echo __("Export", "wpsg"); ?></a></li>
					<?php } ?>			
			 	</ul>			 	
			</div>
		</div>
		<div class="wpsg-filter container-fluid form-horizontal" style="display:<?php echo (($this->view['hasFilter'] === true)?'block':'none'); ?>;">
			<div class="row">
				<div class="col-lg-4">
					<form method="post" id="filter_form">
					
						<input id="wpsg_seite" type="hidden" name="seite" value="<?php echo $this->view['seite']; ?>" class="current-page" />
						<input id="wpsg_ascdesc" type="hidden" name="search[ascdesc]" value="<?php echo $this->view['search']['ascdesc']; ?>" />
										
						<?php echo wpsg_drawForm_Input('s', __('Suchfeld', 'wpsg'), wpsg_getStr($_REQUEST['s'])); ?>
						
						<?php echo wpsg_drawForm_SubmitButton(__('Gutschein suchen')); ?>
						
					</form>				
				</div>
			</div>		
		</div>
	</nav> 
	
	<?php echo $this->writeBackendMessage(); ?>
	
	<form method="POST" id="filter_form" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Voucher">
		
		<input type="hidden" name="wpsg_status" id="status" value="<?php echo @$this->view['filter']['status']; ?>" />
		<input type="hidden" name="wpsg_voucher_export" value="0" id="wpsg_voucher_export" />

		<input id="wpsg_order" type="hidden" name="filter[order]" value="<?php echo $this->view['filter']['order']; ?>" />
		<input id="wpsg_ascdesc" type="hidden" name="filter[ascdesc]" value="<?php echo $this->view['filter']['ascdesc']; ?>" />
		
		<?php if (wpsg_isSizedArray($this->view['arStatus'])) { ?>		
		<ul class="subsubsub wpsg_order_index_status">
			<?php foreach ($this->view['arStatus'] as $status_id => $status) { ?>
			<li>
				<?php if (isset($this->view['filter']['status']) && $this->view['filter']['status'] == $status_id) { ?>
				<span class="akt"><?php echo wpsg_hspc($status[0]); ?></span> <span class="count">(<?php echo $status[1]; ?>) | </span>
				<?php } else { ?>
				<a onclick="return goStatus(<?php echo $status_id; ?>);" href="#"><?php echo wpsg_hspc($status[0]); ?> <span class="count">(<?php echo $status[1]; ?>)</span></a> |
				<?php } ?>
			</li>			 
			<?php } ?>
			<li>
				<?php if (!isset($this->view['filter']['status']) || $this->view['filter']['status'] <= 0) { ?>
				<span class="akt"><?php echo __('Alle', 'wpsg'); ?></span> <span class="count">(<?php echo $this->view['countAll']; ?>)</span>
				<?php } else { ?>
				<a onclick="return goStatus(0);" href="#"><?php echo __('Alle', 'wpsg'); ?> <span class="count">(<?php echo $this->view['countAll']; ?>)</span></a>
				<?php } ?>
			</li>
		</ul>
		<?php } ?>
		
		<p class="search-box wpsg-search-box">
			<label for="post-search-input" class="screen-reader-text"><?php echo __('Gutscheine suchen', 'wpsg'); ?>:</label>
			<input type="text" value="<?php echo wpsg_hspc($this->view['filter']['search']); ?>" id="wpsg_search" name="wpsg_search" id="post-search-input" />
			<input type="submit" value="<?php echo __('Gutscheine suchen', 'wpsg'); ?>" class="button" id="search-submit" name="search-submit" />
		</p>
		
		<?php if (sizeof($this->view['data'] > 0)) { ?>
		<div class="tablenav top">
			<div class="tablenav-pages tablenav-pages-wrap"><span class="displaying-num"><?php echo wpsg_translate(__('#1# Elemente', 'wpsg'), $this->view['count']); ?></span>
				<div class="tablenav-pages">	
					<span class="pagination-links">
						<a onclick="return goPage(1);" href="#" title="<?php echo __('Zur ersten Seite gehen', 'wpsg'); ?>" class="first-page <?php echo (($this->view['page'] == '1')?'disabled':''); ?>">«</a>
						<a onclick="return goPage(<?php echo $this->view['page'] - 1; ?>);" href="#" title="<?php echo __('Zur vorherigen Seite gehen', 'wpsg'); ?>" class="prev-page <?php echo (($this->view['page'] <= 1)?'disabled':''); ?>">‹</a>
						<span class="paging-input"><input type="text" size="1" value="<?php echo $this->view['page']; ?>" id="seite" name="seite" title="<?php echo __('Aktuelle Seite', 'wpsg'); ?>" class="current-page"> <?php echo __('von', 'wpsg'); ?> <span class="total-pages"><?php echo $this->view['pages']; ?></span></span>
						<a onclick="return goPage(<?php echo $this->view['page'] + 1; ?>);" href="#" title="<?php echo __('Zur nächsten Seite gehen', 'wpsg'); ?>" class="next-page <?php echo (($this->view['page'] >= $this->view['pages'])?'disabled':''); ?>">›</a>
						<a onclick="return goPage(<?php echo $this->view['pages']; ?>);" href="#" title="<?php echo __('Zur letzten Seite gehen', 'wpsg'); ?>" class="last-page <?php echo (($this->view['page'] == $this->view['pages'])?'disabled':''); ?>">»</a>
					</span>
				</div>
				
				<script type="text/javascript">/* <![CDATA[ */

					jQuery('.tablenav-pages .disabled').bind('click', function() { return false; } );
				
				/* ]]> */</script>
				
				<br class="wpsg_clear">
			</div>
		</div>
		<?php } ?>
		
	</form> 
	
	<form method="POST" id="#gs_form" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Voucher&noheader=1">
			 
		<?php if (is_array($this->view['data']) && sizeof($this->view['data']) > 0) { ?>
		<table class="widefat post fixed vouchertable">
			<thead>
				<tr>
					<th class="manage-column column-checkbox"><input title="<?php echo __("Alle markieren", "wpsg"); ?>" type="checkbox" onclick="markAll(this);"/></th>
					<th class="manage-column column-nr <?php echo (($this->view['filter']['order'] == 'id')?'sorted':'sortable'); ?> <?php echo (($this->view['filter']['ascdesc'] == 'asc')?'asc':'desc'); ?>">
						<a href="#" onclick="return wpsg_setOrder('id');">
							<span><?php echo __("ID", 'wpsg'); ?></span>
							<span class="sorting-indicator"></span>
						</a>
					</th>
					<th class="manage-column column-code <?php echo (($this->view['filter']['order'] == 'code')?'sorted':'sortable'); ?> <?php echo (($this->view['filter']['ascdesc'] == 'asc')?'asc':'desc'); ?>">
						<a href="#" onclick="return wpsg_setOrder('code');">
							<span><?php echo __("Code", 'wpsg'); ?></span>
							<span class="sorting-indicator"></span>
						</a>
					</th>
					<th class="manage-column column-start <?php echo (($this->view['filter']['order'] == 'start_date')?'sorted':'sortable'); ?> <?php echo (($this->view['filter']['ascdesc'] == 'asc')?'asc':'desc'); ?>">
						<a href="#" onclick="return wpsg_setOrder('start_date');">
							<span><?php echo __("Start", 'wpsg'); ?></span>
							<span class="sorting-indicator"></span>
						</a> 
					</th>
					<th class="manage-column column-end <?php echo (($this->view['filter']['order'] == 'end_date')?'sorted':'sortable'); ?> <?php echo (($this->view['filter']['ascdesc'] == 'asc')?'asc':'desc'); ?>">
						<a href="#" onclick="return wpsg_setOrder('end_date');">
							<span><?php echo __("End", 'wpsg'); ?></span>
							<span class="sorting-indicator"></span>
						</a> 
					</th>				
					<th class="manage-column column-value <?php echo (($this->view['filter']['order'] == 'value')?'sorted':'sortable'); ?> <?php echo (($this->view['filter']['ascdesc'] == 'asc')?'asc':'desc'); ?>">
						<a href="#" onclick="return wpsg_setOrder('value');">
							<span><?php echo __("Wert", 'wpsg'); ?></span>
							<span class="sorting-indicator"></span>
						</a>
					</th>
					<th class="manage-column column-status <?php echo (($this->view['filter']['order'] == 'status')?'sorted':'sortable'); ?> <?php echo (($this->view['filter']['ascdesc'] == 'asc')?'asc':'desc'); ?>">
						<a href="#" onclick="return wpsg_setOrder('status');">
							<span><?php echo __("Status", 'wpsg'); ?></span>
							<span class="sorting-indicator"></span>
						</a> 
					</th>
				</tr>
			</thead>
			<tbody>
				<?php foreach ($this->view['data'] as $g) { ?>
				<tr>
					<td class="column-checkbox"><input type="checkbox" value="<?php echo $g['id']; ?>"  class="wpsg_mod_gs_cb" name="wpsg_gs_cb[]" /></td>
					<td class="column-nr"><?php echo wpsg_hspc($g['id']); ?>.</td>
					<td class="column-code"><?php echo wpsg_hspc($g['code']); ?></td>
					<td class="column-start"><?php echo date('d.m.Y H:i', strtotime($g['start_date'])); ?></td>
					<td class="column-end"><?php echo date('d.m.Y H:i', strtotime($g['end_date'])); ?></td>
					<td class="column-value">
						<?php if ($g['calc_typ'] == 'w') { ?>
							<?php echo wpsg_ff($g['value'], $this->get_option('wpsg_currency')); ?>
						<?php } else { ?>
							<?php echo wpsg_ff($g['value'], '%'); ?>
						<?php } ?> 
						<?php if (wpsg_tf($g['minvalue']) > 0) { ?>
						<br /><div class="wpsg_hinweis"><?php echo wpsg_translate(__('Ab #1#', 'wpsg'), wpsg_ff(wpsg_tf($g['minvalue']), $this->get_option('wpsg_currency'))); ?></div>
						<?php } ?>
					</td>
					<td class="column-status">
						<?php if (trim($g['comment']) != '') { ?>
						<a href="#" style="cursor:default;" title="<?php echo wpsg_hspc($g['comment']); ?>">
							<img src="<?php echo WPSG_URL_CONTENT; ?>plugins/<?php echo WPSG_FOLDERNAME; ?>/views/gfx/comment.png" alt="<?php echo wpsg_hspc($g['comment']); ?>" />
						</a>
						<?php } ?>
						<?php echo wpsg_hspc($g['status']); ?>
						<?php if ($g['multi'] == '1') { ?> 
						<?php if ($g['ordered'] > 0) { ?>
						<?php echo wpsg_translate(__('#1# mal benutzt', 'wpsg'), $g['ordered']); ?>
						<?php } ?>
						<span class="wpsg_mod_gutschein_multi">&nbsp;<a class="tooltip" href="#" onclick="return false;" title="<?php echo __('Mehrfach benutzbar', 'wpsg'); ?>">[M]</a></span>
						<?php } ?>						
					</td>
				</tr>
				<?php } ?>
			</tbody>
			<tfoot>
				<tr>
					<th class="manage-column column-checkbox"><input title="<?php echo __("Alle markieren", "wpsg"); ?>" type="checkbox" onclick="markAll(this);"/></th>
					<th class="manage-column column-nr <?php echo (($this->view['filter']['order'] == 'id')?'sorted':'sortable'); ?> <?php echo (($this->view['filter']['ascdesc'] == 'asc')?'asc':'desc'); ?>">
						<a href="#" onclick="return wpsg_setOrder('id');">
							<span><?php echo __("ID", 'wpsg'); ?></span>
							<span class="sorting-indicator"></span>
						</a>
					</th>
					<th class="manage-column column-code <?php echo (($this->view['filter']['order'] == 'code')?'sorted':'sortable'); ?> <?php echo (($this->view['filter']['ascdesc'] == 'asc')?'asc':'desc'); ?>">
						<a href="#" onclick="return wpsg_setOrder('code');">
							<span><?php echo __("Code", 'wpsg'); ?></span>
							<span class="sorting-indicator"></span>
						</a>
					</th>
					<th class="manage-column column-start <?php echo (($this->view['filter']['order'] == 'start_date')?'sorted':'sortable'); ?> <?php echo (($this->view['filter']['ascdesc'] == 'asc')?'asc':'desc'); ?>">
						<a href="#" onclick="return wpsg_setOrder('start_date');">
							<span><?php echo __("Start", 'wpsg'); ?></span>
							<span class="sorting-indicator"></span>
						</a> 
					</th>
					<th class="manage-column column-end <?php echo (($this->view['filter']['order'] == 'end_date')?'sorted':'sortable'); ?> <?php echo (($this->view['filter']['ascdesc'] == 'asc')?'asc':'desc'); ?>">
						<a href="#" onclick="return wpsg_setOrder('end_date');">
							<span><?php echo __("End", 'wpsg'); ?></span>
							<span class="sorting-indicator"></span>
						</a> 
					</th>				
					<th class="manage-column column-value <?php echo (($this->view['filter']['order'] == 'value')?'sorted':'sortable'); ?> <?php echo (($this->view['filter']['ascdesc'] == 'asc')?'asc':'desc'); ?>">
						<a href="#" onclick="return wpsg_setOrder('value');">
							<span><?php echo __("Wert", 'wpsg'); ?></span>
							<span class="sorting-indicator"></span>
						</a>
					</th>
					<th class="manage-column column-status <?php echo (($this->view['filter']['order'] == 'status')?'sorted':'sortable'); ?> <?php echo (($this->view['filter']['ascdesc'] == 'asc')?'asc':'desc'); ?>">
						<a href="#" onclick="return wpsg_setOrder('status');">
							<span><?php echo __("Status", 'wpsg'); ?></span>
							<span class="sorting-indicator"></span>
						</a> 
					</th>
				</tr>
			</tfoot> 
		</table>
		
		<div class="tablenav top">
			<div class="tablenav-pages"><span class="displaying-num"><?php echo wpsg_translate(__('#1# Elemente', 'wpsg'), $this->view['count']); ?></span>
				<div class="tablenav-pages">	
					<span class="pagination-links">
						<a onclick="return goPage(1);" href="#" title="<?php echo __('Zur ersten Seite gehen', 'wpsg'); ?>" class="first-page <?php echo (($this->view['page'] == '1')?'disabled':''); ?>">«</a>
						<a onclick="return goPage(<?php echo $this->view['page'] - 1; ?>);" href="#" title="<?php echo __('Zur vorherigen Seite gehen', 'wpsg'); ?>" class="prev-page <?php echo (($this->view['page'] <= 1)?'disabled':''); ?>">‹</a>
						<span class="paging-input"><input type="text" size="1" value="<?php echo $this->view['page']; ?>" id="seite" name="seite" title="<?php echo __('Aktuelle Seite', 'wpsg'); ?>" class="current-page"> <?php echo __('von', 'wpsg'); ?> <span class="total-pages"><?php echo $this->view['pages']; ?></span></span>
						<a onclick="return goPage(<?php echo $this->view['page'] + 1; ?>);" href="#" title="<?php echo __('Zur nächsten Seite gehen', 'wpsg'); ?>" class="next-page <?php echo (($this->view['page'] >= $this->view['pages'])?'disabled':''); ?>">›</a>
						<a onclick="return goPage(<?php echo $this->view['pages']; ?>);" href="#" title="<?php echo __('Zur letzten Seite gehen', 'wpsg'); ?>" class="last-page <?php echo (($this->view['page'] == $this->view['pages'])?'disabled':''); ?>">»</a>
					</span>
				</div>
				
				<script type="text/javascript">/* <![CDATA[ */

					jQuery('.tablenav-pages .disabled').bind('click', function() { return false; } );
				
				/* ]]> */</script>
				
				<br class="wpsg_clear">
			</div>
		</div>
	  	  
		<input class="button-primary" type="submit" onclick="if (!confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) return false;" name="wpshopgermany-submit-gs_del" value="<?php echo __("alle markierten Gutscheine löschen", "wpsg"); ?>" />&nbsp;
		<br /><br />		
		<?php } else { ?>
		<p><?php echo __('Keine Gutscheine in der Datenbank.', 'wpsg'); ?></p>					
		<?php } ?>
	
	</form>
</div>

<script type="text/javascript">/* <![CDATA[ */

	function markAll(el)
	{

		var arCB = jQuery(".wpsg_mod_gs_cb");

		for (var i = 0; i < arCB.length; i ++)
		{
			if (el.checked)
			{
				jQuery(arCB[i]).attr('checked', true);
			}
			else
			{
				jQuery(arCB[i]).attr('checked', false);
			}
		}
					
	} // function markAll(el)

/* ]]> */</script>