Subversion Repositories wpShopGermany4

Rev

Rev 8212 | Rev 8317 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1197 daniel 1
<?php
2
 
3
	/**
4
	 * Template für die Einstellungen eines Profils
5
	 */
6
 
5911 daniel 7
	$inlineEdit_url = WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=inlinedit&noheader=1&profil_id='.$this->view['profil']['id'];
5896 daniel 8
	$upload_url = WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=musterupload&noheader=1&profil_id='.$this->view['profil']['id'];
6428 daniel 9
    $download_url = WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=save&noheader=1&profil_id='.$this->view['profil']['id'];
5896 daniel 10
 
1197 daniel 11
?>
12
 
5896 daniel 13
<div id="wpsg_mod_export_profil_tab">
14
    <ul class="nav nav-tabs" role="tablist">
15
        <li role="presentation" class="active"><a href="#tab1" aria-controls="home" role="tab" data-toggle="tab"><?php echo __('Profiloptionen', 'wpsg'); ?></a></li>
16
        <li role="presentation"><a href="#tab2" aria-controls="profile" role="tab" data-toggle="tab"><?php echo __('Feldkonfiguration', 'wpsg'); ?></a></li>
5911 daniel 17
        <li role="presentation"><a href="#tab3" aria-controls="cron" role="tab" data-toggle="tab"><?php echo __('Automatische Ausführung', 'wpsg'); ?></a></li>
5896 daniel 18
    </ul>
19
	<div class="tab-content">
5911 daniel 20
		<div id="tab1" role="tabpanel" class="tab-pane active">
5896 daniel 21
 
