-
Notifications
You must be signed in to change notification settings - Fork 0
/
createpost.php
274 lines (215 loc) · 7.68 KB
/
createpost.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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<?php
session_start();
include 'check_token.php';
function show_visibility($year){
echo '
<h3>'.$year.'</h3>
<p>Branch:</p>
<div class="branch">
<button type="button" name="'.$year.'-all-branch" id="'.$year.'-all-branch" class="btn btn-light mx-1" btn-lg btn-block data-toggle="button" aria-pressed="false" autocomplete="off">ALL</button>
<button type="button" name="'.$year.'-ce-branch" id="'.$year.'-ce-branch" class="btn btn-light mx-1" btn-lg btn-block data-toggle="button" aria-pressed="false" autocomplete="off">CE</button>
<button type="button" name="'.$year.'-it-branch" id="'.$year.'-it-branch" class="btn btn-light mx-1" btn-lg btn-block data-toggle="button" aria-pressed="false" autocomplete="off">IT</button>
<button type="button" name="'.$year.'-entc-branch" id="'.$year.'-entc-branch" class="btn btn-light mx-1" btn-lg btn-block data-toggle="button" aria-pressed="false" autocomplete="off">ENTC</button>
</div>
<p>Division:</p>
<div class="division">';
for ($x = 1; $x <= 11; $x++) {
if ($x==1) {
# code...
echo '<button type="button" name="'.$year.'-div-ALL" id="'.$year.'-div-ALL" class="btn btn-light my-1 mx-1 btn-lg " data-toggle="button" aria-pressed="false" autocomplete="off" >ALL</button>';
}
if ($x==10){
echo '<button type="button" name="'.$year.'-div-ten" id="'.$year.'-div-ten" class="btn btn-light mx-1 my-1 btn-lg " data-toggle="button" aria-pressed="false" autocomplete="off" >'.$x.'</button>';
}
else if($x==11){
echo '<button type="button" name="'.$year.'-div-ele" id="'.$year.'-div-ele" class="btn btn-light mx-1 my-1 btn-lg " data-toggle="button" aria-pressed="false" autocomplete="off" >'.$x.'</button>';
}
else{
echo '<button type="button" name="'.$year.'-div-'.$x.'" id="'.$year.'-div-'.$x.'" class="btn btn-light mx-1 my-1 btn-lg " data-toggle="button" aria-pressed="false" autocomplete="off" >'.$x.'</button>';
}
};
echo '</div>';
};
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="resources/css/style.css">
<?php
include_once "link_inc.php";
?>
<style>
.ck-content .image>img {
display: block;
margin: 0 auto;
max-width: 80%;
min-width: 50px;
max-height: 350px;
}
.row {
margin-right: 0 !important;
margin-left: 0 !important;
}
.form_wrap {
min-height: 90vh;
}
input[type="checkbox"] {
transform: scale(2);
margin-right: 10px;
}
@media only screen and (max-width: 430px) {
.ck.ck-toolbar-dropdown .ck.ck-toolbar .ck.ck-toolbar__items {
flex-wrap: wrap !important;
}
}
</style>
</head>
<body>
<!-- Modal -->
<div class="modal fade" id="alert_box" tabindex="-1" role="dialog" aria-labelledby="alert_box_title" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title"></h2>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="container-fluid modal-body-cont">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" id="modal_dis" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="publish_btn">Publish</button>
</div>
</div>
</div>
</div>
<?php
$id = $_SESSION["mail"].uniqid();
if (isset($_SESSION["mail"])) {
include_once "navbar.php";
echo '
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-10 mt-4 ">
<form class="px-2" id="post_create_form">
<div class="form-group">
<label for="title">Title <span style="color: rgb(170, 169, 169);"><i>(The title of the blog goes here)</i></span></label>
<input type="text" name="title" id="title" class="form-control">
</div>
<div class="row">
<div class="form-group col-md-6 px-0">
<label for="category"> Category <span style="color: rgb(170, 169, 169);"><i>(Category to which blog content belongs)</i></span> : </label>
<select name="category" id="category" class="form-control">
<option value="physics" selected>Physics</option>
<option value="mathematics">Mathematics</option>
<option value="sports">Sports</option>
<option value="mechanical engineering">Mechanival Engineering</option>
</select>
</div>
</div>
<div class="row">
<div class="form-group col-md-6 px-0">
<label for="file">Thumbnail image</label>
<input type="file" name="file" id="file" class="form-control">
</div>
<div class="col-md-6">
<img src="" alt="" id="preview" style="max-height: 200px;">
</div>
</div>
<br>
<textarea id="editor" name="editor_content">
</textarea>
<br>
</form>';
echo '
<h3>Visibility</h3>
<p><button type="button" class="btn btn-light btn-lg" id="public" data-toggle="button" aria-pressed="false" autocomplete="off">Public</button></p>
<div id="visibility" role="tablist" aria-multiselectable="true">
<p>Based on Year,Branch & Division</p>
<div class="card">
<div class="card-header" role="tab" id="fe_v_opt">
<h5 class="mb-0">
<a data-toggle="collapse" data-parent="#visibility" href="#fe_branch_year" aria-expanded="true" aria-controls="fe_branch_year">
FE
</a>
</h5>
</div>
<div id="fe_branch_year" class="collapse in" role="tabpanel" aria-labelledby="fe_v_opt">
<div class="card-body">
';show_visibility("FE");echo'
</div>
</div>
</div>
<div class="card">
<div class="card-header" role="tab" id="se_v_opt">
<h5 class="mb-0">
<a data-toggle="collapse" data-parent="#visibility" href="#se_branch_year" aria-expanded="true" aria-controls="se_branch_year">
SE
</a>
</h5>
</div>
<div id="se_branch_year" class="collapse in" role="tabpanel" aria-labelledby="se_v_opt">
<div class="card-body">
';show_visibility("SE");echo'
</div>
</div>
</div>
<div class="card">
<div class="card-header" role="tab" id="te_v_opt">
<h5 class="mb-0">
<a data-toggle="collapse" data-parent="#visibility" href="#te_branch_year" aria-expanded="true" aria-controls="te_branch_year">
TE
</a>
</h5>
</div>
<div id="te_branch_year" class="collapse in" role="tabpanel" aria-labelledby="te_v_opt">
<div class="card-body">
';show_visibility("TE");echo'
</div>
</div>
</div>
<div class="card">
<div class="card-header" role="tab" id="be_v_opt">
<h5 class="mb-0">
<a data-toggle="collapse" data-parent="#visibility" href="#be_branch_year" aria-expanded="true" aria-controls="be_branch_year">
BE
</a>
</h5>
</div>
<div id="be_branch_year" class="collapse in" role="tabpanel" aria-labelledby="se_v_opt">
<div class="card-body">
';show_visibility("BE");echo'
</div>
</div>
</div>
</div>';
echo '
<div class="my-1">
<button class="btn btn-success" id="draft">Save as draft</button>
<button class="btn btn-success" id="Publish">Publish</button>
</div>
</div>
<div class="col-md-1"></div>
</div>
<script src="vendor\js\build\ckeditor.js"></script>
<script src="vendor\js\jquery.validate.min.js"></script>
<script src="resources/js/createpost.js">
</script>';
include_once "footer.php";
}
else{
echo '
<script>
window.location = "login.php";
</script>
';
};
?>
</body>
</html>