本文整理汇总了PHP中Bootstrap::modal方法的典型用法代码示例。如果您正苦于以下问题:PHP Bootstrap::modal方法的具体用法?PHP Bootstrap::modal怎么用?PHP Bootstrap::modal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bootstrap
的用法示例。
在下文中一共展示了Bootstrap::modal方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_page
public static function print_page($content)
{
$start_time = microtime(true);
if (strlen(LINK_PATH) > 0) {
$sitePathArray = explode("/", LINK_PATH);
for ($i = 0; $i < count($sitePathArray); $i++) {
$file = FILE_ROOT . implode("/", array_slice($sitePathArray, 0, $i + 1)) . "/sidebar.php";
if (file_exists($file)) {
include $file;
MainTemplate::set_sidebar(sidebar());
MainTemplate::set_menu(menu());
}
}
unset($sitePathArray, $i, $file);
}
$main_menu = new Menu();
$main_menu->add_many(array("music", "Music Library", "music"), array("playlists", "Playlists", "th-list"), array("audiowalls", "Audiowalls", "th"), array("files", "Files", "folder-open"), array("showplans", "Show Planning", "tasks"));
if (Session::is_admin()) {
$main_menu->add("admin", "Admin", "cog");
}
$site_path_array = explode("/", LINK_PATH);
$main_menu->set_active($site_path_array[0]);
header("Content-Type: text/html; charset=utf-8");
$return = "<!DOCTYPE html> \n<html> \n\t<head> \n\t\t<title>RaW Digiplay";
if (Output::get_title() != 'Untitled Page') {
$return .= " - " . Output::get_title();
}
$return .= "</title> \n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n\t\t<script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js\"></script>\n\t\t<script type=\"text/javascript\" src=\"" . LINK_ABS . "js/bootstrap.min.js\"></script>\n\t\t";
if (isset($_REQUEST["theme"])) {
$return .= "<link rel=\"stylesheet\" href=\"//netdna.bootstrapcdn.com/bootswatch/3.0.0/" . $_REQUEST["theme"] . "/bootstrap.min.css\">\n";
} else {
$return .= "<link rel=\"stylesheet\" href=\"" . LINK_ABS . "css/bootstrap.min.css\">\n";
}
if (count(Output::get_stylesheets()) > 0) {
foreach (Output::get_stylesheets() as $src) {
$return .= "<link href=\"" . $src . "\" rel=\"stylesheet\" type=\"text/css\">\n";
}
}
if (count(Output::get_scripts()) > 0) {
foreach (Output::get_scripts() as $src) {
$return .= "<script src=\"" . $src . "\" type=\"text/javascript\"></script>\n";
}
}
if (count(Output::get_feeds()) > 0) {
foreach (Output::get_feeds() as $feed) {
$return .= "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . $feed['title'] . "\" href=\"" . $feed['url'] . "\">\n";
}
}
if (self::$barebones == false) {
$return .= "\n\t\t\t<link rel=\"stylesheet\" href=\"" . LINK_ABS . "css/style.css\">\n\t\t\t<script src=\"" . LINK_ABS . "js/main.js\" type=\"text/javascript\"></script>\n\t\t\t";
}
$return .= "\t</head>\n\t<body" . (self::$body_class ? " class=\"" . self::$body_class . "\"" : "") . ">";
if (self::$barebones == false) {
$return .= "\n\t\t<div id=\"wrap\">\n\t\t\t<nav class=\"navbar navbar-inverse navbar-fixed-top\" role=\"navigation\">\n\t\t\t\t<div class=\"container\">\n\t\t\t\t<div class=\"navbar-header\">\n\t\t\t\t\t<button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-dps-collapse\">\n \t\t\t\t\t\t<span class=\"sr-only\">Toggle navigation</span>\n \t\t\t\t\t\t<span class=\"icon-bar\"></span>\n \t\t\t\t\t\t<span class=\"icon-bar\"></span>\n \t\t\t\t\t\t<span class=\"icon-bar\"></span>\n \t\t\t\t\t</button>\n\t \t\t\t\t<a class=\"navbar-brand hidden-sm\" href=\"" . LINK_ABS . "\">Digiplay</a>\n\t\t\t\t\t<div class=\"navbar-spinner hidden\">\n\t\t\t\t\t\t<svg class=\"spinner\" width=\"25px\" height=\"25px\" viewBox=\"0 0 66 66\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t\t\t\t<circle class=\"path\" fill=\"none\" stroke-width=\"8\" stroke-linecap=\"round\" cx=\"33\" cy=\"33\" r=\"29\"></circle>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"navbar-collapse collapse navbar-dps-collapse\">" . $main_menu->output(LINK_ABS, 6, "nav navbar-nav");
if (Session::is_user()) {
$return .= "\n\t\t\t\t\t<ul class=\"nav search-pull-right hidden-sm\">\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<form class=\"navbar-form\" action=\"" . LINK_ABS . "music/search\" method=\"GET\" role=\"search\">\n\t\t\t\t\t\t\t\t<div class=\"form-group\">\n\t \t\t\t\t\t<input type=\"text\" class=\"form-control search-query\" placeholder=\"Search Tracks\" name=\"q\" autocomplete=\"off\">\n\t \t\t\t\t</div>\n\t \t\t\t</form>\n\t \t\t</li>\n\t \t\t<li>\n\t\t \t\t\t<ul id=\"quick-search\" class=\"dropdown-menu pull-right\"></ul>\n\t\t \t\t</li>\n\t\t \t</ul>\n\t\t \t";
}
$return .= "\n\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</nav>\n\t\t\t" . (isset(self::$feature_html) ? "<div class=\"jumbotron" . (isset(self::$feature_image) ? " feature-image\" style=\"background-image: url('" . self::$feature_image . "')\"" : "\"") . "><div class=\"container\">" . self::$feature_html . "</div></div>" : "") . "<div class=\"container\">";
if (Output::get_title() != 'Untitled Page') {
$return .= "\n\t\t\t\t<div class=\"page-header\">\n\t\t\t\t\t<h2>" . Output::get_title();
if (isset(self::$subtitle)) {
$return .= " <small>" . self::$subtitle . "</small>";
}
$return .= "</h2>\n\t\t\t\t</div>";
}
$return .= "\n\t\t\t\t<div class=\"row\">";
if (isset(self::$sidebar) || isset(self::$menu)) {
$return .= "\n\t\t\t\t<div class=\"col-md-3\">";
if (isset(self::$menu)) {
$return .= self::$menu;
}
if (isset(self::$sidebar)) {
$return .= "\t\n\t\t\t\t\t<div class=\"panel panel-noborder visible-md visible-lg\">\n\t\t\t\t\t\t<div class=\"panel-body\">" . self::$sidebar . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>";
}
$return .= "\n\t\t\t\t</div>\n\t\t\t\t<div class=\"col-md-9\">";
} else {
$return .= "\n\t\t\t\t<div class=\"col-md-12\">";
}
}
$return .= $content;
if (self::$barebones == false) {
$return .= "\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>";
if (Session::is_user()) {
$return .= Bootstrap::modal("logout-modal", "You'll lose any unsaved changes on this page.", "Log out?", "<a class=\"btn btn-primary\" href=\"" . LINK_ABS . "ajax/logout.php\">Yes, log out</a>");
}
$return .= "\n\t\t<div id=\"push\"></div>\n\t</div>\n\t\t<footer class=\"jumbotron\">\n\t\t\t<div class=\"container\">\n\t\t\t\t<div class=\"row\">\n\t\t\t\t\t<div class=\"col-sm-8\">\n\t\t\t\t\t\t<p class=\"text-muted credit\">";
if (Session::is_user()) {
$return .= "Logged in as " . Session::get_username() . ". <a href=\"#logout-modal\" data-toggle=\"modal\">Logout</a>. ";
} else {
$return .= "Not logged in. ";
}
$return .= "Copyright © 2011-" . date("y") . " Radio Warwick\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t\t\t<a href=\"" . LINK_ABS . "\"><img src=\"" . LINK_ABS . "img/footer_logo.png\" alt=\"RaW 1251AM\" class=\"pull-right\"/></a>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</footer>";
}
$return .= "\n\t<!-- Page generated in " . (microtime(true) - START_TIME) . " seconds. " . DigiplayDB::get_querycount() . " database queries ran in " . DigiplayDB::get_querytime() . " seconds. -->\n\t</body> \n</html>";
return $return;
}
示例2: foreach
$slots = SustainerSlots::get_all();
$i = 0;
echo "<table class=\"table table-striped table-bordered\">\r\n\t<thead>\r\n\t<tr>\r\n\t<th></th>\r\n\t<th>Monday</th>\r\n\t<th>Tuesday</th>\r\n\t<th>Wednesday</th>\r\n\t<th>Thursday</th>\r\n\t<th>Friday</th>\r\n\t<th>Saturday</th>\r\n\t<th>Sunday</th>\r\n\t</tr>\r\n\t</thead>\r\n\t<tbody>";
$i = 0;
foreach ($slots as $slot) {
if ($i < 1) {
echo "<tr>\r\n\t\t\t<td>" . $slot->get_time() . ":00</td>";
}
$thisPlaylist = Playlists::get_by_id($slot->get_playlist_id());
$thisPlaylistColour = $thisPlaylist->get_colour() == "" ? 'FFFFFF' : $thisPlaylist->get_colour();
echo "<td class='timeslot' id='slot-" . $slot->get_day() . "-" . $slot->get_time() . "' style='background-color: #" . $thisPlaylistColour . ";'>";
echo $slot->get_audio_id() == NULL ? '' : "<span class=\"glyphicon glyphicon-time\" aria-hidden=\"true\"></span>";
echo "</td>";
$i++;
if ($i > 6) {
echo "</tr>";
$i = 0;
}
}
echo "</tbody>\r\n\t</table>";
echo "<form>";
foreach ($slots as $slot) {
echo "<input type=\"hidden\" class=\"field-slots\" id=\"field-slot-" . $slot->get_day() . "-" . $slot->get_time() . "\" name=\"field-slot-" . $slot->get_day() . "-" . $slot->get_time() . "\" value=\"" . $slot->get_playlist_id() . "\">";
}
echo "</form>";
$playlistOptions = "";
foreach (Playlists::get_sustainer() as $playlist) {
$playlistOptions .= "<option value=\"" . $playlist->get_id() . "\">" . $playlist->get_name() . "</option>";
}
echo Bootstrap::modal("update-modal", "\r\n\t\t<p id=\"slot-info\">Current slot information is unavailable.</p>\r\n\t\t<hr>\r\n\t\t<form class=\"form-horizontal\" action=\"?\" method=\"POST\">\r\n\t\t\t<fieldset>\r\n\t\t\t\t<div class=\"control-group\">\r\n\t\t\t\t\t<label class=\"control-label\" for=\"playlist-id\">New Playlist</label>\r\n\t\t\t\t\t<div class=\"controls\">\r\n\t\t\t\t\t\t<select id=\"playlist-id\" name=\"playlist-id\" data-width=\"100%\">\r\n\t\t\t\t\t\t\t" . $playlistOptions . "\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t<p class=\"help-block\">Select the playlist to be scheduled for <hh>.</p>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</fieldset>\r\n\t\t\t<fieldset>\r\n\t\t\t\t<div class=\"control-group\">\r\n\t\t\t\t\t<label class=\"control-label\" for=\"prerecord-id\">Prerecorded File</label>\r\n\t\t\t\t\t<div class=\"controls\">\r\n\t\t\t\t\t\t<select id=\"prerecord-id\" name=\"prerecord-id\" data-width=\"100%\">\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t<p class=\"help-block\">Select the prerecorded content to be played out at <hh>.</p>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</fieldset>\r\n\t\t\t<input type=\"hidden\"class=\"update-id\" name=\"updateid\">\r\n\t\t</form>\r\n\t", "Schedule Prerecorded Content", "<a class=\"btn btn-success\" id=\"update-playlist\" href=\"#\">Update Playlist</a><a class=\"btn btn-primary\" id=\"save-prerecord\" href=\"#\">Schedule Prerecord</a><a class=\"btn btn-danger\" id=\"delete-prerecord\" href=\"#\">Unschedule Prerecord</a><a class=\"btn btn-default\" data-dismiss=\"modal\">Cancel</a>") . "<script type=\"text/javascript\">\r\n\t\tboxes = \$('.timeslot');\r\n\t\tboxes.dblclick(function(){\r\n\t\t\t\$('#update-modal').modal('show');\r\n\t\t\t\$('.update-id').val(\$(this).attr('id'));\r\n\t\t\t\$.ajax({\r\n\t\t\t\turl: '" . LINK_ABS . "ajax/get-slot-status.php',\r\n\t\t\t\tdata: { updateid: \$('.update-id').val() },\r\n\t\t\t\ttype: 'POST',\r\n\t\t\t\tdataType: 'json',\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\t\$('#slot-info').html(data.status);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n</script>";
示例3: array
$track = Tracks::get($track_id);
echo "\r\n\t\t<tr id=\"" . $track->get_id() . "\">\r\n\t\t\t<td class=\"icon\">\r\n\t\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $track->get_id() . "\" class=\"track-info\">\r\n\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\r\n\t\t\t\t</a>\r\n\t\t\t\t<div class=\"hover-info\">\r\n\t\t\t\t\t<strong>Artist:</strong> " . $track->get_artists_str() . "<br />\r\n\t\t\t\t\t<strong>Album:</strong> " . $track->get_album()->get_name() . "<br />\r\n\t\t\t\t\t<strong>Year:</strong> " . $track->get_year() . "<br />\r\n\t\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($track->get_length()) . "<br />\r\n\t\t\t\t\t<strong>Origin:</strong> " . $track->get_origin() . "<br />\r\n\t\t\t\t\t" . ($track->get_reclibid() ? "<strong>Reclib ID:</strong> " . $track->get_reclibid() . "<br />" : "") . "\r\n\t\t\t\t\t<strong>Censored:</strong> " . ($track->is_censored() ? "Yes" : "No") . "<br /> \r\n\t\t\t\t</div>\r\n\t\t\t</td>\r\n\t\t\t<td class=\"artist\">" . $track->get_artists_str() . "</td>\r\n\t\t\t<td class=\"title\">" . $track->get_title() . "</td>\r\n\t\t\t<td class=\"album\">" . $track->get_album()->get_name() . "</td>\r\n\t\t\t<td class=\"length nowrap\">" . Time::format_succinct($track->get_length()) . "</td>";
if (Session::is_group_user("Playlist Admin")) {
$playlists = array();
foreach ($track->get_playlists_in() as $playlist) {
$playlists[] = $playlist->get_id();
}
echo "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#playlist-modal\" data-backdrop=\"true\" data-keyboard=\"true\" data-dps-id=\"" . $track->get_id() . "\" data-playlists-in=\"" . implode(",", $playlists) . "\" class=\"playlist-add\" title=\"Add to playlist\" rel=\"twipsy\">" . Bootstrap::glyphicon("plus-sign") . "</a></td>";
}
echo (Session::is_group_user("Music Admin") ? "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#delete-modal\" data-backdrop=\"true\" data-keyboard=\"true\" data-dps-id=\"" . $track->get_id() . "\" class=\"track-delete\" title=\"Delete this track\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</a></td>" : "") . "\r\n\t\t</tr>";
}
echo "</table>";
echo $pages->return;
} else {
if ($query) {
echo "<h3>Sorry, no results for " . $query . "</h3>";
echo "<h4>Try a more generic search term.</h4>";
}
echo "<h4>Enter keywords below to search for tracks:</h4>\r\n\t<form action=\"" . LINK_ABS . "music/search\" method=\"GET\" class=\"form-inline\">\r\n\t\t<input type=\"text\" placeholder=\"Search Tracks\" name=\"q\" class=\"col-9\">\r\n \t<input type=\"submit\" class=\"btn btn-primary\" value=\"Search\" class=\"col-2 col-offset-1\">\r\n </form>";
}
if (Session::is_group_user("Playlist Admin")) {
$playlist_modal_content = "<p>Select a playlist to add/remove <span class=\"playlist-track-title\">this track</span> to/from:</p><ul class=\"nav nav-pills nav-stacked\">";
foreach (Playlists::get_all() as $playlist) {
$playlist_modal_content .= "<li><a href=\"#\" class=\"playlist-select\" data-playlist-id=\"" . $playlist->get_id() . "\">" . Bootstrap::glyphicon("plus") . $playlist->get_name() . "</a></li>";
}
$playlist_modal_content .= "</ul>";
echo Bootstrap::modal("playlist-modal", $playlist_modal_content, "Add to playlist", "<a href=\"#\" class=\"btn btn-primary\" data-dismiss=\"modal\">Done</a> <a href=\"" . LINK_ABS . "playlists\" class=\"btn btn-default\">Manage playlists</a>");
}
if (Session::is_group_user("Music Admin")) {
echo Bootstrap::modal("delete-modal", "<p>Are you sure you want to move <span class=\"delete-track-title\">this track</span> to the trash?</p>", "Delete track", "<a href=\"#\" class=\"btn btn-primary yes-definitely-delete\">Yes</a> <a href=\"#\" class=\"btn btn-default\" data-dismiss=\"modal\">No</a>");
}
示例4: foreach
Output::set_title("System Information");
Output::add_stylesheet(LINK_ABS . "faults/comment.css");
MainTemplate::set_subtitle("View updates and report faults");
$faults = Faults::get(NULL, Session::get_id());
foreach ($faults as $fault) {
$title = "<b>Fault ID: DIGI_" . $fault->get_id() . " </b><small>Assigned to: " . $fault->get_real_assignedto($fault->get_assignedto()) . "</small><span class=\"pull-right label label-" . $fault->get_panel_class() . "\">" . $fault->get_real_status() . "</span>";
$footer = "<a data-toggle=\"modal\" href=\"#add-comment\" class=\"btn btn-primary btn-xs new-comment\" data-dps-id=" . $fault->get_id() . ">Add Comment</a>";
if (Comments::get_fault_comments($fault->get_id()) != 0) {
$footer .= "<span class=\"pull-right\"><a class=\"accordion-toggle\" data-toggle=\"collapse\" href=\"#collapse-" . $fault->get_id() . "\">" . Bootstrap::glyphicon("plus") . "</a></span></div><div id=\"collapse-" . $fault->get_id() . "\" class=\"panel-collapse collapse\"><div class=\"panel-body\">";
$comments = Comments::get_by_fault($fault->get_id());
foreach ($comments as $comment) {
if ($comment->get_author() == -1) {
$footer .= "<div class=\"row\">\r\n\t\t\t\t\t\t<div class=\"col-md-6 col-md-offset-3\"><hr></div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t <div class=\"col-md-8 col-md-offset-2 system-comment\"><b style=\"color: #f0ad4e;\">System:</b> " . $comment->get_comment() . "<br><span>" . $comment->get_postdate() . "</span></div>\t\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t<div class=\"col-md-6 col-md-offset-3\"><hr></div>\r\n\t\t\t\t\t\t</div>";
} else {
if ($comment->get_author() == $fault->get_author()) {
$footer .= "\r\n\t\t \t<div class=\"panel panel-default\">\r\n\t\t\t\t\t<div class=\"panel-body\">\r\n\t\t\t\t\t\t" . $comment->get_comment() . "\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"panel-footer\"><span class=\"glyphicon glyphicon-time fault-time\" aria-hidden=\"true\"></span>" . $comment->get_postdate() . "<span class=\"glyphicon glyphicon-user fault-user\" aria-hidden=\"true\"></span>" . $comment->get_real_author($comment->get_author()) . "<span class=\"label label-success\">Customer</span></div>\r\n\t\t\t\t</div>\r\n\t\t\t\t";
} else {
$footer .= "\t\t \t<div class=\"panel panel-default\">\r\n\t\t\t\t\t<div class=\"panel-body\">\r\n\t\t\t\t\t\t" . $comment->get_comment() . "\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"panel-footer\"><span class=\"glyphicon glyphicon-time fault-time\" aria-hidden=\"true\"></span>" . $comment->get_postdate() . "<span class=\"glyphicon glyphicon-user fault-user\" aria-hidden=\"true\"></span>" . $comment->get_real_author($comment->get_author()) . "<span class=\"label label-danger\">Developer</span></div>\r\n\t\t\t\t</div>";
}
}
}
$footer .= "</div>";
}
$body = "<p><i>Submitted by: <b>" . $fault->get_real_author($fault->get_author()) . "</b> on: <b>" . $fault->get_postdate() . "</b></i><hr></p>\r\n\t<p>" . $fault->get_content() . "</p>";
echo Bootstrap::panel($fault->get_panel_class(), $body, $title, $footer);
}
$title = "<span id=\"comment-status-title\">Add a comment to the fault DIGI_</span>";
$body = "<form role=\"form\">\r\n <div class=\"form-group\">\r\n \t<input type=\"hidden\" class=\"fault-comment-id\">\r\n <textarea class=\"form-control fault-comment-value\" rows=\"3\"></textarea>\r\n </div>\r\n <div class=\"form-group\">\r\n <button type=\"submit\" class=\"btn btn-primary confirm-fault-comment\">Add Comment</button>\r\n <a href=\"#\" data-dismiss=\"modal\" class=\"btn btn-default\">Cancel</a>\r\n </div>\r\n</form>";
echo Bootstrap::modal("add-comment", $body, $title);
echo "<script>\r\n\t\$('.new-comment').click(function() {\r\n\t\t\$('#comment-status-title').html('Add a comment to the fault DIGI_');\r\n\t\t\$('#comment-status-title').append(\$(this).attr('data-dps-id'));\r\n\t\t\$('.fault-comment-id').val(\$(this).attr('data-dps-id'));\r\n\t});\r\n\t\$('.confirm-fault-comment').click(function() {\r\n\t\t\$.ajax({\r\n\t\t\turl: '" . LINK_ABS . "ajax/add-update-comment.php',\r\n\t\t\tdata: 'faultid='+\$('.fault-comment-id').val()+'&comment='+\$('.fault-comment-value').val(),\r\n\t\t\ttype: 'POST',\r\n\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\talert(value.error);\r\n\t\t\t},\r\n\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\twindow.location.reload(true); \r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n</script>";
示例5: function
}
echo "</td><td><strong>" . $set->get_name() . "</strong><br /><span class=\"description\">" . $set->get_description() . "</span></td>";
$station_aw = DigiplayDB::select("val FROM configuration WHERE parameter = 'station_aw_set' AND location = '1'");
if (!($set->get_id() == (int) $station_aw)) {
if ($set->user_can_delete() || Session::is_group_user('Audiowalls Admin')) {
echo "<td class=\"delete-aw-btn\" data-aw-name=\"" . $set->get_name() . "\" data-dps-set-id=\"" . $set->get_id() . "\" style=\"width:65px\"><a href=\"#\" class=\"btn btn-danger\">Delete</a></td>";
} else {
echo "<td style=\"width:65px\"></td>";
}
} else {
echo "<td style=\"width:65px\"></td>";
}
if ($set->user_can_edit() || Session::is_group_user('Audiowalls Admin')) {
echo "<td style=\"width:65px\"><a href=\"edit.php?id=" . $set->get_id() . "\" class=\"btn btn-primary\">Edit</a></td>";
} else {
echo "<td style=\"width:65px\"></td>";
}
echo "<td style=\"width:185px\">";
if ($set->get_id() == $active) {
echo "<a href=\"#\" class=\"btn btn-success disabled\" id=\"active-aw\" data-user-id=\"" . Session::get_id() . "\" onclick=\"javascript: return false;\">Active Personal Audiowall</a>";
} else {
echo "<a href=\"#\" data-aw-id=\"" . $set->get_id() . "\" class=\"btn btn-default set-personal-audiowall\" onclick=\"javascript: return false;\">Use as Personal Audiowall</a>";
}
echo "</td></tr>";
}
echo "</tbody></table></div>";
echo Bootstrap::modal("add-audiowall-modal", "\n\t\t<form class=\"form-horizontal\" action=\"?\" method=\"POST\">\n\t\t\t<fieldset>\n\t\t\t\t<div class=\"control-group\">\n\t\t\t\t\t<label class=\"control-label\" for=\"audiowall-name\">Audiowall Name</label>\n\t\t\t\t\t<div class=\"controls\">\n\t\t\t\t\t\t<input type=\"text\" class=\"form-control add_aw_text\" id=\"audiowall-name\" placeholder=\"Enter audiowall title.\">\n\t\t\t\t\t</div>\n\t\t\t\t\t<br>\n\t\t\t\t\t<label class=\"control-label\" for=\"audiowall-description\">Audiowall Description</label>\n\t\t\t\t\t<div class=\"controls\">\n\t\t\t\t\t\t<textarea class=\"form-control add_aw_text\" id=\"audiowall-description\" placeholder=\"Enter audiowall description.\"></textarea>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t\t<input type=\"hidden\"class=\"update-id\" name=\"updateid\">\n\t\t</form>\n\t", "Create New Audiowall", "<a class=\"btn btn-success\" id=\"create-audiowall\" href=\"#\">Create New Audiowall</a><a class=\"btn btn-default\" data-dismiss=\"modal\">Cancel</a>");
echo "<div id=\"delete-audiowall-modal\" class=\"modal fade\">\n <div class=\"modal-dialog\">\n <div class=\"modal-content\"> \n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button><h4 class=\"modal-title\">Delete Audiowall</h4>\n </div>\n <div class=\"modal-body\">\n <div class=\"row\">\n <div class=\"col-md-8\">\n Are you sure you want to delete the page: \n </div>\n <div class=\"col-md-4\" id=\"wall-to-delete\"></div>\n </div>\n <p> </p>\n <div class=\"modal-footer clearfix\">\n <a href=\"#\" class=\"btn btn-primary\">Yes</a>\n <a href=\"#\" class=\"btn btn-danger\">No</a>\n </div>\n </div>\n </div>\n</div>\n</div>";
echo "<script type=\"text/javascript\">\n\t\t\$('.delete-aw-btn').click(function(){\n\t\t\t\$('#wall-to-delete').html(\$(this).data('aw-name'));\n\t\t\t\$('#wall-to-delete').attr('data-dps-aw-set', \$(this).data('dps-set-id'));\n\t\t\t\$('#delete-audiowall-modal').modal('show');\n\t\t});\n\t\t\$('#delete-audiowall-modal .btn-danger').click(function(){\n\t\t\t\$('#delete-audiowall-modal').modal('hide');\n\t\t});\n\t\t\$('#delete-audiowall-modal .btn-primary').click(function(){\n\t\t\t\$('#delete-audiowall-modal .btn-primary').addClass(\"disabled\");\n\t\t\t\$.ajax({\n\t\t\t\turl: '" . LINK_ABS . "ajax/delete-audiowall-set.php',\n\t\t\t\tdata: { setid: \$('#wall-to-delete').attr('data-dps-aw-set') },\n\t\t\t\ttype: 'POST',\n\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\talert(value.error);\n\t\t\t\t},\n\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\twindow.location.reload(true); \n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\t</script>\n\t\t";
echo "<script type=\"text/javascript\">\n\t\tboxes = \$('#create');\n\t\tboxes.click(function(){\n\t\t\t\$('#add-audiowall-modal').modal('show');\n\t\t});\n\t\t\n\t\tfunction add_aw() {\n\t\t\tif (\$('#audiowall-description').val() == \"\" || \$('#audiowall-name').val() == \"\") {\n\t\t\t\talert(\"Audiowalls must have both name and description!\");\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\t\$.ajax({\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/add-audiowall-set.php',\n\t\t\t\t\tdata: { awname: \$('#audiowall-name').val().replace(\"'\", \"''\"), awdescription: \$('#audiowall-description').val().replace(\"'\", \"''\") },\n\t\t\t\t\ttype: 'POST',\n\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\talert(value.error);\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\twindow.location.reload(true); \n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t\$('#create-audiowall').click(function() {\n\t\t\tadd_aw();\n\t\t});\n\n\t\t\$('.add_aw_text').on('keypress', function(e) {\n \t\t\t\tvar code = (e.keyCode ? e.keyCode : e.which);\n \t\t\t\tif(code == 13) {\n \t\t\t\t\tadd_aw();\n \t\t\t\t\te.preventDefault();\n \t\t\t\t}\n\t\t\t});\t\n</script>";
echo "<script type=\"text/javascript\">\n\t\$('.set-personal-audiowall').click(function(){\n\t\t\t\t\$.ajax({\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/update-audiowall-config.php',\n\t\t\t\t\tdata: { awid: \$(this).attr('data-aw-id'), userid: " . Session::get_id() . "},\n\t\t\t\t\ttype: 'POST',\n\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\talert(value.error);\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\twindow.location.reload(true); \n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n</script>";
示例6: foreach
} else {
$footer .= "\t\t \t<div class=\"panel panel-default\">\r\n\t\t\t\t\t<div class=\"panel-body\">\r\n\t\t\t\t\t\t" . $comment->get_comment() . "\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"panel-footer\"><span class=\"glyphicon glyphicon-time fault-time\" aria-hidden=\"true\"></span>" . $comment->get_postdate() . "<span class=\"glyphicon glyphicon-user fault-user\" aria-hidden=\"true\"></span>" . $comment->get_real_author($comment->get_author()) . "<span class=\"label label-danger\">Developer</span></div>\r\n\t\t\t\t</div>";
}
}
}
$footer .= "</div>";
}
$body = "<p><i>Submitted by: <b>" . $fault->get_real_author($fault->get_author()) . "</b> on: <b>" . $fault->get_postdate() . "</b></i><hr></p>\r\n\t<p>" . $fault->get_content() . "</p>";
echo Bootstrap::panel($fault->get_panel_class(), $body, $title, $footer);
}
$title = "<span id=\"comment-status-title\">Add a comment to the fault DIGI_</span>";
$body = "<form role=\"form\">\r\n <div class=\"form-group\">\r\n \t<input type=\"hidden\" class=\"fault-comment-id\">\r\n <textarea class=\"form-control fault-comment-value\" rows=\"3\"></textarea>\r\n </div>\r\n <div class=\"form-group\">\r\n <button type=\"submit\" class=\"btn btn-primary confirm-fault-comment\">Add Comment</button>\r\n <a href=\"#\" data-dismiss=\"modal\" class=\"btn btn-default\">Cancel</a>\r\n </div>\r\n</form>";
echo Bootstrap::modal("add-comment", $body, $title);
$title = "<span id=\"update-status-title\">Change the status of fault DIGI_</span>";
$body = "<form role=\"form\">\r\n <div class=\"form-group\">\r\n \t<input type=\"hidden\" class=\"fault-update-id\">\r\n <select class=\"form-control fault-update-value\" name=\"status\">\r\n\t <option value=\"1\">Not yet read</option>\r\n\t <option value=\"2\">On hold</option>\r\n\t <option value=\"3\">Work in progress</option>\r\n\t <option value=\"4\">Fault complete</option>\r\n\t</select>\r\n </div>\r\n <div class=\"form-group\">\r\n <button type=\"submit\" class=\"btn btn-success confirm-fault-update\">Change Status</button>\r\n <a href=\"#\" data-dismiss=\"modal\" class=\"btn btn-default\">Cancel</a>\r\n </div>\r\n</form>";
echo Bootstrap::modal("update-status", $body, $title);
$title = "<span id=\"assign-status-title\">Assign fault DIGI_</span>";
$body = "<form role=\"form\">\r\n <div class=\"form-group\">\r\n \t<input type=\"hidden\" class=\"fault-assign-id\">\r\n <select class=\"form-control fault-assign-value\" name=\"assign\">";
$group = Groups::get_by_name("Developers");
$developers = $group->get_users();
foreach ($developers as $developer) {
$user = Users::get_by_id($developer->get_id());
$user_fullname = $user->get_display_name();
$body .= "<option value=" . $developer->get_id() . ">" . $user_fullname . "</option>";
}
$body .= "</select>\r\n </div>\r\n <div class=\"form-group\">\r\n <button type=\"submit\" class=\"btn btn-warning confirm-fault-assign\">Assign Fault</button>\r\n <a href=\"#\" data-dismiss=\"modal\" class=\"btn btn-default\">Cancel</a>\r\n </div>\r\n</form>";
echo Bootstrap::modal("assign-fault", $body, $title);
$title = "<span id=\"delete-status-title\">Are you sure you want to delete fault DIGI_</span>";
$body = "<input type=\"hidden\" class=\"fault-delete-id\">\r\n\t\t<a href=\"#\" class=\"btn btn-danger confirm-fault-delete\">Delete</a> \r\n\t\t<a href=\"#\" data-dismiss=\"modal\" class=\"btn btn-default\">Cancel</a>";
echo Bootstrap::modal("delete-fault", $body, $title);
echo "<script>\r\n\t\$('.new-comment').click(function() {\r\n\t\t\$('#comment-status-title').html('Add a comment to the fault DIGI_');\r\n\t\t\$('#comment-status-title').append(\$(this).attr('data-dps-id'));\r\n\t\t\$('.fault-comment-id').val(\$(this).attr('data-dps-id'));\r\n\t});\r\n\t\$('.change-status').click(function() {\r\n\t\t\$('#update-status-title').html('Change the status of fault DIGI_');\r\n\t\t\$('#update-status-title').append(\$(this).attr('data-dps-id'));\r\n\t\t\$('.fault-update-id').val(\$(this).attr('data-dps-id'));\r\n\t});\r\n\t\$('.delete-fault').click(function() {\r\n\t\t\$('#delete-status-title').html('Are you sure you want to delete fault DIGI_');\r\n\t\t\$('#delete-status-title').append(\$(this).attr('data-dps-id'));\r\n\t\t\$('.fault-delete-id').val(\$(this).attr('data-dps-id'));\r\n\t});\r\n\t\$('.assign-fault').click(function() {\r\n\t\t\$('#assign-status-title').html('Assign fault DIGI_');\r\n\t\t\$('#assign-status-title').append(\$(this).attr('data-dps-id'));\r\n\t\t\$('.fault-assign-id').val(\$(this).attr('data-dps-id'));\r\n\t});\r\n\t\$('.confirm-fault-comment').click(function() {\r\n\t\t\$.ajax({\r\n\t\t\turl: '" . LINK_ABS . "ajax/add-update-comment.php',\r\n\t\t\tdata: 'faultid='+\$('.fault-comment-id').val()+'&comment='+\$('.fault-comment-value').val(),\r\n\t\t\ttype: 'POST',\r\n\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\talert(value.error);\r\n\t\t\t},\r\n\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\twindow.location.reload(true); \r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\t\$('.confirm-fault-update').click(function() {\r\n\t\t\$.ajax({\r\n\t\t\turl: '" . LINK_ABS . "ajax/fault-admin.php',\r\n\t\t\tdata: 'action=update-status&id='+\$('.fault-update-id').val()+'&status='+\$('.fault-update-value').val(),\r\n\t\t\ttype: 'POST',\r\n\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\talert(value.error);\r\n\t\t\t},\r\n\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\twindow.location.reload(true); \r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\t\$('.confirm-fault-delete').click(function() {\r\n\t\t\$.ajax({\r\n\t\t\turl: '" . LINK_ABS . "ajax/fault-admin.php',\r\n\t\t\tdata: 'action=del-fault&id='+\$('.fault-delete-id').val(),\r\n\t\t\ttype: 'POST',\r\n\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\talert(value.error);\r\n\t\t\t},\r\n\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\twindow.location.reload(true); \r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\t\$('.confirm-fault-assign').click(function() {\r\n\t\t\$.ajax({\r\n\t\t\turl: '" . LINK_ABS . "ajax/fault-admin.php',\r\n\t\t\tdata: 'action=assign-fault&id='+\$('.fault-assign-id').val()+'&assign='+\$('.fault-assign-value').val(),\r\n\t\t\ttype: 'POST',\r\n\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\talert(value.error);\r\n\t\t\t},\r\n\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\twindow.location.reload(true); \r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n</script>";
示例7: count
echo "<strong>" . $track->get_title() . "</strong> by " . $track->get_artists_str() . "<br />";
}
if ($count > 10) {
echo "<br />and <strong>" . ($count - 10) . " more...<br />";
}
echo "\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t\t<td class=\"title\">" . $playlist->get_name() . "</td>\n\t\t\t<td>" . count($playlist->get_tracks()) . "</td>\n\t";
if (Session::is_group_user("Playlist Admin")) {
echo "\n\t\t\t<td>\n\t\t\t\t<a href=\"#\" data-toggle=\"modal\" data-target=\"#update-modal\" data-dps-id=\"" . $playlist->get_id() . "\" class=\"edit-playlist\" title=\"Edit playlist name\" rel=\"twipsy\">\n\t\t\t\t\t" . Bootstrap::glyphicon("pencil") . "\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<a href=\"#\" data-toggle=\"modal\" data-target=\"#delete-modal\" data-dps-id=\"" . $playlist->get_id() . "\" class=\"delete-playlist\" title=\"Delete this playlist\" rel=\"twipsy\">\n\t\t\t\t\t" . Bootstrap::glyphicon("remove-sign") . "\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<a href=\"#\" class=\"move\">\n\t\t\t\t\t" . Bootstrap::glyphicon("move move") . "\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t";
}
echo "\n\t\t</tr>";
}
echo "\n\t</tbody>\n</table>\n</div>\n</form>\n";
if (Session::is_group_user("Playlist Admin")) {
echo "<h3>Sustainer playlists:</h3>";
echo "\n\t<div class=\"table-responsive\">\n\t<table class=\"table table-striped\">\n\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th class=\"icon\"></th>\n\t\t\t\t<th>Title</th>\n\t\t\t\t<th class=\"icon\">Items</th>\n\t\t\t\t<th class=\"icon\"></th>\n\t\t\t\t<th class=\"icon\"></th>\n\t\t\t\t<th class=\"icon\"></th>\n\t\t\t</tr>\n\t\t</thead>\n\t\t<tbody>\n\t";
foreach (Playlists::get_sustainer() as $playlist) {
echo "\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<a href=\"" . LINK_ABS . "playlists/detail/" . $playlist->get_id() . "\" class=\"info\">\n\t\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\n\t\t\t\t\t\t<input type=\"hidden\" name=\"id[]\" value=\"" . $playlist->get_id() . "\">\n\t\t\t\t\t</a>\n\t\t\t\t\t<div class=\"hover-info\">\n\t\t\t\t\t";
$count = $playlist->count_tracks();
foreach ($playlist->get_tracks(10) as $track) {
echo "<strong>" . $track->get_title() . "</strong> by " . $track->get_artists_str() . "<br />";
}
if ($count > 10) {
echo "<br />and <strong>" . ($count - 10) . " more...<br />";
}
echo "\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"title\">" . $playlist->get_name() . "</td>\n\t\t\t\t<td>" . count($playlist->get_tracks()) . "</td>\n\t\t\t\t<td>\n\t\t\t\t\t<a href=\"#\" data-toggle=\"modal\" data-target=\"#update-modal\" data-dps-id=\"" . $playlist->get_id() . "\" class=\"edit-playlist\" title=\"Edit playlist name\" rel=\"twipsy\">\n\t\t\t\t\t\t" . Bootstrap::glyphicon("pencil") . "\n\t\t\t\t\t</a>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<a href=\"#\" data-toggle=\"modal\" data-target=\"#delete-modal\" data-dps-id=\"" . $playlist->get_id() . "\" class=\"delete-playlist\" title=\"Delete this playlist\" rel=\"twipsy\">\n\t\t\t\t\t\t" . Bootstrap::glyphicon("remove-sign") . "\n\t\t\t\t\t</a>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<a href=\"#\" class=\"move\">\n\t\t\t\t\t\t" . Bootstrap::glyphicon("move move") . "\n\t\t\t\t\t</a>\n\t\t\t\t</td>\n\t\t\t</tr>";
}
echo "\n\t\t</tbody>\n\t</table>\n\t</div>\n\t";
}
if (Session::is_group_user("Playlist Admin")) {
echo "<a href=\"#\" data-toggle=\"modal\" data-target=\"#addnew-modal\" id=\"add\">Add a new playlist »</a>" . Bootstrap::modal("addnew-modal", "\n\t\t<form class=\"form-horizontal\" action=\"" . LINK_ABS . "/ajax/add-update-playlist.php\" method=\"POST\">\n\t\t\t<fieldset>\n\t\t\t\t<div class=\"control-group\">\n\t\t\t\t\t<label class=\"control-label\" for=\"name\">Name</label>\n\t\t\t\t\t<div class=\"controls\">\n\t\t\t\t\t\t<input type=\"text\" class=\"form-control playlist-name\" id=\"name\">\n\t\t\t\t\t\t<p class=\"help-block\">Enter a name for the new playlist.</p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t</form>\n\t", "Add new playlist", "<a class=\"btn btn-primary add-playlist\" href=\"#\">Save</a><a class=\"btn btn-default\" data-dismiss=\"modal\">Cancel</a>") . "</div>\n</div>" . Bootstrap::modal("update-modal", "\n\t\t<form class=\"form-horizontal\" action=\"" . LINK_ABS . "/ajax/add-update-playlist.php\" method=\"POST\">\n\t\t\t<fieldset>\n\t\t\t\t<div class=\"control-group\">\n\t\t\t\t\t<label class=\"control-label\" for=\"name\">Name</label>\n\t\t\t\t\t<div class=\"controls\">\n\t\t\t\t\t\t<input type=\"hidden\"class=\"update-id\">\n\t\t\t\t\t\t<input type=\"text\" class=\"form-control playlist-edit-name\">\n\t\t\t\t\t\t<p class=\"help-block\">Enter a name for the playlist.</p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t</form>\n\t", "Edit playlist name", "<a class=\"btn btn-primary update-playlist\" href=\"#\">Save</a><a class=\"btn btn-default\" data-dismiss=\"modal\">Cancel</a>") . "</div>\n</div>" . Bootstrap::modal("delete-modal", "<p>Are you sure you want to permanently delete <span class=\"delete-playlist-title\">this playlist</span>? </p><p>(this does not delete any of the tracks on it)</p>", "Delete playlist", "<a href=\"#\" class=\"btn btn-primary yes-definitely-delete\">Yes</a> <a href=\"#\" class=\"btn btn-default\" data-dismiss=\"modal\">No</a>");
}
示例8: implode
$pages->index = implode(",", $index);
$pages->mid_range = 5;
$pages->items_total = Tracks::count_deleted();
$pages->paginate();
$low = ($page - 1) * $limit + 1;
$high = $low + $limit - 1 > Tracks::count_deleted() ? Tracks::count_deleted() : $low + $limit - 1;
echo "<script>\n\t\t\$(function () {\n\t\t\t\$('.track-info').popover({\n\t\t\t\t'html': true, \n\t\t\t\t'trigger': 'hover',\n\t\t\t\t'title': function() { \n\t\t\t\t\treturn(\$(this).parent().parent().find('.title').html())\n\t\t\t\t},\n\t\t\t\t'content': function() {\n\t\t\t\t\treturn(\$(this).parent().find('.hover-info').html());\n\t\t\t\t}\n\t\t\t});\n" . (Session::is_group_user("Playlist Admin") ? "\n\t\tvar item;\n\t\t\$('.playlist-add').click(function() {\n\t\t\titem = \$(this).parent().parent();\n\t\t\tplaylists = \$(this).attr('data-playlists-in').split(',');\n\t\t\t\$('.playlist-select').parent().removeClass('active');\n\t\t\t\$('.playlist-select').find('span').removeClass('glyphicon-minus').addClass('glyphicon-plus');\n\t\t\t\$('.playlist-select').each(function() {\n\t\t\t\tif(\$.inArray(\$(this).attr('data-playlist-id'),playlists) > -1) {\n\t\t\t\t\t\$(this).find('span').removeClass('icon-plus').addClass('glyphicon-minus');\n\t\t\t\t\t\$(this).parent().addClass('active');\n\t\t\t\t}\n\t\t\t})\n\t\t});\n\n\t\t\$('.playlist-select').click(function() {\n\t\t\tobj = \$(this);\n\t\t\tif(\$(this).parent().hasClass('active')) {\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-minus').addClass('glyphicon-refresh');\n\t\t\t\t\$.ajax({\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\n\t\t\t\t\tdata: 'trackid='+item.attr('id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=del',\n\t\t\t\t\ttype: 'POST',\n\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\n\t\t\t\t\t\talert(value.error);\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\tvalues = \$.parseJSON(data);\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\n\t\t\t\t\t\tobj.parent().removeClass('active');\n\t\t\t\t\t\titem.find('.playlist-add').attr('data-playlists-in',values.playlists.join(','));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-refresh');\n\t\t\t\t\$.ajax({\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\n\t\t\t\t\tdata: 'trackid='+item.attr('id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=add',\n\t\t\t\t\ttype: 'POST',\n\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\n\t\t\t\t\t\talert(value.error);\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\tvalues = \$.parseJSON(data);\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\n\t\t\t\t\t\tobj.parent().addClass('active');\n\t\t\t\t\t\titem.find('.playlist-add').attr('data-playlists-in',values.playlists.join(','));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t\$(this).parent().addClass('active');\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-minus');\n\t\t\t}\n\t\t});\t\t\n" : "") . (Session::is_group_user("Music Admin") ? "\n\t\tvar trackid;\n\t\t\$('.track-delete').click(function() {\n\t\t\t\$('.delete-track-title').html(\$(this).parent().parent().find('.title').html());\n\t\t\ttrackid = \$(this).attr('data-dps-id');\n\t\t});\n\n\t\t\$('.yes-definitely-delete').click(function() {\n\t\t\t\$.ajax({\n\t\t\t\turl: '" . LINK_ABS . "ajax/remove-track.php',\n\t\t\t\tdata: { id: trackid },\n\t\t\t\ttype: 'POST',\n\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\talert(value.error);\n\t\t\t\t},\n\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\twindow.location.reload(true); \n\t\t\t\t}\n\t\t\t});\n\t\t});\n" : "") . "\t\t});\n\t</script>";
echo "<a href=\"#\" id=\"flag\" data-toggle=\"modal\" data-target=\"#empty-modal\" class=\"btn btn-danger btn-block\">" . Bootstrap::glyphicon("warning-sign") . " Empty Trash</a>";
echo "<p></p>";
echo "<h3>" . Tracks::count_deleted() . " results for deleted items.</small></h3>";
echo "<div class=\"row\"><div class=\"col-lg-5\"><h5>Showing results " . $low . " to " . $high . "</h5></div><div class=\"pull-right\">" . $pages->display_jump_menu() . $pages->display_items_per_page() . "</div></div>";
echo "<table class=\"table table-striped\" cellspacing=\"0\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th class=\"icon\"> </th>\n\t\t\t<th class=\"artist\">Artist</th>\n\t\t\t<th class=\"title\">Title</th>\n\t\t\t<th class=\"album\">Album</th>\n\t\t\t<th class=\"length nowrap\">Length</th> \n\t\t\t" . (Session::is_group_user("Playlist Admin") ? "<th class=\"icon\"></th>" : "") . "\n\t\t\t" . (Session::is_group_user("Music Admin") ? "<th class=\"icon\"></th>" : "") . "\n\t\t</tr>\n\t</thead>";
foreach ($tracks as $track) {
echo "\n\t\t<tr id=\"" . $track->get_id() . "\">\n\t\t\t<td class=\"icon\">\n\t\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $track->get_id() . "\" class=\"track-info\">\n\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\n\t\t\t\t</a>\n\t\t\t\t<div class=\"hover-info\">\n\t\t\t\t\t<strong>Artist:</strong> " . $track->get_artists_str() . "<br />\n\t\t\t\t\t<strong>Album:</strong> " . $track->get_album()->get_name() . "<br />\n\t\t\t\t\t<strong>Year:</strong> " . $track->get_year() . "<br />\n\t\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($track->get_length()) . "<br />\n\t\t\t\t\t<strong>Origin:</strong> " . $track->get_origin() . "<br />\n\t\t\t\t\t" . ($track->get_reclibid() ? "<strong>Reclib ID:</strong> " . $track->get_reclibid() . "<br />" : "") . "\n\t\t\t\t\t<strong>Censored:</strong> " . ($track->is_censored() ? "Yes" : "No") . "<br /> \n\t\t\t\t</div>\n\t\t\t</td>\n\t\t\t<td class=\"artist\">" . $track->get_artists_str() . "</td>\n\t\t\t<td class=\"title\">" . $track->get_title() . "</td>\n\t\t\t<td class=\"album\">" . $track->get_album()->get_name() . "</td>\n\t\t\t<td class=\"length nowrap\">" . Time::format_succinct($track->get_length()) . "</td>";
if (Session::is_group_user("Playlist Admin")) {
$playlists = array();
foreach ($track->get_playlists_in() as $playlist) {
$playlists[] = $playlist->get_id();
}
echo "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#playlist-modal\" data-backdrop=\"true\" data-keyboard=\"true\" data-dps-id=\"" . $track->get_id() . "\" data-playlists-in=\"" . implode(",", $playlists) . "\" class=\"playlist-add\" title=\"Add to playlist\" rel=\"twipsy\">" . Bootstrap::glyphicon("plus-sign") . "</a></td>";
}
echo (Session::is_group_user("Music Admin") ? "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#delete-modal\" data-backdrop=\"true\" data-keyboard=\"true\" data-dps-id=\"" . $track->get_id() . "\" class=\"track-delete\" title=\"Delete this track\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</a></td>" : "") . "\n\t\t</tr>";
}
echo "</table>";
echo $pages->return;
}
if (Session::is_group_user("Music Admin")) {
echo Bootstrap::modal("delete-modal", "<p>Are you sure you want to remove <span class=\"delete-track-title\">this track</span> completely?</p>", "Delete track", "<a href=\"#\" class=\"btn btn-primary yes-definitely-delete\">Yes</a> <a href=\"#\" class=\"btn btn-default\" data-dismiss=\"modal\">No</a>");
echo Bootstrap::modal("empty-modal", "<p>Are you sure you want to empty the trash completely?</p>", "Empty Trash", "<div class=\"btn btn-primary\" id=\"flag-confirm\">Yes</div> <a href=\"#\" class=\"btn btn-default\" data-dismiss=\"modal\">No</a>");
echo "<script>\n\t\t\t\$('#flag-confirm').click(function(){\n\t\t\t\t\$.ajax({\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/empty-trash.php',\n\t\t\t\t\ttype: 'POST',\n\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\talert(value.error);\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\twindow.location.reload(true); \n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t</script>\n\t";
}
示例9: foreach
$first = false;
}
echo "\n\t\t\t\t\t\t<div class=\"col-md-10 col-md-offset-2\">\n\t\t\t\t\t\t\t<input type=\"text\" id=\"new_artist\" name=\"new-artist\" class=\"form-control\" " . $disabled . " placeholder=\"Add new artist...\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"album\">Album</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<input type=\"text\" id=\"album\" name=\"album\" class=\"form-control\" " . $disabled . " value=\"" . $track->get_album()->get_name() . "\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"year\">Year</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" id=\"year\" name=\"year\" " . $disabled . " value=\"" . $track->get_year() . "\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"length\">Length</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<p class=\"form-control-static\">" . Time::format_succinct($track->get_length()) . "</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"origin\">Origin</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<input type=\"text\" id=\"origin\" name=\"origin\" class=\"form-control\" " . $disabled . " value=\"" . $track->get_origin() . "\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<div class=\"col-md-10 col-md-offset-2\">\n\t\t\t\t\t\t\t<div class=\"checkbox\">\n\t\t\t\t\t\t\t\t<label for=\"censored\">\n\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" id=\"censored\" name=\"censored\" " . $disabled . " " . ($track->is_censored() ? "checked" : "") . ">\n\t\t\t\t\t\t\t\t\tExplicit\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<div class=\"col-md-10 col-md-offset-2\">\n\t\t\t\t\t\t\t<button type=\"submit\" class=\"btn btn-primary btn-block\">\n\t\t\t\t\t\t\t\t" . Bootstrap::glyphicon("save save") . "\n\t\t\t\t\t\t\t\tSave\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"col-md-5 form\">\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label for=\"notes\">Notes</label>\n\t\t\t\t\t\t<textarea class=\"form-control\" id=\"notes\" name=\"notes\" " . $disabled . ">" . $track->get_notes() . "</textarea>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label for=\"keyword\">Keywords</label>\n\t\t\t\t\t\t<div class=\"for-keywords\">";
foreach ($track->get_keywords() as $keyword) {
echo "\n\t\t\t\t\t\t\t\t<div class=\"input-group\">\n\t\t\t\t\t\t\t\t\t<span class=\"input-group-addon\"><a class=\"keyword-remove\" href=\"" . LINK_ABS . "ajax/del-keywords.php?track_id=" . $track->get_id() . "&keyword=" . $keyword->get_text() . "\">" . Bootstrap::glyphicon("remove-sign") . "</a></span>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" disabled value=\"" . $keyword->get_text() . "\">\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t";
}
echo "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"input-group\">\n\t\t\t\t\t\t\t<span class=\"input-group-addon\">" . Bootstrap::glyphicon("tag") . "</span>\n\t\t\t\t\t\t\t<input type=\"text\" id=\"new_keyword\" name=\"new_keyword\" class=\"form-control\" " . $disabled . " placeholder=\"Add new keyword...\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label for=\"type\">Audio Type</label>\n\t\t\t\t\t\t<select class=\"selectpicker\" id=\"type\" name=\"type\" data-width=\"100%\" " . $disabled . ">";
foreach (AudioTypes::get_all() as $audiotype) {
if ($audiotype->get_id() == $track->get_type()->get_id()) {
echo "<option value=\"" . $audiotype->get_id() . "\" selected=\"selected\">" . $audiotype->get_name() . "</option>";
} else {
echo "<option value=\"" . $audiotype->get_id() . "\">" . $audiotype->get_name() . "</option>";
}
}
echo "</select>\n\t\t\t\t\t</div>\n\t\t\t\t\t<hr />\n\t\t\t\t\t";
if (Session::is_group_user("Playlist Editor")) {
$playlists = array();
foreach ($track->get_playlists_in() as $playlist) {
$playlists[] = $playlist->get_id();
}
echo "<a href=\"#\" data-toggle=\"modal\" data-target=\"#playlist-modal\" data-backdrop=\"true\" data-keyboard=\"true\" data-dps-id=\"" . $track->get_id() . "\" data-playlists-in=\"" . implode(",", $playlists) . "\" id=\"playlists\" class=\"playlist-add btn btn-primary btn-block\">" . Bootstrap::glyphicon("th-list") . " Playlists</a>";
}
echo "\n\t\t\t\t\t<a href=\"#\" id=\"flag\" class=\"btn btn-danger btn-block" . ($track->is_flagged() ? " active" : "") . "\">" . Bootstrap::glyphicon("warning-sign censor-flag") . " Flag for censorship</a>\n\t\t\t\t\t" . (Session::is_group_user("Music Admin") ? "<hr /><a href=\"" . LINK_ABS . "audio/get/" . $track->get_id() . ".flac\" class=\"btn btn-primary btn-block\">" . Bootstrap::glyphicon("download-alt") . " Download FLAC</a>" : "") . "\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</fieldset>\n\t</form>\n";
if (Session::is_group_user("Playlist Editor")) {
$playlist_modal_content = "<p>Select a playlist to add/remove <span class=\"playlist-track-title\">this track</span> to/from:</p><ul class=\"nav nav-pills nav-stacked\">";
foreach (Playlists::get_all() as $playlist) {
$playlist_modal_content .= "<li><a href=\"#\" class=\"playlist-select\" data-playlist-id=\"" . $playlist->get_id() . "\">" . Bootstrap::glyphicon("plus") . $playlist->get_name() . "</a></li>";
}
$playlist_modal_content .= "</ul>";
echo Bootstrap::modal("playlist-modal", $playlist_modal_content, "Add to playlist", "<a href=\"#\" class=\"btn btn-primary\" data-dismiss=\"modal\">Done</a> <a href=\"" . LINK_ABS . "playlists\" class=\"btn btn-default\">Manage playlists</a>");
}