-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanager.php
More file actions
312 lines (275 loc) · 9.09 KB
/
manager.php
File metadata and controls
312 lines (275 loc) · 9.09 KB
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<?php
require_once("initdb.php");
$eventcode = "";
if (isset($_SESSION["type"])) {
if ($_SESSION["type"] == 'MN' || $_SESSION["type"] == 'PR') {
if (isset($_SESSION["ecode"]))
$eventcode = $_SESSION["ecode"];
else
_exit("Please go back and try again!");
} else
_exit("You don't have permission!");
} else {
header("Location: $start_page");
_exit();
}
if (isset($_POST["prback"])) {
unset($_SESSION["ecode"]);
header("Location: $pr_page");
_exit();
}
$query="SELECT name,shortdesc,longdesc,tags,contacts,prize,prtpnt FROM events WHERE code='$eventcode'";
$result=$mysqli->query($query);
$row=$result->fetch_assoc();
$eventname=NULL; $shortdesc=NULL; $longdesc=NULL;
$tags=NULL; $contacts=NULL; $prize=NULL;
if($row)
{
$eventname=$row['name'];
$shortdesc=$row['shortdesc'];
$longdesc=$row['longdesc'];
$tags=$row['tags'];
$contacts=$row['contacts'];
$prize=$row['prize'];
$prtpnt=$row['prtpnt'];
$result->free();
}
$mysqli->close();
?>
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title> Event Manager : Tathva 13 Organiser</title>
<link rel="shortcut icon" href="taticon.png" type="image/png" />
<link rel="stylesheet" href="style/manager.css" type="text/css" media="all" />
<link rel="stylesheet" href="style/style.css" type="text/css" media="all" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="ajaxupload.js"></script>
<script type="text/javascript" src="kaja-input.js"></script>
<script type="text/javascript"><!--
function remove_sec() {
$(this).remove();
}
function move_sec_up() {
var next = $(this).next('.desc-sec');
var mover = $(this).prev('.desc-sec');
if (next.length == 0 || mover.offset().top + $(this).height() > $(document).scrollTop() + $(window).height() - 200) $('body,html').animate({
scrollTop: '+=' + $(this).height()
}, 400);
$(this).insertBefore(mover);
$(this).animate({
height: 'show',
opacity: 'show'
}, 400);
}
function move_sec_down() {
$(this).insertAfter($(this).next('.desc-sec'));
$(this).animate({
height: 'show',
opacity: 'show'
}, 400);
}
function get_par_sec(e) {
return $(e).closest(".desc-sec");
}
function new_desc_sec(title, content) {
var link = $("#new_sec");
var new_section = $("<div/>", {
class: "desc-sec"
});
var desc_head = $("<span/>", {
html: "Section Title: ",
class: "desc-head"
});
var sec_ttl = $("<input type='text' />").appendTo(desc_head); //$(..).attr({name: 'xyz'})
$("<span/>", {
html: "Remove",
class: "desc-but"
}).click(function () {
get_par_sec(this).hide(400, remove_sec);
}).appendTo(desc_head);
$("<span/>", {
html: "Down",
class: "desc-but"
}).appendTo(desc_head).click(function () {
var par_sec = get_par_sec(this);
par_sec.next('.desc-sec').animate({
height: 'hide',
opacity: 'hide'
}, 400, move_sec_up);
});
$("<span/>", {
html: "Up",
class: "desc-but"
}).appendTo(desc_head).click(function () {
var par_sec = get_par_sec(this);
par_sec.prev('.desc-sec').animate({
height: 'hide',
opacity: 'hide'
}, 400, move_sec_down);
});
var desc_src = document.createElement("textarea");
new_section.hide();
new_section.insertBefore(link);
desc_head.appendTo(new_section);
$(desc_src).appendTo(new_section);
new_kaja_input(desc_src);
$('body,html').animate({
scrollTop: '+=' + new_section.height()
}, 400);
new_section.show(400);
if (title) {
sec_ttl.val(title);
if (content) {
desc_src.value = content;
update_preview(desc_src);
}
} else sec_ttl.focus();
}
$(document).ready(function () {
new_kaja_input($("#intro"));
$("#new_sec").click(function () {
new_desc_sec();
});
$("#event_form").submit(function () {
$("#con_disp").get(0).value=null;
$("#pr_disp").get(0).value=null;
$(".con").each(function(index) {
$("#con_disp").get(0).value += $(this).find(".na").val()+"||@||"+$(this).find(".co").val()+"||@||"+$(".em").val()+"||0||";
});
$("#pr_disp").get(0).value = $(this).find("#pr").val();
$("#prtpnt").get(0).value=$(this).find("#par_min").val()+"||@||"+$(this).find("#par_max").val();
var desc_hid = $("#desc").get(0);
desc_hid.value = $("#intro").val();
$(".desc-sec").each(function(index) {
$("#desc").get(0).value += "||sec||" + $(this).find("input").val() + "||ttl||" + $(this).find("textarea").val();
});
desc_hid.value = desc_hid.value.replace(/'/g, "'").replace(/\u2013/g, "–");
return true;
});
//Filling descriptions
var descs = $("#desc").get(0).value.split("||sec||");
if (descs.length > 0) {
update_preview($("#intro").val(descs[0]).get(0));
if (descs.length > 1) {
var sec_data, i;
for (i = 1; i<descs.length; i++) {
sec_data = descs[i].split("||ttl||");
new_desc_sec(sec_data[0], sec_data[1]);
}
}
}
// Filling prizes and contacts
var prv = $("#pr_disp").get(0).value;
$("#pr").get(0).value=prv;
var conv=$("#con_disp").get(0).value;
var cons=conv.split("||0||");
if(conv && cons.length>0)
{
var cnt,j,k;
for(j=0;j<3;j++)
{
cnt=cons[j].split("||@||");
k=j+1;
$("#na"+k).get(0).value=cnt[0];
$("#co"+k).get(0).value=cnt[1];
}
$(".em").get(0).value=cnt[2];
}
var prtpnt=$("#prtpnt").get(0).value;
if(prtpnt!=1)
{
pnt=prtpnt.split("||@||");
$("#par_min").get(0).value=pnt[0];
$("#par_max").get(0).value=pnt[1];
}
else if(prtpnt==1)
{
$("#par_min").get(0).value=1;
$("#par_max").get(0).value=1;
}
});
//-->
</script>
</head>
<body>
<?php include("header.php");?>
<div class="left">
<?php if ($_SESSION["type"] == 'PR') { ?>
<form method="post" action="manager.php" name="back_form">
<input type="submit" style="float:right" name="prback" value="Go Back" >
</form>
<?php } ?>
<h4>Event Code: <?php echo $eventcode; ?></h4>
<a style="float:right" href="logout.php">Log out</a>
<form method="post" action="submit.php" id="event_form" name="event_form">
<h4>Event Name:</h4>
<input type="text" name="ename" value="<?php echo $eventname; ?>" >
<h4>Short Description</h4>
<textarea name="shortdesc"><?php echo $shortdesc; ?></textarea>
<h4>Tags</h4>
<textarea name="tags"><?php echo $tags;?></textarea>
<div class="wrapper">
<h4>Contacts:</h4>
<h5>Event email-id</h5>
<div class="email">
<div style="float:right; padding: 3px">@tathva.org</div>
<div style="margin-right: 96px"><input type="text" class="em" id="em3" placeholder="eMail" /></div>
</div>
<div class="con">
<h5>Manager 1 <small>(preferred contact for queries)</small></h5>
<input type="text" class="na" id="na1" placeholder="Name" />
<div style="float:left; padding: 3px">+91</div>
<div style="margin-left: 36px"><input type="text" class="co" id="co1" placeholder="Contact Number" /></div>
</div>
<div class="con">
<h5>Manager 2</h5>
<input type="text" class="na" id="na2" placeholder="Name" />
<div style="float:left; padding: 3px">+91</div>
<div style="margin-left: 36px"><input type="text" class="co" id="co2" placeholder="Contact Number" /></div>
</div>
<div class="con">
<h5>Manager 3</h5>
<input type="text" class="na" id="na3" placeholder="Name" />
<div style="float:left; padding: 3px">+91</div>
<div style="margin-left: 36px"><input type="text" class="co" id="co3" placeholder="Contact Number" /></div>
</div>
<input type="hidden" name="contacts" id="con_disp" value="<?php echo $contacts;?>" />
</div>
<div>
<h4>Prizes:</h4>
<table>
<tr>
<td><textarea id="pr" style="width:150px"></textarea></td>
</tr>
</table>
<input type="hidden" name="prizes" id="pr_disp" value="<?php echo $prize;?>" />
</div>
<div id="num_par">
<h4>No of participants</h4>
<table>
<tr>
<td style="text-align: right">Min: </td>
<td> <input id="par_min" type="text" style="width:150px"/></td>
</tr>
<tr>
<td style="text-align: right">Max: </td>
<td> <input id="par_max" type="text" style="width:150px"/></td>
</tr>
<input type="hidden" name="prtpnt" id="prtpnt" value="<?php echo $prtpnt;?>" />
</table>
</div>
<input type="hidden" id="desc" name="longdesc" value="<?php echo str_replace('"', '"', $longdesc);?>" />
<center>
<input name="update" type="submit" value="Update" />
</center>
</form>
</div>
<div class="main">
<h2>Introduction</h2>
<textarea id="intro" name="intro"></textarea>
<a href="javascript:void(0)" id="new_sec">+section</a>
</div>
</body>
</html>