-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharticle.php
More file actions
77 lines (71 loc) · 3.22 KB
/
article.php
File metadata and controls
77 lines (71 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php require_once("scripts/model.php")?>
<?php require_once("scripts/php_article.php")?>
<?php require_once("header.php")?>
<!-- PRODUCT -->
<div class="content">
<section class="background">
<div class="greyfilter" style="background-image:url('http://<?php echo $_SERVER['HTTP_HOST']?>/WebProject/img/beerpong.jpg')"></div>
<div class="setsession">
<div><?php if(isset($_SESSION["connecte"])){?>
<?php if($article == null && $_SESSION["connecte"][0]["Role"] == "1") {
?>
<div id="edit" class="dispcaractprod">
<form action="" method="post" enctype="multipart/form-data">
<input type="text" name="name"><br>
<input type="text" name="price"><br>
<div>
<select name="cat">
<option disabled selected>Choisir la catégorie</option>
<?php foreach($categories as $values){ ?>
<option value="<?php echo $values->getId() ?>"><?php echo $values->getName()?></option>
<?php } ?>
</select><br>
<input type="text" name="newcat" placeholder="Ajouter une catégorie"><br>
</div>
<textarea name="description"></textarea><br>
<input type="hidden" name="MAX_FILE_SIZE" value="5000000">
<input type="file" name="avatar[]" ><br>
<input type="submit" value="Créer">
</form>
</div>
<?php }elseif($_SESSION["connecte"][0]["Role"] == "1"){?>
<div id="edit" class="dispcaractprod">
<form>
<input type="text" name="nameprod" value="<?php echo $article->getName() ?>">
<input type="text" name="priceprod" value="<?php echo $article->getPrice() ?>">
<div>
<select>
<option disabled selected>Choisir la catégorie</option>
<?php foreach($categories as $values){ ?>
<option value="<?php $values->getId() ?>"><?php $values->getName() ?></option>
<?php } ?>
</select>
<input type="text" name="newcat" placeholder="Ajouter une catégorie">
</div>
<textarea><?php echo $article->getDescription() ?></textarea>
<input type="submit" value="Valider les modifications">
</form>
<div class="controlpannel">
<button><img src="http://<?php echo $_SERVER['HTTP_HOST']?>/WebProject/img/icon/edit.svg"></button>
<button><img src="http://<?php echo $_SERVER['HTTP_HOST']?>/WebProject/img/icon/trash.svg"></button>
</div>
</div>
<?php }}elseif(!$article == null){?>
<div>
<div class="productpic"><img class="imgproduct" src="http://<?php echo $_SERVER['HTTP_HOST']."/WebProject/data/".$articlePicture ?>"></div>
<div id="visit" class="dispcaractprod ">
<h1><?php echo $article->getName() ?></h1>
<h2><?php echo $article->getPrice() ?></h2>
<p><?php echo $article->getDescription() ?></p>
<button><img src="http://<?php echo $_SERVER['HTTP_HOST']?>/WebProject/img/icon/shoppingcart.svg">Ajouter au panier<img src="http://<?php echo $_SERVER['HTTP_HOST']?>/WebProject/img/icon/next.svg"></button>
</div>
</div>
<?php }else{
header("Location: http://".$_SERVER['HTTP_HOST']."/WebProject/index.php");
} ?>
</div>
</div>
</section>
</div>
<!-- FOOTER -->
<?php require_once("footer.php") ?>