当前位置: 首页>>代码示例>>PHP>>正文


PHP Requests::count方法代码示例

本文整理汇总了PHP中Requests::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Requests::count方法的具体用法?PHP Requests::count怎么用?PHP Requests::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Requests的用法示例。


在下文中一共展示了Requests::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: menu

function menu()
{
    $site_path_array = explode("/", LINK_FILE);
    $menu = array(array("url" => LINK_ABS . $site_path_array[0] . "/index.php", "text" => "Library Overview", "icon" => "home"), array("url" => LINK_ABS . $site_path_array[0] . "/search", "text" => "Search Tracks", "icon" => "search"), array("url" => LINK_ABS . $site_path_array[0] . "/request", "text" => "Request Tracks", "icon" => "question-sign"), array("url" => LINK_ABS . $site_path_array[0] . "/censor", "text" => "Tag for Censorship", "icon" => "exclamation-sign"), array("url" => LINK_ABS . $site_path_array[0] . "/upload", "text" => "Upload Tracks", "icon" => "upload"));
    $requests = Requests::count();
    if ($requests > 0) {
        $menu[2]["badge"] = $requests;
    }
    $flagged = count(Tracks::get_flagged());
    if ($flagged > 0) {
        $menu[3]["badge"] = $flagged;
    }
    foreach ($menu as &$item) {
        if ($site_path_array[1] == array_pop(explode("/", $item["url"]))) {
            $item["active"] = true;
        }
    }
    return Bootstrap::list_group($menu);
}
开发者ID:radiowarwick,项目名称:digiplay,代码行数:19,代码来源:sidebar.php

示例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\">&raquo; Go to requests</a>";
    } else {
        echo "<a href=\"" . LINK_ABS . "music/request\">&raquo; 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\">&raquo; 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());
开发者ID:radiowarwick,项目名称:digiplay,代码行数:31,代码来源:index.php


注:本文中的Requests::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。