Skip to content
Snippets Groups Projects
Commit 172a0b18 authored by Aldrich Valentino Halim's avatar Aldrich Valentino Halim
Browse files

added GET variable for user

parent 154f75e2
1 merge request!42Projekers - 13515051 - Girvandi Ilyas
......@@ -30,14 +30,15 @@ if($isDriver) {
<img class='user-image' src='../img/" . $image . "'/>
<div class='transaction-info'><div class='transaction-date'>" . $row['date'] . " </div>
<div class='user-name'>" . $username . "</div>
<div class='transaction-city'>" . $row['pickup'] . "=>" . $row['destination'] . "</div>
<div class='transaction-city'>" . $row['pickup'] . " to " . $row['destination'] . "</div>
<div class='transaction-rating'>gave " . $row['rating'] . " star(s) for this order</div>
<div class='transaction-comment'>and left comment <br />" . $row['comment'] . " </div></div>
<div class='transaction-comment'>and left comment:<blockquote>\"" . $row['comment'] . "\"</blockquote></div></div>
<div class='hide-button'><button id='transaction-" . $i . "' onclick='hide(" . $i . ")'>HIDE</button></div>
</div>";
$i++;
}
}
header('Content-Type: text/xml');
echo $asDriverCompletedTransaction;
} else {
$asUserCompletedTransaction = "";
......@@ -59,12 +60,13 @@ if($isDriver) {
<div class='user-name'>" . $fetched['name'] . "</div>
<div class='transaction-city'>" . $row['pickup'] . " to " . $row['destination'] . "</div>
<div class='transaction-rating'>you rated: " . $row['rating'] . "</div>
<div class='transaction-comment'>and left comment: <br />" . $row['comment'] . " </div></div>
<div class='transaction-comment'>and left comment:<blockquote>\"" . $row['comment'] . "\"</blockquote></div></div>
<div class='hide-button'><button id='transaction-" . $i . "' onclick='hide(" . $i . ")'>HIDE</button></div>
</div>";
$i++;
}
}
header('Content-Type: text/xml');
echo $asUserCompletedTransaction;
}
......
......@@ -15,7 +15,7 @@
box-sizing: border-box;
}
.transaction-info {
width: 60%;
width: 65%;
display: inline-block;
font-size: initial;
vertical-align: top;
......@@ -35,7 +35,7 @@
margin: 5px 0;
}
.hide-button {
width: 20%;
width: 15%;
text-align: right;
display: inline-block;
font-size: initial;
......
function getAllTransaction(isDriver){
//TODO: minta id dari session!!
var id = 1;
var id = sessionid;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
document.getElementById('driver-info').innerHTML = xmlhttp.responseText;
//console.log(result.getElementById('transaction-id').innerHTML);
}
};
xmlhttp.open('GET', '../controller/transactionController.php?id=' + id + '&driver=' + isDriver,true);
......
function getUserProfile(){
var id = sessionid;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
......@@ -9,7 +10,7 @@ function getUserProfile(){
var phone = result.getElementsByTagName('phone')[0].childNodes[0].nodeValue;
var image =result.getElementsByTagName('image')[0].childNodes[0].nodeValue;
document.getElementById('username').innerHTML = 'Hi, ' + username + '!';
document.getElementById('username').innerHTML = 'Hello, ' + name + '!';
document.getElementById('profile-username').innerHTML = '@' + username;
document.getElementById('name').innerHTML = name;
document.getElementById('email').innerHTML = email;
......@@ -17,10 +18,7 @@ function getUserProfile(){
document.getElementById('user-image').style.backgroundImage = 'url(../img/' + image + ')';
}
};
//var userid = 1;
xmlhttp.open('GET', '../controller/profile.php?id=1', true);
xmlhttp.open('GET', '../controller/profile.php?id=' + id, true);
xmlhttp.send();
}
<?php
session_start();
$_SESSION['id'] = 1;
$_SESSION['name'] = 'Pikachu';
?>
<html>
<head>
<title>User Dashboard</title>
<link href="../css/primary.css" type="text/css" rel="stylesheet" />
<link href="../css/dashboard.css" type="text/css" rel="stylesheet" />
<link href="../css/history.css" type="text/css" rel="stylesheet" />
<script>
//send session id to JS files
var sessionid = "<?php echo $_GET['id']; ?>";
</script>
<script src="../js/dashboard.js"></script>
<script src="../js/profile.js"></script>
<script src="../js/history.js"></script>
</head>
<body>
<body onpageshow="getUserProfile()">
<div class="container">
<div class="header">
<div class="logo"><img src="../img/logo.png" /></div>
......@@ -19,7 +29,7 @@
</div>
<div class="menu">
<button class="submenu" id="order" onclick="order_clicked()">ORDER</button>
<button class="submenu" id="history" onclick="history_clicked();">HISTORY</button>
<button class="submenu" id="history" onclick="history_clicked(); getAllTransaction(1)">HISTORY</button>
<button class="submenu selected" id="profile" onclick="getUserProfile(); profile_clicked();">PROFILE</button>
</div>
......@@ -65,9 +75,6 @@
</ul>
</div>
</section>
</div>
</body>
</html>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment