function paginador() { if ($this->con->conectar() == true) { $num_rows = mysql_query("SELECT COUNT(*) FROM noticias"); $pages = new Paginator(); $pages->items_total = $num_rows[0]; $pages->mid_range = 3; $pages->paginate(); $result = mysql_query("SELECT * FROM noticias ORDER BY id ASC '" . $pages->limit . "'"); while ($rows = mysql_fetch_array($result)) { echo "<td><?php echo (\$result[\\'id\\']) ?></td>"; } echo "<li>" . $pages->display_jump_menu() . $pages->display_items_per_page() . "</li>"; echo "Page {$pages->current_page} of {$pages->num_pages}"; } }
<div align="center"> <? $pages = new Paginator; $pages->items_total = mysql_num_rows($result); $pages->mid_range = 7; $pages->paginate(); $query = "SELECT * FROM mailinglist_messages ORDER BY created DESC $pages->limit"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); if(mysql_num_rows($result) > 0) { echo "<h3>Click to show/hide a message. <a href=\"javascript:void(0);\" onclick=\"do_divs(1)\">Show All</a>/<a href=\"javascript:void(0);\" onclick=\"do_divs(0)\">Hide All</a></h3>\n"; echo "<span class=\"paginate\">Page </span><span style=\"padding:8px;border:1px dotted #999;\">"; echo $pages->display_pages(); echo $pages->display_jump_menu(); echo $pages->display_items_per_page(); echo "</span>"; } $counter = 0; while ($row = mysql_fetch_assoc($result)) { // query queue table and count addresses for this message id // divide total messgaes sent (first query) by the count and round down $queue_query = "SELECT COUNT(*) FROM mailinglist_queue WHERE message_id = '$row[id]'"; $queue_result = mysql_query($queue_query) or die("Query failed : " . mysql_error()); $queue_count = mysql_fetch_row($queue_result); $percent = @floor((($row[count]-$queue_count[0])/$row[count])*100); echo "<p><table width=\"100%\" border=\"0\" id=\"table2\" cellpadding=\"0\" cellspacing=\"2\">\n";
<body> <div id="wrapper"> <div class="main"> <?php //$search="WHERE (MATCH(title,description) AGAINST ('school education parent grade' IN BOOLEAN MODE))"; //$search="WHERE (MATCH(title,description) AGAINST ('theory' IN BOOLEAN MODE))"; $search = ""; // get rows $num_rows = getNumRows($search); $pages = new Paginator(); $pages->items_total = $num_rows; $pages->mid_range = 9; echo "<div class=\"paginate\">"; $pages->paginate(); echo $pages->display_pages(); echo "<span style=\"margin-left:25px\"> " . $pages->display_jump_menu() . $pages->display_items_per_page() . "</span>"; echo "</div>\n"; // print the stories printStoriesPaginator($pages, $search); echo "<div class=\"paginate\">" . $pages->display_pages() . "</div>"; echo "<p>Page {$pages->current_page} of {$pages->num_pages} </p>"; include 'closedb.php'; ?> </div></div> </body> </html>
</tbody> </table> <div class="form-actions"> <?php if ($pagi == 1) { ?> <div class="pagination pull-left"> <?php echo $pages->display_pages(); ?> <span style="margin-left:25px"> <?php echo $pages->display_jump_menu() . $pages->display_items_per_page(); ?> </span> <?php ?> </div> <?php } $u = $url . "/forexcel.php?"; $r = $_SERVER['QUERY_STRING']; $uri = $u . $r; //echo $uri; if ($level['level'] == 1) { ?> <input type="hidden" name="uri" value="<?php
$q_Players = "SELECT DISTINCT " . TBL_PLAYERS . ".*, " . TBL_GAMERS . ".*, " . TBL_USERS . ".*" . " FROM " . TBL_PLAYERS . ", " . TBL_GAMERS . ", " . TBL_USERS . " WHERE (" . TBL_PLAYERS . ".Event = '{$event_id}')" . " AND (" . TBL_PLAYERS . ".Gamer = " . TBL_GAMERS . ".GamerID)" . " AND (" . TBL_USERS . ".user_id = " . TBL_GAMERS . ".User)" . $order_by_str . ($paginate == true ? " {$pages->limit}" : ''); $result = $sql->db_Query($q_Players); $nbr_players = mysql_numrows($result); if (!$result || $nbr_players < 0) { $text .= EB_EVENTM_L51 . '<br />'; } else { if ($nbr_players == 0) { $text .= EB_EVENTM_L52 . '<br />'; } else { if ($paginate == true) { // Paginate $text .= '<br />'; $text .= '<span class="paginate" style="float:left;">' . $pages->display_pages() . '</span>'; $text .= '<span style="float:right">'; // Go To Page $text .= $pages->display_jump_menu(); $text .= ' '; // Items per page $text .= $pages->display_items_per_page(); $text .= '</span><br /><br />'; } /* Display table contents */ if ($can_change_seeds_players == true) { $text .= '<table class="table_left">'; $text .= '<tr>'; $text .= '<td>' . EB_EVENTM_L156 . '</td>'; $text .= '<td><form action="' . e_PLUGIN . 'ebattles/eventprocess.php?eventid=' . $event_id . '" method="post">'; $text .= ebImageTextButton('eventplayersshuffle', '', EB_EVENTM_L155); $text .= '</form></td>'; $text .= '<td> <div id="ajaxSpinnerContainer">
} $tracks = $search["results"]; if ($tracks) { $pages = new Paginator(); $pages->items_per_page = $limit; $pages->querystring = $query; $pages->index = implode(",", $index); $pages->mid_range = 5; $pages->items_total = $search["total"]; $pages->paginate(); $low = ($page - 1) * $limit + 1; $high = $low + $limit - 1 > $search["total"] ? $search["total"] : $low + $limit - 1; echo "<script>\r\n\t\t\$(function () {\r\n\t\t\t\$('.track-info').popover({\r\n\t\t\t\t'html': true, \r\n\t\t\t\t'trigger': 'hover',\r\n\t\t\t\t'title': function() { \r\n\t\t\t\t\treturn(\$(this).parent().parent().find('.title').html())\r\n\t\t\t\t},\r\n\t\t\t\t'content': function() {\r\n\t\t\t\t\treturn(\$(this).parent().find('.hover-info').html());\r\n\t\t\t\t}\r\n\t\t\t});\r\n" . (Session::is_group_user("Playlist Admin") ? "\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("Music Admin") ? "\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\t});\r\n\t</script>"; $indexes = implode(", ", $index); echo "<h3>" . $search["total"] . " results for " . $query . "<small> searching in " . $indexes . "</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\">\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=\"album\">Album</th>\r\n\t\t\t<th class=\"length nowrap\">Length</th> \r\n\t\t\t" . (Session::is_group_user("Playlist Admin") ? "<th class=\"icon\"></th>" : "") . "\r\n\t\t\t" . (Session::is_group_user("Music Admin") ? "<th class=\"icon\"></th>" : "") . "\r\n\t\t</tr>\r\n\t</thead>"; foreach ($tracks as $track_id) { $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;
require_once "../classes/db.class.php"; include_once '../classes/paginator.class.php'; /* Instantiate DB Class */ $db = new db(); /* Get Row count from nodes where NOT deleted*/ $rs = $db->q('SELECT COUNT(*) AS total FROM users WHERE status = 1'); $row = mysql_fetch_row($rs); $result["total"] = $row[0]; /* Instantiate Paginator Class */ $pages = new Paginator(); $pages->items_total = $result['total']; $pages->mid_range = 7; // Number of pages to display. Must be odd and > 3 $pages->paginate(); echo $pages->display_pages(); echo "<span class=\"\">" . $pages->display_jump_menu() . $pages->display_items_per_page() . "</span>"; /* GET all nodes records from DB */ $q = $db->q("SELECT \n\t\tid,\n\t\tusername,\n\t\tuserlevel,\n\t\temail,\n\t\ttimestamp\n\tFROM users\n\tWHERE status = 1\n\t{$pages->limit}"); // push rows to $itesm array $items = array(); while ($row = mysql_fetch_assoc($q)) { array_push($items, $row); } /* Create Multidimensional array for use later */ $result["rows"] = $items; $i = 0; # row counter to enable alternate row coloring ?> <table id="userAddTbl" class="tableSimple"> <thead>
public function manageBlog() { $content = ' <section id="content"> <div class="content-wrap"> <div class="container clearfix"> <div class="fancy-title title-border topmargin"> <h4>Admin Dashboard</h4> </div> <div class="table-toolbar"> <div class="btn-group"> <a href="?go=addBlog"> <button id="sample_editable_1_new" class="button button-3d button-rounded button-green"> Add New Blog Post <i class="icon-plus"></i> </button></a> </div> </div> <table class="table table-striped table-bordered table-hover" id="sample_1"> <thead> <tr> <th>ID</th> <th >Photo</th> <th >Title</th> <th >Views</th> <th >Quote</th> <th >Category</th> <th >Actions</th> </tr> </thead> <tbody>'; $sub_sql = "SELECT COUNT(*) AS count FROM article WHERE trashed =0"; $result_pag_num = Database::performQuery($sub_sql); $row = $result_pag_num->fetch_assoc(); $num_rows = $row['count']; $pages = new Paginator($num_rows, 9, array(3, 5, 10, 12, 15, 20, 25, 30, 50, 100, 250, 'All')); //$content .= $pages->display_pages(); $sql = "SELECT id,title,views,quote,media,articleCat_id,published FROM article WHERE trashed=0 ORDER BY id DESC LIMIT " . $pages->limit_start . "," . $pages->limit_end; $result = Database::performQuery($sql); while ($data = $result->fetch_assoc()) { $catid = $data['articleCat_id']; $sqlcat = "SELECT name FROM articlecat WHERE id LIKE '{$catid}'"; $resultcat = Database::performQuery($sqlcat); $datacat = $resultcat->fetch_assoc(); $cat = $datacat['name']; //published status set $pub = $data['published']; if ($pub) { $actions = '<a href="./?go=editBlog&id=' . $data['id'] . '"><span class="badge badge-warning"><i class="icon-pencil"></i> Edit</span></a> <a href="./?go=unpublish&id=' . $data['id'] . '"><span class="badge badge-primary"><i class="icon-thumbs-down"></i> Unpublish</span></a> <a href="./?go=trash&id=' . $data['id'] . '"><span class="badge badge-danger"><i class="icon-trash"></i> </span></a>'; } else { $actions = '<a href="./?go=editBlog&id=' . $data['id'] . '"><span class="badge badge-warning"><i class="icon-pencil"></i> Edit</span></a> <a href="./?go=publish&id=' . $data['id'] . '"><span class="badge badge-success"><i class="icon-thumbs-up"></i> Publish</span></a> <a href="./?go=trash&id=' . $data['id'] . '"><span class="badge badge-danger"><i class="icon-trash"></i></span></a>'; } //Set actions $content .= '<tr class="odd gradeX"> <td>' . $data['id'] . '</td> <td ><img src="' . BASE_URL . '/img/' . $data['media'] . '" width="100"/></a></td> <td >' . $data['title'] . '</td> <td class="center">' . $data['views'] . '</td> <td class="center">' . $data['quote'] . '</td> <td >' . $cat . '</td> <td >' . $actions . '</td> </tr>'; } $content .= '<tr><td colspan="5">' . $pages->display_pages() . '</td><td colspan="1">' . $pages->display_jump_menu() . '</td><td colspan="1">' . $pages->display_items_per_page() . '</td></tr>'; $content .= ' </tbody> </table> </div></div></section> '; return $content; }
/** * displayEvents - Displays the events database table in * a nicely formatted html table. */ function displayPastEvents() { global $sql; global $text; global $time; $pages = new Paginator(); $array = array('latest' => array(EB_EVENTS_L4, 'EventID'), 'name' => array(EB_EVENTS_L5, TBL_EVENTS . '.Name'), 'game' => array(EB_EVENTS_L6, TBL_GAMES . '.Name'), 'type' => array(EB_EVENTS_L7, TBL_EVENTS . '.Type'), 'start' => array(EB_EVENTS_L8, TBL_EVENTS . '.StartDateTime')); if (!isset($_GET['gameid'])) { $_GET['gameid'] = "All"; } $gameid = eb_sanitize($_GET['gameid']); if (!isset($_GET['matchtype'])) { $_GET['matchtype'] = "All"; } $matchtype = eb_sanitize($_GET['matchtype']); if (!isset($_GET['orderby'])) { $_GET['orderby'] = 'game'; } $orderby = eb_sanitize($_GET['orderby']); $sort = "ASC"; if (isset($_GET["sort"]) && !empty($_GET["sort"])) { $sort = $_GET["sort"] == "ASC" ? "DESC" : "ASC"; } $game_string = $gameid == "All" ? "" : " AND (" . TBL_EVENTS . ".Game = '{$gameid}')"; $matchtype_string = $matchtype == "All" ? "" : " AND (" . TBL_GAMES . ".MatchTypes LIKE '%{$matchtype}%')"; // Drop down list to select Games to display $q_Games = "SELECT DISTINCT " . TBL_GAMES . ".*" . " FROM " . TBL_GAMES . ", " . TBL_EVENTS . " WHERE (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)" . $matchtype_string . " ORDER BY Name"; $result_Games = $sql->db_Query($q_Games); $numGames = mysql_numrows($result_Games); // Drop down list to select Match type to display $q_mt = "SELECT " . TBL_GAMES . ".*" . " FROM " . TBL_GAMES . ", " . TBL_EVENTS . " WHERE (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)" . $game_string; $result_mt = $sql->db_Query($q_mt); $num_mt = mysql_numrows($result_mt); $gmatchtypes = ''; for ($i = 0; $i < $num_mt; $i++) { $gmatchtypes .= ',' . mysql_result($result_mt, $i, TBL_GAMES . ".MatchTypes"); } $text .= '<form id="submitform" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="get">'; $text .= '<div>'; $text .= '<table class="table_left">'; $text .= '<tr>'; // Games drop down $text .= '<td>' . EB_EVENTS_L9 . '<br />'; $text .= '<select class="tbox" name="gameid" onchange="this.form.submit()">'; $text .= '<option value="All" ' . ($gameid == "All" ? 'selected="selected"' : '') . '>' . EB_EVENTS_L10 . '</option>'; for ($i = 0; $i < $numGames; $i++) { $gName = mysql_result($result_Games, $i, TBL_GAMES . ".Name"); $gid = mysql_result($result_Games, $i, TBL_GAMES . ".GameID"); $text .= '<option value="' . $gid . '" ' . ($gameid == $gid ? 'selected="selected"' : '') . '>' . htmlspecialchars($gName) . '</option>'; } $text .= '</select>'; $text .= '</td>'; // Match Types drop down $text .= '<td>' . EB_EVENTS_L32 . '<br />'; $text .= '<select class="tbox" name="matchtype" onchange="this.form.submit()">'; $text .= '<option value="All" ' . ($matchtype == "All" ? 'selected="selected"' : '') . '>' . EB_EVENTS_L10 . '</option>'; $gmatchtypes = explode(",", $gmatchtypes); $gmatchtypes = array_unique($gmatchtypes); sort($gmatchtypes); foreach ($gmatchtypes as $gmatchtype) { if ($gmatchtype != '') { $text .= '<option value="' . $gmatchtype . '" ' . ($gmatchtype == $matchtype ? 'selected="selected"' : '') . '>' . htmlspecialchars($gmatchtype) . '</option>'; } } $text .= '</select>'; $text .= '</td>'; $text .= '</tr>'; $text .= '</table>'; $game_string = $gameid == "All" ? "" : " AND (" . TBL_EVENTS . ".Game = '{$gameid}')"; $matchtype_string = $matchtype == "All" ? "" : " AND (" . TBL_EVENTS . ".MatchType = '{$matchtype}')"; $q = "SELECT count(*) " . " FROM " . TBL_EVENTS . " WHERE (" . TBL_EVENTS . ".Status = 'finished')" . $game_string . $matchtype_string; $result = $sql->db_Query($q); $totalItems = mysql_result($result, 0); $pages->items_total = $totalItems; $pages->mid_range = eb_PAGINATION_MIDRANGE; $pages->paginate(); $orderby_array = $array["{$orderby}"]; $q = "SELECT " . TBL_EVENTS . ".*, " . TBL_GAMES . ".*" . " FROM " . TBL_EVENTS . ", " . TBL_GAMES . " WHERE (" . TBL_EVENTS . ".Status = 'finished')" . " AND (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)" . $game_string . $matchtype_string . " ORDER BY {$orderby_array['1']} {$sort}, EventID DESC" . " {$pages->limit}"; $result = $sql->db_Query($q); $numEvents = mysql_numrows($result); if (!$result || $numEvents < 0) { /* Error occurred, return given name by default */ $text .= EB_EVENTS_L11 . '</div>'; $text .= '</form><br/>'; } else { if ($numEvents == 0) { $text .= EB_EVENTS_L12 . '</div>'; $text .= '</form><br/>'; } else { // Paginate & Sorting $items = ''; foreach ($array as $opt => $opt_array) { $items .= $opt == $orderby ? '<option selected="selected" value="' . $opt . '">' . $opt_array[0] . '</option>' : '<option value="' . $opt . '">' . $opt_array[0] . '</option>'; } // Paginate $text .= '<span class="paginate" style="float:left;">' . $pages->display_pages() . '</span>'; $text .= '<span style="float:right">'; // Sort By $text .= EB_PGN_L6; $text .= '<select class="tbox" name="orderby" onchange="this.form.submit()">'; $text .= $items; $text .= '</select>'; // Up/Down arrow $text .= '<input type="hidden" id="sort" name="sort" value=""/>'; if ($sort == "ASC") { $text .= '<a href="javascript:buttonval(\'ASC\');" title="Ascending"><img src="' . e_PLUGIN . 'ebattles/images/sort_asc.gif" alt="Asc" style="vertical-align:middle; border:0"/></a>'; } else { $text .= '<a href="javascript:buttonval(\'DESC\');" title="Descending"><img src="' . e_PLUGIN . 'ebattles/images/sort_desc.gif" alt="Desc" style="vertical-align:middle; border:0"/></a>'; } $text .= ' '; // Go To Page $text .= $pages->display_jump_menu(); $text .= ' '; // Items per page $text .= $pages->display_items_per_page(); $text .= '</span>'; $text .= '</div>'; $text .= '</form><br/><br/>'; /* Display table contents */ $text .= '<table class="eb_table" style="width:95%"><tbody>'; $text .= '<tr> <th class="eb_th2">' . EB_EVENTS_L13 . '</th> <th colspan="2" class="eb_th2">' . EB_EVENTS_L14 . '</th> <th class="eb_th2">' . EB_EVENTS_L15 . '</th> <th class="eb_th2">' . EB_EVENTS_L16 . '</th> <th class="eb_th2">' . EB_EVENTS_L17 . '</th> <th class="eb_th2">' . EB_EVENTS_L18 . '</th> <th class="eb_th2">' . EB_EVENTS_L19 . '</th> <th class="eb_th2">' . EB_EVENTS_L34 . '</th> </tr>'; for ($i = 0; $i < $numEvents; $i++) { $gName = mysql_result($result, $i, TBL_GAMES . ".Name"); $gIcon = mysql_result($result, $i, TBL_GAMES . ".Icon"); $event_id = mysql_result($result, $i, TBL_EVENTS . ".EventID"); $event = new Event($event_id); if ($event->getField('StartDateTime') != 0) { $startdatetime_local = $event->getField('StartDateTime') + TIMEOFFSET; $date_start = date("d M Y", $startdatetime_local); } else { $date_start = "-"; } if ($event->getField('EndDateTime') != 0) { $enddatetime_local = $event->getField('EndDateTime') + TIMEOFFSET; $date_end = date("d M Y", $enddatetime_local); } else { $date_end = "-"; } /* Nbr players */ $q_2 = "SELECT COUNT(*) as NbrPlayers" . " FROM " . TBL_PLAYERS . " WHERE (Event = '{$event_id}')"; $result_2 = $sql->db_Query($q_2); $row = mysql_fetch_array($result_2); $nbrplayers = $row['NbrPlayers']; /* Nbr Teams */ $q_2 = "SELECT COUNT(*) as NbrTeams" . " FROM " . TBL_TEAMS . " WHERE (" . TBL_TEAMS . ".Event = '{$event_id}')"; $result_2 = $sql->db_Query($q_2); $row = mysql_fetch_array($result_2); $nbrTeams = $row['NbrTeams']; /* Nbr matches */ $q_2 = "SELECT COUNT(DISTINCT " . TBL_MATCHS . ".MatchID) as NbrMatches" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . " WHERE (Event = '{$event_id}')" . " AND (" . TBL_MATCHS . ".Status = 'active')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)"; $result_2 = $sql->db_Query($q_2); $row = mysql_fetch_array($result_2); $nbrmatches = $row['NbrMatches']; switch ($event->getField('Type')) { case "One Player Ladder": case "One Player Tournament": $nbrTeamPlayers = $nbrplayers; break; case "Team Ladder": $nbrTeamPlayers = $nbrTeams . '/' . $nbrplayers; break; case "Clan Ladder": case "Clan Tournament": $nbrTeamPlayers = $nbrTeams; break; default: } $text .= '<tr> <td class="eb_td"><a href="' . e_PLUGIN . 'ebattles/eventinfo.php?eventid=' . $event_id . '">' . $event->getField('Name') . '</a></td> <td class="eb_td"><img ' . getGameIconResize($gIcon) . '/></td> <td class="eb_td">' . $gName . '</td> <td class="eb_td">' . ($event->getField('MatchType') != '' ? $event->getField('MatchType') . ' - ' : '') . $event->eventTypeToString() . '</td> <td class="eb_td">' . $date_start . '</td> <td class="eb_td">' . $date_end . '</td> <td class="eb_td">' . $nbrTeamPlayers . '</td> <td class="eb_td">' . $nbrmatches . '</td> <td class="eb_td">' . $event->eventStatusToString() . '</td> </tr>'; } $text .= '</tbody></table><br />'; $text .= '<div>'; $text .= ebImageLink('back_to_events', '', e_PLUGIN . 'ebattles/events.php', '', 'action_back.gif', EB_EVENTP_L3 . ' ' . EB_EVENTP_L4, 'jq-button'); $text .= '</div>'; } } }
<?php } ?> </table> <!-- Hiddend Field For Delete --> <input type="hidden" id="id" name="id" value=" " /> <input type="hidden" id="method" name="method" value=" " /> </form><?php echo "<span style='text-align:center;display:block;color:#fff;padding-top:10px;font-size:12px;font-family:Helvetica,Arial,sans-serif;'> " . $pages->display_jump_menu() . $pages->display_items_per_page() . "</span>"; ?> </td> </tr> </table></td> </tr> <tr> <td> </td> </tr>
/** * displayGames - Displays the games database table */ function displayGames() { global $pref; global $sql; global $text; global $session; $pages = new Paginator(); $array = array('id' => array(EB_GAMES_L3, TBL_GAMES . '.GameID'), 'icon' => array(EB_GAMES_L4, TBL_GAMES . '.Icon'), 'game' => array(EB_GAMES_L5, TBL_GAMES . '.Name')); if (!isset($_GET['orderby'])) { $_GET['orderby'] = 'game'; } $orderby = eb_sanitize($_GET['orderby']); $sort = "ASC"; if (isset($_GET["sort"]) && !empty($_GET["sort"])) { $sort = $_GET["sort"] == "ASC" ? "DESC" : "ASC"; } $q = "SELECT count(*) " . " FROM " . TBL_GAMES; $result = $sql->db_Query($q); $numGames = mysql_result($result, 0); $totalItems = $numGames; $pages->items_total = $totalItems; $pages->mid_range = eb_PAGINATION_MIDRANGE; $pages->paginate(); $text .= '<div class="spacer">'; $text .= '<p>'; $text .= $numGames . ' ' . EB_GAMES_L6 . '<br />'; $text .= '</p>'; $text .= '</div>'; $orderby_array = $array["{$orderby}"]; $q = "SELECT " . TBL_GAMES . ".*" . " FROM " . TBL_GAMES . " ORDER BY {$orderby_array['1']} {$sort}" . " {$pages->limit}"; $result = $sql->db_Query($q); $num_rows = mysql_numrows($result); if (!$result || $num_rows < 0) { $text .= EB_GAMES_L7; return; } if ($num_rows == 0) { $text .= EB_GAMES_L8; } else { // Paginate $text .= '<br />'; $text .= '<span class="paginate" style="float:left;">' . $pages->display_pages() . '</span>'; $text .= '<span style="float:right">'; // Go To Page $text .= $pages->display_jump_menu(); $text .= ' '; // Items per page $text .= $pages->display_items_per_page(); $text .= '</span><br /><br />'; /* Display table contents */ $text .= '<form id="gamesform" action="' . e_PLUGIN . 'ebattles/gameprocess.php" method="post">'; $text .= '<table class="fborder" style="width:95%"><tbody>'; $text .= '<tr>'; $text .= '<td class="eb_td2"><input class="tbox" type="checkbox" name="sAll" onclick="selectAll(this)" /> (' . EB_GAMES_L9 . ')</td>'; foreach ($array as $opt => $opt_array) { $text .= '<td class="eb_td2"><a href="' . e_PLUGIN . 'ebattles/admin_config.php?eb_games&orderby=' . $opt . '&sort=' . $sort . '">' . $opt_array[0] . '</a></td>'; } $text .= '<td class="eb_td2">' . EB_GAMES_L10; $text .= '<input type="hidden" id="delete_game" name="delete_game" value=""/></td></tr>'; for ($i = 0; $i < $num_rows; $i++) { $gid = mysql_result($result, $i, TBL_GAMES . ".GameID"); $gname = mysql_result($result, $i, TBL_GAMES . ".Name"); $gicon = mysql_result($result, $i, TBL_GAMES . ".Icon"); $text .= '<tr>'; $text .= '<td class="forumheader3"><input class="tbox" type="checkbox" name="game_sel[]" value="' . $gid . '" /></td>'; $text .= '<td class="forumheader3">' . $gid . '</td>'; $text .= '<td class="forumheader3"><img ' . getGameIconResize($gicon) . ' title="' . $gicon . '"/></td>'; $text .= '<td class="forumheader3"><a href="' . e_PLUGIN . 'ebattles/admin_config.php?eb_games&gameid=' . $gid . '">' . $gname . '</a></td>'; $text .= '<td class="forumheader3"><a href="' . e_PLUGIN . 'ebattles/admin_config.php?eb_games&gameid=' . $gid . '"><img src="' . e_PLUGIN . 'ebattles/images/page_white_edit.png" alt="' . EB_GAMES_L11 . '" title="' . EB_GAMES_L11 . '"/></a>'; $text .= '<a href="javascript:buttonval(\'' . $gid . '\');" title="' . EB_GAMES_L12 . '" onclick="return confirm(\'' . EB_GAMES_L13 . '\')"><img src="' . e_PLUGIN . 'ebattles/images/cross.png" alt="' . EB_GAMES_L12 . '"/></a>'; $text .= '</td>'; $text .= '</tr>'; } $text .= '</tbody></table>'; $text .= '<table><tr> <td> <input class="eb_button" type="submit" name="delete_selected_games" value="' . EB_GAMES_L14 . '" onclick="return confirm(\'' . EB_GAMES_L15 . '\')"/> </td> <td> <input class="eb_button" type="submit" name="delete_all_games" value="' . EB_GAMES_L16 . '" onclick="return confirm(\'' . EB_GAMES_L17 . '\')"/> </td> <td> <input class="eb_button" type="submit" name="update_selected_games" value="' . EB_GAMES_L18 . '"/> </td> <td> <input class="eb_button" type="submit" name="update_all_games" value="' . EB_GAMES_L19 . '"/> </td> <td> <input class="eb_button" type="submit" name="add_games" value="' . EB_GAMES_L20 . '"/> </td> </tr> </table> '; $text .= '</form>'; } }
public function manageRsvp() { $content = ' <section id="content"> <div class="content-wrap"> <div class="container clearfix"> <div class="fancy-title title-border topmargin"> <h4>Manage RSVPs</h4> </div> <table class="table table-striped table-bordered table-hover" id="sample_1"> <thead> <tr> <th>ID</th> <th >Parent Name</th> <th >Telephone</th> <th >Email</th> <th >Number of Kids</th> <th >Kids Details</th> </tr> </thead> <tbody>'; $sub_sql = "SELECT COUNT(*) AS count FROM rsvp"; $result_pag_num = Database::performQuery($sub_sql); $row = $result_pag_num->fetch_assoc(); $num_rows = $row['count']; $pages = new Paginator($num_rows, 9, array(3, 5, 10, 12, 15, 20, 25, 30, 50, 100, 250, 'All')); //$content .= $pages->display_pages(); $sql = "SELECT * FROM rsvp ORDER BY id DESC LIMIT " . $pages->limit_start . "," . $pages->limit_end; $result = Database::performQuery($sql); while ($data = $result->fetch_assoc()) { $content .= '<tr class="odd gradeX"> <td>' . $data['id'] . '</td> <td >' . $data['parent'] . '</td> <td >' . $data['phone'] . '</td> <td class="center">' . $data['email'] . '</td> <td class="center">' . $data['numkids'] . '</td> <td >' . $data['kids'] . '</td> </tr>'; } $content .= '<tr><td colspan="4">' . $pages->display_pages() . '</td><td colspan="1">' . $pages->display_jump_menu() . '</td><td colspan="1">' . $pages->display_items_per_page() . '</td></tr>'; $content .= ' </tbody> </table> </div></div></section> '; return $content; }
public function manageEvent() { $content = ' <section id="content"> <div class="content-wrap"> <div class="container clearfix"> <div class="fancy-title title-border topmargin"> <h4>Manage Events</h4> </div> <div class="table-toolbar"> <div class="btn-group"> <a href="?go=addEvent"> <button id="sample_editable_1_new" class="button button-3d button-rounded button-green"> Add New Event <i class="icon-plus"></i> </button></a> </div> </div> <table class="table table-striped table-bordered table-hover" id="sample_1"> <thead> <tr> <th>ID</th> <th >Photo</th> <th >Title</th> <th >Target</th> <th >Day&Time</th> <th >Venue</th> <th >Cost</th> <th >Actions</th> </tr> </thead> <tbody>'; $sub_sql = "SELECT COUNT(*) AS count FROM events WHERE trashed =0"; $result_pag_num = Database::performQuery($sub_sql); $row = $result_pag_num->fetch_assoc(); $num_rows = $row['count']; $pages = new Paginator($num_rows, 9, array(3, 5, 10, 12, 15, 20, 25, 30, 50, 100, 250, 'All')); //$content .= $pages->display_pages(); $sql = "SELECT * FROM events WHERE trashed=0 ORDER BY id DESC LIMIT " . $pages->limit_start . "," . $pages->limit_end; $result = Database::performQuery($sql); while ($data = $result->fetch_assoc()) { //published status set $pub = $data['published']; if ($pub) { $actions = '<a href="./?go=editEvent&id=' . $data['id'] . '"><span class="badge badge-warning"><i class="icon-pencil"></i> Edit</span></a> <a href="./?go=unpublishEvent&id=' . $data['id'] . '"><span class="badge badge-primary"><i class="icon-thumbs-down"></i> Unpublish</span></a> <a href="./?go=trashEvent&id=' . $data['id'] . '"><span class="badge badge-danger"><i class="icon-trash"></i> </span></a>'; } else { $actions = '<a href="./?go=editEvent&id=' . $data['id'] . '"><span class="badge badge-warning"><i class="icon-pencil"></i> Edit</span></a> <a href="./?go=publishEvent&id=' . $data['id'] . '"><span class="badge badge-success"><i class="icon-thumbs-up"></i> Publish</span></a> <a href="./?go=trashEvent&id=' . $data['id'] . '"><span class="badge badge-danger"><i class="icon-trash"></i></span></a>'; } //Set actions $content .= '<tr class="odd gradeX"> <td>' . $data['id'] . '</td> <td ><img src="' . BASE_URL . '/img/' . $data['photo'] . '" width="100"/></a></td> <td >' . $data['title'] . '</td> <td class="center">' . $data['target'] . '</td> <td class="center">' . $data['daytime'] . '</td> <td class="center">' . $data['venue'] . '</td> <td class="center">' . $data['cost'] . '</td> <td >' . $actions . '</td> </tr>'; } $content .= '<tr><td colspan="6">' . $pages->display_pages() . '</td><td colspan="1">' . $pages->display_jump_menu() . '</td><td colspan="1">' . $pages->display_items_per_page() . '</td></tr>'; $content .= ' </tbody> </table> </div></div></section> '; return $content; }
/** * displayClans - Displays the Clans database table in * a nicely formatted html table. */ function displayClans() { global $pref; global $sql; global $text; $pages = new Paginator(); if (check_class($pref['eb_teams_create_class'])) { $text .= '<form action="' . e_PLUGIN . 'ebattles/clancreate.php" method="post">'; $text .= '<div>'; $text .= '<input type="hidden" name="userid" value="' . USERID . '"/>'; $text .= '<input type="hidden" name="username" value="' . USERNAME . '"/>'; $text .= '</div>'; $text .= ebImageTextButton('createteam', 'add.png', EB_CLANS_L7); $text .= '</form><br />'; } else { //$text .= '<div>'..'</div>'; } /* set pagination variables */ $q = "SELECT count(*) " . " FROM " . TBL_CLANS; $result = $sql->db_Query($q); $totalItems = mysql_result($result, 0); $pages->items_total = $totalItems; $pages->mid_range = eb_PAGINATION_MIDRANGE; $pages->paginate(); $q = "SELECT " . TBL_CLANS . ".*" . " FROM " . TBL_CLANS . " ORDER BY Name" . " {$pages->limit}"; $result = $sql->db_Query($q); /* Error occurred, return given name by default */ $num_rows = mysql_numrows($result); if (!$result || $num_rows < 0) { $text .= EB_CLANS_L3; return; } if ($num_rows == 0) { $text .= '<div>' . EB_CLANS_L4 . '</div>'; } else { // Paginate $text .= '<span class="paginate" style="float:left;">' . $pages->display_pages() . '</span>'; $text .= '<span style="float:right">'; // Go To Page $text .= $pages->display_jump_menu(); $text .= ' '; // Items per page $text .= $pages->display_items_per_page(); $text .= '</span><br /><br />'; /* Display table contents */ $text .= '<table class="eb_table" style="width:95%"><tbody>'; $text .= '<tr> <th class="eb_th2">' . EB_CLANS_L5 . '</th> <th class="eb_th2">' . EB_CLANS_L6 . '</th> </tr>'; for ($i = 0; $i < $num_rows; $i++) { $clan_id = mysql_result($result, $i, TBL_CLANS . ".ClanID"); $clan = new Clan($clan_id); $image = ""; if ($pref['eb_avatar_enable_teamslist'] == 1) { if ($clan->getField('Image')) { $image = '<img ' . getAvatarResize(getImagePath($clan->getField('Image'), 'team_avatars')) . '/>'; } else { if ($pref['eb_avatar_default_team_image'] != '') { $image = '<img ' . getAvatarResize(getImagePath($pref['eb_avatar_default_team_image'], 'team_avatars')) . '/>'; } } } $text .= '<tr> <td class="eb_td">' . $image . ' <a href="' . e_PLUGIN . 'ebattles/claninfo.php?clanid=' . $clan_id . '">' . $clan->getField('Name') . '</a></td> <td class="eb_td">' . $clan->getField('Tag') . '</td></tr>'; } $text .= '</tbody></table><br />'; } }