Browse code

Initial commit

Benjamin Roth authored on16/03/2023 20:22:35
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,179 @@
1
+<?php
2
+if (TL_MODE == 'FE') {
3
+    if (!isset($this->size)) {
4
+        $this->{"size"} = "";
5
+    }
6
+}
7
+?>
8
+
9
+
10
+    <div <?php echo $this->cssID; ?> class="content--element <?php echo $this->class; ?>">
11
+        <div class="ce--inner container">
12
+            <?php if ($this->headline || $this->subline || $this->topline) : ?>
13
+            <div class="ce--headline"
14
+                 data-aos="<?php if ($this->animation_type) : ?><?php echo $this->animation_type; ?><?php else : ?>animate__fadeInUp<?php endif; ?>">
15
+
16
+                <?php if ($this->topline) : ?>
17
+                    <span class="ce--topline"><?php echo $this->topline; ?></span>
18
+                <?php endif; ?>
19
+
20
+                <?php if ($this->headline) : ?>
21
+                <<?php echo($this->hl); ?>>
22
+                <?php echo($this->headline); ?>
23
+            </<?php echo($this->hl); ?>>
24
+        <?php endif; ?>
25
+            <?php if ($this->subline) : ?>
26
+                <span class=" ce--subline"><?php echo $this->subline; ?></span>
27
+            <?php endif; ?>
28
+        </div>
29
+        <?php endif; ?>
30
+
31
+        <?php
32
+        if ($this->selecttype == "multiple") {
33
+            $dataSorted = array_map('\StringUtil::binToUuid', deserialize($this->orderSRC, true));
34
+        }
35
+        ?>
36
+
37
+
38
+        <div class="ce--content-slider <?php if (count($this->galery) > $this->slides_per_view || count($dataSorted) > $this->slides_per_view) : ?>is-slider<?php endif; ?>"
39
+             data-aos="<?php if ($this->animation_type) : ?><?php echo $this->animation_type; ?><?php else : ?>animate__fadeInUp<?php endif; ?>">
40
+            <?php $rand = rand(1, 100); ?>
41
+
42
+            <?php if ($this->open_lightbox): ?>
43
+                <script>
44
+                    $(function () {
45
+                        $(".group_<?php echo $rand; ?>").colorbox({
46
+                            rel: "group_<?php echo $rand; ?>",
47
+                            current: "Bild {current} von {total}",
48
+                            maxWidth: '95%',
49
+                            maxHeight: '95%'
50
+                        });
51
+                    });
52
+                </script>
53
+            <?php endif; ?>
54
+
55
+            <div class="swiper content-slider_<?= $this->id; ?>">
56
+                <!-- Additional required wrapper -->
57
+                <div class="swiper-wrapper">
58
+                    <!-- Slides -->
59
+                    <?php if ($dataSorted) : ?>
60
+
61
+                        <?php foreach ($dataSorted as $data) : ?><?php if ($image = $this->getImageObject($data, $this->size)) : ?>
62
+                            <div class="swiper-slide">
63
+                                <?php if ($this->open_lightbox): ?>
64
+                                <a href="<?= Image::get(FilesModel::findByUuid($image->uuid)->path, null, null, null); ?>"
65
+                                   class="group_<?php echo $rand; ?> bts-cboxElement cboxElement"><?php endif; ?>
66
+                                    <img class="swiper-lazy"
67
+                                         data-src="<?= Image::get(FilesModel::findByUuid($image->uuid)->path, $this->size[0], $this->size[1], $this->size[2]); ?>">
68
+                                    <?php if ($this->open_lightbox): ?></a><?php endif; ?>
69
+                            </div>
70
+                        <?php endif; ?>
71
+
72
+                        <?php endforeach ?>
73
+
74
+                    <?php else : ?>
75
+
76
+                        <?php foreach ($this->galery as $slide) : ?>
77
+                            <div class="swiper-slide">
78
+                                <?php if ($this->open_lightbox): ?>
79
+                                <a href="<?= Image::get(FilesModel::findByUuid($slide->slide)->path, null, null, null); ?>"
80
+                                   class="group_<?php echo $rand; ?> bts-cboxElement cboxElement"><?php endif; ?>
81
+                                    <img class="swiper-lazy"
82
+                                         data-src="<?= Image::get(FilesModel::findByUuid($slide->slide)->path, $this->size[0], $this->size[1], $this->size[2]); ?>">
83
+                                    <?php if ($this->open_lightbox): ?> </a><?php endif; ?>
84
+                                <?php if ($slide->slide_text) : ?>
85
+                                    <span class="slider-subline"><?php echo $slide->slide_text; ?></span>
86
+                                <?php endif; ?>
87
+                            </div>
88
+                        <?php endforeach ?>
89
+
90
+                    <?php endif; ?>
91
+                </div>
92
+
93
+            </div>
94
+            <?php if (count($this->galery) > 1 || count($dataSorted) > 1) : ?>
95
+                <?php if ($this->show_pagination): ?>
96
+                    <div class="content-slider_<?= $this->id; ?> swiper-pagination"></div>
97
+                <?php endif; ?>
98
+                <?php if ($this->show_arrows): ?>
99
+                    <div class="content-slider_<?= $this->id; ?> swiper-button-prev"></div>
100
+                    <div class="content-slider_<?= $this->id; ?> swiper-button-next"></div>
101
+                <?php endif; ?>
102
+            <?php endif; ?>
103
+        </div>
104
+    </div></div>
105
+<?php if (TL_MODE == 'FE'): ?>
106
+    <script>
107
+        window.addEventListener('load', function () {
108
+            if ($('.swiper.content-slider_<?= $this->id;?>').length) {
109
+
110
+                const swiper_<?php echo $this->id; ?> = new Swiper('.swiper.content-slider_<?php echo $this->id; ?>', {
111
+                    direction: 'horizontal',
112
+
113
+
114
+                    loop: <?php if ($this->loop) : ?>true<?php else:?>false<?php endif;?>,
115
+
116
+
117
+                    preloadImages: false,
118
+                    lazy: {
119
+                        loadPrevNext: true,
120
+                    },
121
+
122
+                    spaceBetween: <?php if ($this->space_between) : ?><?= $this->space_between; ?><?php else:?>30<?php endif;?>,
123
+                    //centeredSlides: <?php if ($this->centered_slides) : ?>true<?php else:?>false<?php endif;?>,
124
+                    //slidesPerView: <?php if ($this->slides_per_view) : ?><?= $this->slides_per_view; ?><?php else:?>1<?php endif;?>,
125
+
126
+                    speed: <?php if ($this->transition_time) : ?><?= $this->transition_time; ?><?php else:?>1500<?php endif;?>,
127
+                    effect: <?php if ($this->slide_effect) : ?>'<?= $this->slide_effect; ?>'<?php else:?>
128
+                    'slide'<?php endif;?>,
129
+
130
+                    <?php if ($this->autoplay) : ?>
131
+                    autoplay: {
132
+                        delay: <?php if ($this->autoplay_time) : ?><?= $this->autoplay_time; ?><?php else:?>3000<?php endif;?>,
133
+                    },
134
+                    <?php endif; ?>
135
+
136
+
137
+                    <?php if ($this->slide_effect == "coverflow") : ?>
138
+                    coverflowEffect: {
139
+                        rotate: 50, // Slide rotate in degrees
140
+                        stretch: 0, // Stretch space between slides (in px)
141
+                        depth: 100, // Depth offset in px (slides translate in Z axis)
142
+                        modifier: 1, // Effect multipler
143
+                        slideShadows: true, // Enables slides shadows
144
+                    },
145
+                    <?php endif;?>
146
+
147
+                    <?php if ($this->slide_effect == "fade") : ?>
148
+                    fadeEffect: {
149
+                        crossFade: true
150
+                    },
151
+                    <?php endif;?>
152
+
153
+                    <?php if (count($this->galery) > 1 || count($dataSorted) > 1) : ?>
154
+                    navigation: {
155
+                        nextEl: '.content-slider_<?= $this->id;?>.swiper-button-next',
156
+                        prevEl: '.content-slider_<?= $this->id;?>.swiper-button-prev',
157
+                    },
158
+
159
+                    pagination: {
160
+                        el: '.content-slider_<?php echo $this->id; ?>.swiper-pagination',
161
+                        clickable: true,
162
+                    },
163
+                    <?php endif; ?>
164
+
165
+                    slidesPerView: 1,
166
+
167
+                    breakpoints: {
168
+                        768: {
169
+                            slidesPerView: <?php if ($this->slides_per_view) : ?><?= $this->slides_per_view / 2; ?><?php else:?>1<?php endif;?>,
170
+                        },
171
+                        992: {
172
+                            slidesPerView: <?php if ($this->slides_per_view) : ?><?= $this->slides_per_view; ?><?php else:?>3<?php endif;?>,
173
+                        }
174
+                    }
175
+                });
176
+            }
177
+        }, {passive: true})
178
+    </script>
179
+<?php endif; ?>
0 180
\ No newline at end of file