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 index 0e7a64ade284f106ba8fc8e6a240794f2d9f5df7..7b1fe49d8bbbe865cb301f5039f0c2274f4e6ee5 100644 --- a/assets/css/biodata.css +++ b/assets/css/biodata.css @@ -11,12 +11,13 @@ text-align: center; line-height: 75px; font-size: 30px; + font-family: 'Trebuchet MS'; } -.content { - font-size: 30px; - color: orangered; - font-family: 'Times New Roman'; +h1 { + font-size: 2rem; + color: orange; + font-family: 'Trebuchet MS'; } ul { @@ -27,20 +28,45 @@ div.edit{ align-self:flex-end; } -img.profile { +div.profile { + overflow: hidden; height: 250px; width: 250px; border-radius: 50%; + border-color: maroon; + border-width: 50px; } -img.edits { - padding: 5px; - 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: 30px; - width: 30px; - padding-right: 0cm; + 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 index 25c777e8084d250e62538cc7e0be1da5461b01a8..bc98ba2e43ba425506b3a1eb8b1b684518b3f3c7 100644 --- a/assets/css/edit_biodata.css +++ b/assets/css/edit_biodata.css @@ -1,57 +1,53 @@ -th { - color: coral; -} - th span { - font-size: 30px; + color: orange; + font-size: 2rem; + font-family: 'Trebuchet MS'; } -prof_pic { - height: 200px; - width: 200px; - border-radius: 50%; +td { + padding-right: 1rem; + font-family: 'Trebuchet MS'; } -img { - width: 100px; - height: 100px; +img.prof_pic { + height: 6rem; + width: 6rem; + padding: 0; + border: black solid 2px; } -button.back { - background-color: beige; - border: maroon 1px solid; - border-style: solid; - color: maroon; - text-align: center; - font-size: 20px; - cursor: pointer; - padding: 15px 25px; +button { + font-size: 1rem; + padding: 0.25rem 1rem; + margin-top: 3rem; } -button.back:hover { - background-color: maroon; - border: plum 1px solid; - color: linen; +button.back { + font-size: 1rem; + padding: 0.25rem 1rem; } button.save { background-color: royalblue; + color: white; border: none; - color: navajowhite; - text-align: center; - font-size: 20px; - cursor: pointer; - padding: 15px 25px; + font-size: 1rem; + padding: 0.25rem 1rem; + float: right; + margin-right: 0; } button.save:hover { - background-color: whitesmoke; - border: navy; - color: royalblue; + background-color: rgb(103, 160, 235); +} + +input.user_data { + width: 14rem; } textarea { resize: none; + width: 14rem; } .inputfile { @@ -64,16 +60,22 @@ textarea { } .inputfile + label { - font-size: 1.25em; - font-weight: 700; - background-color: rgb(209, 202, 202); - border: 1px solid gainsboro; + 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; } -div.fieldname { +input.fieldname { border: 1px solid; - width: 200px; - height: 20px; + width: 10rem; + height: 1rem; +} + +.edit_profile_container { + width: 500px; + margin: auto; } \ No newline at end of file diff --git a/assets/css/main.css b/assets/css/main.css index e202f3763a1349ef1c8566400905472125938522..a61f974b8e8a7a3657fb72418354bc32226fa32e 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -27,7 +27,7 @@ button:disabled { input[type=text], input[type=password], textarea { background-color: white; - border: #3a4249 solid 0.1rem; + border: #3a4249 solid 1px; border-radius: 0.125rem; padding: 0.1rem; } diff --git a/assets/css/navBar.css b/assets/css/navBar.css index b13d327fb578e39dc0981bf131c56c5355b62dfb..ca27f3214756b20b45f45f8a0dd8a9dc3bd19f77 100644 --- a/assets/css/navBar.css +++ b/assets/css/navBar.css @@ -64,7 +64,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 old mode 100644 new mode 100755 index 1896fe53a66cd537f958ac9d64e042d4e819bb64..3ca9e5ebbd466cc830b13f11f66a254c70793056 Binary files a/assets/image/address.png and b/assets/image/address.png differ diff --git a/assets/image/dummy.jpg b/assets/image/dummy.jpg old mode 100644 new mode 100755 diff --git a/assets/image/email.png b/assets/image/email.png old mode 100644 new mode 100755 index 63d1e0c8117d49ea41dbfb00c345923d3a0937ac..fad9607bdb0b7b8a6490c4cde3c1404decc87594 Binary files a/assets/image/email.png and b/assets/image/email.png differ diff --git a/assets/image/phone.png b/assets/image/phone.png old mode 100644 new mode 100755 index 43c4dfcaa0eaf8d9ea2b83b9a45c246111df4703..86da83fa5db760656c7374f0461435bf4449fc3e Binary files a/assets/image/phone.png and b/assets/image/phone.png differ diff --git a/assets/image/profile.jpg b/assets/image/profile.jpg old mode 100644 new mode 100755 diff --git a/assets/js/edit.js b/assets/js/edit.js index c9e65dd780931f45b09c9449ec8d8d411a381d68..9d7309063d6fc6354ab3e458c36321b95888996e 100644 --- a/assets/js/edit.js +++ b/assets/js/edit.js @@ -1,8 +1,10 @@ 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 @@ -13,17 +15,17 @@ window.addEventListener('load', function() { // 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'); - // let pic_id = document.getElementById('field_image_id'); - //let image = document.getElementById('field_data'); + name.onchange = function(e) { if (this.value.match(nameRE)) { name_ok = true; @@ -49,7 +51,6 @@ window.addEventListener('load', function() { var name_ok = name.value !== ""; var address_ok = address.value !== ""; var phone_ok = phone.value !== ""; - // var pic_id_ok = false; // On save button clicked. let button = document.getElementById('save_button'); 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 index 1768ab07c7e471c2c92bc2fdbacef2ec2dca31b6..4f59995e8d2e038812a93c65ed0b52f7521fe2b6 100644 --- a/controller/BiodataController.php +++ b/controller/BiodataController.php @@ -15,6 +15,7 @@ class BiodataController extends BaseController { 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(); diff --git a/controller/EditController.php b/controller/EditController.php index c51f3ced98b2562597fcae539f18419f3f0989d4..c73cb3eada6c7934285a33da46031d5b5ecb77d4 100644 --- a/controller/EditController.php +++ b/controller/EditController.php @@ -15,24 +15,20 @@ class EditController extends BaseController { if (isset($username)) { $image_id = null; - //If uploaded an image + //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); - // if ($model_image->affectedRow > 0) { - // $this->setResponse(200, "Ganti gambar"); - // } else { - // $this->setResponse(200, "Unchanged."); - // } - // return $image->id; + $model_image->update($image); } + //Set profile picture for user else { $image = new Entity\ImageEntity(array( "id" => 0, @@ -46,51 +42,35 @@ class EditController extends BaseController { $model_account = new Model\AccountModel(); $model_biodata = new Model\BiodataModel(); - // $model_image = new Model\ImageModel(); - $user = $model_account->findByID($username); + + //Updating data if (isset($this->params["data"]["name"])) { - // Data received. - // $image = $model_image->findByID($this->getArg('pic_id')); $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); - - // $model_biodata->update($biodatas); - + $this->setResponse(200, "User $username updated"); return $biodata->asArray(); - // return $params; } else { - //Initial condition $biodata = $model_biodata->findByID($username); $arr_bio = $biodata->asArray(); - // $biodatas = new Entity\GenericEntity(array( - // "username" => $username, - // "name" => $arr_bio['name'], - // "email" => $arr_bio['email'], - // "address" => $arr_bio['address'], - // "phone" => $arr_bio['phone'], - // "pic_id" => $arr_bio["pic_id"], - // // "pic_id" => "100", - // )); - $this->setResponse(200, "Please edit"); + $this->setResponse(200, "User $username data accepted"); return $arr_bio; - // return $_FILES; } - - } else { $this->setResponse(401, "Please log in first"); return $params; } } - + } ?> \ No newline at end of file diff --git a/view/biodata.php b/view/biodata.php index 4c74b606c1dd3e55044db7e4d000a70d14829b78..5357e463ee71ecf34d98bd7e4469cf5173ce48a8 100644 --- a/view/biodata.php +++ b/view/biodata.php @@ -2,7 +2,6 @@ <?php if ($response['code'] != 200) { alert("Error : " . $response['code'] . ' ' . $response['message']); - redirect(URLROOT . 'login'); die; } ?> @@ -14,15 +13,15 @@ <meta name="viewport" content="width=device-width, initial-scale=1"> <?php include VIEW . "navBar.php"; + css("main.css"); css("biodata.css"); ?> - <!-- <link rel="stylesheet" href="assets/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/image/pencil.png"> </a></div> - <div><img class="profile" src="<?php + <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"]; } @@ -33,29 +32,31 @@ <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>Username</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>Email </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>Address </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>Phone Number </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 index db1a935b5744f928a295c777927357e07e13eb24..f6807c7bb5c8254fd282bc537d2a338fa3798088 100644 --- a/view/edit_biodata.php +++ b/view/edit_biodata.php @@ -24,12 +24,10 @@ js("bootstrap.js"); js("edit.js"); ?> - <!-- <link rel="stylesheet" href="assets/css/edit_biodata.css"> - <script src="assets/js/edit.js"></script> --> </head> <body> -<div> +<div class="edit_profile_container"> <table> <thead> <tr> @@ -41,41 +39,37 @@ <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> + 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> - <!-- <input type="text" id="filename" class="fieldname" name="pic_id" value="<?php echo $data["pic_id"]?>"></div> --> - <!-- <form action="ajax/image/set" method="POST" id="prof_pic_form"> - <input id="field_data" name="data" type="file" accept="image/jpg|image/png" class="inputfile"/><label for="field_data">Browse...</label> - </form> --> </td> </tr> <tr> - <td><label>Name </label></td> - <td><input type="text" id="field_name" name="name" value="<?php echo $data["name"] ?>"> </td> + <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>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 type="text" id="field_phone" name="phone" maxlength="12" value="<?php echo $data["phone"] ?>"> </td> + <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> - <td><button class="back" onclick="window.location.href = path('profile');">Cancel</button></td> - <td align="right"><button class="save" id="save_button">Save </button></td> </tr> - </table> + </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> 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">