30 new WText(
"<h2>Hall of fame</h2>",
this);
34 std::string yourScore;
36 yourScore =
"Congratulations! You are currently leading the pack.";
38 yourScore =
"You are currently ranked number " 39 + boost::lexical_cast<std::string>(ranking)
43 WText *score =
new WText(
"<p>" + yourScore +
"</p>",
this);
44 score->addStyleClass(
"score");
48 WTable *table =
new WTable(
this);
50 new WText(
"Rank", table->elementAt(0, 0));
51 new WText(
"User", table->elementAt(0, 1));
52 new WText(
"Games", table->elementAt(0, 2));
53 new WText(
"Score", table->elementAt(0, 3));
54 new WText(
"Last game", table->elementAt(0, 4));
55 table->setHeaderCount(1);
59 for (
unsigned i = 0; i < top.size(); i++) {
62 if (u.
score != formerScore) {
63 formerScore = u.
score;
67 int row = table->rowCount();
68 new WText(boost::lexical_cast<std::string>(rank),
69 table->elementAt(row, 0));
70 new WText(u.
name, table->elementAt(row, 1));
71 new WText(boost::lexical_cast<std::string>(u.
gamesPlayed),
72 table->elementAt(row, 2));
73 new WText(boost::lexical_cast<std::string>(u.
score),
74 table->elementAt(row, 3));
76 new WText(u.
lastGame.timeTo(WDateTime::currentDateTime())
77 +
" ago", table->elementAt(row, 4));
79 new WText(
"---", table->elementAt(row, 4));
82 table->rowAt(row)->setId(
"self");
85 WText *fineprint =
new WText(tr(
"highscore.info"),
this);
86 fineprint->addStyleClass(
"fineprint");
std::string userName() const
Wt::Auth::Login & login()
std::vector< User > topUsers(int limit)