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
|
<?php
/**
* Template für die Verwaltung der Kundendaten
* @version 4.6.1
*/
?>
<div class="wpsg_admin_submenu">
<div class="list-group">
<span class="list-group-head list-group-item"><?php echo __('Konfiguration', 'wpsg'); ?></span>
<?php foreach ($this->view['arSubAction'] as $k => $v) { ?>
<a class="list-group-item <?php echo (($k == $this->view['subAction'])?'active':''); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=<?php echo $k; ?>"><?php echo $v['Menutext']; ?></a>
<?php } ?>
</div>
</div>
<!-- Modal für Codeanzeige -->
<div class="modal fade" id="wpsg_code_dialog" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"><?php echo __('HTML Code Block', 'wpsg'); ?></h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Schließen', 'wpsg'); ?></button>
</div>
</div>
</div>
</div>
<div class="wpsg_admin_content form-horizontal wpsg_customerfield">
<form name="form1" method="post" enctype="multipart/form-data" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=<?php echo $_REQUEST['subaction']; ?>&noheader=1">
<?php echo wp_nonce_field('wpsg-admin-kundendaten'); ?>
<div class="panel panel-default">
<div class="panel-heading clearfix">
<h3 class="panel-title"><?php echo __('Kundendaten', 'wpsg'); ?></h3>
</div>
<div class="panel-body">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#tabcontent1" role="tab" aria-controls="tabcontent1" data-toggle="tab"><?php echo __('Pflichtfelder', 'wpsg'); ?></a></li>
<li role="presentation" class=""><a href="#tabcontent2" role="tab" aria-controls="tabcontent2" data-toggle="tab"><?php echo __('Weitere Kundendaten', 'wpsg'); ?></a></li>
<li role="presentation" class=""><a href="#tabcontent3" role="tab" aria-controls="tabcontent3" data-toggle="tab"><?php echo __('Kundenvoreinstellungen', 'wpsg'); ?></a></li>
</ul>
<div class="tab-content">
<div role="tabpanel" id="tabcontent1" class="tab-pane active">
<?php echo $this->render(WPSG_PATH_VIEW.'/admin/kundendaten_tab1.phtml'); ?>
</div>
<div role="tabpanel" id="tabcontent2" class="tab-pane">
<div id="wpsg_kv_list">
<?php echo $this->render(WPSG_PATH_VIEW.'/admin/kundendaten_tab2.phtml'); ?>
</div>
<div class="wpsg_clear"></div><br />
<a href="" onclick="return wpsg_addCustomField();"><span class="glyphicon glyphicon-plus"></span> <?php echo __('Neue Kundenvariable anlegen.', 'wpsg'); ?></a>
</div>
<div role="tabpanel" id="tabcontent3" class="tab-pane">
<?php echo $this->render(WPSG_PATH_VIEW.'/admin/kundendaten_tab3.phtml'); ?>
</div>
</div>
</div>
</div>
<p class="submit"><input name="submit" type="submit" value="<?php echo __('Einstellungen Speichern', 'wpsg'); ?>" class="button-primary" /></p>
</form>
<script>
/**
* Fügt ein neues Feld in die Liste der Kundenvariablen ein und lädt die Liste neu
*/
function wpsg_addCustomField()
{
jQuery('#wpsg_kv_list').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
jQuery.ajax( {
url: '<?php echo html_entity_decode(wp_nonce_url(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=kundendaten&do=add&noheader=1', 'wpsg-admin-kundendaten-add')); ?>',
success: function(data) {
jQuery('#wpsg_kv_list').html(data);
}
} );
return false;
} // function wpsg_addCustomField()
/**
* Löscht eine Kundenvariable und entfernt die Zeile aus der Liste
*/
function wpsg_removeCustomField(kv_index)
{
if (!confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) return false;
jQuery('.wpsg_customervar_row_' + kv_index).hide(250, function() { jQuery(this).remove(); } );
jQuery.ajax( {
url: '<?php echo html_entity_decode(wp_nonce_url(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=kundendaten&do=remove&noheader=1', 'wpsg-admin-kundendaten-delete')); ?>',
data: {
'kv_index': kv_index
},
success: function(data) {
if (data != "1") alert(data);
}
} );
return false;
} // function wpsg_removeCustomField(kv_index)
/**
* Zeigt den HTML Code, der die gewählte Kundenvariablen in die Templates einbaut
*/
function wpsg_genKVCode(kv_index)
{
jQuery('#wpsg_code_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
jQuery('#wpsg_code_dialog').modal( { } );
jQuery.ajax( {
url: '<?php echo html_entity_decode(wp_nonce_url(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=kundendaten&noheader=1&show=code', 'wpsg-admin-kundendaten-code')); ?>',
data: { 'kv_id': kv_index },
success: function(data) { jQuery('#wpsg_code_dialog .modal-body').html(data); }
} );
return false;
} // function wpsg_genPACode(pa_id)
jQuery(document).ready(function() {
jQuery('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { localStorage.setItem('wpsg_admin_customer_lastTab', jQuery(this).attr('href')); } );
var lastTab = localStorage.getItem('wpsg_admin_customer_lastTab');
if (lastTab) jQuery('[href="' + lastTab + '"]').tab('show');
} );
</script>
</div>
|