summaryrefslogtreecommitdiff
path: root/views/mods/mod_productgroups/index.phtml
blob: c51250911548c5e075ebd1a3d47655049d7bf521 (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
<?php

	/**
	 * Template für die Produktgruppenübersicht
	 */

?>

<div class="wpsg_productgroups" id="wpsg-bs">

    <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-customer-navbar-collapse-1">
				<ul class="nav navbar-nav">
					<li role="presentation" class="wpsg-customer-tab-a active"><a href="#" onclick="return false;"><?php echo wpsg_translate(__("Produktgruppenverwaltung (#1# Produktgruppen)", "wpsg"), $this->view['countAll']); ?></a></li>
                    <li role="presentation" class="wpsg-customer-tab-a wpsg_showhide_filter" id="wpsg-customer-tab-0"><a href="#" onclick="return false;"><span class="glyphicon glyphicon-search"></span><?php echo __("Suche", "wpsg"); ?></a></li>
                    <li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'add'))?'active':''); ?>"><a href="<?php 
							
						echo wpsg_admin_url('Productgroups', '', ['wpsg_mod_action' => 'add']);
						
					?>"><span class="glyphicon glyphicon-plus"></span><?php echo __("Hinzufügen", "wpsg"); ?></a></li>
				</ul>
				<ul class="nav navbar-nav navbar-right">
				</ul>
			</div>
		</div>

        <div class="wpsg-filter wpsg-customer-tab wpsg-customer-tab-0 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">

						<?php echo wp_nonce_field('wpsg-mod-productgroups-search'); ?>
						
                        <input id="wpsg_seite" type="hidden" name="filter[page]" value="<?php echo @$this->view['page']; ?>" class="current-page" />

                        <input id="wpsg_order" type="hidden" name="filter[order]" value="<?php echo @$this->view['arFilter']['order']; ?>" />
                        <input id="wpsg_ascdesc" type="hidden" name="filter[ascdesc]" value="<?php echo @$this->view['arFilter']['ascdesc']; ?>" />

                        <?php echo wpsg_drawForm_Input('filter[s]', __('Suchfeld', 'wpsg'), wpsg_getStr($this->view['arFilter']['s'])); ?>

                        <?php echo wpsg_drawForm_SubmitButton(__('Produktgruppen suchen', 'wpsg')); ?><br />

                    </form>
                </div>
            </div>
        </div>

    </nav>
	
	<div class="wpsg_msg_wrap"><hr class="wp-header-end wpsg-wp-header-end"/></div>
	<div class="wpsg_clear"></div>
	
    <?php if ($this->view['pages'] > 1) { ?>
        <nav class="pagination_wrap">
            <ul class="pagination">
                <?php if ($this->view['arFilter']['page'] > 1) { ?>
                    <li><a onclick="return goPage(<?php echo $this->view['arFilter']['page'] - 1; ?>);" href="#" aria-label="<?php echo __('Vorherige Seite', 'wpsg'); ?>"><span aria-hidden="true">&laquo;</span></a></li>
                <?php } ?>
                <?php for ($i = 1; $i <= $this->view['pages']; $i ++) { ?>
                    <li class="<?php echo (($i == $this->view['arFilter']['page'])?'active':''); ?>"><a onclick="return goPage(<?php echo $i; ?>);" href="#"><?php echo $i; ?></a></li>
                <?php } ?>
                <?php if ($this->view['arFilter']['page'] + 1 <= $this->view['pages']) { ?>
                    <li><a onclick="return goPage(<?php echo $this->view['arFilter']['page'] + 1; ?>);" href="#" aria-label="<?php echo __('Nächste Seite', 'wpsg'); ?>"><span aria-hidden="true">&raquo;</span></a></li>
                <?php } ?>
            </ul>
        </nav>
	<?php } ?>

    <div class="wpsg_clear"></div>

	<div class="content">

        <?php if (is_array($this->view['arData']) && sizeof($this->view['arData']) > 0) { ?>

            <table class="table wpsg-table-order table-bordered table-hover table-striped wpsg-table-customer">
                <thead>
                    <tr>
                        <th class="wpsg_pic_col"></th>
                        <th class="col_id"><?php echo __("ID", 'wpsg'); ?></th>
                        <th class="wpsg_order col_name" data-order="nr"><?php echo __("Name", 'wpsg'); ?></th>
                        <th class="wpsg_order col_template" data-order="template"><?php echo __("Template", 'wpsg'); ?></th>
                        <th class="wpsg_order col_pos" data-order="template"><?php echo __("Position", 'wpsg'); ?></th>
                        <th class="wpsg_order col_products" data-order="products"><?php echo __("Produkte", 'wpsg'); ?></th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($this->view['arData'] as /** @var wpsg_productgroup */ $pg) { ?>
                    <tr>
                        <td class="wpsg_pic_col">
                            <?php if ($pg->getImage() > 0) { ?>

                                <?php echo \wp_get_attachment_image($pg->getImage(), [75, 75]); ?>

                            <?php } ?>
                        </td>
                        <td class="col_id"><?php echo intval($pg->id); ?></td>
                        <td class="col_name">
                            <strong><a title="<?php echo __("Diese Produktgruppe bearbeiten", "wpsg"); ?>" href="<?php

                                echo wpsg_admin_url('Productgroups', '', ['wpsg_mod_action' => 'edit', 'edit_id' => $pg->id]);

                            ?>" class="row-title"><?php echo $pg->name; ?></a></strong>
					        <div class="row-actions">
                                <span class="edit"><a title="<?php echo __("Diese Produktgruppe bearbeiten", "wpsg"); ?>" href="<?php
										
									echo wpsg_admin_url('Productgroups', '', ['wpsg_mod_action' => 'edit', 'edit_id' => $pg->id]);
										
								?>"><?php echo __("Bearbeiten", "wpsg"); ?></a>
                                |
                                <span class="del"><a onclick="if (!confirm('<?php echo __("Sind Sie sich sicher?", "wpsg"); ?>')) return false;" title="<?php echo __("Diese Produktgruppe löschen", "wpsg"); ?>" href="<?php 
										
									echo wpsg_admin_url('Productgroups', '', ['wpsg_mod_action' => 'del', 'edit_id' => $pg->id], ['noheader' => '1']); 
										
								?>"><?php echo __("Löschen", "wpsg"); ?></a>
                                <?php if ($pg->countProducts() > 0) { ?>
                                |
                                <span class="edit"><a title="<?php echo __("Zur Produktliste", "wpsg"); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&search[pgruppe]=<?php echo $pg->id; ?>"><?php echo __("Zur Produktliste", "wpsg"); ?></a>
                                <?php } ?>
                            </div>
                        </td>
                        <td class="col_template">
                            <?php echo (($pg->template_file == "0")?'Individuelle Produkttemplates':$pg->template_file); ?>
                        </td>
						<td class="col_pos">
                            <?php echo $pg->pos; ?>
                        </td>
                        <td class="col_products">
                            <?php echo $pg->countProducts(); ?>
                        </td>
                    </tr>
                    <?php } ?>
                </tbody>
            </table>

            <?php if ($this->view['pages'] > 1) { ?>
                <nav class="pagination_wrap pagination_wrap_bottom">
                    <ul class="pagination">
                        <?php if ($this->view['arFilter']['page'] > 1) { ?>
                            <li><a onclick="return goPage(<?php echo $this->view['arFilter']['page'] - 1; ?>);" href="#" aria-label="<?php echo __('Vorherige Seite', 'wpsg'); ?>"><span aria-hidden="true">&laquo;</span></a></li>
                        <?php } ?>
                        <?php for ($i = 1; $i <= $this->view['pages']; $i ++) { ?>
                            <li class="<?php echo (($i == $this->view['arFilter']['page'])?'active':''); ?>"><a onclick="return goPage(<?php echo $i; ?>);" href="#"><?php echo $i; ?></a></li>
                        <?php } ?>
                        <?php if ($this->view['arFilter']['page'] + 1 <= $this->view['pages']) { ?>
                            <li><a onclick="return goPage(<?php echo $this->view['arFilter']['page'] + 1; ?>);" href="#" aria-label="<?php echo __('Nächste Seite', 'wpsg'); ?>"><span aria-hidden="true">&raquo;</span></a></li>
                        <?php } ?>
                    </ul>
                </nav>
            <?php } ?>

        <?php } else { ?>

            <?php echo wpsg_drawForm_AdminboxStart(); ?>
    		<?php echo __('Keine Produktgruppen in der Datenbank.', 'wpsg'); ?>
            <?php echo wpsg_drawForm_AdminboxEnd(); ?>

        <?php } ?>

</div>

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

    <?php if (wpsg_isSizedString($this->view['arFilter']['order']) && wpsg_isSizedString($this->view['arFilter']['ascdesc'])) { ?>
    jQuery('th[data-order="<?php echo $this->view['arFilter']['order']; ?>"]').addClass('wpsg_order_<?php echo strtolower($this->view['arFilter']['ascdesc']); ?>');
    <?php } ?>

	function goPage(page)
	{

		//if (page <= 0 || page == <?php echo $this->view['arFilter']['page']; ?> || page > <?php echo $this->view['pages']; ?>) return;

		jQuery('#wpsg_seite').val(page);
		jQuery('#filter_form').trigger('submit');

		return false;

	} // function goPage(page)

/* ]]> */</script>