summaryrefslogtreecommitdiff
path: root/template.php
blob: 49d96eefb96973356eb286a86c47f8b42eee15a5 (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
<?php require_once 'music.php'?>
<?php require_once 'functions.php'?>

<?php 

function html_music($music) {
    echo '<div class="music_container">';
    echo '  <div class="music_image_root"  onmouseenter="showPlayButton(this)" onmouseleave="hidePlayButton(this)">';
    echo '      <img class="cover_img" src="'. $music->cover .'"/>';
    echo '      <img class="play_img" audiosrc="' . $music->path . '" src="./res/play_cover.png" onclick="playMusic(this)" onmouseenter="showPlayButtonSelf(this)" onmouseleave="hidePlayButtonSelf(this)"/>';
    echo '  </div>';
    echo '  <a href="booth.php?id=' . $music->uid . '" class="music_title">' . $music->title . '</a>';
    echo '</div>' ;
}

function html_tag($tag) {
    echo '<a href="search.php?page=0&type=tag&value=' . $tag->uid. '" class="tag_link">' . $tag->name . '</a>';
}

function get_html_tag($tag) {
    return '<a href="search.php?page=0&type=tag&value=' . $tag->uid. '" class="tag_link">' . $tag->name . '</a>';
}

function html_music_player($music) {
    if($music == null)
        return ;
    $tags = fetch_music_tags($music->uid) ;
    $html_tags = "";
    foreach($tags as $tag){
        $html_tags = $html_tags . get_html_tag($tag);
    }

    echo '<img class="music_cover" src=" ' . $music->cover . ' " />' ;
    echo '<audio id="music_player" src="' . $music->path .  '" controls="controls">';
    echo ' Sorry, your browser do not support audio.';
    echo '</audio>' ; 

    echo '<label class="key">Name:</label>';
    echo '<label class="value">' . $music->title . '</label><br/>';

    echo '<label class="key">Date:</label>';
    echo '<label id="music_time" class="value" timestamp="' . $music->time . '" ></label><br/>';
    
    echo '<label class="key">Tags:</label>';
    echo $html_tags;
    echo '<br/>';

    echo '<label class="key">Music File:</label>';
    echo '<label class="value"><a href="' . $music->path . '">Download</a></label><br/>';

    if($music->project != ""){
        echo '<label class="key">Project File:</label>';
        echo '<label class="value"><a href=" ' . $music->project . '">Download</a></label>';
    }

}

function html_paginate_link($url, $pagei) {
    echo '<a href="' . $url . '&page=' . $pagei . '">' . ($pagei + 1) .  '</a>';
}

function html_paginate_link_current($url, $pagei) {
    echo '<a class="current" href="' . $url . '&page=' . $pagei . '">' . ($pagei + 1) .  '</a>';
}


?>