Skip to content
Snippets Groups Projects
Commit 2e863fe9 authored by Fadhil Imam Kurnia's avatar Fadhil Imam Kurnia
Browse files

Add database and icon

parent f6f24aba
Branches
1 merge request!3Profil
-- phpMyAdmin SQL Dump
-- version 4.5.4.1deb2ubuntu2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 04, 2017 at 09:40 PM
-- Server version: 10.0.31-MariaDB-0ubuntu0.16.04.2
-- PHP Version: 7.0.22-0ubuntu0.16.04.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `db_dagojek`
--
-- --------------------------------------------------------
--
-- Table structure for table `driver`
--
CREATE TABLE `driver` (
`id` int(11) NOT NULL,
`rating` float NOT NULL DEFAULT '0',
`sum_order` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `driver`
--
INSERT INTO `driver` (`id`, `rating`, `sum_order`) VALUES
(1, 4.3, 121);
-- --------------------------------------------------------
--
-- Table structure for table `order`
--
CREATE TABLE `order` (
`id_order` int(11) NOT NULL,
`id_driver` int(11) NOT NULL,
`id_customer` int(11) NOT NULL,
`source` varchar(20) NOT NULL,
`destination` varchar(20) NOT NULL,
`rating` int(11) NOT NULL,
`comment` varchar(120) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `prefered_location`
--
CREATE TABLE `prefered_location` (
`id_driver` int(11) NOT NULL,
`location` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(15) NOT NULL,
`name` varchar(50) NOT NULL,
`username` varchar(20) NOT NULL,
`email` varchar(40) NOT NULL,
`password` varchar(100) NOT NULL,
`phone` varchar(15) NOT NULL,
`photo` varchar(100) NOT NULL,
`is_driver` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `name`, `username`, `email`, `password`, `phone`, `photo`, `is_driver`) VALUES
(1, 'Fadhil Imam Kurnia', 'fadhilimamk', '13515146@std.stei.itb.ac.id', 'dtashfVATSaashdbgasdjy78123bahsVJSF72vsahsj', '085797490039', 'http://www.simian-risk.com/wp-content/themes/custom/images/empty-profile.png', 1);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `driver`
--
ALTER TABLE `driver`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `order`
--
ALTER TABLE `order`
ADD PRIMARY KEY (`id_order`);
--
-- Indexes for table `prefered_location`
--
ALTER TABLE `prefered_location`
ADD PRIMARY KEY (`id_driver`,`location`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`,`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(15) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `driver`
--
ALTER TABLE `driver`
ADD CONSTRAINT `driver_user_id` FOREIGN KEY (`id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
File added
This diff is collapsed.
File added
File added
public/img/logo.jpg

21.6 KiB

.container{ /* ------------------------- GENERAL -------------------------*/
width: 100%;
body {
background-color: #F5F5F5;
font-family: KacstOffice, sans-serif;
}
.container {
width: 80%;
max-width: 1200px; max-width: 1200px;
margin:auto; margin: 50px auto;
background-color: white;
padding: 20px;
border-radius: 5px;
} }
.row:before, .row:before,
...@@ -24,6 +34,29 @@ ...@@ -24,6 +34,29 @@
.col-5{ width: 83.33%; } .col-5{ width: 83.33%; }
.col-6{ width: 100%; } .col-6{ width: 100%; }
.text-right {
text-align: right;
}
.text-center {
text-align: center;
}
.text-orange {
color: orange;
}
/* ------------------------- HEADER -------------------------*/
.logo:after {
background-image: url('/img/logo.jpg');
background-size: 210px 100px;
display: inline-block;
width: 210px;
height: 100px;
content:"";
}
.tab { .tab {
outline: 1px solid #004D40; outline: 1px solid #004D40;
padding-top:10px; padding-top:10px;
...@@ -36,16 +69,56 @@ ...@@ -36,16 +69,56 @@
color : #FAFAFA; color : #FAFAFA;
} }
.text-right { /* ------------------------- ICON -------------------------*/
text-align: right;
@font-face {
font-family: 'icon';
src: url("/font/typicons.eot");
src: url("/font/typicons.eot?#iefix") format('embedded-opentype'),
url("/font/typicons.woff") format('woff'),
url("/font/typicons.ttf") format('truetype'),
url("/font/typicons.svg#typicons") format('svg');
font-weight: normal;
font-style: normal;
} }
.text-center { .icon:before {
text-align: center; font-family:'icon';
font-style:normal;
font-weight:normal;
speak:none;
display:inline-block;
text-decoration:inherit;
width:1em;
height:1em;
font-size:1em;
text-align:center;
-webkit-font-smoothing:antialiased;
font-smoothing:antialiased;
text-rendering:optimizeLegibility
}
.icon.icon-mail:before {
content:'\e0a5'
} }
.icon.icon-phone:before {
content:'\e0c5'
}
.icon.icon-star:before{
content:'\e108'
}
/* ------------------------- PROFIL -------------------------*/
.img-circle { .img-circle {
max-width: 170px; max-width: 170px;
max-height: 170px; max-height: 170px;
border-radius: 50%; border-radius: 50%;
}
.profil>p {
line-height: 50%;
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ class Driver extends User { ...@@ -7,7 +7,7 @@ class Driver extends User {
public static function Create($id, PDO $dbconn) { public static function Create($id, PDO $dbconn) {
try { try {
$stmt = $dbconn->prepare(" $stmt = $dbconn->prepare("
SELECT id, name, username, email, phone, rating, is_driver AS isDriver, sum_order AS sumOrder SELECT id, name, username, email, phone, rating, is_driver AS isDriver, sum_order AS sumOrder, photo
FROM user NATURAL JOIN driver FROM user NATURAL JOIN driver
WHERE id =:id" WHERE id =:id"
); );
...@@ -17,7 +17,6 @@ class Driver extends User { ...@@ -17,7 +17,6 @@ class Driver extends User {
$result = $stmt->fetchObject('Driver'); $result = $stmt->fetchObject('Driver');
return $result; return $result;
} catch (PDOException $e) { } catch (PDOException $e) {
echo "Error : ".$e->getMessage(); echo "Error : ".$e->getMessage();
return false; return false;
......
...@@ -7,19 +7,21 @@ class User { ...@@ -7,19 +7,21 @@ class User {
public $username; public $username;
public $email; public $email;
public $phone; public $phone;
public $photo;
public $isDriver; public $isDriver;
public static function Create($id, PDO $conn) { public static function Create($id, PDO $conn) {
try { try {
$stmt = $conn->prepare("SELECT * FROM user WHERE id=$id"); $stmt = $conn->prepare("
$stmt->execute(); SELECT id, name, username, email, phone, photo, is_driver AS isDriver
FROM user
WHERE id=:id");
$stmt->execute(array('id'=>$id));
$stmt->setFetchMode(PDO::FETCH_ASSOC); $stmt->setFetchMode(PDO::FETCH_ASSOC);
$user = $stmt->fetchObject(); $user = $stmt->fetchObject('User');
$result = new User($user->id, $user->name, $user->username, $user->email, $user->phone);
$result->isDriver = $user->is_driver;
return $result; return $user;
} catch (PDOException $e) { } catch (PDOException $e) {
echo "Error : ".$e->getMessage(); echo "Error : ".$e->getMessage();
return false; return false;
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
<body> <body>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-3">Logo</div> <div class="col-3"><span class="logo"></span></div>
<div class="col-3 text-right"> <div class="col-3 text-right">
<p> <p>
Hi, <?=$user->username?><br> Hi, <b><?=$user->username?></b> !<br>
Logout <a href="#">Logout</a>
</p> </p>
</div> </div>
</div> </div>
...@@ -23,17 +23,17 @@ ...@@ -23,17 +23,17 @@
<div class="col-5"><h1>MY PROFILE</h1></div> <div class="col-5"><h1>MY PROFILE</h1></div>
<div class="col-1 text-right">edit</div> <div class="col-1 text-right">edit</div>
</div> </div>
<div class="text-center"> <div class="text-center profil">
<img class="img-circle" src="<?=$user->photo?>"/><br> <img class="img-circle" src="<?=$user->photo?>"/><br>
<h2>@<?=$user->username?></h2> <h2>@<?=$user->username?></h2>
<p><?=$user->name?></p> <p><?=$user->name?></p>
<?php if ($user->isDriver) : ?> <?php if ($user->isDriver) : ?>
<p>Driver | <?=$driver_rating?> (<?=$driver_order?> vote<?=($driver_order>1)?'s':''?>)</p> <p>Driver | <span class="text-orange"><i class="icon icon-star"></i> <?=$user->rating?></span> (<?=$user->sumOrder?> vote<?=($user->sumOrder>1)?'s':''?>)</p>
<?php else : ?> <?php else : ?>
<p>Non Driver</p> <p>Non Driver</p>
<?php endif; ?> <?php endif; ?>
<p><?=$user->email?></p> <p><i class="icon icon-mail"></i> <?=$user->email?></p>
<p><?=$user->phone?></p> <p><i class="icon icon-phone"></i> <?=$user->phone?></p>
</div> </div>
<div class="row"> <div class="row">
<div class="col-5"><h2>PREFERED LOCATIONS</h2></div> <div class="col-5"><h2>PREFERED LOCATIONS</h2></div>
......
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