summaryrefslogtreecommitdiff
path: root/views/mods/mod_export/fields.phtml
blob: 8861505bcbc5e602d158fe9ab84877b15b0fea00 (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
<?php

    /**
     * User: Daschmi (https://daschmi.de)
     * Date: 03.11.2016
     * Time: 14:12
     */

    $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'];

?>
<table class="table table-body-striped" id="wpsg_mod_export_fieldtable">
    <thead>
        <tr>
            <th class="wpsg_mod_export_col_name"><?php echo __('Spaltenname', 'wpsg'); ?></th>
            <th class="wpsg_mod_export_col_value"><?php echo __('Wert', 'wpsg'); ?></th>
            <th class="wpsg_mod_export_col_format"><?php echo __('Format', 'wpsg'); ?></th>
            
            <th style="display:<?php echo (($this->view['profil']['format'] == wpsg_mod_export::FORMAT_XML)?'table-cell':'none'); ?>;" title="<?php echo __('Feld im XML als Attribut exportieren', 'wpsg'); ?>" class="wpsg_mod_export_format wpsg_mod_export_format_<?php echo wpsg_mod_export::FORMAT_XML; ?> wpsg_mod_export_col_att"><?php echo __('Att', 'wpsg'); ?></th>            
            <th style="display:<?php echo (($this->view['profil']['format'] != wpsg_mod_export::FORMAT_XML)?'table-cell; padding:0px':'none'); ?>;" class="wpsg_mod_export_format wpsg_mod_export_format_<?php echo wpsg_mod_export::FORMAT_CSV; ?>">&nbsp;</th>
            
            <th class="wpsg_mod_export_col_remove">
                
                <a style="float:right;" onclick="return wpsg_mod_export_addField(<?php echo $this->view['profil']['id']; ?>);" title="<?php echo __('Neues Feld einfügen', 'wpsg'); ?>" href="#" class="glyphicon glyphicon-plus"></a>
                
            </th>
        </tr>
    </thead>

    <?php $i = 0; foreach ((array)$this->view['profil']['fields'] as $f_id => $f) { $i ++; ?>
    <tbody id="field_<?php echo $f_id; ?>">
        <tr class="wpsg_tablerow wpsg_mod_export_row1 wpsg_mod_export_fieldrow_<?php echo $f_id; ?> <?php echo (($i % 2 == 0)?'odd':'even'); ?>">
            
            <td class="wpsg_mod_export_col">
                <div class="name wpsg_editable" id="field_name_<?php echo $f_id; ?>"><?php echo $f['name']; ?></div>
            </td>
            <td class="wpsg_mod_export_col_field"><div class="wpsg_editable" id="field_typ_<?php echo $f_id; ?>"><?php
    
                foreach ($this->view['fields'] as $fieldgroup) {
    
                    foreach ($fieldgroup['fields'] as $field_key => $field) {
    
                        if ($field_key == $f['value_key']) {
                            
                            echo $field;
                            
                        }
    
                    }
    
                }
    
            ?></div></td>
            <td class="wpsg_mod_export_col_format">
                
                <div class="wpsg_editable" id="field_format_<?php echo $f_id; ?>"><?php echo $this->view['arFieldFormats'][$f['format']]; ?></div>
            
            </td> 
            
            <td style="display:<?php echo (($this->view['profil']['format'] == wpsg_mod_export::FORMAT_XML)?'table-cell':'none'); ?>;" class="wpsg_mod_export_col_att wpsg_mod_export_format wpsg_mod_export_format_<?php echo wpsg_mod_export::FORMAT_XML; ?>">
                
                <input type="checkbox" onchange="wpsg_mod_export_setAtt(this, <?php echo $f['id']; ?>);" value="1" <?php echo ((wpsg_isSizedInt($f['xml_att']))?'checked="checked"':''); ?> />
                                
            </td>
            <td style="display:<?php echo (($this->view['profil']['format'] != wpsg_mod_export::FORMAT_XML)?'table-cell; padding:0px':'none'); ?>;" class="wpsg_mod_export_format wpsg_mod_export_format_<?php echo wpsg_mod_export::FORMAT_CSV; ?>">&nbsp;</td>
                        
            <td>
                
                <a style="float:right;" onclick="return wpsg_mod_export_removeField(<?php echo $f_id; ?>);" title="<?php echo __('Feld löschen', 'wpsg'); ?>" href="#" class="glyphicon glyphicon-trash"></a>
                               
            </td>
            
        </tr>
        <tr id="staticformat_<?php echo $f_id; ?>" style="<?php echo (($f['value_key'] != 'general_static')?'display:none;':''); ?>" class="wpsg_mod_export_row2 wpsg_tablerow wpsg_mod_export_fieldrow_<?php echo $f_id; ?> <?php echo (($i % 2 == 0)?'odd':'even'); ?>">
            <td class="wpsg_mod_export_col_format_user" colspan="4">
                
                <?php echo __('Statischer Wert', 'wpsg'); ?>:
                
                <div class="wpsg_editable" id="field_static_<?php echo $f_id; ?>"><?php echo wpsg_hspc(wpsg_getStr($f['static'])); ?></div>
                
            </td>
            <td></td>
        </tr>
        <tr id="userformatrow_<?php echo $f_id; ?>" style="<?php echo (($f['format'] != 700)?'display:none;':''); ?>" class="wpsg_mod_export_row2 wpsg_tablerow wpsg_mod_export_fieldrow_<?php echo $f_id; ?> <?php echo (($i % 2 == 0)?'odd':'even'); ?>">
            <td class="wpsg_mod_export_col_format_user" colspan="4">                
            
                <?php echo __('Format', 'wpsg'); ?>:
                
                <div class="wpsg_editable" id="field_userformat_<?php echo $f_id; ?>"><?php echo wpsg_hspc(wpsg_getStr($f['userformat'])); ?></div>
            
            </td>
            <td style="position:relative;">
                
                <a rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_export_userformat" href="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_export_userformat" data-wpsg-tip="mod_export_userformat" class="glyphicon glyphicon-question-sign" style="float:right;"></a>
               
                <script type="text/javascript">/* <![CDATA[ */
                
                    jQuery(document).ready(function() {
                        
                        jQuery('#field_name_<?php echo $f_id; ?>').wpsg_editable('<?php echo $inlineEdit_url; ?>', { } );
                        
                        jQuery('#field_typ_<?php echo $f_id; ?>').wpsg_editable('<?php echo $inlineEdit_url; ?>', { 
                            'type': 'multiarray',
                            'data': '<?php echo addslashes(json_encode($this->view['fields'], JSON_UNESCAPED_SLASHES)); ?>',
                            'callback': function(response, newValue) {
								
								if (newValue === 'general_static') jQuery('#staticformat_<?php echo $f_id; ?>').show();
								else jQuery('#staticformat_<?php echo $f_id; ?>').hide();
								
                            }
                        } );
                        
                        jQuery('#field_format_<?php echo $f_id; ?>').wpsg_editable('<?php echo $inlineEdit_url; ?>', {
                            'type': 'select',
                            'data': <?php echo wpsg_prepare_for_inlineEdit($this->view['arFieldFormats']); ?>,
                            'callback': function(response, newValue) {
                                
                                if (newValue === "700") jQuery('#userformatrow_<?php echo $f_id; ?>').show();
                                else jQuery('#userformatrow_<?php echo $f_id; ?>').hide();
                                
                            }
                        } );
                        
                        jQuery('#field_userformat_<?php echo $f_id; ?>').wpsg_editable('<?php echo $inlineEdit_url; ?>', { } );
                        
						jQuery('#field_static_<?php echo $f_id; ?>').wpsg_editable('<?php echo $inlineEdit_url; ?>', { } );
						
                    } );
                
                /* ]]> */</script>
                
            </td>
        </tr>
    </tbody>
    <?php } ?>

</table>

<script type="text/javascript">/* <![CDATA[ */
    
    wpsg_ajaxBind();

    jQuery("#wpsg_mod_export_fieldtable").sortable( { 
        helper: wpsg_Tablefix,
        items: 'tbody',
        handler: '.wpsg_id',
        update: function(event, ui) {

            var wpsg_reorder = jQuery(this).sortable('serialize');
            
            jQuery.ajax( {
                url: '<?php echo WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=wpsg_mod_export_reorder&noheader=1&profil_id='.$this->view['profil']['id']; ?>',
                data: { 
                    wpsg_reorder: wpsg_reorder
                },
                success: function(data) {

                    if (data !== "1") alert(data);
                    
                }
            } );
            
        }} 
    ).disableSelection();
    
/* ]]> */</script>

<style>

    .wpsg_mod_export_col_format { min-width:100px; }
    
</style>