forked from usict-acm/ACM-new
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventYear.php
224 lines (195 loc) · 10.7 KB
/
eventYear.php
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!DOCTYPE html>
<html lang="en">
<head>
<?php
include('./head.php');
?>
<title>USICT ACM</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<link href="./assets/CSS/eventsyearpage.css" rel="stylesheet" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Lato:wght@300&family=Poppins:wght@200&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="./assets/CSS/glider.css" />
<script src="https://kit.fontawesome.com/d459eda8d9.js" crossorigin="anonymous"></script>
</head>
<body>
<?php
// $currentPage = 'blogs';
include('./header.php');
?>
<!-- ==============================================Content========================================== -->
<section id="content">
<div class="event-container">
<div id="eventPage"></div>
</div>
<div class="row pagination_row">
<div style="margin:auto;" id="pagination_row_2021"></div>
</div>
</section>
<?php
$page = isset($_GET["page"]) ? $_GET["page"] : 1;
$year = $_GET["year"];
$previous = $page == 1 ? 1 : $page - 1;
?>
<script>
let allEvents = document.getElementById("eventPage");
if (<?php echo $year ?> != 2019 && <?php echo $year ?> != 2020 && <?php echo $year ?> != 2021 && <?php echo $year ?> != 2022) {
allEvents.innerHTML += `<h1 class='noEvents'>No Events for this year</h1>`;
} else {
let urlEvent = './admin/blogAdmin/api.php/?q=readAllEvent&year=' + <?php echo $year ?> + '&page=' + <?php echo $page ?>;
let pagination = document.getElementById("pagination_row_2021");
allEvents.innerHTML = "";
$(document).ready(function() {
$.ajax({
url: urlEvent,
method: 'GET',
dataType: 'JSON',
success: function(data) {
console.log("check data ywar", data);
if (<?php echo $page ?> > Math.ceil(data[1] / 7)) {
allEvents.innerHTML += `<h1 class='noEvents'>No Events on this page</h1>`;
} else {
data[0].forEach(allEvent);
}
function allEvent(event) {
let button1 = ` <a href=${event.button1Link} style="float: right; margin-left:8px;" target="_blank"><button class="dateTime-para btn form-input-boxes-manual btn-watch" style="font-size: 16px;">${event.button1Text}</button></a>`;
let button2 = `<a href=${event.button2Link} style="float: right;" target="_blank"><button class="dateTime-para btn form-input-boxes-manual event-button-two btn-watch" style="font-size: 16px;">${event.button2Text}</button></a>`;
let eventPartner = `<p class="dateTime-para">Partnered By: ${event.partners}</p>`
let eventSpeaker = `<p class="dateTime-para">Speakers: ${event.speakers}</p>`
let sameDate = `<span>${event.startDate}</span>`;
let diffDate = `<span>${event.startDate} — ${event.endDate}</span>`;
let afterDate = `<span>${event.time}</span>
</div>
<h1 class="event-post_title">${event.name}</h1>
<p class="event-post_text">${event.description}</p>
<div class="buttonDiv">`;
let var1 = `<div class="event-post">
<div class="event-post_img" style="margin-top:15px;">
<img src=${event.poster} alt="">
</div>
<div class="event-post_info">
<div class="event-post_date">`;
if (event.startDate === event.endDate) {
var1 = var1 + sameDate + afterDate;
} else if (event.startDate !== event.endDate) {
var1 = var1 + diffDate + afterDate;
}
let closeDIV = ` </div>
</div>
</div>`;
if (event.partners !== '') {
var1 = var1 + eventPartner;
}
if (event.speakers !== '') {
var1 = var1 + eventSpeaker
}
if (event.button2Text !== '' && event.button1Text !== '') {
let finalCode = var1.concat(button1, button2, closeDIV);
$("#eventPage").append(finalCode);
} else if (event.button1Text !== '' && event.button2Text === '') {
let finalCode = var1.concat(button1, closeDIV);
$("#eventPage").append(finalCode);
} else if (event.button2Text !== '' && event.button1Text === '') {
let finalCode = var1.concat(button1, closeDIV);
$("#eventPage").append(finalCode);
} else {
let finalCode = var1.concat(closeDIV);
$("#eventPage").append(finalCode);
}
}
pagination.innerHTML += "<nav style=display:inline-block; aria-label=Page navigation example>\
<ul class=pagination>\
<li class=page-item >\
<a id='previous-pagination' class='page-link pagination-option-next-prev' href=./eventYear.php?q=readAllEvent&year=" + <?php echo $year ?> + "&page=<?php echo $previous ?> disabled>\
< Prev\
</a>\
</li>\
</ul>\
</nav>";
if (<?php echo $page ?> === 1) {
document.getElementById("previous-pagination").className += " disabled-pagination";
}
for (var i = 1; i <= data[2]; i++) {
var id = "link_pagination" + i;
pagination.innerHTML += "<nav style=display:inline-block; aria-label=Page navigation example>\
<ul class=pagination>\
<li class=page-item>\
<a id=" + id + " class='page-link pagination-numbers pagination-option-next-prev '" + "href=./eventYear.php?q=readAllEvent&year=" + <?php echo $year ?> + "&page=" + i + ">\
" + i + "\
</a>\
</li>\
</ul>\
</nav></div>"
if (<?php echo $page ?> === i) {
console.log(<?php echo $page ?>);
document.getElementById("link_pagination" + i).className += "active_pagination";
}
}
var next = <?php echo $page ?> === data[2] ? data[2] : <?php echo $page + 1 ?>;
pagination.innerHTML += "<nav style=display:inline-block; aria-label=Page navigation example>\
<ul class=pagination>\
<li class=page-item>\
<a id='next-pagination' class='page-link pagination-option-next-prev' href=./eventYear.php?q=readAllEvent&year=" + <?php echo $year ?> + "&page=" + next + ">\
Next >\
</a>\
</li>\
</ul>\
</nav>";
if (<?php echo $page ?> === data[2] || <?php echo $page ?> > Math.ceil(data[1] / 7)) {
document.getElementById("next-pagination").className += " disabled-pagination";
}
},
});
});
}
</script>
<style>
.pagination_row {
margin-right: 0;
margin-left: 0;
}
.pagination-option-next-prev {
border: 0.5px solid gray;
color: black;
box-shadow: rgb(0 0 0 / 17%) 2px 2px 10px;
font-size: 23px;
margin: 40px 10px 20px 10px !important;
}
.pagination-numbers {
border: 2px solid #0297ff;
box-shadow: none;
padding-left: 15px !important;
padding-right: 15px !important;
border-radius: 50% !important;
}
.active_pagination {
border: 2px solid #0297ff;
background-color: #0297ff;
color: white;
padding-left: 15px !important;
padding-right: 15px !important;
border-radius: 50% !important;
}
.disabled-pagination {
color: lightgray;
pointer-events: none;
cursor: default;
border: none;
box-shadow: none;
font-size: 23px;
margin: 40px 10px 20px 10px !important;
}
.noEvents {
font-size: 4rem;
padding: 80px 20px;
text-align: center;
}
</style>
<!-- ==============================================Footer========================================== -->
<?php
include('footer.php');
?>
</body>
</html>