本文整理汇总了PHP中Time::format_pretty方法的典型用法代码示例。如果您正苦于以下问题:PHP Time::format_pretty方法的具体用法?PHP Time::format_pretty怎么用?PHP Time::format_pretty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Time
的用法示例。
在下文中一共展示了Time::format_pretty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preg_replace
<?php
if (isset($_REQUEST['refer']) && Session::is_user()) {
$refer = preg_replace('/\\&/', '?', $_REQUEST["refer"], 1);
header("Location: " . LINK_ABS . $refer);
}
MainTemplate::set_feature_image(LINK_ABS . "img/homepage.png");
echo "\n\t\t<script type=\"text/javascript\">\n\t\t\$(function () {\n\t\t\t\$('#username').focus();\n\t\t\t\$('.form-signin').submit(function(event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t\$('#submit').button('loading');\n\t\t\t\t\$('.help-inline').remove();\n\t\t\t\t\$.post('ajax/login.php', \$(this).serialize(), function(data) {\n\t\t\t\t\tif(data == \"success\") { \n\t\t\t\t\t\tlocation.reload()\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\$('#submit').after('<span class=\"help-inline\">'+data+'</span>');\n\t\t\t\t\t\t\$('#submit').button('reset');\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t});\n\t\t});\n\t\t</script>";
$feature = "\n\t\t\t<div class=\"row\">\n\t\t\t\t<div class=\"col-sm-8\">\n\t\t\t\t\t<h1>Digiplay <small>by Radio Warwick</small></h1>\n\t\t\t\t\t<p>A magical software suite run by miniature elves, which is amazing because elves are already very small by their nature.</p>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t" . (Session::is_user() ? "\n\t\t\t\t\t<h2>Common Tasks</h2>\n\t\t\t\t\t<a href=\"music/upload/\" class=\"btn btn-primary btn-large btn-block\">Upload Audio »</a>\n\t\t\t\t\t<a href=\"playlists/\" class=\"btn btn-primary btn-large btn-block\">Edit Playlists »</a>\n\t\t\t\t\t<a href=\"sustainer/\" class=\"btn btn-primary btn-large btn-block\">Schedule Prerecorded Content »</a>\n\t\t\t\t\t<a href=\"faults/\" class=\"btn btn-primary btn-large btn-block\">Report a Fault »</a>\n\t\t\t\t\t" . (Session::is_group_user("Studio Admin") ? "<a href=\"reset.php\" class=\"btn btn-primary btn-large btn-block\">Reset Playout Systems »</a>" : "") . "\n\t\t\t\t" : "\n\t\t\t\t\t<form class=\"form-signin\" action=\"ajax/login.php\" method=\"post\">\n\t\t\t\t\t\t<div class=\"form-group" . (isset($_REQUEST['refer']) ? " has-error" : "") . "\">\n\t\t\t\t\t\t\t<input id=\"username\" name=\"username\" type=\"text\" class=\"form-control input-lg\" placeholder=\"Username\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"form-group" . (isset($_REQUEST['refer']) ? " has-error" : "") . "\">\n\t\t\t\t\t\t\t<input id=\"password\" name=\"password\" type=\"password\" class=\"form-control input-lg\" placeholder=\"Password\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t\t<input type=\"submit\" class=\"btn btn-lg " . (isset($_REQUEST['refer']) ? "btn-danger" : "btn-primary") . " btn-block\" id=\"submit\" name=\"submit\" value=\"Log In\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</form>\n\t\t\t\t") . "\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t";
MainTemplate::set_feature_html($feature);
echo "<div class=\"row\">\n\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t<h2>Music Library</h2>\n\t\t\t\t<dl>\n\t\t\t\t\t<dt>Tracks Stored</dt>\n\t\t\t\t\t<dd>" . number_format(Tracks::get_total_tracks()) . "</dd>\n\t\t\t\t\t<dt>Length of Tracks</dt>\n\t\t\t\t\t<dd>" . Time::format_pretty(Tracks::get_total_length()) . "</dd>\n\t\t\t\t\t<dt>Playlisted Tracks</dt>\n\t\t\t\t\t<dd>" . (count(Tracks::get_playlisted()) - count(Tracks::get_playlisted(Playlists::get(0)))) . "</dd>\n\t\t\t\t</dl>\n\t\t\t</div>\n\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t<h2>Sustainer Service</h2>\n\t\t\t\t<dl>\n\t\t\t\t\t<dt>Tracks on Sustainer</dt>\n\t\t\t\t\t<dd>" . Sustainer::get_total_tracks() . "</dd>\n\t\t\t\t\t<dt>Length of Sustainer Playlist</dt>\n\t\t\t\t\t<dd>" . Sustainer::get_total_length_formatted() . "</dd>\n\t\t\t\t</dl>\n\t\t\t\t<a class=\"btn btn-primary btn-block\" href=\"" . LINK_ABS . "sustainer/\">" . Bootstrap::glyphicon("headphones") . "Now playing</a>\n\t\t\t\t<a class=\"btn btn-primary btn-block\" href=\"" . LINK_ABS . "playlists/detail/0\">" . Bootstrap::glyphicon("list") . "View playlist</a>\n\t\t\t</div>\n\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t<h2>Newest Tracks</h2>";
$tracks = Tracks::get_newest(4);
echo "<table class=\"table table-striped table-hover table-condensed\" cellspacing=\"0\">";
foreach ($tracks as $track) {
echo "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"icon\">\n\t\t\t\t\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $track->get_id() . "\" class=\"track-info\">\n\t\t\t\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class=\"title\">" . $track->get_title() . " by " . $track->get_artists_str() . "</td>\n\t\t\t\t\t</tr>";
}
echo "\n\t\t\t\t</table>\n\t\t\t\t<a class=\"btn btn-primary btn-block\" href=\"" . LINK_ABS . "music/\">" . Bootstrap::glyphicon("chevron-right") . "More</a>\n\t\t\t</div>\n\t\t</div>";
if (Session::is_user()) {
$lastlogin = Session::get_lastlogin();
if ($lastlogin) {
echo "<p class=\"text-success\">You last logged in: " . strftime("%A %e %B %G %H:%M", $lastlogin) . "</p>";
} else {
echo "<p class=\"text-success\">You've never logged in before! Welcome to the Digiplay Web Management System.</p>";
}
echo "<h4>Tracks of the Day:</h4><ul>";
$tracks = Tracks::get_tracks_of_the_day(3);
foreach ($tracks as $track) {
echo "<li><a href=\"music/detail/" . $track->get_id() . "\">" . $track->get_artists_str() . " - " . $track->get_title() . "</a></li>";
}
echo "</ul>";
}
示例2: function
<?php
Output::set_title("Music Library");
echo "<script>\r\n\t\$(function () {\r\n\t\t\$('.track-info').popover({\r\n\t\t\t'html': true, \r\n\t\t\t'trigger': 'hover',\r\n\t\t\t'title': function() { \r\n\t\t\t\treturn(\$(this).parent().parent().find('.title').html())\r\n\t\t\t},\r\n\t\t\t'content': function() {\r\n\t\t\t\treturn(\$(this).parent().find('.hover-info').html());\r\n\t\t\t}\r\n\t\t});\r\n\r\n" . (Session::is_group_user("Playlist Editor") ? "\r\n\t\tvar item;\r\n\t\t\$('.playlist-add').click(function() {\r\n\t\t\titem = \$(this).parent().parent();\r\n\t\t\tplaylists = \$(this).attr('data-playlists-in').split(',');\r\n\t\t\t\$('.playlist-select').parent().removeClass('active');\r\n\t\t\t\$('.playlist-select').find('span').removeClass('glyphicon-minus').addClass('glyphicon-plus');\r\n\t\t\t\$('.playlist-select').each(function() {\r\n\t\t\t\tif(\$.inArray(\$(this).attr('data-playlist-id'),playlists) > -1) {\r\n\t\t\t\t\t\$(this).find('span').removeClass('icon-plus').addClass('glyphicon-minus');\r\n\t\t\t\t\t\$(this).parent().addClass('active');\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t});\r\n\r\n\t\t\$('.playlist-select').click(function() {\r\n\t\t\tobj = \$(this);\r\n\t\t\tif(\$(this).parent().hasClass('active')) {\r\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-minus').addClass('glyphicon-refresh');\r\n\t\t\t\t\$.ajax({\r\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\r\n\t\t\t\t\tdata: 'trackid='+item.attr('id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=del',\r\n\t\t\t\t\ttype: 'POST',\r\n\t\t\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\r\n\t\t\t\t\t\talert(value.error);\r\n\t\t\t\t\t},\r\n\t\t\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\t\t\tvalues = \$.parseJSON(data);\r\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\r\n\t\t\t\t\t\tobj.parent().removeClass('active');\r\n\t\t\t\t\t\titem.find('.playlist-add').attr('data-playlists-in',values.playlists.join(','));\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-refresh');\r\n\t\t\t\t\$.ajax({\r\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\r\n\t\t\t\t\tdata: 'trackid='+item.attr('id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=add',\r\n\t\t\t\t\ttype: 'POST',\r\n\t\t\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\r\n\t\t\t\t\t\talert(value.error);\r\n\t\t\t\t\t},\r\n\t\t\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\t\t\tvalues = \$.parseJSON(data);\r\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\r\n\t\t\t\t\t\tobj.parent().addClass('active');\r\n\t\t\t\t\t\titem.find('.playlist-add').attr('data-playlists-in',values.playlists.join(','));\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\t\$(this).parent().addClass('active');\r\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-minus');\r\n\t\t\t}\r\n\t\t});\t\t\r\n" : "") . (Session::is_group_user("Librarian") ? "\r\n\t\tvar trackid;\r\n\t\t\$('.track-delete').click(function() {\r\n\t\t\t\$('.delete-track-title').html(\$(this).parent().parent().find('.title').html());\r\n\t\t\ttrackid = \$(this).attr('data-dps-id');\r\n\t\t});\r\n\r\n\t\t\$('.yes-definitely-delete').click(function() {\r\n\t\t\t\$.ajax({\r\n\t\t\t\turl: '" . LINK_ABS . "ajax/delete-track.php',\r\n\t\t\t\tdata: 'id='+trackid,\r\n\t\t\t\ttype: 'POST',\r\n\t\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\t\talert(value.error);\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\t\twindow.location.reload(true); \r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n" : "") . "\t});\r\n</script>";
MainTemplate::set_subtitle("Add and remove tracks, edit track details");
if (($flagged = Tracks::get_flagged()) && Session::is_group_user("Censor")) {
echo Bootstrap::alert_message_basic("warning", "<a href=\"" . LINK_ABS . "music/censor\">Click here to view them.</a>", "Tracks have been flagged for censorship.");
}
echo "\r\n<div class=\"row\">\r\n\t<div class=\"col-sm-5\">\r\n\t<h3>Library Statistics</h3>\r\n\t\t<dl>\r\n\t\t\t<dt>Tracks Stored</dt>\r\n\t\t\t<dd>" . number_format(Tracks::get_total_tracks()) . "</dd>\r\n\t\t\t<dt>Length of Tracks</dt>\r\n\t\t\t<dd>" . Time::format_pretty(Tracks::get_total_length()) . "</dd>\r\n\t\t\t<dt>Playlisted Tracks</dt>\r\n\t\t\t<dd>" . count(Tracks::get_playlisted()) . "</dd>\r\n\t\t</dl>\r\n\t</div>\r\n\t<div class=\"col-sm-7\">\r\n\t\t<h3>Requested Tracks</h3>\r\n\t\t";
if ($requested = Requests::get_latest(3)) {
echo "\r\n\t\t<table class=\"table table-striped table-condensed\" cellspacing=\"0\">\r\n\t\t\t<thead>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th class=\"icon\"></th>\r\n\t\t\t\t\t<th class=\"artist\">Artist</th>\r\n\t\t\t\t\t<th class=\"title\">Title</th>" . (Session::is_group_user("Requests Admin") ? "\r\n\t\t\t\t\t<th class=\"icon\"></th>" : "") . "\r\n\t\t\t\t</tr>\r\n\t\t\t</thead>";
foreach ($requested as $request) {
echo "\r\n\t\t\t<tr id=\"" . $request->get_id() . "\">\r\n\t\t\t\t<td class=\"icon\">\r\n\t\t\t\t\t<a href=\"#\" class=\"track-info\">\r\n\t\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\r\n\t\t\t\t\t</a>\r\n\t\t\t\t\t<div class=\"hover-info\">\r\n\t\t\t\t\t\t<strong>Artist:</strong> " . $request->get_artist_name() . "<br />\r\n\t\t\t\t\t\t<strong>Title:</strong> " . $request->get_name() . "<br />\r\n\t\t\t\t\t\t<strong>Date Requested:</strong> " . date("d/m/Y H:i", $request->get_date()) . "<br />\r\n\t\t\t\t\t\t<strong>Requester:</strong> " . $request->get_user()->get_username() . "<br />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td class=\"artist\">" . $request->get_artist_name() . "</td>\r\n\t\t\t\t<td class=\"title\">" . $request->get_name() . "</td>\r\n\t\t\t\t" . (Session::is_group_user("Requests Admin") ? "<td class=\"icon\"><a href=\"" . LINK_ABS . "music/request/delete?id=" . $request->get_id() . "\" class=\"request-delete\" title=\"Delete this request\" rel=\"twipsy\">" . Bootstrap::glyphicon("minus-sign") . "</td>" : "") . "\r\n\t\t\t</tr>";
}
echo "\r\n\t\t</table>";
$total_requests = Requests::count();
if ($total_requests <= count($requested)) {
echo "<a href=\"" . LINK_ABS . "music/request\">» Go to requests</a>";
} else {
echo "<a href=\"" . LINK_ABS . "music/request\">» See " . ($total_requests - count($requested)) . " more requests</a>";
}
} else {
echo "\r\n\t\t<strong>No new requested tracks.</strong><br />\r\n\t\t<a href=\"" . LINK_ABS . "music/request\">» Go to requests</a>";
}
echo "\r\n\t</div>\r\n</div>\r\n<hr />\r\n";
$tracks = Tracks::get_newest();
if ($tracks) {
echo "<h3>10 newest tracks</h3>";
echo "<div class=\"table-responsive\"><table class=\"table table-striped\" cellspacing=\"0\">\r\n\t<thead>\r\n\t\t<tr>\r\n\t\t\t<th class=\"icon\"> </th>\r\n\t\t\t<th class=\"artist\">Artist</th>\r\n\t\t\t<th class=\"title\">Title</th>\r\n\t\t\t<th class=\"date-added nowrap\">Date Added</th>\r\n\t\t\t<th class=\"length nowrap\">Length</th> \r\n\t\t\t" . (Session::is_group_user("Playlist Editor") ? "<th class=\"icon\"></th>" : "") . "\r\n\t\t\t" . (Session::is_group_user("Librarian") ? "<th class=\"icon\"></th>" : "") . "\r\n\t\t</tr>\r\n\t</thead>";
foreach ($tracks as $track) {
$import_date = date("d/m/Y H:i", $track->get_import_date());