Commit 75cdc90f authored by Kylian ou Nathan's avatar Kylian ou Nathan
Browse files

Camera almost ok

parent c9f6f334
<?php
class Camera extends CI_Controller{
class Camera extends CI_Controller
{
public function __construct(){
public function __construct()
{
parent::__construct();
$this->load->model("CameraModele");
......@@ -9,7 +11,7 @@ class Camera extends CI_Controller{
}
public function list(){
function list() {
//VERIFICATION QUE L'UTILISATEUR EST CONNECTE
if (!$this->session->has_userdata("email")) {
......@@ -22,7 +24,7 @@ class Camera extends CI_Controller{
if ($cameras == false) {
$data = array("error" => "Vous n'avez pas ajouté de camera pour le moment.");
} else {
$data = array("camera" => $cameras);
$data = array("cameras" => $cameras);
}
$this->load->view('camera/list', $data);
......@@ -45,7 +47,7 @@ class Camera extends CI_Controller{
$nom = $this->input->post('nom');
$ip = $this->input->post('ip');
if ($nom != "" and $ip != "" ) {
if ($nom != "" and $ip != "") {
// On met a jour le capteur
$this->CameraModele->edit($id, $nom, $ip);
......@@ -85,8 +87,19 @@ class Camera extends CI_Controller{
}
}
public function view($id){
$this->load->view('camera/view');
public function view($id)
{
$camera = $this->CameraModele->get($id);
if ($camera !== false) {
$data["id"] = $camera->id;
$data["nom"] = $camera->nom;
$data["ip"] = $camera->ip;
$data["new"] = false;
$this->load->view('camera/view', $data);
} else {
redirect("/camera", "refresh");
}
}
public function delete($id)
......@@ -98,7 +111,7 @@ class Camera extends CI_Controller{
exit();
}
$this->CapteurModele->delete($id);
$this->CameraModele->delete($id);
redirect("/camera", "refresh");
......
......@@ -18,7 +18,7 @@
<a href="<?=base_url("/camera")?>">
<i class='uil uil-angle-left'></i>
</a>
<div class="title"><?= ($new ? "Ajouter une caméra" : ("Caméra : " . $nom) )?></div>
<div class="title"><?=($new ? "Ajouter une caméra" : ("Caméra : " . $nom))?></div>
</div>
<div class="right">
<button type="submit" form="EditCamera" class="blue">
......@@ -27,7 +27,7 @@
</div>
</header>
<main>
<form id="EditCamera" action="<?= base_url("/camera/edit/" . ($new ? "new" : $id))?>" method="post">
<form id="EditCamera" action="<?=base_url("/camera/edit/" . ($new ? "new" : $id))?>" method="post">
<h6 class="big">Nom</h6>
<label for="NOM" class="input l_r">
......@@ -43,7 +43,7 @@
<i class='uil uil-wifi'></i>
<input name="ip" required pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" type="text" value="<?=isset($ip) ? $ip : ""?>" placeholder="192.168.4..." />
</div>
</label>
</label>
<?php if (!$new) {?>
<a href="<?=base_url("/camera/delete/" . $id)?>" class="simple_button_link l_r red bottom">
......
......@@ -15,8 +15,8 @@
<body>
<header class="l_r">
<div class="left">
<a href="<?=base_url("/accueil")?>">
<i class='uil uil-angle-left'></i>
<a href="<?=base_url("/accueil")?>">
<i class='uil uil-angle-left'></i>
</a>
<div class="title">Liste des caméras</div>
</div>
......@@ -35,31 +35,29 @@
</a>
<h6 class="big">Liste des caméras</h6>
<a href="<?=base_url("/camera/view/1")?>" class="image_button_link">
<img src="/static/ressources/cuisine.png" alt="Une caméra">
<div class="button l_r">
<div class="left">
<i class='uil uil-camera'></i>
<p class="title">Cuisine</p>
</div>
<div class="right">
<i class='uil uil-angle-right'></i>
</div>
</div>
</a>
<a href="<?=base_url("/camera/view/2")?>" class="image_button_link">
<img src="/static/ressources/garden.jpg" alt="Une caméra">
<div class="button l_r">
<div class="left">
<i class='uil uil-camera'></i>
<p class="title">Cuisine</p>
</div>
<div class="right">
<i class='uil uil-angle-right'></i>
</div>
</div>
</a>
<?php
if(isset($error)) {
echo $error;
} else {
foreach($cameras as $camera){ ?>
<a href="<?=base_url("/camera/view/" . $camera->id)?>" class="image_button_link">
<img src="/static/ressources/cuisine.png" alt="Une caméra">
<div class="button l_r">
<div class="left">
<i class='uil uil-camera'></i>
<p class="title"><?= $camera->nom ?></p>
</div>
<div class="right">
<i class='uil uil-angle-right'></i>
</div>
</div>
</a>
<?php } } ?>
</main>
</body>
......
......@@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Caméra : Cuisine - LockHome</title>
<title>Caméra : <?=$nom?> - LockHome</title>
<link rel="stylesheet" href="<?=base_url()?>/static/camera.css">
<link rel="stylesheet" href="<?=base_url()?>/static/commun.css">
<link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700&display=swap" rel="stylesheet">
......@@ -18,19 +18,22 @@
<a href="<?=base_url("/camera/list")?>">
<i class='uil uil-angle-left'></i>
</a>
<div class="title">Caméra : Cuisine</div>
<div class="title">Caméra : <?=$nom?></div>
</div>
<div class="right">
<button type="submit" form="EditCapteur" class="blue">
<a class="blue" href="<?=base_url("/camera/edit/" . $id)?>">
<i class='uil uil-pen'></i>
</button>
</a>
</div>
</header>
<main>
<h6 class="big">En temps réel</h6>
<img src="<?= base_url("/static/ressources/garden.jpg") ?>" />
<img src="<?=base_url("/static/ressources/garden.jpg")?>" />
<h6 class="big">Vidéos</h6>
<?=var_dump($ee)?>
<table>
<thead>
<td>Filmé le</td>
......
......@@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Liste des capteurs - LockHome</title>
<link rel="stylesheet" href="<?= base_url() ?>/static/liste_capteur.css">
<link rel="stylesheet" href="<?= base_url() ?>/static/commun.css">
<link rel="stylesheet" href="<?= base_url("/static/liste_capteur.css") ?>">
<link rel="stylesheet" href="<?= base_url("/static/commun.css") ?>">
<link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://unicons.iconscout.com/release/v2.0.1/css/unicons.css">
</head>
......
Markdown is supported
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