Bouton déconnexion
This commit is contained in:
parent
ac167feda5
commit
775bc341df
application
@ -9,13 +9,13 @@ class Albums extends CI_Controller {
|
|||||||
$this->load->library('session');
|
$this->load->library('session');
|
||||||
}
|
}
|
||||||
public function index(){
|
public function index(){
|
||||||
$albums = $this->model_music->getAlbums();
|
$albums = $this->model_music->getAlbums();
|
||||||
$is_logged_in = $this->session->userdata('logged_in');
|
$is_logged_in = $this->session->userdata('logged_in');
|
||||||
$data = array(
|
$data = array(
|
||||||
'albums' => $albums,
|
'albums' => $albums,
|
||||||
'is_logged_in' => $is_logged_in
|
'is_logged_in' => $is_logged_in
|
||||||
);
|
);
|
||||||
$this->load->view('layout/header');
|
$this->load->view('layout/header',$data);
|
||||||
$this->load->view('albums_list', $data);
|
$this->load->view('albums_list', $data);
|
||||||
$this->load->view('layout/footer');
|
$this->load->view('layout/footer');
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
<h5>Albums list</h5>
|
<h5>Albums list</h5>
|
||||||
<section class="list">
|
<section class="list">
|
||||||
|
|
||||||
<?php if ($is_logged_in): ?>
|
<?php if (isset($is_logged_in) && $is_logged_in): ?>
|
||||||
<h1>Connecté</h1>
|
<h1>Connecté</h1>
|
||||||
<?php else: ?>
|
<a href="<?= site_url('connect/logout') ?>">Déconnexion</a>
|
||||||
<h1>Non connecté</h1>
|
<?php else: ?>
|
||||||
<?php endif; ?>
|
<h1>Non connecté</h1>
|
||||||
|
<a href="<?= site_url('connect/login') ?>">Connexion</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
foreach($albums as $album){
|
foreach($albums as $album){
|
||||||
|
@ -1,31 +1,32 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en" class="has-navbar-fixed-top">
|
<html lang="en" class="has-navbar-fixed-top">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>Dix heures</title>
|
<title>Dix heures</title>
|
||||||
<link
|
<link
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
|
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
|
||||||
/>
|
/>
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
<?= link_tag('assets/style.css') ?>
|
||||||
<?=link_tag('assets/style.css')?>
|
</head>
|
||||||
</head>
|
<body>
|
||||||
<body>
|
<main class='container'>
|
||||||
<main class='container'>
|
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>Dix heures</strong></li>
|
<li><strong>Dix heures</strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
<li><?=anchor('albums','Albums');?></li>
|
<li><?= anchor('albums', 'Albums'); ?></li>
|
||||||
<li><?=anchor('artistes','Artistes');?></li>
|
<li><?= anchor('artistes', 'Artistes'); ?></li>
|
||||||
<li><?=anchor('playlist','Playlist');?></li>
|
<li><?= anchor('playlist', 'Playlist'); ?></li>
|
||||||
<?php if ($this->session->userdata('user_id')): ?>
|
<?php if ($this->session->userdata('user_id')): ?>
|
||||||
<li><?=anchor('connect/logout','Déconnexion');?></li>
|
<li><?= anchor('connect/logout', 'Déconnexion'); ?></li>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<li><?=anchor('connect/login','Connexion');?></li>
|
<li><?= anchor('connect/login', 'Connexion'); ?></li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user