* game) and print them out in a <div> suitable for div#notification in jewel.php. Called via JavaScript * polling in jewel.php. * * @author William Shaw <*****@*****.**> * @author Katherine Jentleson <*****@*****.**>, designer * @version 0.1., 8/2012 * * @param jlt (via GET): Last jewel load time. Passed from jewel.php. */ if (session_id() == '') { session_start(); } $uname = $_SESSION['uname']; $uuid = $_SESSION['uuid']; $jlt = $_GET['jlt']; ob_start(); require 'functions.php'; require 'db.php'; ob_end_clean(); // Find all notifications that are either global or targeted to uuid $query = $dbh->prepare("SELECT * FROM notifications WHERE (target = ? OR target = -1) AND UNIX_TIMESTAMP(date) > ? ORDER BY date DESC"); $query->bindParam(1, $uuid); $query->bindParam(2, $_SESSION['lastpoll']); $query->execute(); while ($row = $query->fetch()) { echo "<div style=\"clear:both;padding:4px;vertical-align:top;\"><img src=\"resources/icons/" . getIconForEventType($row['type']) . "\" style=\"margin-top:4px;width:12px;float:left;padding-right:4px;padding-bottom:4px;\"/>" . $row['text'] . "</div>"; } $_SESSION['lastpoll'] = time(); ?>
/** * displayEvent: Generate a simple HTML div for the activity feed, given a row from the events * table as a PHP array. * * @param row Array representing a row of the events table. * @param context Deprecated * @return HTML representation of this even. */ function displayEvent($row, $context) { $output = "<div class=\"activityFeed\">"; $output .= "<div class=\"feedicon\"><img src=\"resources/icons/" . getIconForEventType($row['type']) . "\"/></div>"; $output .= "<div class=\"feedtitle\">"; $output .= "<b>" . $row['headline'] . "</b><br/>"; $output .= "<span style=\"font-size:small;color:gray;\">" . $row['date'] . "</span>"; $output .= "</div>"; $output .= "<div class=\"feedbody\">"; $output .= stripslashes($row['description']); $output .= "</div>"; $output .= "</div>"; return $output; }