Subversion Repositories wpShopGermany4

Rev

Rev 7774 | Rev 8197 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7774 Rev 8195
Line 2... Line 2...
2
 
2
 
3
	/**
3
	/**
4
	 * Template für das Anlegen/Bearbeiten einer Produktgruppe
4
	 * Template für das Anlegen/Bearbeiten einer Produktgruppe
5
	 */
5
	 */
6
 
6
 
-
 
7
    /** @var \wpsg\productgroup|null $oProductgroup */
-
 
8
    $oProductgroup = null;
-
 
9
 
-
 
10
    if (intval($_REQUEST['edit_id']??0) > 0) {
-
 
11
 
-
 
12
        $oProductgroup = wpsg\productgroup::getInstance(intval($_REQUEST['edit_id']));
-
 
13
 
-
 
14
    }
-
 
15
 
7
?>
16
?>
8
 
17
 
9
<div class="wpsg_productgroups" id="wpsg-bs">
18
<div class="wpsg_productgroups" id="wpsg-bs">
10
 
19
 
11
    <nav class="navbar navbar-default">
20
    <nav class="navbar navbar-default">
Line 59... Line 68...
59
                        <?php } ?>
68
                        <?php } ?>
60
 
69
 
61
                        <?php echo wpsg_drawForm_Select('template_file', __('Template', 'wpsg'), $this->view['templates'], $this->view['data']['template_file']); ?>
70
                        <?php echo wpsg_drawForm_Select('template_file', __('Template', 'wpsg'), $this->view['templates'], $this->view['data']['template_file']); ?>
62
                        <?php echo wpsg_drawForm_Select('infopage', __('Info Seite', 'wpsg'), $this->view['pages'], $this->view['data']['infopage']); ?>
71
                        <?php echo wpsg_drawForm_Select('infopage', __('Info Seite', 'wpsg'), $this->view['pages'], $this->view['data']['infopage']); ?>
63
 
72
 
-
 
73
                        <div class="form-group form-group-sm ">
-
 
74
                            <label class="col-sm-6 control-label"><?php echo __('Produktgruppenbild', 'wpsg'); ?></label>
-
 
75
                            <div class="col-sm-6">
-
 
76
                                <div class="wpsg_field_wrap">
-
 
77
                                    <div id="imageBox"><?php
-
 
78
 
-
 
79
                                        if ($oProductgroup !== null) {
-
 
80
 
-
 
81
                                            if ($oProductgroup->getImage() > 0) {
-
 
82
 
-
 
83
                                                echo wp_get_attachment_image($oProductgroup->getImage(), 'full', false, [
-
 
84
                                                    'style' => 'max-width:100%; height:auto; margin-bottom:8px;'
-
 
85
                                                ]);
-
 
86
 
-
 
87
                                            }
-
 
88
 
-
 
89
                                        }
-
 
90
 
-
 
91
                                    ?></div>
-
 
92
 
-
 
93
                                    <input value="Mediathek" class="button" type="button" style="text-align:center;" size="10" id="btnAddImgLink" />
-
 
94
                                    <input type="hidden" name="image" value="<?php echo (($oProductgroup !== null)?$oProductgroup->getImage():0); ?>" id="image_input" />
-
 
95
 
-
 
96
                                    <script>
-
 
97
 
-
 
98
                                        let wpframe = undefined;
-
 
99
                                        let imageBox = document.getElementById('imageBox');
-
 
100
                                        let elImageInput = document.getElementById('image_input');
-
 
101
 
-
 
102
                                        document.getElementById('btnAddImgLink').addEventListener('click', (event) => {
-
 
103
 
-
 
104
                                            event.preventDefault();
-
 
105
 
-
 
106
                                            if (wpframe !== undefined) { wpframe.open(); return; }
-
 
107
 
-
 
108
                                            wpframe = wp.media.frames.file_frame = wp.media({
-
 
109
                                                title: "<?php echo __('Auswählen oder Hochladen von Medien', 'wpsg'); ?>",
-
 
110
                                                button: { text: "<?php echo __('Medien benutzen', 'wpsg'); ?>" },
-
 
111
                                                multiple: false
-
 
112
                                            });
-
 
113
 
-
 
114
                                            wpframe.on('select', () => {
-
 
115
 
-
 
116
                                                let attachments = wpframe.state().get('selection').map((attachment) => {
-
 
117
 
-
 
118
                                                    attachment.toJSON();
-
 
119
 
-
 
120
                                                    return attachment;
-
 
121
 
-
 
122
                                                });
-
 
123
 
-
 
124
                                                for (let i = 0; i < attachments.length; ++i) {
-
 
125
 
-
 
126
                                                    let attachment = attachments[i];
-
 
127
 
-
 
128
                                                    imageBox.innerHTML = '<img src="' + attachment.attributes.url + '" alt="" style="max-width:100%; margin-bottom:8px;"/>';
-
 
129
                                                    elImageInput.value = attachment.attributes.id;
-
 
130
 
-
 
131
                                                }
-
 
132
 
-
 
133
                                            });
-
 
134
 
-
 
135
                                            wpframe.open();
-
 
136
 
-
 
137
                                        });
-
 
138
 
-
 
139
                                    </script>
-
 
140
                                </div>
-
 
141
                            </div>
-
 
142
                            <div class="clearfix wpsg_clear"></div>
-
 
143
                        </div>
-
 
144
 
64
                    <?php echo wpsg_drawForm_AdminboxEnd(); ?>
145
                    <?php echo wpsg_drawForm_AdminboxEnd(); ?>
65
 
146
 
66
                </div>
147
                </div>
67
                <div class="col-md-4 col-lg-4">
148
                <div class="col-md-4 col-lg-4">
68
 
149