</table> </div> <div id="awards"> <h1>Awards</h1> <h3>Promote or Demote a Player</h3> Here, you may promote a player to Connoisseur status (or strip them of that status, as the case may be). Enter a short message to appear in the player's notification feed. <?php $stmt = $dbh->prepare("SELECT * FROM collectors WHERE id > -1 ORDER BY name ASC"); $stmt->execute(); echo "<form id=\"promotionForm\">"; echo "<select name=\"collector\">\n"; while ($row = $stmt->fetch()) { echo "<option value=\"" . $row['id'] . "\">" . $row['name'] . (isConnoisseur($row['id']) ? " (Connoisseur)" : "") . "</option>\n"; } echo "</select>\n"; echo "<br/><textarea style=\"width:400px;height:150px;\" name=\"desc\"></textarea>\n"; echo "</form>"; echo "<button class=\"promotionButton\">Change Player's Status</button>\n"; ?> <p/> <h3>Arbitrary ∮</h3> Select a player, specify an amount of ∮ to grant or subtract, and enter a message. Your message text will appear in the collector's notification feed. (Example: "You have been rewarded for your excellent work descriptions!" "You lose ∮50 for slacking off.")<p/> <?php $stmt = $dbh->prepare("SELECT * FROM collectors WHERE id > -1 ORDER BY name ASC"); $stmt->execute(); echo "<form id=\"awardForm\">"; echo "<select name=\"collector\">\n"; while ($row = $stmt->fetch()) {
// older events when the user scrolls to the bottom of the page. Right now, there's no obvious // way for players to see what happened before the past 40 events. $query = $dbh->prepare("SELECT * FROM events ORDER BY date DESC LIMIT 40"); $query->execute(); while ($row = $query->fetch()) { // displayEvent: convenience function (functions.php) that generates the HTML. echo displayEvent($row, $CONTEXT_EVENT_FEED); } ?> </div> <?php // If the user has Connoisseur status, print the div (tab) that allows them to approve // submitted tombstones. The logic here is basically the same as the supervisor's page // (supervisor/index.php). if (isConnoisseur($uuid)) { echo "<div id=\"con\">"; echo "<h2>You're a Connoisseur!</h2>"; echo "You've earned the connoisseur badge! As a reward for your excellent gameplay, "; echo "you can earn extra " . $CURRENCY_SYMBOL . " by approving other players' tombstones. Check this "; echo "tab of your home screen to see what tombstones are available for validation. "; echo "<table style=\"border:1px solid black;width:90%;\">"; echo "<tr><td class=\"header\">Collector</td><td class=\"header\">Work</td><td class=\"header\">Tombstone</td><td class=\"header\">Approve?</td></tr>"; // TODO the magic numbers for approval/rejection in various tables are really confusing. // 2 = pending approval, but how would anyone know? Need to make these named constants before release. $stmt = $dbh->prepare("SELECT * FROM tombstones WHERE approved = 2 AND uid_creator != ?"); $stmt->bindParam(1, $uuid); $stmt->execute(); while ($row = $stmt->fetch()) { // Create an ad hoc form for approving or rejecting tombstone echo "<form id=\"" . $row['id'] . "-ts\"><input type=\"hidden\" name=\"mode\" value=\"ts\"/><input type=\"hidden\" name=\"tombstoneId\" value=\"" . $row['id'] . "\"/><input type=\"hidden\" name=\"player\" value=\"" . $row['uid_creator'] . "\"/><input type=\"hidden\" name=\"work\" value=\"" . $row['wid'] . "\"/><tr>\n";
} // Need to spell the math out (== 0) because Boolean false and 0 aren't equivalent in PHP if ($ind % 3 == 0) { echo "</div><div style=\"display:table-row;\">"; } // Figure out the name of the user table for this collector. So much code smell $userTable = $row['owner'] . "_" . $gameinstance . "_coll"; // Placeholder for the actual cover/marquee piece -- just pick the first one in their user table. $collectionQuery = $dbh->prepare("SELECT work,w1.id AS iid FROM " . $userTable . " LEFT OUTER JOIN works AS w1 ON w1.id = " . $userTable . ".work LIMIT 1"); $collectionQuery->execute(); $userName = $row['cn']; // Loop that prints the collection cell divs. while ($item = $collectionQuery->fetch()) { // Name of collector (or "You") and a star icon if this collector has Connoisseur status. echo "<div class=\"collCell\" id=\"" . $row['owner'] . "\"><b>" . ($row['owner'] == $uuid ? "You" : $row['cn']); echo " " . (isConnoisseur($row['owner']) ? "<img style=\"padding-top:3px;\" src=\"resources/icons/star_16x16.png\" alt=\"[Connoisseur]\"/>" : ""); // Current FCGs (money) and a link to userCollection, a larger display of all this user's art. echo " (" . $CURRENCY_SYMBOL . $row['points'] . ")</b><br/><a href=\"userCollection.php?uid=" . $row['owner'] . "&gid=" . $_SESSION['gameinstance'] . "\">"; // Marquee image for this collection. Right now, it's just the first row returned from the query // above, but it would be nice to allow users to specify a marquee work. echo "<div class=\"collCellMarquee\"><img src=\"img.php?img=" . $item['iid'] . "\" width=\"180\" alt=\"[Marquee Image]\" valign=\"top\" style=\"padding:5px;border-style:none;\"/></div>"; echo "</a>\n"; // Now print the (hidden) matrix of thumbnails. Select a list of works in this user's collection, // use img.php to display them as thumbnails, and limit them to 40px wide echo "<div class=\"collCellThumbs\" style=\"display:none;\">"; echo "<a href=\"userCollection.php?uid=" . $row['owner'] . "&gid=" . $_SESSION['gameinstance'] . "\">"; $subQuery = $dbh->prepare("SELECT work,w1.id AS iid FROM " . $userTable . " LEFT OUTER JOIN works AS w1 ON w1.id = " . $userTable . ".work"); $subQuery->execute(); while ($subItem = $subQuery->fetch()) { echo "<img src=\"img.php?mode=thumb&img=" . $subItem['iid'] . "\" width=\"40\" style=\"padding:5px;border-style:none;\"/>"; }
</head> <body> <?php include 'topBar.php'; ?> <div class="body"> <a href="collections.php" class="xbold navHref">All Collections</a> > <?php echo getUserName($userRequested); ?> 's Collection <p/> <?php if ($uuid != $userRequested) { // If this is someone other than uuid (me), display trade proposal button. if (isConnoisseur($userRequested)) { echo "<img src=\"resources/icons/star_16x16.png\"/>"; echo " <b>" . getUserName($userRequested) . "</b> has been given the <b>Connoisseur</b> badge by the game administrator! "; echo getUserName($userRequested) . " can earn " . $CURRENCY_SYMBOL . " by validating other players' tombstones and work descriptions.<p/>"; } echo "<a href=\"trader.php?origin=" . $uuid . "&destination=" . $userRequested . "&gameinstance=" . $gameinstance . "\" rel=\"shadowbox;height=800;width=1000;\">"; echo "<button type=\"submit\" class=\"subs ui-state-default ui-corner-all\"> Propose a Trade </button></a>"; } ?> </form> <?php // Wordy but simple logic -- get everything this player owns and display it as a grid. $sstmt = $dbh->prepare("SELECT collections.id,owner,gameinstance,points,collectors.name AS cn from collections inner join collectors on collectors.id = owner where gameinstance = ? and owner = ?"); $sstmt->bindParam(1, $gameinstance); $sstmt->bindParam(2, $userRequested); $sstmt->execute();
<?php /** * promote.php: Helper that allows game admin to promote individual users to Connoisseur status. */ ob_start(); require '../functions.php'; require '../db.php'; ob_end_clean(); $player = $_GET['collector']; $message = $_GET['desc']; $points = $_GET['points']; createNotification($player, $E_ACHIEVEMENT, $message); $retVal = ""; // FIXME: hard coded levels/magic # if (isConnoisseur($player)) { $retVal = "The player has been demoted."; setLevel($player, 1); } else { $retVal = "Promotion complete!"; setLevel($player, 10); $newsFeedMsg = "<div style=\"display:inline;padding-left:50px;float:left;padding-right:5px;padding-top:5px;padding-bottom:5px;\">" . getUserName($player) . " has earned the Connoisseur badge! As a reward for excellent gameplay, " . getUserName($player) . " can now earn extra " . $CURRENCY_SYMBOL . " by validating other players' tombstone entries.</div>"; $headline = getUserName($player) . " is now a Connoisseur!"; $query = $dbh->prepare("INSERT INTO events( type, target, description, headline ) VALUES( ?, ?, ?, ? )"); $query->bindParam(1, $E_ACHIEVEMENT); $query->bindParam(2, $player); $query->bindParam(3, $newsFeedMsg); $query->bindParam(4, $headline); $query->execute(); } echo $retVal;