forked from science-ation/science-ation
Add a start of the fundraising system's overview page and fund type editor
This commit is contained in:
parent
2d8c3a72ef
commit
f2101200b6
65
admin/fundraising.php
Normal file
65
admin/fundraising.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?
|
||||||
|
/*
|
||||||
|
This file is part of the 'Science Fair In A Box' project
|
||||||
|
SFIAB Website: http://www.sfiab.ca
|
||||||
|
|
||||||
|
Copyright (C) 2007 James Grant <james@lightbox.org>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public
|
||||||
|
License as published by the Free Software Foundation, version 2.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; see the file COPYING. If not, write to
|
||||||
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<?
|
||||||
|
require("../common.inc.php");
|
||||||
|
require("../tableeditor.class.php");
|
||||||
|
require_once("../user.inc.php");
|
||||||
|
|
||||||
|
user_auth_required('committee', 'admin');
|
||||||
|
send_header("Fundraising",
|
||||||
|
array('Committee Main' => 'committee_main.php',
|
||||||
|
'Administration' => 'admin/index.php'),
|
||||||
|
"fundraising"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//first, insert any defaults
|
||||||
|
$q=mysql_query("SELECT * FROM fundraising WHERE year='".$config['FAIRYEAR']."'");
|
||||||
|
if(!mysql_num_rows($q)) {
|
||||||
|
$q=mysql_query("SELECT * FROM fundraising WHERE year='-1'");
|
||||||
|
while($r=mysql_fetch_object($q)) {
|
||||||
|
mysql_query("INSERT INTO fundraising (`type`,`name`,`system`,`goal`,`year`) VALUES ('$r->type','".mysql_real_escape_string($r->name)."','$r->system','$r->goal','".$config['FAIRYEAR']."')");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//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");
|
||||||
|
echo "<table class=\"tableview\">";
|
||||||
|
echo "<tr>";
|
||||||
|
echo " <th>".i18n("Fund")."</th>\n";
|
||||||
|
echo " <th>".i18n("Goal")."</th>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
while($r=mysql_fetch_object($q)) {
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>".i18n($r->name)."</td>\n";
|
||||||
|
echo "<td>".format_money($r->goal)."</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
$totalgoal+=$r->goal;
|
||||||
|
}
|
||||||
|
echo "<tr><td>".i18n("Total")."</td><td>".format_money($totalgoal)."</td></tr>\n";
|
||||||
|
echo "</table>\n";
|
||||||
|
echo "<a href=\"fundraising_types.php\">".i18n("Edit fund types and goals")."</a>\n";
|
||||||
|
|
||||||
|
send_footer();
|
||||||
|
?>
|
62
admin/fundraising_types.php
Normal file
62
admin/fundraising_types.php
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<?
|
||||||
|
/*
|
||||||
|
This file is part of the 'Science Fair In A Box' project
|
||||||
|
SFIAB Website: http://www.sfiab.ca
|
||||||
|
|
||||||
|
Copyright (C) 2008 James Grant <james@lightbox.org>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public
|
||||||
|
License as published by the Free Software Foundation, version 2.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; see the file COPYING. If not, write to
|
||||||
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<?
|
||||||
|
require("../common.inc.php");
|
||||||
|
require("../tableeditor.class.php");
|
||||||
|
require_once("../user.inc.php");
|
||||||
|
|
||||||
|
//first, insert any defaults
|
||||||
|
$q=mysql_query("SELECT * FROM fundraising WHERE year='".$config['FAIRYEAR']."'");
|
||||||
|
if(!mysql_num_rows($q)) {
|
||||||
|
$q=mysql_query("SELECT * FROM fundraising WHERE year='-1'");
|
||||||
|
while($r=mysql_fetch_object($q)) {
|
||||||
|
mysql_query("INSERT INTO fundraising (`type`,`name`,`system`,`goal`,`year`) VALUES ('$r->type','".mysql_real_escape_string($r->name)."','$r->system','$r->goal','".$config['FAIRYEAR']."')");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//make sure storage folder exists
|
||||||
|
user_auth_required('committee', 'admin');
|
||||||
|
send_header("Types of Fundraising",
|
||||||
|
array('Committee Main' => 'committee_main.php',
|
||||||
|
'Administration' => 'admin/index.php',
|
||||||
|
'Fundraising' => 'admin/fundraising.php'),
|
||||||
|
"fundraising"
|
||||||
|
);
|
||||||
|
|
||||||
|
$editor=new TableEditor("fundraising",
|
||||||
|
array("name"=>"Name",
|
||||||
|
"goal"=>"Goal",
|
||||||
|
),
|
||||||
|
array("name"=>"Name",
|
||||||
|
"goal"=>"Goal",
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$editor->filterList("year='".$config['FAIRYEAR']."'");
|
||||||
|
$editor->setPrimaryKey("id");
|
||||||
|
$editor->setDefaultSortField("system,name");
|
||||||
|
$editor->setRecordType("Fund Type");
|
||||||
|
$editor->execute();
|
||||||
|
|
||||||
|
send_footer();
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user