diff --git a/src/App/components/profile/Profile.php b/src/App/components/profile/Profile.php index 3f40b8ce4c7d4e2f135841ecc8a2a605c3b61d2d..e8ea4307fa8f38fe45faf3cc80f2138bbb0303cb 100644 --- a/src/App/components/profile/Profile.php +++ b/src/App/components/profile/Profile.php @@ -34,7 +34,12 @@ </tr> <tr> <th>Description</th> - <td><?php echo $this->data['description'] ?></td> + <td><?php + if (!isset($data['description'])) { + echo '-'; + } else { + echo $this->data['description']; + } ?></td> </tr> <tr> <th> diff --git a/src/App/components/template/ProductCard.php b/src/App/components/template/ProductCard.php index 4f2f92fbbef17937d2a706fa6d699380defee8a9..3e9d0d2490a66896640abbad8d5998f0e4380541 100644 --- a/src/App/components/template/ProductCard.php +++ b/src/App/components/template/ProductCard.php @@ -1,23 +1,28 @@ <?php function product_card_template($imgsrc, $name, $price, $text, $productId, $isManage = False) { - $hrefPart = ""; + $href = ""; + $redirectText = ""; if($isManage) { - $hrefPart = "<a href='/EditProduct/$productId'>Edit product</a>"; + $href = "href='/EditProduct/$productId'"; + $redirectText = "Edit product"; }else { - $hrefPart = "<a href='/product/$productId'>Add to cart</a>"; + $href = "href='/product/$productId'"; + $redirectText = "Add to cart"; } $html = <<<"EOT" <article> - <figure> - <img src="$imgsrc" alt="$name"> - </figure> - <div class="article-preview"> - <h2>$name</h2> - <h4>$price</h4> - <p>$text</p> - $hrefPart - </div> + <a $href> + <figure> + <img src="$imgsrc" alt="$name"> + </figure> + <div class="article-preview"> + <h2>$name</h2> + <h4>$price</h4> + <p>$text</p> + <h1>$redirectText</h1> + </div> + </a> </article> EOT; diff --git a/src/App/controller/profile/ProfileController.php b/src/App/controller/profile/ProfileController.php index 458c7a42520eb9e7a279180e7dd99bb448fc28cc..e052a4b61054264d000baba9da0b5d87e6fa0969 100644 --- a/src/App/controller/profile/ProfileController.php +++ b/src/App/controller/profile/ProfileController.php @@ -5,7 +5,8 @@ class ProfileController extends Controller public function index() { if($this->userRole === 0) { - throw new Exception("You are not allowed to view this page", 405); + header("Location: /login"); + exit(); } $userModel = $this->model("UserModel"); diff --git a/src/App/public/styles/product/ProductCard.css b/src/App/public/styles/product/ProductCard.css index 4b981cee6cf4c6007bde1fc6d704b1eb3a64cac0..7040eeadc7a3c50b59125e83730fd36064c155f3 100644 --- a/src/App/public/styles/product/ProductCard.css +++ b/src/App/public/styles/product/ProductCard.css @@ -33,11 +33,17 @@ } .articles article a{ - display: inline-flex; - color: #DD946F; + color: #000000; text-decoration: none; } +.articles article h1{ + margin: 0 0 10px 0; + font-size: 1.2rem; + color: #DD946F; + transition: color 0.3s ease-out; +} + .articles article h2{ margin: 0 0 10px 0; font-size: 1.6rem;