- Added a bit of code that lets you know if there are any new polls available which you haven't answered yet.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4100 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2012-07-17 21:50:57 +00:00
parent e4c971e3e4
commit 84e2fbceb1

View File

@@ -48,11 +48,23 @@
output += "<p><a href='byond://?src=\ref[src];observe=1'>Observe</A></p>"
var/DBConnection/dbcon = new()
dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
if(dbcon.IsConnected())
output += "<p><a href='byond://?src=\ref[src];showpoll=1'>Show Player Polls</A></p>"
dbcon.Disconnect()
if(!IsGuestKey(src.key))
var/DBConnection/dbcon = new()
dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
if(dbcon.IsConnected())
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_poll_question WHERE Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM erro_poll_vote WHERE ckey = \"[ckey]\")")
query.Execute()
var/newpoll = 0
while(query.NextRow())
newpoll = 1
break
if(newpoll)
output += "<p><b><a href='byond://?src=\ref[src];showpoll=1'>Show Player Polls</A> (NEW!)</b></p>"
else
output += "<p><a href='byond://?src=\ref[src];showpoll=1'>Show Player Polls</A></p>"
dbcon.Disconnect()
output += "</div>"