Add sponsorship levels to the sponsor main page

This commit is contained in:
james 2008-11-07 03:23:42 +00:00
parent 3ab46da3d5
commit 95c559fa08

View File

@ -47,7 +47,7 @@
// echo " <td><a href=\"user_activate.php\">".theme_icon("")."<br />".i18n("Manage My Roles")."</a></td>"; // echo " <td><a href=\"user_activate.php\">".theme_icon("")."<br />".i18n("Manage My Roles")."</a></td>";
echo " </tr>\n"; echo " </tr>\n";
echo "</table>\n"; echo "</table>\n";
echo "<h2>Your sponsorships</h2>\n"; echo "<h2>Your Sponsorships</h2>\n";
$sq=mysql_query("SELECT sponsorships.id, $sq=mysql_query("SELECT sponsorships.id,
sponsors.organization, sponsors.organization,
@ -71,6 +71,7 @@
echo " <th>".i18n("Amount")."</th>\n"; echo " <th>".i18n("Amount")."</th>\n";
echo " <th>".i18n("Action")."</th>"; echo " <th>".i18n("Action")."</th>";
echo "</tr>\n"; echo "</tr>\n";
$total=0;
while($sr=mysql_fetch_object($sq)) { while($sr=mysql_fetch_object($sq)) {
echo "<tr id=\"sponsorships_$sr->id\" class=\"fundraising{$sr->status}\">"; echo "<tr id=\"sponsorships_$sr->id\" class=\"fundraising{$sr->status}\">";
echo "<td>$sr->name</td>\n"; echo "<td>$sr->name</td>\n";
@ -86,6 +87,41 @@
echo "&nbsp;"; echo "&nbsp;";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
$total+=$sr->value;
}
echo "</table>\n";
echo "<br />\n";
echo "<br />\n";
echo "<h2>Sponsorship Levels</h2>\n";
$q=mysql_query("SELECT * FROM sponsorships_levels WHERE year='".$config['FAIRYEAR']."' ORDER BY max DESC");
echo "<table class=\"tableview\">";
echo "<th></th><th>".i18n("Level")."</th>";
echo "<th>".i18n("Description / Benefits")."</th>\n";
echo "<th>".i18n("Range")."</th>\n";
echo "</tr>\n";
$first=true;
while($r=mysql_fetch_object($q)) {
echo "<tr>";
echo "<td>";
if($total>=$r->min && $total<=$r->max) {
echo "<b>".i18n("You are here");
echo "&nbsp;&gt;&gt;";
echo "</b>";
}
echo "</td>";
echo "<td>$r->level</td>";
echo "<td>$r->description</td>";
echo "<td>";
if($first) {
echo format_money($r->min)."+";
$first=false;
}
else
echo format_money($r->min)."-".format_money($r->max);
echo "</td>";
} }
echo "</table>\n"; echo "</table>\n";