summaryrefslogtreecommitdiff
path: root/template.php
blob: 55724ba147f0d21a26fe8d0bcf23881048e9d801 (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
<?php require_once 'music.php'?>
<?php require_once 'utils.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_music_wide($music, $index=0) {
    echo '<div class="music_container_wide">';
    echo '<font class="music_index"> ' . $index .'</font>';
    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)" style="display: none; cursor: auto;"> '; 
    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>' ; 

    if(isLogin()){
        echo '<label class="key">ID:</label>';
        echo '<label class="value">' . $music->uid . '</label><br/>';
    }

    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>';
}

function html_album($album) {
    echo '<div class="album_container">';
    echo '    <div class="album_image_root">     ';
    echo '        <img class="cover_img" src="'. $album->cover .'">    ';  
    echo '    </div>';
    echo '    <a href="album.php?id='. $album->uid .'" class="album_title">' . $album->title . '</a>';
    echo '</div>';
}


?>