diff options
author | chai <chaifix@163.com> | 2022-03-17 21:02:13 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-03-17 21:02:13 +0800 |
commit | 90483f6eb389f041e0dbd0fca8bb766edbc85910 (patch) | |
tree | 125e5d01012cbab1ada0546dc5b9771af573a9ea /template.php |
+init
Diffstat (limited to 'template.php')
-rw-r--r-- | template.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/template.php b/template.php new file mode 100644 index 0000000..04965b6 --- /dev/null +++ b/template.php @@ -0,0 +1,58 @@ +<?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>'; + } + +} + +?>
\ No newline at end of file |