summaryrefslogtreecommitdiff
path: root/view/album.php
blob: 795491de841cbc4403cefe38ca585782dd8182a2 (plain)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
// view/album.php

// variable $css
// utilise discographie.css
ob_start();
?>
        <link rel="stylesheet" type="text/css" href="public/css/discographie.css" />
        <link rel="stylesheet" type="text/css" href="public/css/donnees_hors_editeur.css" />
<?php
$css = ob_get_clean();

// variable $js
ob_start();
?>
        <script type="text/javascript" src="public/main.js" ></script>
<?php
if(isset($_GET['action']) && $_GET['action'] === 'edition')
{

    // bibliothèques JS ckeditor
?>
        <script src="lib/ckeditor5/build/ckeditor.js"></script>
<?php
}
$js = ob_get_clean();

// variable $header
ob_start();
echo "\n";
?>
            <header>
                <div id="titre" >
                    <div class="police_titre" ><?= $Albums->oneAlbum['titre'] ?> - <?= $Albums->oneAlbum['annee'] ?></div>
                </div>
                <div id="photo" ></div>
            </header>
 <?php
$header = ob_get_clean();

// variable $content
ob_start();
?>
                <aside>
                    <div>
                    <p id="bouton_chronologie" >Chronologie</p>
                    <div id="chronologie" >
                        <!-- ajouter à chaque entrée une ancre et un lien soit vers l'ancre soit vers la page dédiée -->
<?php
//for($i = $Albums->fileListCount - 1; $i >= 0; $i--)
for($i = 0; $i < $Albums->fileListCount; $i++)
{
    // menu dessous la mouette
    // comporte un lien si fichier html existe, sinon une ancre
?>
                        <p><a class="<?= $linkDiscoChrono[$i] ?>" href="index.php?<?= $lienAlbum[$i] ?>" ><?= $Albums->fileList[$i]['annee'] ?> - <?= $Albums->fileList[$i]['titre'] ?></a></p>
<?php
}
?>
                    </div>
                    </div>
                </aside>
<?php

// formulaires et éditeur à la place de l'article à modifier
if(isset($_SESSION['admin']) && $_SESSION['admin'] == 1
    && isset($_GET['action']) && $_GET['action'] === 'edition')
{
    $style = 'class="articleAvecEditeur"';
?>
            <article id="albumHTML" <?= $style ?> >
                <h3>Modifier cet album</h3>
                <?= $editeurHTML ?>
<?php
}
// affichage normal
else
{
?>
            <article id="albumHTML" >
				<?= $album ?>
<?php
}
?>
			</article>
<?php
// boutons modifier et supprimer, mais pas monter ni descendre
// modifier ouvre l'éditeur, supprimer renvoie vers la discographie
if($_SESSION['admin'] == 1 && (!isset($_GET['action']) || $_GET['action'] !== 'edition'))
{
    $lien_partage = 'index.php?page=' . $page . '&file_code=' . $fileCode;
    global $host;
?>
            <p>
                <a class="infobulle" href="<?= $lien_partage ?>" >
                    <img src="public/icone_partager.png" onclick="copierDansPressePapier('<?= $host ?>/<?= $lien_partage ?>')" >
                    <button>Partager</button>
                </a>
                <a class="infobulle" href="index.php?page=album&action=edition&file_code=<?= $fileCode ?>" >
                    <img src="public/icone_modifier.png" >
                    <button>Modifier</button>
                </a>
                <a class="infobulle" href="index.php?page=discographie&action=suppression&file_code=<?= $fileCode ?>" onclick="confirmerSuppression()" >
                    <img src="public/icone_supprimer.png" >
                    <button>Supprimer</button>
                </a>
                <button><a href="index.php?page=discographie" >Retour page discographie</a></button>
            </p>
<?php
}
$content = ob_get_clean();