forked from science-ation/science-ation
Add ability to delete funds and delete sponsorships
Update some of the sponsors editor code to look a bit.. umm... better.... needs more work me thinks...
This commit is contained in:
parent
1d09e7fb38
commit
d849040872
@ -48,17 +48,21 @@ require_once("../dialog.inc.php");
|
||||
}
|
||||
|
||||
//this table is eventually going to be massive, and probably not in a tableview format, it'll show goals as well as all ongoing fund pledges, probabilities, etc as well as over/under, etc, all prettily colour coded.. basically a good overview of the total fundraising status of the fair.
|
||||
$q=mysql_query("SELECT * FROM fundraising WHERE year='{$config['FAIRYEAR']}' ORDER BY system,type");
|
||||
$q=mysql_query("SELECT * FROM fundraising WHERE year='{$config['FAIRYEAR']}' ORDER BY system DESC,type");
|
||||
echo "<table class=\"fundraisingtable\">";
|
||||
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
echo "<tr>";
|
||||
echo "<th width=\"30\"><a onclick=\"return SFIABDialog(event,'fundraising_types.php?id=$r->id',300,200)\" href=\"#\">edit</a></th>\n";
|
||||
echo "<th><a title=\"".i18n("Edit fund details")."\" onclick=\"return SFIABDialog(event,'fundraising_types.php?id=$r->id',300,200)\" href=\"#\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
|
||||
if($r->system=="no") {
|
||||
echo "<a title=\"".i18n("Remove Fund")."\" onclick=\"return confirmClick('Are you sure you want to remove this fund and all sponsorships inside it?')\" href=\"fundraising.php?action=funddelete&delete=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
|
||||
}
|
||||
|
||||
echo "</th>\n";
|
||||
echo "<th colspan=\"5\">".i18n($r->name)."</th>\n";
|
||||
echo "<th style=\"text-align: right\">".format_money($r->goal)."</th>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
||||
if($r->type=="general")
|
||||
$orsql.="OR fundraising_type IS NULL";
|
||||
|
||||
@ -70,7 +74,25 @@ require_once("../dialog.inc.php");
|
||||
AND sponsorships.year='{$config['FAIRYEAR']}'");
|
||||
while($sr=mysql_fetch_object($sq)) {
|
||||
echo "<tr id=\"sponsorships_$sr->id\" class=\"fundraising{$sr->status}\">";
|
||||
echo "<td width=\"30\"><a onclick=\"return SFIABDialog(event,'fundraising_sponsorship.php?id=$sr->id&fundraising_type=$r->type',400,200)\" href=\"#\">edit</a></td><td>$sr->organization</td>\n";
|
||||
echo "<td><a title=\"".i18n("Edit sponsorship details")."\" onclick=\"return SFIABDialog(event,'fundraising_sponsorship.php?id=$sr->id&fundraising_type=$r->type',400,200)\" href=\"#\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
|
||||
echo "<a title=\"".i18n("Remove sponsorship")."\" onclick=\"return confirmClick('Are you sure you want to remove this sponsorship?')\" href=\"fundraising.php?action=sponsorshipdelete&delete=$sr->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
|
||||
|
||||
echo "</td>";
|
||||
echo "<td>$sr->organization</td>\n";
|
||||
/*
|
||||
echo "<a href=\"communication.php?action=edit&edit=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
|
||||
|
||||
//only user emails can be deleted, system ones are required and cannot be removed
|
||||
if($r->type=="user")
|
||||
{
|
||||
echo " ";
|
||||
echo "<a onclick=\"return confirmClick('Are you sure you want to remove email?')\" href=\"communication.php?action=delete&delete=$r->id\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
|
||||
echo " ";
|
||||
echo "<a href=\"communication.php?action=send&send=$r->id\">Send</a>";
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
echo "<td>$sr->status</td>";
|
||||
echo "<td>";
|
||||
if($sr->status=="pending")
|
||||
@ -104,6 +126,9 @@ require_once("../dialog.inc.php");
|
||||
echo "<td colspan=\"2\"><a onclick=\"return SFIABDialog(event,'fundraising_types.php',300,200)\" href=\"#\">add fund type</a></td>";
|
||||
echo "<td colspan=\"4\" style=\"font-weight: bold; text-align: right;\">".i18n("Total Net Position")."</td><td style=\"text-align: right; font-weight: bold;\">".format_money($totaldiff)."</td></tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
echo "<a href=\"sponsors.php\">Manage Sponsors</a>\n";
|
||||
|
||||
send_footer();
|
||||
?>
|
||||
|
@ -27,7 +27,7 @@
|
||||
user_auth_required('committee', 'admin');
|
||||
|
||||
if($_GET['id']) {
|
||||
$id=intval($_GET['id']);
|
||||
$idintval($_GET['id']);
|
||||
$q=mysql_query("SELECT * FROM sponsorships WHERE id='$id'");
|
||||
echo "<h2>Edit Sponsorship</h2>";
|
||||
$sponsorship=mysql_fetch_object($q);
|
||||
@ -54,7 +54,7 @@
|
||||
if($r->id==$sponsorship->sponsors_id) $sel="selected=\"selected\""; else $sel="";
|
||||
echo "<option $sel value=\"$r->id\">$r->organization</option>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
echo "</select> <a href=\"sponsors.php?action=add\">".i18n("Add")."</a>\n";
|
||||
echo "</td></tr>\n";
|
||||
|
||||
echo "<tr><th>".i18n("Type")."</th>";
|
||||
|
@ -1,4 +1,10 @@
|
||||
<?
|
||||
if($_GET['action']=="sponsorshipdelete") {
|
||||
mysql_query("DELETE FROM sponsorships WHERE id='".intval($_GET['delete'])."'");
|
||||
if(mysql_affected_rows())
|
||||
message_push(happy(i18n("Successfully removed sponsorship")));
|
||||
}
|
||||
|
||||
if($_POST['action']=="sponsorshipedit" || $_POST['action']=="sponsorshipadd") {
|
||||
$sponsors_id=intval($_POST['sponsors_id']);
|
||||
$sponsorships_id=intval($_POST['sponsorships_id']);
|
||||
|
@ -1,4 +1,22 @@
|
||||
<?
|
||||
if($_GET['action']=="funddelete" && $_GET['delete']) {
|
||||
//first lookup all the sponsorships inside the fund
|
||||
$id=intval($_GET['delete']);
|
||||
$q=mysql_query("SELECT * FROM fundraising WHERE id='$id' AND year='".$config['FAIRYEAR']."'");
|
||||
$f=mysql_fetch_object($q);
|
||||
//hold yer horses, no deleting system funds!
|
||||
if($f) {
|
||||
if($f->system=="no") {
|
||||
mysql_query("DELETE FROM sponsorships WHERE fundraising_type='".mysql_real_escape_string($f->type)."' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM fundraising WHERE id='$id'");
|
||||
if(mysql_affected_rows())
|
||||
message_push(happy(i18n("Successfully removed fund %1",array($f->name))));
|
||||
}
|
||||
else {
|
||||
message_push(error(i18n("Cannot remove system fund")));
|
||||
}
|
||||
}
|
||||
}
|
||||
if($_POST['action']=="fundedit" || $_POST['action']=="fundadd") {
|
||||
$fundraising_id=intval($_POST['fundraising_id']);
|
||||
if($fundraising_id) {
|
||||
|
@ -104,18 +104,18 @@
|
||||
if($_GET['action']=="edit")
|
||||
echo "<input type=\"hidden\" name=\"id\" value=\"".$_GET['edit']."\">\n";
|
||||
|
||||
echo "<table>\n";
|
||||
echo "<tr><td>".i18n("Organization Name")."</td><td><input type=\"text\" id=\"organization\" name=\"organization\" value=\"".htmlspecialchars($r->organization)."\" size=\"60\" maxlength=\"128\" /><script type=\"text/javascript\">translateButton('organization');</script></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Address")."</td><td><input type=\"text\" name=\"address\" value=\"".htmlspecialchars($r->address)."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("City")."</td><td><input type=\"text\" name=\"city\" value=\"".htmlspecialchars($r->city)."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n($config['provincestate'])."</td><td>";
|
||||
echo "<table class=\"tableedit\">\n";
|
||||
echo "<tr><th>".i18n("Organization Name")."</th><td><input type=\"text\" id=\"organization\" name=\"organization\" value=\"".htmlspecialchars($r->organization)."\" size=\"60\" maxlength=\"128\" /><script type=\"text/javascript\">translateButton('organization');</script></td></tr>\n";
|
||||
echo "<tr><th>".i18n("Address")."</th><td><input type=\"text\" name=\"address\" value=\"".htmlspecialchars($r->address)."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
|
||||
echo "<tr><th>".i18n("City")."</th><td><input type=\"text\" name=\"city\" value=\"".htmlspecialchars($r->city)."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><th>".i18n($config['provincestate'])."</th><td>";
|
||||
emit_province_selector("province_code",$r->province_code);
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td>".i18n($config['postalzip'])."</td><td><input type=\"text\" name=\"postalcode\" value=\"$r->postalcode\" size=\"8\" maxlength=\"7\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Phone")."</td><td><input type=\"text\" name=\"phone\" value=\"".htmlspecialchars($r->phone)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Fax")."</td><td><input type=\"text\" name=\"fax\" value=\"".htmlspecialchars($r->fax)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Email")."</td><td><input type=\"text\" name=\"email\" value=\"".htmlspecialchars($r->email)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Notes")."</td><td><textarea name=\"notes\" rows=\"8\" cols=\"60\">".htmlspecialchars($r->notes)."</textarea></td></tr>\n";
|
||||
echo "<tr><th>".i18n($config['postalzip'])."</th><td><input type=\"text\" name=\"postalcode\" value=\"$r->postalcode\" size=\"8\" maxlength=\"7\" /></td></tr>\n";
|
||||
echo "<tr><th>".i18n("Phone")."</th><td><input type=\"text\" name=\"phone\" value=\"".htmlspecialchars($r->phone)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><th>".i18n("Fax")."</th><td><input type=\"text\" name=\"fax\" value=\"".htmlspecialchars($r->fax)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><th>".i18n("Email")."</th><td><input type=\"text\" name=\"email\" value=\"".htmlspecialchars($r->email)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
|
||||
echo "<tr><th>".i18n("Notes")."</th><td><textarea name=\"notes\" rows=\"4\" cols=\"60\">".htmlspecialchars($r->notes)."</textarea></td></tr>\n";
|
||||
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"$buttontext\" /></td></tr>\n";
|
||||
|
||||
echo "</table>\n";
|
||||
@ -126,14 +126,10 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
echo "<br />";
|
||||
echo "<a href=\"sponsors.php?action=add\">Add New Sponsor</a>\n";
|
||||
echo "<br />";
|
||||
echo "<table class=\"summarytable\">";
|
||||
echo "<table class=\"tableview\">";
|
||||
echo "<tr>";
|
||||
echo " <th>Confirmed?</th>";
|
||||
echo " <th>Organization</th>";
|
||||
echo " <th># of Awards</th>";
|
||||
echo " <th># of Contacts</th>";
|
||||
@ -146,6 +142,7 @@
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
echo "<tr>\n";
|
||||
/*
|
||||
echo "<td align=\"center\">\n";
|
||||
if($r->confirmed=='yes')
|
||||
{
|
||||
@ -156,6 +153,7 @@
|
||||
echo "<a title=\"click here to mark this sponsor as confirmed\" href=\"sponsors.php?action=confirm&confirm=$r->id\">confirm</a>";
|
||||
}
|
||||
echo "</td>\n";
|
||||
*/
|
||||
echo " <td>$r->organization</td>\n";
|
||||
|
||||
$numq=mysql_query("SELECT COUNT(id) AS num FROM award_awards WHERE year='".$config['FAIRYEAR']."' AND sponsors_id='$r->id'");
|
||||
|
Loading…
x
Reference in New Issue
Block a user