Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 *
19
 * @package   theme_universe
20
 * @copyright 2022 Marcin Czaja (https://rosea.io)
21
 * @license   Commercial https://themeforest.net/licenses
22
 *
23
 */
24
 
25
defined('MOODLE_INTERNAL') || die();
26
global $PAGE, $OUTPUT;
27
 
28
// Variables Theme Settings.
29
$block1wrapperalign = theme_universe_get_setting('block1wrapperalign');
30
$block1titlecolor = theme_universe_get_setting('block1herotitlecolor');
31
$block1herotitlesize = theme_universe_get_setting('block1herotitlesize');
32
$block1titleweight = theme_universe_get_setting('block1herotitleweight');
33
$block1count = theme_universe_get_setting('block1count');
34
$block1class = theme_universe_get_setting('block1class');
35
 
36
// Customm ID for the block.
37
$block1customid = theme_universe_get_setting('block1id');
38
$fpblockid1 = 'block1';
39
if (!empty($block1customid)) {
40
    $fpblockid5 = $block1customid;
41
}
42
// End.
43
 
44
if (!empty(theme_universe_get_setting('block1sliderinterval'))) {
45
    $block1sliderinterval = theme_universe_get_setting('block1sliderinterval');
46
} else {
47
    $block1sliderinterval = '7000';
48
}
49
 
50
// Start Title - Alignment.
51
$block1wrapperalignclass = null;
52
if ($block1wrapperalign == 0) {
53
    $block1wrapperalignclass = 'rui-hero-content-left';
54
}
55
 
56
if ($block1wrapperalign == 1) {
57
    $block1wrapperalignclass = 'rui-hero-content-centered';
58
}
59
 
60
if ($block1wrapperalign == 2) {
61
    $block1wrapperalignclass = 'rui-hero-content-right';
62
}
63
// End.
64
 
65
// Start Title - Color.
66
$block1titlecolorclass = null;
67
if ($block1titlecolor == 0) {
68
    $block1titlecolorclass = ' rui-text--white';
69
}
70
 
71
if ($block1titlecolor == 1) {
72
    $block1titlecolorclass = ' rui-text--black';
73
}
74
 
75
if ($block1titlecolor == 2) {
76
    $block1titlecolorclass = ' rui-text--gradient';
77
}
78
// End.
79
 
80
// Start Title - Weight.
81
$block1titleweightclass = null;
82
if ($block1titleweight == 0) {
83
    $block1titleweightclass = ' rui-text--weight-normal';
84
}
85
 
86
if ($block1titleweight == 1) {
87
    $block1titleweightclass = ' rui-text--weight-medium';
88
}
89
 
90
if ($block1titleweight == 2) {
91
    $block1titleweightclass = ' rui-text--weight-bold';
92
}
93
// End.
94
 
95
// Start Title - Size.
96
$block1herotitlesizeclass = null;
97
if ($block1herotitlesize == 0) {
98
    $block1herotitlesizeclass = '';
99
}
100
 
101
if ($block1herotitlesize == 1) {
102
    $block1herotitlesizeclass = ' rui-hero-title-lg';
103
}
104
 
105
if ($block1herotitlesize == 2) {
106
    $block1herotitlesizeclass = ' rui-hero-title-xl';
107
}
108
// End.
109
 
110
if (theme_universe_get_setting('showblock1sliderwrapper') == '1') {
111
    $class = 'rui-hero-content-backdrop rui-hero-content-backdrop--block1';
112
} else {
113
    $class = '';
114
}
115
 
116
echo '<!-- Start Block #1 -->';
117
 
118
if (theme_universe_get_setting('block1fw') == '1') {
119
    echo '<div id="' . $fpblockid1 . '" class="wrapper-fw rui-fp-block--1 rui-fp-margin-bottom ' . $block1class . '">';
120
} else {
121
    echo '<div id="' . $fpblockid1 . '" class="wrapper-lg rui-fp-block--1 rui-fp-margin-bottom mt-3 ' . $block1class . '">';
122
}
123
 
124
 
125
echo '<div class="swiper swiper-block--1 pb-0">';
126
echo '<div class="swiper-wrapper">';
127
 
128
for ($i = 1; $i <= $block1count; $i++) {
129
 
130
    $subtitle = format_text(theme_universe_get_setting("block1slidesubtitle" . $i), FORMAT_HTML, array('noclean' => true));
131
    $title = format_text(theme_universe_get_setting("block1slidetitle" . $i), FORMAT_HTML, array('noclean' => true));
132
    $caption = format_text(theme_universe_get_setting("block1slidecaption" . $i), FORMAT_HTML, array('noclean' => true));
133
    $css = theme_universe_get_setting("block1slidecss" . $i);
134
    $img = $PAGE->theme->setting_file_url("block1slideimg" . $i, "block1slideimg" . $i);
135
 
136
    if (!empty($css)) {
137
        echo '<div class="rui-hero-bg swiper-slide">';
138
    } else {
139
        echo '<div class="rui-hero-bg swiper-slide" style="' . $css . '">';
140
    }
141
 
142
    if (!empty($caption) || !empty($title)) {
143
        echo '<div class="rui-hero-content rui-hero--slide ' .
144
        $class .
145
        ' rui-hero-content-position ' .
146
        $block1wrapperalignclass .
147
        '">';
148
    }
149
 
150
    if (!empty($subtitle)) {
151
        echo '<h3 class="rui-hero-subtitle' .
152
            $block1titlecolorclass .
153
            $block1titleweightclass .
154
            '">' . $subtitle . '</h3>';
155
    }
156
 
157
    if (!empty($title)) {
158
        echo '<h3 class="rui-hero-title' .
159
            $block1titlecolorclass .
160
            $block1titleweightclass .
161
            $block1herotitlesizeclass .
162
            '">' . $title . '</h3>';
163
    }
164
 
165
    if (!empty($caption)) {
166
        echo '<div class="rui-hero-desc ' . $block1titlecolorclass . '">' . $caption . '</div>';
167
    }
168
 
169
    if (!empty($caption) || !empty($title)) {
170
        echo '</div>';
171
    }
172
 
173
    echo '<img class="d-flex img-fluid w-100" src="' . $img . '" alt="' . $title . '" />';
174
    echo '</div>';
175
}
176
 
177
echo '</div>';
178
echo '<div class="d-none d-md-flex swiper-button-next"></div>';
179
echo '<div class="d-none d-md-flex swiper-button-prev"></div>';
180
echo '<div class="swiper-pagination"></div>';
181
echo '</div>';
182
echo '</div>';
183
 
184
/*
185
    function reportWindowSize() {
186
        // Align center content of the hero
187
        var el = document.getElementsByClassName("rui-hero-content");
188
        for (var i=0, len=el.length|0; i<len; i=i+1|0) {
189
            var sidebarContentHeight = el[i].offsetHeight;
190
            el[i].style.top = "calc(50% - " + sidebarContentHeight * 0.5+ "px)";
191
        }
192
    }
193
 
194
    window.addEventListener("resize", reportWindowSize);
195
    window.onload = reportWindowSize();
196
*/
197
echo '<script>function reportWindowSize(){for(var e=document.getElementsByClassName("rui-hero--slide"),
198
o=0,t=0|e.length;o<t;o=o+1|0){var n=e[o].offsetHeight;e[o].style.top="calc(50% - "+n/2+"px)"}}
199
window.addEventListener("resize",reportWindowSize),
200
window.onload=reportWindowSize();</script>';
201
echo '<!-- End Block #1 -->';
202
 
203
echo '<script>var swiper=new Swiper(".swiper-block--1",{slidesPerView:1,
204
pagination:{el:".swiper-pagination",type:"progressbar"},
205
navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"},
206
autoplay: {delay: ' . $block1sliderinterval . ',},
207
keyboard:{enabled:!0},mousewheel:{releaseOnEdges:!0},effect:"creative",
208
autoHeight:!0,creativeEffect:{prev:{shadow:!0,translate:["-20%",0,-1]},
209
next:{translate:["100%",0,0]}},breakpoints:{}});</script>';