-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathuserPage.php
225 lines (172 loc) · 6.76 KB
/
userPage.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
<!--
userPage.php
Second main page. Displays all events that this person is participating in on the left sidebar
and asynchronously loads the event page on the right side.
-->
<?php
include('./scripts/database_connection.php');
include('./scripts/cookies.php');
//If cookies not calidated, throws person back to index.php
if(!validate_cookie()) header('Location: index.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<script src="bootstrap/js/jquery.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
<title>DecidR</title>
<link href="bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<style type="text/css">
/* CUSTOMIZE THE NAVBAR
-------------------------------------------------- */
/* Remove border and change up box shadow for more contrast */
.navbar .navbar-inner {
border: 0;
-webkit-box-shadow: 0 2px 10px rgba(0,0,0,.25);
-moz-box-shadow: 0 2px 10px rgba(0,0,0,.25);
box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
/* Downsize the brand/project name a bit */
.navbar .brand {
padding: 14px 20px 16px; /* Increase vertical padding to match navbar links */
font-size: 36px;
font-weight: bold;
text-shadow: 0 -1px 0 rgba(0,0,0,.5);
}
/* Navbar links: increase padding for taller navbar */
.navbar .nav > li > a {
padding: 15px 20px;
}
/* Offset the responsive button for proper vertical alignment */
.navbar .btn-navbar {
margin-top: 10px;
}
</style>
</head>
<body>
<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="index.php">DecidR</a>
<div class="pull-right">
<ul class="nav">
<li><a href="#">Settings</a></li>
<li><a href="./userPage.php">Events</a></li>
<li><a href="./scripts/signout.php">Logout <?php
$name = explode(' ', getUserName());
echo $name[0];
?></a></li>
</ul>
</div>
</div>
</div>
<div class="container">
<?php
//Successful alert that shows up when join is successful
if(isset($_GET['join']))
echo '<div class="alert alert-success"><b>Successfully joined the event!</b> Check it out in the sidebar.</div>';
?>
<div class="container-fluid">
<div class="row-fluid">
<div class="span4">
<div class ="hero-unit">
<div class="well">
<ul class="nav nav-list" id="eventList">
<li class="nav-header" id="getUserID" userID="<?php echo getUserFBId();?>">My Events</li>
<?php
$id = getUserFBId();
//Get user information from database
$query = 'SELECT * FROM User WHERE FBid = ' . $id;
$result = mysql_query($query) or die(mysql_error());
for($i = 0; $row = @mysql_fetch_assoc($result); $i++) {
$rows[$i] = $row;
}
//Get all events the person is participating in
$query = 'SELECT * FROM Event NATURAL JOIN User NATURAL JOIN Participates WHERE FBid = ' . $id;
$result = mysql_query($query) or die(mysql_error());
// Put the result in our own rows table.
for($i = 0; $row = @mysql_fetch_assoc($result); $i++) {
$rows[$i] = $row;
}
//Prints all events as bullets on the left sidebar
foreach ($rows as $event) {
echo '<li><a class="openEvent" href="#" eventID="'.$event['EventID'].'">'.$event['Title'].'</a></li>';
}
?>
</ul>
<ul class="nav nav-list">
<li class="nav-header"></li>
<li><a id="newEvent"><b>+ Create a new event</b></a></li>
</ul>
</div>
</div>
</div>
<div class="span8" id="eventContent">
<div class ="hero-unit">
<h4>Click on an event on the left sidebar to see what all the fuss is about.</h4><br><br><p>Remember that thing that you wanted to go to? Yea, that one. Well, you still haven't decided what you're
going to be doing. Maybe you should make a new event for that and invite all your friends!</p>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="pageScripts.js"></script>
<script type="text/javascript">userPageScripts();</script>
<div id="createEventModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">New Event</h3>
</div>
<div class="modal-body">
<div class="tab-pane">
<div>
<form id="submitEvent" class="form" method="post">
<div class="controls">
<input type="text" id="titleinp" placeholder="Title" class="span5">
</div>
<div class="controls controls-row">
<input type="text" id="dateinp" placeholder="Date" class="span3">
<input type="text" id="timeinp" placeholder="Time" class="span2">
</div>
<button type="submit" class="btn">Submit</button>
<br>
<div class="progress progress-striped active" style="display:none;" id="eventLoading">
<div class="bar" style="width: 10%;"></div>
</div>
</form>
</div>
</div>
</div>
</div>
<div id="createTodoModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">New Idea</h3>
</div>
<div class="modal-body">
<div class="tab-pane">
<div>
<form id="submitTodo" eventID="" class="form" method="post">
<div class="controls">
<input type="text" required id="titletodo" placeholder="Title" class="span5">
</div>
<div class="controls controls-row">
<textarea rows="3" required placeholder="Description" id="descr" class="span5"></textarea>
</div>
<h3>Place</h3>
<div class="controls">
<input type="text" id="nameOfLocation" placeholder="Name of Place" class="span5">
</div>
<div class="controls">
<input type="text" id="location" placeholder="Location eg. 1234 Fake St, Urbana, IL" class="span5">
</div>
<div class="alert alert-success" style="display:none;" id="confirmation">Thats the address that we found. If that is right, click submit!</div>
<button id="todoSubmitConf" type="submit" class="btn" loc="0">Submit</button>
</form>
</div>
</div>
</div>
</div>
</body>
</html>