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

    /**
     * User: Daschmi (daschmi@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 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>
                
                <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="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="3">
            
                <?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-info-sign" style="float:right;"></a>
               
                <script type="text/javascript">/* <![CDATA[ */
                
                    jQuery(document).ready(function() {
                        
                        jQuery('#field_name_<?php echo $f_id; ?>').wspg_editable('<?php echo $inlineEdit_url; ?>', { } );
                        
                        jQuery('#field_typ_<?php echo $f_id; ?>').wspg_editable('<?php echo $inlineEdit_url; ?>', { 
                            'type': 'multiarray',
                            'data': '<?php echo json_encode($this->view['fields']); ?>'                            
                        } );
                        
                        jQuery('#field_format_<?php echo $f_id; ?>').wspg_editable('<?php echo $inlineEdit_url; ?>', {
                            'type': 'select',
                            'data': <?php echo json_encode($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; ?>').wspg_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>