22
            <?php echo wpsg_drawForm_Text(__('Profilname', 'wpsg'), $this->view['profil']['name'], 'name', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
23
            <?php echo wpsg_drawForm_Text(__('Dateiname', 'wpsg'), $this->view['profil']['filename'], 'filename', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
24
            <?php echo wpsg_drawForm_Text(__('Encoding', 'wpsg'), $this->view['arFileEncoding'][$this->view['profil']['file_encoding']], 'file_encoding', array('inlineEdit' => true, 'inlineEdit_type' => 'select', 'inlineEdit_source' => $this->view['arFileEncoding'], 'inlineEdit_url' => $inlineEdit_url)); ?>
25
            <?php echo wpsg_drawForm_Text(__('Dateiformat', 'wpsg'), $this->view['arExportFormats'][$this->view['profil']['format']], 'format', array('inlineEdit' => true, 'inlineEdit_type' => 'select', 'inlineEdit_source' => $this->view['arExportFormats'], 'inlineEdit_url' => $inlineEdit_url)); ?>
26
 
27
            <?php /* CSV */ ?>
28
            <div class="wpsg_mod_export_format wpsg_mod_export_format_<?php echo wpsg_mod_export::FORMAT_CSV; ?>" style="display:<?php echo (($this->view['profil']['format'] == wpsg_mod_export::FORMAT_CSV)?'block':'none'); ?>;">
29
 
30
                <?php echo wpsg_drawForm_Text('Feld-Trennzeichen', $this->view['profil']['field_delimiter'], 'field_delimiter', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
6052 hartmut 31
                <?php echo wpsg_drawForm_Text('Feld-Begrenzung', $this->view['profil']['field_enclosure'], 'field_enclosure', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
5896 daniel 32
                <?php echo wpsg_drawForm_Text('Maskierungs-Zeichen', $this->view['profil']['field_escape'], 'field_escape', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
33
 
34
            </div>
35
 
5911 daniel 36
            <?php /* XML */ ?>
37
            <div class="wpsg_mod_export_format wpsg_mod_export_format_<?php echo wpsg_mod_export::FORMAT_XML; ?>" style="display:<?php echo (($this->view['profil']['format'] == wpsg_mod_export::FORMAT_XML)?'block':'none'); ?>;">
38
 
39
                <?php echo wpsg_drawForm_Text('Root-Tagname', $this->view['profil']['xml_roottag'], 'xml_roottag', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
6425 daniel 40
 
41
                <?php if ($this->view['profil']['export_type'] === wpsg_mod_export::TYPE_ORDER) { ?>
42
                    <?php echo wpsg_drawForm_Text('Bestellung-Tagname', $this->view['profil']['xml_ordertag'], 'xml_ordertag', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
43
                    <?php echo wpsg_drawForm_Text('Produkt-Root-Tagname', $this->view['profil']['xml_productroottag'], 'xml_productroottag', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
44
                <?php } ?>
45
 
6447 daniel 46
                <?php if ($this->view['profil']['export_type'] === wpsg_mod_export::TYPE_CUSTOMER) { ?>
47
                    <?php echo wpsg_drawForm_Text('Kunden-Tagname', $this->view['profil']['xml_customertag'], 'xml_customertag', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
48
                <?php } else { ?>
49
                    <?php echo wpsg_drawForm_Text('Produkt-Tagname', $this->view['profil']['xml_producttag'], 'xml_producttag', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
50
                <?php } ?>
5911 daniel 51
 
52
            </div>
53
 
5896 daniel 54
            <div class="wpsg_mod_export_format wpsg_mod_export_format_<?php echo wpsg_mod_export::FORMAT_CSV; ?>" style="display:<?php echo (($this->view['profil']['format'] == wpsg_mod_export::FORMAT_CSV)?'block':'none'); ?>">
5911 daniel 55
                <?php echo wpsg_drawForm_Upload('samplefile', __('Muster Vorlage', 'wpsg'), false, '50', '100000', array('ajax_upload' => true, 'ajax_upload_url' => $upload_url, 'ajax_success' => 'samplefile_success')); ?>
5896 daniel 56
            </div>
5911 daniel 57
 
58
            <br />
59
 
6425 daniel 60
            <?php if ($this->view['profil']['export_type'] === wpsg_mod_export::TYPE_ORDER) { ?>
5896 daniel 61
 
6425 daniel 62
                <?php echo wpsg_drawForm_Checkbox('order_onetime', __('Bestellungen nur einmalig exportieren', 'wpsg'), $this->view['profil']['order_onetime'], array('label' => __('Optionen', 'wpsg'), 'inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
63
 
64
                <div class="wpsg_mod_export_format wpsg_mod_export_format_<?php echo wpsg_mod_export::FORMAT_CSV; ?>" style="display:<?php echo (($this->view['profil']['format'] == wpsg_mod_export::FORMAT_CSV)?'block':'none'); ?>">
65
                <?php echo wpsg_drawForm_Checkbox('order_online', __('Eine Zeile pro Bestellung', 'wpsg'), $this->view['profil']['order_online'], array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
66
                </div>
67
 
68
            <?php } ?>
69
 
5911 daniel 70
            <div class="wpsg_mod_export_format wpsg_mod_export_format_<?php echo wpsg_mod_export::FORMAT_CSV; ?>" style="display:<?php echo (($this->view['profil']['format'] == wpsg_mod_export::FORMAT_CSV)?'block':'none'); ?>">
71
 
6052 hartmut 72
                <?php echo wpsg_drawForm_Checkbox('csv_fieldnames', __('Spaltennamen in erster Zeile', 'wpsg'), $this->view['profil']['csv_fieldnames'], array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
5896 daniel 73
 
74
            </div>
75
 
76
        </div>
77
 
5911 daniel 78
        <div id="tab2" role="tabpanel" class="tab-pane">
5896 daniel 79
 
80
            <div id="wpsg_mod_export_fields"><?php echo $this->view['strFields']; ?></div>
81
 
82
        </div>
5911 daniel 83
 
84
        <div id="tab3" role="tabpanel" class="tab-pane">
85
 
86
            <?php echo wpsg_drawForm_Text(__('Automatische Ausführung aktivieren', 'wpsg'), $this->view['arCronTypes'][$this->view['profil']['cron_interval']], 'cron_interval', array('inlineEdit' => true, 'inlineEdit_callback' => 'switchCronType', 'inlineEdit_url' => $inlineEdit_url, 'inlineEdit_type' => 'select', 'inlineEdit_source' => wpsg_prepare_for_inlineEdit($this->view['arCronTypes']))); ?>
87
 
88
            <div class="cron_interval cron_interval_1" style="<?php echo (($this->view['profil']['cron_interval'] == '0')?'display:none;':''); ?>">
89
 
90
                <?php echo wpsg_drawForm_Text(__('Pfad', 'wpsg'), $this->view['profil']['cron_path'], 'cron_path', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
5912 daniel 91
                <?php echo wpsg_drawForm_Text(__('Letzte Ausführung', 'wpsg'), (($this->view['profil']['cron_lastrun'] == '0000-00-00')?__('Noch nie', 'wpsg'):wpsg_formatTimestamp($this->view['profil']['cron_lastrun'], true)), false, array('noP' => false)); ?>
8131 daniel 92
 
93
                <fieldset id="wpsg_mod_export_cron_url" style="display:<?php echo (($this->view['profil']['cron_interval'] !== wpsg_mod_export::CRON_ORDER)?'block':'none'); ?>;">
94
                    <?php echo wpsg_drawForm_Text(__('Cron URL', 'wpsg'), '<a href="'.site_url().'/?wpsg_cron=1">'.site_url().'/?wpsg_cron=1</a>', false, array('noP' => false)); ?>
95
                </fieldset>
8212 daniel 96
 
97
                <?php echo wpsg_drawForm_Checkbox('wp_cron', __('Stündlich mit Wordpress Cron ausführen', 'wpsg'), ($this->view['profil']['wp_cron']??'0') === '1'); ?>
98
 
99
                <script>
100
 
101
                    document.getElementById('wp_cron').addEventListener('change', (event) => {
102
 
103
                        jQuery.ajax({
104
                            url: '<?php echo $inlineEdit_url; ?>',
105
                            data: {
106
                                name: 'wp_cron',
107
                                value: ((event.target.checked === true)?'1':'0')
108
                            }
109
                        })
110
 
111
                       // console.log('<?php echo $inlineEdit_url; ?>');
112
 
113
                    });
114
 
115
                </script>
116
 
6425 daniel 117
                <?php if ($this->view['profil']['export_type'] === wpsg_mod_export::TYPE_ORDER) { ?>
8131 daniel 118
                <fieldset id="wpsg_mod_export_orderfilter" style="display:<?php echo (($this->view['profil']['cron_interval'] !== wpsg_mod_export::CRON_ORDER)?'block':'none'); ?>;">
5911 daniel 119
 
5912 daniel 120
                    <legend><div class="col-sm-offset-6"><?php echo __('Bestellfilter', 'wpsg'); ?></div></legend>
121
 
5911 daniel 122
                    <form id="wpsg_mod_export_searchfilter">
123
 
124
                        <?php echo wpsg_drawForm_Text(__('Suchfeld', 'wpsg'), wpsg_getStr($this->view['profil']['orderfilter']['s']), 'orderfilter_s', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
125
                        <?php echo wpsg_drawForm_Text(__('Kunde (ID)', 'wpsg'), wpsg_getStr($this->view['profil']['orderfilter']['k_id']), 'orderfilter_k_id', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
126
 
127
                        <?php $arOrderStatus = wpsg_array_merge(array('-1' => __('Alle', 'wpsg')), $this->arStatus); ?>
128
                        <?php echo wpsg_drawForm_Text(__('Bestellstatus', 'wpsg'), $arOrderStatus[wpsg_getStr($this->view['profil']['orderfilter']['status'], '-1')], 'orderfilter_status', array('inlineEdit' => true, 'inlineEdit_type' => 'select', 'inlineEdit_url' => $inlineEdit_url, 'inlineEdit_source' => $arOrderStatus)); ?>
129
 
130
                        <?php $arMonth = array('-1' => __('Alle', 'wpsg')); ?>
8212 daniel 131
                        <?php for ($i = 1; $i <= 12; $i ++) { $arMonth[str_pad($i, 2, '0', STR_PAD_LEFT)] = wpsg_strftime("%B", mktime(0, 0, 0, $i, 1, 2000)); } ?>
5911 daniel 132
 
133
                        <?php $arYearCdate = array('-1' => __('Alle', 'wpsg')); ?>
134
                        <?php foreach ($this->view['cdate_years'] as $y) { $arYearCdate[$y] = $y; } ?>
135
 
136
                        <?php $arYearInvoice = array('-1' => __('Alle', 'wpsg')); ?>
137
                        <?php foreach ($this->view['invoicedate_years'] as $y) { $arYearInvoice[$y] = $y; } ?>
138
 
139
                        <?php echo wpsg_drawForm_TextStart(); ?>
140
                        <div class="row">
141
                            <div class="col-lg-6">
142
                                <p id="orderfilter_cdate_m" class="form-control-static"><?php echo $arMonth[wpsg_getStr($this->view['profil']['orderfilter']['cdate_m'], '-1')]; ?></p>
143
                                <script type="text/javascript">/* <![CDATA[ */
144
 
145
                                    jQuery(document).ready(function() {
146
 
5934 hartmut 147
                                        jQuery('#orderfilter_cdate_m').wpsg_editable('<?php echo $inlineEdit_url; ?>', {
5911 daniel 148
                                            'test': '1', 'placement': 'bottom', 'type': 'select',  'data': <?php echo wpsg_prepare_for_inlineEdit($arMonth); ?>
149
                                        } );
150
 
151
                                    } );
152
 
153
                                /* ]]> */</script>
154
                            </div>
155
                            <div class="col-lg-6">
156
                                <p id="orderfilter_cdate_y" class="form-control-static"><?php echo $arYearCdate[wpsg_getStr($this->view['profil']['orderfilter']['cdate_y'], '-1')]; ?></p>
157
                                <script type="text/javascript">/* <![CDATA[ */
158
 
159
                                    jQuery(document).ready(function() {
160
 
5934 hartmut 161
                                        jQuery('#orderfilter_cdate_y').wpsg_editable('<?php echo $inlineEdit_url; ?>', {
5911 daniel 162
                                            'placement': 'bottom', 'type': 'select',  'data': <?php echo wpsg_prepare_for_inlineEdit($arYearCdate); ?>
163
                                        } );
164
 
165
                                    } );
166
 
167
                                /* ]]> */</script>
168
                            </div>
169
                        </div>
170
                        <?php echo wpsg_drawForm_TextEnd(__('Bestelldatum (Monat/Jahr)', 'wpsg'), array('noP' => true)); ?>
171
 
172
                        <?php if ($this->hasMod('wpsg_mod_rechnungen')) { ?>
173
                        <?php echo wpsg_drawForm_TextStart(); ?>
174
                        <div class="row">
175
                            <div class="col-lg-6">
176
                                <p id="orderfilter_invoicedate_m" class="form-control-static"><?php echo $arMonth[wpsg_getStr($this->view['profil']['orderfilter']['invoicedate_m'], '-1')]; ?></p>
177
                                <script type="text/javascript">/* <![CDATA[ */
178
 
179
                                    jQuery(document).ready(function() {
180
 
5934 hartmut 181
                                        jQuery('#orderfilter_invoicedate_m').wpsg_editable('<?php echo $inlineEdit_url; ?>', {
5911 daniel 182
                                            'placement': 'bottom', 'type': 'select',  'data': <?php echo wpsg_prepare_for_inlineEdit($arMonth); ?>
183
                                        } );
184
 
185
                                    } );
186
 
187
                                /* ]]> */</script>
188
                            </div>
189
                            <div class="col-lg-6">
190
                                <p id="orderfilter_invoicedate_y" class="form-control-static"><?php echo $arYearInvoice[wpsg_getStr($this->view['profil']['orderfilter']['invoicedate_y'], '-1')]; ?></p>
191
                                <script type="text/javascript">/* <![CDATA[ */
192
 
193
                                    jQuery(document).ready(function() {
194
 
5934 hartmut 195
                                        jQuery('#orderfilter_invoicedate_y').wpsg_editable('<?php echo $inlineEdit_url; ?>', {
5911 daniel 196
                                            'placement': 'bottom', 'type': 'select',  'data': <?php echo wpsg_prepare_for_inlineEdit($arYearInvoice); ?>
197
                                        } );
198
 
199
                                    } );
200
 
201
                                /* ]]> */</script>
202
                            </div>
203
                        </div>
204
                        <?php echo wpsg_drawForm_TextEnd(__('Rechnungsdatum (Monat/Jahr)', 'wpsg'), array('noP' => true)); ?>
205
                        <?php } ?>
206
 
207
                    </form>
208
 
209
                </fieldset>
6425 daniel 210
                <?php } else if ($this->view['profil']['export_type'] === wpsg_mod_export::TYPE_PRODUCT) { ?>
211
                <fieldset id="wpsg_mod_export_productfilter">
212
 
213
                    <legend><div class="col-sm-offset-6"><?php echo __('Produktfilter', 'wpsg'); ?></div></legend>
214
 
215
                    <form id="wpsg_mod_export_searchfilter">
216
 
217
                        <?php echo wpsg_drawForm_Text(__('Suchfeld', 'wpsg'), wpsg_getStr($this->view['profil']['orderfilter']['s']), 'orderfilter_s', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
218
 
219
                        <?php if ($this->hasMod('wpsg_mod_productgroups')) { $arProductGroupSelect = array('-1' => __('Alle Produktgruppen', 'wpsg')) + wpsg_productgroup::getProductgroupSelect(); ?>
220
                        <?php echo wpsg_drawForm_Text(__('Produktgruppe', 'wpsg'), $arProductGroupSelect[wpsg_getStr($this->view['profil']['orderfilter']['productgroup_ids'], '-1')], 'orderfilter_productgroup_ids', array('inlineEdit' => true, 'inlineEdit_type' => 'select', 'inlineEdit_url' => $inlineEdit_url, 'inlineEdit_source' => $arProductGroupSelect)); ?>
221
                        <?php } ?>
222
 
223
                        <?php if ($this->hasMod('wpsg_mod_produktartikel')) { $temp = $this->callMod('wpsg_mod_produktartikel', 'getProductcategorySelect', array()); ?>
224
                        <?php $arProductCategorySelect = array(); foreach ($temp as $k => $v) $arProductCategorySelect[$v['term_id']] = $v['label']; ?>
8264 karl 225
                        <?php $productCategoryIds = wpsg_getStr($this->view['profil']['orderfilter']['productcategory_ids'], '-1'); ?>
226
                        <?php $selectedCategory = $arProductCategorySelect['-1'] ?? ''; ?>
227
                        <?php echo wpsg_drawForm_Text(__('Produktkategorie', 'wpsg'), $arProductCategorySelect[$productCategoryIds], 'orderfilter_productcategory_ids', array('inlineEdit' => true, 'inlineEdit_type' => 'select', 'inlineEdit_url' => $inlineEdit_url, 'inlineEdit_source' => $arProductCategorySelect)); ?>
6425 daniel 228
                        <?php } ?>
229
 
230
                    </form>
231
 
232
                </fieldset>
6447 daniel 233
                <?php } else if ($this->view['profil']['export_type'] === wpsg_mod_export::TYPE_CUSTOMER) { ?>
234
                <fieldset id="wpsg_mod_export_productfilter">
235
 
236
                    <legend><div class="col-sm-offset-6"><?php echo __('Kundenfilter', 'wpsg'); ?></div></legend>
237
 
238
                    <form id="wpsg_mod_export_searchfilter">
239
 
240
                        <?php echo wpsg_drawForm_Text(__('Suchfeld', 'wpsg'), wpsg_getStr($this->view['profil']['orderfilter']['s']), 'orderfilter_s', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
241
 
242
                    </form>
243
 
244
                </fieldset>
6425 daniel 245
                <?php } ?>
5911 daniel 246
 
247
            </div>
248
 
249
        </div>
250
 
5896 daniel 251
    </div>
1197 daniel 252
</div>
253
 
2598 daniel 254
<br />
255
 
6428 daniel 256
<a onclick="return wpsg_mod_export_removeProfil(<?php echo $this->view['profil']['id']; ?>);" href="#"><span class="glyphicon glyphicon-trash wpsg-glyphicon"></span><?php echo __('Profil löschen', 'wpsg'); ?></a><br />
257
<a href="<?php echo $download_url; ?>"><span class="glyphicon glyphicon-save wpsg-glyphicon"></span><?php echo __('Profil speichern', 'wpsg'); ?></a>
1197 daniel 258
 
5896 daniel 259
<script type="text/javascript">/* <![CDATA[ */
5856 thomas 260
 
8131 daniel 261
    function switchCronType(response, newValue) {
262
 
263
		if (parseInt(newValue) === parseInt("<?php echo wpsg_mod_export::CRON_ORDER; ?>")) {
264
 
265
			jQuery('#wpsg_mod_export_cron_url').hide();
266
			jQuery('#wpsg_mod_export_orderfilter').hide();
267
 
268
        } else {
269
 
270
			jQuery('#wpsg_mod_export_cron_url').show();
271
			jQuery('#wpsg_mod_export_orderfilter').show();
272
 
273
        }
274
 
5911 daniel 275
        if (newValue != "0") jQuery('.cron_interval_1').show();
276
        else jQuery('.cron_interval_1').hide();
277
 
278
    }
279
 
5896 daniel 280
    function samplefile_success(data)
281
    {
282
 
283
        jQuery('#wpsg_mod_export_fields').html(data);
284
        jQuery('#samplefile').val('');
7131 daniel 285
 
286
        jQuery('#wpsg_mod_export_profil_tab .nav-tabs a[href="#tab2"]').tab('show');
5896 daniel 287
 
288
    }
289
 
290
    jQuery(document).ready(function() {
291
 
292
		jQuery('#format').on('save', function(e, params) {
1197 daniel 293
 
5896 daniel 294
			jQuery('.wpsg_mod_export_format').hide();
295
			jQuery('.wpsg_mod_export_format_' + params.newValue).show();
1197 daniel 296
 
1212 daniel 297
		} );
5913 daniel 298
 
299
        jQuery('#name').on('save', function(e, params) {
300
 
301
            jQuery('#wpsg_mod_export_profil option[value="<?php echo $this->view['profil']['id']; ?>"]').text(params.newValue);
302
 
303
		} );
1210 daniel 304
 
305
	} );
306
 
5896 daniel 307
/* ]]> */</script>