diff --git a/.gitattributes b/.gitattributes index 2b0ddd419527b9ba107fd395411676e0ea269d55..e69b585a030d422f5579e7c0f5ac354dd811c64b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,180 @@ -# Declare files that will always have LF line endings on checkout. -*.php text eol=lf -*.css text eol=lf -*.js text eol=lf -.htaccess text eol=lf -*.md text eol=lf \ No newline at end of file +## AUTO-DETECT +## Handle line endings automatically for files detected as +## text and leave all files detected as binary untouched. +## This will handle all files NOT defined below. +* text=auto + +## SOURCE CODE +*.bat text eol=crlf +*.coffee text +*.css text +*.htm text +*.html text +*.inc text +*.ini text +*.js text +*.json text +*.jsx text +*.less text +*.od text +*.onlydata text +*.php text +*.pl text +*.py text +*.rb text +*.sass text +*.scm text +*.scss text +*.sh text eol=lf +*.sql text +*.styl text +*.tag text +*.ts text +*.tsx text +*.xml text +*.xhtml text + +## DOCKER +*.dockerignore text +Dockerfile text + +## DOCUMENTATION +*.markdown text +*.md text +*.mdwn text +*.mdown text +*.mkd text +*.mkdn text +*.mdtxt text +*.mdtext text +*.txt text +AUTHORS text +CHANGELOG text +CHANGES text +CONTRIBUTING text +COPYING text +copyright text +*COPYRIGHT* text +INSTALL text +license text +LICENSE text +NEWS text +readme text +*README* text +TODO text + +## TEMPLATES +*.dot text +*.ejs text +*.haml text +*.handlebars text +*.hbs text +*.hbt text +*.jade text +*.latte text +*.mustache text +*.njk text +*.phtml text +*.tmpl text +*.tpl text +*.twig text + +## LINTERS +.csslintrc text +.eslintrc text +.htmlhintrc text +.jscsrc text +.jshintrc text +.jshintignore text +.stylelintrc text + +## CONFIGS +*.bowerrc text +*.cnf text +*.conf text +*.config text +.browserslistrc text +.editorconfig text +.gitattributes text +.gitconfig text +.htaccess text +*.npmignore text +*.yaml text +*.yml text +browserslist text +Makefile text +makefile text + +## HEROKU +Procfile text +.slugignore text + +## GRAPHICS +*.ai binary +*.bmp binary +*.eps binary +*.gif binary +*.ico binary +*.jng binary +*.jp2 binary +*.jpg binary +*.jpeg binary +*.jpx binary +*.jxr binary +*.pdf binary +*.png binary +*.psb binary +*.psd binary +*.svg text +*.svgz binary +*.tif binary +*.tiff binary +*.wbmp binary +*.webp binary + +## AUDIO +*.kar binary +*.m4a binary +*.mid binary +*.midi binary +*.mp3 binary +*.ogg binary +*.ra binary + +## VIDEO +*.3gpp binary +*.3gp binary +*.as binary +*.asf binary +*.asx binary +*.fla binary +*.flv binary +*.m4v binary +*.mng binary +*.mov binary +*.mp4 binary +*.mpeg binary +*.mpg binary +*.ogv binary +*.swc binary +*.swf binary +*.webm binary + +## ARCHIVES +*.7z binary +*.gz binary +*.jar binary +*.rar binary +*.tar binary +*.zip binary + +## FONTS +*.ttf binary +*.eot binary +*.otf binary +*.woff binary +*.woff2 binary + +## EXECUTABLES +*.exe binary +*.pyc binary \ No newline at end of file diff --git a/assets/css/biodata.css b/assets/css/biodata.css new file mode 100644 index 0000000000000000000000000000000000000000..7b1fe49d8bbbe865cb301f5039f0c2274f4e6ee5 --- /dev/null +++ b/assets/css/biodata.css @@ -0,0 +1,72 @@ +.header { + background-color: rgb(20,50,180); + display: flex; + flex-direction: column; + align-items: center; +} + +.header > div { + color : blanchedalmond; + /* width: 100px; */ + text-align: center; + line-height: 75px; + font-size: 30px; + font-family: 'Trebuchet MS'; +} + +h1 { + font-size: 2rem; + color: orange; + font-family: 'Trebuchet MS'; +} + +ul { + list-style-position: inside; +} + +div.edit{ + align-self:flex-end; +} + +div.profile { + overflow: hidden; + height: 250px; + width: 250px; + border-radius: 50%; + border-color: maroon; + border-width: 50px; +} + +div.profile img { + width: 100%; + height: 100%; +} + +img.edits { + padding: 0.5rem; + width: 3rem; + margin-right: 0.5rem; + margin-top: 0.5rem; +} + +img.icon { + height: 1.5rem; + width: 1.5rem; + margin-right: 0.5rem; +} + +table{ + margin-left: 1rem; +} + +.profile_container { + width: 400px; + margin: auto; + font-size: 1.1rem; + font-family: 'Trebuchet MS'; +} + +.data_type { + padding-right: 1rem; + width: 10rem; +} \ No newline at end of file diff --git a/assets/css/edit_biodata.css b/assets/css/edit_biodata.css new file mode 100644 index 0000000000000000000000000000000000000000..bc98ba2e43ba425506b3a1eb8b1b684518b3f3c7 --- /dev/null +++ b/assets/css/edit_biodata.css @@ -0,0 +1,81 @@ +th span { + color: orange; + font-size: 2rem; + font-family: 'Trebuchet MS'; +} + +td { + padding-right: 1rem; + font-family: 'Trebuchet MS'; +} + +img.prof_pic { + height: 6rem; + width: 6rem; + padding: 0; + border: black solid 2px; +} + +button { + font-size: 1rem; + padding: 0.25rem 1rem; + margin-top: 3rem; +} + +button.back { + font-size: 1rem; + padding: 0.25rem 1rem; +} + +button.save { + background-color: royalblue; + color: white; + border: none; + font-size: 1rem; + padding: 0.25rem 1rem; + float: right; + margin-right: 0; +} + +button.save:hover { + background-color: rgb(103, 160, 235); +} + +input.user_data { + width: 14rem; +} + +textarea { + resize: none; + width: 14rem; +} + +.inputfile { + width: 0.1px; + height: 0.1px; + opacity: 0; + overflow: hidden; + position: absolute; + z-index: -1; +} + +.inputfile + label { + font-size: 0.8rem; + padding: 0.2rem; + background-color: rgb(223, 213, 213); + border: 1px solid rgb(161, 157, 157); + border-radius: 5px; + display: inline-block; + font-family: Arial, Helvetica, sans-serif; +} + +input.fieldname { + border: 1px solid; + width: 10rem; + height: 1rem; +} + +.edit_profile_container { + width: 500px; + margin: auto; +} \ No newline at end of file diff --git a/assets/css/navBar.css b/assets/css/navBar.css index 16ba39e8c512f8d69732cf5df6cd66f9e0c806e9..4f8e38828cad8c0a565d10f0c74b2ccf664995ef 100644 --- a/assets/css/navBar.css +++ b/assets/css/navBar.css @@ -59,7 +59,11 @@ a.bottomNavBarItem { border-right: 1px solid black; } -span { - color: rgba(255, 251, 0, 0.74); +span.pro { + color: rgb(255, 238, 0); padding-left: 10px; } + +span.book { + color: white; +} diff --git a/assets/image/address.png b/assets/image/address.png new file mode 100755 index 0000000000000000000000000000000000000000..3ca9e5ebbd466cc830b13f11f66a254c70793056 Binary files /dev/null and b/assets/image/address.png differ diff --git a/assets/image/dummy.jpg b/assets/image/dummy.jpg new file mode 100755 index 0000000000000000000000000000000000000000..45cb6608d8a5d97b97e4696a3207fbfe8710aa18 Binary files /dev/null and b/assets/image/dummy.jpg differ diff --git a/assets/image/dummy2.jpg b/assets/image/dummy2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..889ae10f1e910c35a6295e2a763186781bda35bf Binary files /dev/null and b/assets/image/dummy2.jpg differ diff --git a/assets/image/email.png b/assets/image/email.png new file mode 100755 index 0000000000000000000000000000000000000000..fad9607bdb0b7b8a6490c4cde3c1404decc87594 Binary files /dev/null and b/assets/image/email.png differ diff --git a/assets/image/pacman.jpg b/assets/image/pacman.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2fab54f5723b48bfe3e201bf8d837b9c4cbac67f Binary files /dev/null and b/assets/image/pacman.jpg differ diff --git a/assets/image/pencil.png b/assets/image/pencil.png new file mode 100644 index 0000000000000000000000000000000000000000..f0632c7303d217cad2d1a0794f8b297846ceaa46 Binary files /dev/null and b/assets/image/pencil.png differ diff --git a/assets/image/pencil2.png b/assets/image/pencil2.png new file mode 100644 index 0000000000000000000000000000000000000000..cded74059278c934caf54ef95edb14b902b6a667 Binary files /dev/null and b/assets/image/pencil2.png differ diff --git a/assets/image/phone.png b/assets/image/phone.png new file mode 100755 index 0000000000000000000000000000000000000000..86da83fa5db760656c7374f0461435bf4449fc3e Binary files /dev/null and b/assets/image/phone.png differ diff --git a/assets/image/profile.jpg b/assets/image/profile.jpg new file mode 100755 index 0000000000000000000000000000000000000000..97a1a78035f2c53030c9b148e9a9fe39b355b901 Binary files /dev/null and b/assets/image/profile.jpg differ diff --git a/assets/image/tayo.jpg b/assets/image/tayo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5c597838ea1361d9c1393a986edd95a2f4c5eaa2 Binary files /dev/null and b/assets/image/tayo.jpg differ diff --git a/assets/js/edit.js b/assets/js/edit.js new file mode 100644 index 0000000000000000000000000000000000000000..9d7309063d6fc6354ab3e458c36321b95888996e --- /dev/null +++ b/assets/js/edit.js @@ -0,0 +1,75 @@ +window.addEventListener('load', function() { + // --Uploading file-- + var input = document.getElementById('field_data'); + var infoArea = document.getElementById('filename'); + var image = document.getElementById('prof_pic'); + + // On browse button clicked. + input.addEventListener('change', function ( event ) { + + // the change event gives us the input it occurred in + var input = event.srcElement; + + // the input has an array of files in the `files` property, each one has a name that you can use. We're just using the name here. + var fileName = input.files[0].name; + + // use fileName however fits your app best, i.e. add it into a div + infoArea.value = fileName; + + var imagePath = URL.createObjectURL(event.target.files[0]); + image.src = imagePath; + }); + + // --Validate and send changed data + // Add validator for the fields below. + var name = document.getElementById('field_name'); + var address = document.getElementById('field_address'); + var phone = document.getElementById('field_phone'); + + name.onchange = function(e) { + if (this.value.match(nameRE)) { + name_ok = true; + } else { + name_ok = false; + } + } + address.onchange = function(e) { + if (this.value !== "") { + address_ok = true; + } else { + address_ok = false; + } + } + phone.onchange = function(e) { + if (this.value.match(phoneRE)) { + phone_ok = true; + } else { + phone_ok = false; + } + } + // Whether or not a field is okay. + var name_ok = name.value !== ""; + var address_ok = address.value !== ""; + var phone_ok = phone.value !== ""; + + // On save button clicked. + let button = document.getElementById('save_button'); + button.addEventListener("click", (e) => { + if ((!name_ok)) { + notifyError(name); + return; + } + if (!address_ok) { + notifyError(address); + return; + } + if (!phone_ok) { + notifyError(phone); + return; + } + document.getElementById("edit_form").submit(); + }); +}); + +nameRE = /^(\w+)(\s\w+)*$/g; +phoneRE = /^\d{9,12}$/g; \ No newline at end of file diff --git a/assets/svg/pencil.svg b/assets/svg/pencil.svg new file mode 100644 index 0000000000000000000000000000000000000000..b35122838402199b526f685a71d4c103edec3de7 --- /dev/null +++ b/assets/svg/pencil.svg @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve"> +<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata> +<g><path fill="white" d="M931.9,58.4c-33.3-31.9-70-48.1-109.3-48.1c-61.3,0-106,39.6-118.3,51.7c-17.2,17-604.7,604.7-604.7,604.7c-3.8,3.9-6.6,8.6-8.1,13.9C78.4,729.7,12,946.9,11.4,949.2c-3.4,11.1-0.4,23.3,7.8,31.4c5.9,5.9,13.8,9.1,21.8,9.1c3.2,0,6.4-0.5,9.5-1.5c2.2-0.7,226.5-73.2,263.4-84.2c4.9-1.5,9.3-4.1,12.9-7.7c23.3-23,571.2-564.9,607.6-602.4c37.6-38.8,56.3-79.1,55.6-120C989.3,133.5,969.7,94.7,931.9,58.4z M694.7,159.9c15.5,3.7,52.1,15.9,89.8,53.9c38,38.4,48.2,82.1,50.1,91.9c-120.2,119.6-397,393.4-506,501.2c-10-23.5-26-51.7-52.4-78.2c-32-32.2-64.5-50.4-89.6-60.6C294.5,560.1,576.3,278.2,694.7,159.9z M145.1,719.6c16.8,4.5,51.6,17.3,87.3,53.3c27.4,27.7,40.3,58.1,46.1,76.7c-42.3,13.5-135.3,45.6-194.6,64.8C101.4,856.6,130.9,766.9,145.1,719.6z M890.1,250.1c-1.3,1.3-3.3,3.4-5.8,5.9c-9.7-24.9-26.6-56.8-55.9-86.4c-30.1-30.3-60.4-48-84.9-58.5c2.1-2.1,3.8-3.8,4.4-4.4c3.5-3.5,35.2-33.8,74.8-33.8c22.8,0,45.1,10.4,66.5,30.9C914.5,128,927.5,152,928,175C928.4,198.5,915.6,223.7,890.1,250.1z"/></g> +</svg> \ No newline at end of file diff --git a/controller/BiodataController.php b/controller/BiodataController.php new file mode 100644 index 0000000000000000000000000000000000000000..4f59995e8d2e038812a93c65ed0b52f7521fe2b6 --- /dev/null +++ b/controller/BiodataController.php @@ -0,0 +1,36 @@ +<?php +namespace JLAS\Book\Controller; +use \JLAS\Book\Controller\BaseController; +use \JLAS\Book\Model as Model; +use \JLAS\Book\Entity as Entity; + +class BiodataController extends BaseController { + + /** + * Get the data needed for this controller. + * @return array data passed to the view. + */ + protected function run($params) { + $username = $this->getUsername(); + if (isset($username)) { + $model_biodata = new Model\BiodataModel(); + $biodata = $model_biodata->findByID($username); + //There is profile for $username + if (isset($biodata)) { + $this->setResponse(200, "Success"); + return $biodata->asArray(); + } + else { + $this->setResponse(500, "No biodata for $username"); + return; + } + } + else { + $this->setResponse(401, "Please log in first!"); + return $params; + } + } + +} + +?> \ No newline at end of file diff --git a/controller/EditController.php b/controller/EditController.php new file mode 100644 index 0000000000000000000000000000000000000000..c73cb3eada6c7934285a33da46031d5b5ecb77d4 --- /dev/null +++ b/controller/EditController.php @@ -0,0 +1,76 @@ +<?php +namespace JLAS\Book\Controller; +use \JLAS\Book\Controller\BaseController; +use \JLAS\Book\Model as Model; +use \JLAS\Book\Entity as Entity; + +class EditController extends BaseController { + + /** + * Get the data needed for this controller. + * @return array data passed to the view. + */ + protected function run($params) { + $username = $this->getUsername(); + if (isset($username)) { + + $image_id = null; + //Uploaded an image + if ((isset($_FILES['image'])) && (!empty($_FILES['image']['tmp_name']))) { + $file = file_get_contents($_FILES['image']["tmp_name"]); + $info = pathinfo($_FILES['image']['name']); + $ext = $info['extension']; + $model_image = new Model\ImageModel(); + $image = $model_image->findByID((int) $this->getArg('pic_id')); + //Updating profile picture + if (isset($image)) { + $image->data = $file; + $image->type = $ext; + $model_image->update($image); + } + //Set profile picture for user + else { + $image = new Entity\ImageEntity(array( + "id" => 0, + "data" => $file, + "type" => $ext + )); + $model_image->create($image); + } + $image_id = $image->id; + } + + $model_account = new Model\AccountModel(); + $model_biodata = new Model\BiodataModel(); + $user = $model_account->findByID($username); + + //Updating data + if (isset($this->params["data"]["name"])) { + $biodata = $model_biodata->findByID($username); + $biodata->name = $this->getArg('name'); + $biodata->address = $this->getArg('address'); + $biodata->phone = $this->getArg('phone'); + + //Update profile picture + if (isset($image_id)) { + $biodata->pic_id = $image_id; + } + $model_biodata->update($biodata); + + $this->setResponse(200, "User $username updated"); + return $biodata->asArray(); + } else { + $biodata = $model_biodata->findByID($username); + $arr_bio = $biodata->asArray(); + $this->setResponse(200, "User $username data accepted"); + return $arr_bio; + } + } else { + $this->setResponse(401, "Please log in first"); + return $params; + } + } + +} + +?> \ No newline at end of file diff --git a/model/BiodataModel.php b/model/BiodataModel.php index 7982e00f4ad56064648c88c646ad3775e3c5d149..c63d2155cf9ce68085c87e45f25f754238fd617b 100644 --- a/model/BiodataModel.php +++ b/model/BiodataModel.php @@ -46,13 +46,14 @@ class BiodataModel extends BaseModel { return false; } $result = $this->query( - "INSERT INTO $this->table (`username`, `name`, `email`, `address`, `phone`) VALUES (:username, :name, :email, :address, :phone)", + "INSERT INTO $this->table (`username`, `name`, `email`, `address`, `phone`, `pic_id`) VALUES (:username, :name, :email, :address, :phone, :pic_id)", array( ":username" => $entity->username, ":name" => $entity->name, ":email" => $entity->email, ":address" => $entity->address, ":phone" => $entity->phone, + ":pic_id" => $entity->pic_id, ) ); return $result; @@ -65,13 +66,14 @@ class BiodataModel extends BaseModel { */ public function update($entity) { $result = $this->query( - "UPDATE $this->table SET `name`=:name, `email`=:email, `address`=:address, `phone`:=phone WHERE `username`=:username", + "UPDATE $this->table SET `name`=:name, `email`=:email, `address`=:address, `phone`=:phone, `pic_id`=:pic_id WHERE `username`=:username", array( ":username" => $entity->username, ":name" => $entity->name, ":email" => $entity->email, ":address" => $entity->address, ":phone" => $entity->phone, + ":pic_id" => $entity->pic_id, ) ); return $result; diff --git a/model/ImageModel.php b/model/ImageModel.php index 49488de5acb674d73bb7395f815fd5f15c10cef6..0b1d78b627f45ead9d661d4b8fad71b23e57265e 100644 --- a/model/ImageModel.php +++ b/model/ImageModel.php @@ -64,7 +64,7 @@ class ImageModel extends BaseModel { */ public function update($entity) { $result = $this->query( - "UPDATE $this->table SET `id`=:id, `data`=:data, `type`=:type", + "UPDATE $this->table SET `data`=:data, `type`=:type WHERE `id`=:id", array( ":id" => $entity->id, ":data" => $entity->data, diff --git a/routing/profile.php b/routing/profile.php new file mode 100644 index 0000000000000000000000000000000000000000..f00c7af26b0b27784e3e0b1df58aa55774c15b82 --- /dev/null +++ b/routing/profile.php @@ -0,0 +1,8 @@ +<?php +namespace JLAS\Book; +use SuPHP\Routing as Routing; + +Routing\addRoute("^profile$", "GET", ["biodata.php"], "BiodataController"); +Routing\addRoute("^profile\/edit$", "GET", ["edit_biodata.php"], "EditController"); +Routing\addRoute("^profile\/edit$", "POST", ["edit_biodata.php"], "EditController"); +?> \ No newline at end of file diff --git a/sql/biodata.sql b/sql/biodata.sql index b790d2b3e9a77d2aa6ccea851f80b971f843d00f..344d45fe5312aab1c9c1488807f89ef3cddc0f08 100644 --- a/sql/biodata.sql +++ b/sql/biodata.sql @@ -1,11 +1,11 @@ -- phpMyAdmin SQL Dump --- version 4.8.0 +-- version 4.7.9 -- https://www.phpmyadmin.net/ -- --- Host: localhost --- Generation Time: Oct 20, 2018 at 12:00 PM +-- Host: 127.0.0.1 +-- Generation Time: Oct 25, 2018 at 09:47 AM -- Server version: 10.1.31-MariaDB --- PHP Version: 7.2.4 +-- PHP Version: 7.2.3 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; @@ -34,7 +34,8 @@ CREATE TABLE `biodata` ( `name` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `address` text NOT NULL, - `phone` varchar(255) NOT NULL + `phone` varchar(255) NOT NULL, + `pic_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- diff --git a/view/biodata.php b/view/biodata.php new file mode 100644 index 0000000000000000000000000000000000000000..5357e463ee71ecf34d98bd7e4469cf5173ce48a8 --- /dev/null +++ b/view/biodata.php @@ -0,0 +1,62 @@ +<!DOCTYPE html> +<?php + if ($response['code'] != 200) { + alert("Error : " . $response['code'] . ' ' . $response['message']); + die; + } +?> +<html> +<head> + <meta charset="utf-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <title>Profile</title> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <?php + include VIEW . "navBar.php"; + css("main.css"); + css("biodata.css"); + ?> +</head> +<body> + +<div class="header"> + <div class="edit"><a href="<?php path('profile/edit'); ?>"> <img class="edits" alt="Edit button" src="assets/svg/pencil.svg"> </a></div> + <div class="profile"><img src="<?php + if(isset($data["pic_id"])) { + echo "ajax/image/get?id=". $data["pic_id"]; + } + else { + echo "assets/image/dummy.jpg"; + }?>" + alt="Profile picture"> </div> + <div><?php echo $data["name"] ?></div> +</div> + +<div class="profile_container"> +<h1 class="content"> My profile </h1> +<table> + <tr> + <td><img class="icon" src="assets/image/profile.jpg"> </td> + <td class="data_type">Username</td> + <td><?php echo $data["username"] ?></td> + </tr> + <tr> + <td><img class="icon" src="assets/image/email.png"> </td> + <td class="data_type">Email </td> + <td><?php echo $data["email"] ?></td> + </tr> + <tr> + <td><img class="icon" src="assets/image/address.png" ></td> + <td class="data_type">Address </td> + <td><?php echo $data["address"] ?></textarea></td> + </tr> + <tr> + <td><img class="icon" src="assets/image/phone.png"> </td> + <td class="data_type">Phone Number </td> + <td><?php echo $data["phone"] ?></td> + </tr> +</table> +</div> + +</body> +</html> \ No newline at end of file diff --git a/view/edit_biodata.php b/view/edit_biodata.php new file mode 100644 index 0000000000000000000000000000000000000000..f6807c7bb5c8254fd282bc537d2a338fa3798088 --- /dev/null +++ b/view/edit_biodata.php @@ -0,0 +1,76 @@ +<!DOCTYPE html> +<?php + if (isset($response)) { + if ($response['code'] != 200) { + alert("Error : " . $response['code'] . ' ' . $response['message']); + redirect(URLROOT . 'login'); + die; + } else if ($_SERVER['REQUEST_METHOD'] == "POST") { + redirect(URLROOT . 'profile'); + die; + } + } +?> +<html> +<head> + <meta charset="utf-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>Edit Profile</title> + <?php + include VIEW . "navBar.php"; + css("main.css"); + css("edit_biodata.css"); + js("bootstrap.js"); + js("edit.js"); + ?> +</head> +<body> + +<div class="edit_profile_container"> + <table> + <thead> + <tr> + <th colspan="2"><span>Edit Profile</span></th> + </tr> + </thead> + <body> + <form method="POST" action="" id="edit_form" enctype="multipart/form-data"> + <input id="field_image_id" name="pic_id" hidden value="<?php echo $data["pic_id"]?>"> + <tr> + <td><img id="prof_pic" class="prof_pic" src="<?php + if(isset($data["pic_id"])) { + path("ajax/image/get?id=". $data["pic_id"]); + } + else { + path("assets/image/dummy.jpg"); + }?>" + alt="Profile Picture"> </td> + <td> + Update profile picture <br> + <input type="text" id="filename" class="fieldname" readonly> + <input id="field_data" name="image" type="file" accept="image/jpeg, image/png, image/gif" class="inputfile"/><label for="field_data">Browse...</label> + </td> + </tr> + <tr> + <td>Name</td> + <td><input class="user_data" type="text" id="field_name" name="name" value="<?php echo $data["name"] ?>"> </td> + </tr> + <tr> + <td>Address</td> + <td><textarea id="field_address" name="address" cols="30" rows="5"><?php echo $data["address"] ?></textarea></td> + </tr> + <tr> + <td>Phone Number</td> + <td><input class="user_data" type="text" id="field_phone" name="phone" maxlength="12" value="<?php echo $data["phone"] ?>"> </td> + </tr> + </form> + <tr> + </tr> + </table> + <td><button class="back" onclick="window.location.href = path('profile');">Back</button></td> + <td align="right"><button class="save" id="save_button">Save</button></td> +</div> + +</body> +</html> \ No newline at end of file diff --git a/view/navBar.php b/view/navBar.php index aadc2ac18b5a0314680991b63e88d809cb3644bb..d32667a16ba279cfaf3c0888f59ac23eeb44a719 100644 --- a/view/navBar.php +++ b/view/navBar.php @@ -10,7 +10,7 @@ js("navBar.js"); ?> <ul class="topNavBar"> <li class="topNavBarItem" id="productName"> - <span>Pro</span>-Book + <span class="pro">Pro</span><span class="book">-Book</span> </li> <a href="<?php path("logout")?>"><li class="topNavBarItem" id="logout"><img class="logoutIcon" src="<?php path("assets/image/logout.png"); ?>"></li></a> <li class="topNavBarItem" id="username">