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