forked from science-ation/science-ation
Further updates in migrating to conference id
This commit is contained in:
parent
c3cf698524
commit
88c6d9a0dd
@ -1,175 +0,0 @@
|
|||||||
<?
|
|
||||||
/*
|
|
||||||
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");
|
|
||||||
|
|
||||||
user_auth_required('admin');
|
|
||||||
|
|
||||||
include ("fundraising_sponsorship_handler.inc.php");
|
|
||||||
include ("fundraising_goals_handler.inc.php");
|
|
||||||
include ("fundraising_main.inc.php");
|
|
||||||
|
|
||||||
send_header("Donations",
|
|
||||||
array('Committee Main' => 'committee_main.php',
|
|
||||||
'Administration' => 'admin/index.php',
|
|
||||||
'Fundraising' => 'admin/fundraising.php'),
|
|
||||||
"fundraising"
|
|
||||||
);
|
|
||||||
|
|
||||||
?>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).ready(function() {
|
|
||||||
//initialize the dialog
|
|
||||||
$("#sponsorship_editor").dialog({
|
|
||||||
bgiframe: true, autoOpen: false,
|
|
||||||
modal: true, resizable: false,
|
|
||||||
draggable: false
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#fund_editor").dialog({
|
|
||||||
bgiframe: true, autoOpen: false,
|
|
||||||
modal: true, resizable: falsefundraising
|
|
||||||
draggable: false
|
|
||||||
});
|
|
||||||
|
|
||||||
refresh_fundraising_table();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
function popup_sponsorship_editor(url) {
|
|
||||||
var w = (document.documentElement.clientWidth * 0.6);
|
|
||||||
$('#sponsorship_editor').dialog('option','width',w);
|
|
||||||
//let the height autocalculate
|
|
||||||
/*
|
|
||||||
var h = (document.documentElement.clientHeight * 0.6);
|
|
||||||
$('#sponsorship_editor').dialog('option','height',h);
|
|
||||||
*/
|
|
||||||
$('#sponsorship_editor').dialog('option','buttons',{ "<?=i18n("Save")?>": function() { save_sponsorship(); },
|
|
||||||
"<?=i18n("Cancel")?>": function(){ $(this).dialog("close");}});
|
|
||||||
$('#sponsorship_editor').dialog('open');
|
|
||||||
|
|
||||||
$('#sponsorship_editor_content').load(url);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function save_sponsorship() {
|
|
||||||
$('#debug').load("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
|
|
||||||
$("#fundraisingsponsorship").serializeArray(),
|
|
||||||
function() {
|
|
||||||
$('#sponsorship_editor').dialog('close');
|
|
||||||
refresh_fundraising_table();
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function popup_fund_editor(url) {
|
|
||||||
var w = (document.documentElement.clientWidth * 0.6);
|
|
||||||
$('#fund_editor').dialog('option','width',w);
|
|
||||||
//let the height autocalculate
|
|
||||||
/*
|
|
||||||
var h = (document.documentElement.clientHeight * 0.6);
|
|
||||||
$('#fund_editor').dialog('option','height',h);
|
|
||||||
*/
|
|
||||||
$('#fund_editor').dialog('option','buttons',{ "<?=i18n("Save")?>": function() { save_fund(); },
|
|
||||||
"<?=i18n("Cancel")?>": function(){ $(this).dialog("close");}});
|
|
||||||
$('#fund_editor').dialog('open');
|
|
||||||
|
|
||||||
$('#fund_editor_content').load(url);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function save_fund() {
|
|
||||||
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
|
|
||||||
$("#fundraisingfundraising").serializeArray(),
|
|
||||||
function(data) {
|
|
||||||
$('#fund_editor').dialog('close');
|
|
||||||
refresh_fundraising_table();
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function delete_fund(id) {
|
|
||||||
if(confirmClick('Are you sure you want to remove this fund?')) {
|
|
||||||
$('#debug').load("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
|
|
||||||
{ action: 'funddelete', delete: id },
|
|
||||||
function() {
|
|
||||||
refresh_fundraising_table();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function delete_sponsorship(id) {
|
|
||||||
if(confirmClick('Are you sure you want to remove this sponsorship?')) {
|
|
||||||
$('#debug').load("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
|
|
||||||
{ action: 'sponsorshipdelete', delete: id },
|
|
||||||
function() {
|
|
||||||
refresh_fundraising_table();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function refresh_fundraising_table() {
|
|
||||||
$("#fundraisingmain").load("fundraising.php?action=fundraisingmain");
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?
|
|
||||||
|
|
||||||
//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`,`description`,`system`,`goal`,`year`) VALUES ('$r->type','".mysql_real_escape_string($r->name)."','".mysql_real_escape_string($r->description)."','$r->system','$r->goal','".$config['FAIRYEAR']."')");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<div id=\"fundraisingmain\">";
|
|
||||||
echo "</div>";
|
|
||||||
|
|
||||||
echo "<br />\n";
|
|
||||||
echo "<br />\n";
|
|
||||||
echo "<a href=\"sponsorship_levels.php\">Manage Donation Levels</a>\n";
|
|
||||||
echo "<br />\n";
|
|
||||||
echo "<a href=\"donors.php\">Manage Donors</a>\n";
|
|
||||||
echo "<br />\n";
|
|
||||||
|
|
||||||
?>
|
|
||||||
<div style="display: none" title="<?=i18n("Donation Editor")?>" id="sponsorship_editor">
|
|
||||||
<div id="sponsorship_editor_content">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="display: none" title="<?=i18n("Fund Editor")?>" id="fund_editor">
|
|
||||||
<div id="fund_editor_content">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?
|
|
||||||
send_footer();
|
|
||||||
?>
|
|
@ -41,7 +41,7 @@ switch($_GET['action']) {
|
|||||||
case 'organizationinfo_save':
|
case 'organizationinfo_save':
|
||||||
$id=intval($_POST['sponsor_id']);
|
$id=intval($_POST['sponsor_id']);
|
||||||
if($id==-1) {
|
if($id==-1) {
|
||||||
$q=mysql_query("INSERT INTO sponsors (year) VALUES ('".$config['FAIRYEAR']."')");
|
$q=mysql_query("INSERT INTO sponsors (conferences_id) VALUES ('".$conference['id']."')");
|
||||||
$id=mysql_insert_id();
|
$id=mysql_insert_id();
|
||||||
echo json_encode(array("id"=>$id));
|
echo json_encode(array("id"=>$id));
|
||||||
save_activityinfo("Created donor/sponsor", $id, $_SESSION['users_uid'],"System");
|
save_activityinfo("Created donor/sponsor", $id, $_SESSION['users_uid'],"System");
|
||||||
@ -215,7 +215,7 @@ switch($_GET['action']) {
|
|||||||
echo i18n("Appeal").":";
|
echo i18n("Appeal").":";
|
||||||
echo "</td><td>";
|
echo "</td><td>";
|
||||||
$query = mysql_query(
|
$query = mysql_query(
|
||||||
"SELECT accounts.id as acc_id, users.id as usr_id, users.deleted, MAX(users.year) FROM accounts JOIN users ON" .
|
"SELECT accounts.id as acc_id, users.id as usr_id, users.deleted, MAX(users.id) FROM accounts JOIN users ON" .
|
||||||
" users.accounts_id = accounts.id" .
|
" users.accounts_id = accounts.id" .
|
||||||
" WHERE users.sponsors_id = '$id'" .
|
" WHERE users.sponsors_id = '$id'" .
|
||||||
" AND types LIKE '%sponsor%'" .
|
" AND types LIKE '%sponsor%'" .
|
||||||
@ -351,7 +351,7 @@ switch($_GET['action']) {
|
|||||||
case 'newcontactsearch':
|
case 'newcontactsearch':
|
||||||
|
|
||||||
if($_POST['email'])
|
if($_POST['email'])
|
||||||
$q=mysql_query("SELECT *,MAX(year) FROM users WHERE email='".trim($_POST['email'])."' GROUP BY accounts_id HAVING deleted='no'");
|
$q=mysql_query("SELECT *, MAX(id) FROM users WHERE email='".trim($_POST['email'])."' GROUP BY accounts_id HAVING deleted='no'");
|
||||||
|
|
||||||
if($r=mysql_fetch_object($q)) {
|
if($r=mysql_fetch_object($q)) {
|
||||||
echo i18n("There is an exact email address match for %1",array($_POST['email']));
|
echo i18n("There is an exact email address match for %1",array($_POST['email']));
|
||||||
@ -380,7 +380,7 @@ switch($_GET['action']) {
|
|||||||
if($_POST['email'])
|
if($_POST['email'])
|
||||||
$searchstr.=" AND email LIKE '%".$_POST['email']."%'";
|
$searchstr.=" AND email LIKE '%".$_POST['email']."%'";
|
||||||
|
|
||||||
$q=mysql_query("SELECT *,MAX(year) FROM users WHERE $searchstr GROUP BY accounts_id HAVING deleted='no'");
|
$q=mysql_query("SELECT *, MAX(id) FROM users WHERE $searchstr GROUP BY accounts_id HAVING deleted='no'");
|
||||||
$num=mysql_num_rows($q);
|
$num=mysql_num_rows($q);
|
||||||
if($num==0) {
|
if($num==0) {
|
||||||
echo i18n("No existing users match, will create a new user");
|
echo i18n("No existing users match, will create a new user");
|
||||||
@ -497,7 +497,7 @@ function save_contact(){
|
|||||||
if($_POST['recordtype'] == 'new'){
|
if($_POST['recordtype'] == 'new'){
|
||||||
|
|
||||||
if($_POST['email']) {
|
if($_POST['email']) {
|
||||||
$q=mysql_query("SELECT *,MAX(year) FROM users WHERE email='".trim($_POST['email'])."' GROUP BY accounts_id HAVING deleted='no'");
|
$q=mysql_query("SELECT *,MAX(id) FROM users WHERE email='".trim($_POST['email'])."' GROUP BY accounts_id HAVING deleted='no'");
|
||||||
if(mysql_num_rows($q)) {
|
if(mysql_num_rows($q)) {
|
||||||
error_("A user with that email address already exists");
|
error_("A user with that email address already exists");
|
||||||
exit;
|
exit;
|
||||||
@ -525,14 +525,16 @@ function save_contact(){
|
|||||||
$p = ($_POST['primary']=='yes')?'yes':'no';
|
$p = ($_POST['primary']=='yes')?'yes':'no';
|
||||||
if($p == 'no') {
|
if($p == 'no') {
|
||||||
/* Make sure this sponsor ($sponsor_id) has a primary */
|
/* Make sure this sponsor ($sponsor_id) has a primary */
|
||||||
$query = "SELECT users_id
|
$query = "SELECT users.id
|
||||||
FROM users_sponsor, users
|
FROM users
|
||||||
|
JOIN user_roles ON users_roles.users_id = users.id
|
||||||
|
JOIN roles ON roles.id = user_roles.id
|
||||||
WHERE
|
WHERE
|
||||||
users_sponsor.users_id=users.id
|
roles.type = 'sponsor'
|
||||||
AND sponsors_id='$sponsor_id'
|
AND users.sponsors_id='$sponsor_id'
|
||||||
AND `primary`='yes'
|
AND users.`primary`='yes'
|
||||||
AND year='".$config['FAIRYEAR']."'
|
AND users.conferences_id = '{$conference['id']}'
|
||||||
AND users_id!='$id'";
|
AND users.id != '$id'";
|
||||||
$q = mysql_query($query);
|
$q = mysql_query($query);
|
||||||
if(mysql_num_rows($q) == 0) {
|
if(mysql_num_rows($q) == 0) {
|
||||||
/* This has to be the primary since there isn't one already */
|
/* This has to be the primary since there isn't one already */
|
||||||
@ -602,17 +604,18 @@ function draw_contactsinfo_form($contact = null){
|
|||||||
// start our accordion
|
// start our accordion
|
||||||
echo "<div id=\"contactaccordion\" style=\"width: 740px;\">\n";
|
echo "<div id=\"contactaccordion\" style=\"width: 740px;\">\n";
|
||||||
|
|
||||||
|
|
||||||
// loop through each contact and draw a form with their data in it.
|
// loop through each contact and draw a form with their data in it.
|
||||||
|
$query = mysql_query("
|
||||||
$q = "SELECT * , MAX( year )
|
SELECT *, MAX(conferences_id)
|
||||||
FROM users
|
FROM users
|
||||||
WHERE sponsors_id = '" . $sponsor_id . "'
|
JOIN user_roles ON user_roles.users_id = users.id
|
||||||
AND TYPES LIKE '%sponsor%'
|
JOIN roles ON roles.id = user_roles.id
|
||||||
GROUP BY accounts_id
|
WHERE roles.type = 'sponsor'
|
||||||
HAVING deleted = 'no'
|
AND users.sponsors_id = '" . $sponsor_id . "'
|
||||||
ORDER BY `primary` DESC , lastname, firstname";
|
GROUP BY conferences_id
|
||||||
$query = mysql_query($q);
|
HAVING deleted = 'no'
|
||||||
|
ORDER BY `primary` DESC , lastname, firstname
|
||||||
|
");
|
||||||
|
|
||||||
while($contact = mysql_fetch_array($query)){
|
while($contact = mysql_fetch_array($query)){
|
||||||
// draw a header for this user
|
// draw a header for this user
|
||||||
|
@ -1,88 +0,0 @@
|
|||||||
<?
|
|
||||||
if($_GET['action']=="fundraisingmain") {
|
|
||||||
|
|
||||||
//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_goals WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY system DESC,goal");
|
|
||||||
echo "<table class=\"fundraisingtable\">";
|
|
||||||
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<th><a title=\"".i18n("Edit fund details")."\" onclick=\"return popup_fund_editor('fundraising_types.php?id=$r->id')\" 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\">";
|
|
||||||
echo "<img style=\"cursor:pointer\" onclick=\"return delete_fund($r->id)\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\">";
|
|
||||||
// echo "</a>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "</th>\n";
|
|
||||||
echo "<th colspan=\"5\">".i18n($r->name)."</th>\n";
|
|
||||||
echo "<th style=\"text-align: right\"><nobr>".format_money($r->budget)."</nobr></th>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
|
|
||||||
if($r->type=="general")
|
|
||||||
$orsql.="OR fundraising_type IS NULL";
|
|
||||||
|
|
||||||
$typetotal=0;
|
|
||||||
$typeprobtotal=0;
|
|
||||||
$sq=mysql_query("
|
|
||||||
SELECT fundraising_donations.id, sponsors.organization AS name, fundraising_donations.value, fundraising_donations.status, fundraising_donations.probability
|
|
||||||
FROM fundraising_donations
|
|
||||||
JOIN sponsors ON fundraising_donations.sponsors_id=sponsors.id
|
|
||||||
WHERE (fundraising_donations.fundraising_goal='$r->goal' $orsql)
|
|
||||||
AND fundraising_donations.fiscalyear='{$config['FISCALYEAR']}'
|
|
||||||
|
|
||||||
UNION
|
|
||||||
|
|
||||||
SELECT fundraising_donations.id, CONCAT(users.firstname,' ',users.lastname) AS name, fundraising_donations.value, fundraising_donations.status, fundraising_donations.probability
|
|
||||||
FROM fundraising_donations
|
|
||||||
JOIN users ON fundraising_donations.users_uid=users.uid
|
|
||||||
WHERE (fundraising_donations.fundraising_goal='$r->goal' $orsql)
|
|
||||||
AND fundraising_donations.fiscalyear='{$config['FISCALYEAR']}'
|
|
||||||
|
|
||||||
ORDER BY status DESC, probability DESC, name
|
|
||||||
");
|
|
||||||
echo mysql_error();
|
|
||||||
while($sr=mysql_fetch_object($sq)) {
|
|
||||||
echo "<tr id=\"sponsorships_$sr->id\" class=\"fundraising{$sr->status}\">";
|
|
||||||
echo "<td>";
|
|
||||||
echo "<img style=\"cursor:pointer;\" onclick=\"delete_sponsorship($sr->id)\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\">";
|
|
||||||
echo "</td>";
|
|
||||||
echo "<td style=\"cursor: pointer;\" onclick=\"popup_sponsorship_editor('fundraising_sponsorship.php?id=$sr->id&fundraising_type=$r->type')\">";
|
|
||||||
echo "$sr->name</td>\n";
|
|
||||||
echo "<td>$sr->status</td>";
|
|
||||||
echo "<td>";
|
|
||||||
if($sr->status=="pending") {
|
|
||||||
echo "$sr->probability%";
|
|
||||||
echo "</td>";
|
|
||||||
echo "<td><nobr>".format_money($sr->value)."</nobr></td>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo "</td><td></td>\n";
|
|
||||||
|
|
||||||
$probval=$sr->probability/100*$sr->value;
|
|
||||||
echo "<td style=\"text-align: right\"><nobr>".format_money($probval)."</nobr></td>";
|
|
||||||
echo "<td></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
$typeprobtotal+=$probval;
|
|
||||||
$typetotal+=$sr->value;
|
|
||||||
}
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td><a onclick=\"return popup_sponsorship_editor('fundraising_sponsorship.php?fundraising_type=$r->type')\" href=\"#\">add</a></td>";
|
|
||||||
echo "<td colspan=\"3\" style=\"text-align: right; font-weight: bold;\">".i18n("%1 Total",array($r->name),array("Fundraising type total, eg) Award Sponsorship Total"))."</td>\n";
|
|
||||||
echo "<td style=\"font-weight: bold; text-align: right;\"><nobr>".format_money($typetotal)."</nobr></td>\n";
|
|
||||||
echo "<td style=\"font-weight: bold; text-align: right;\"><nobr>".format_money($typeprobtotal)."</nobr></td>\n";
|
|
||||||
$typediff=$typeprobtotal-$r->goal;
|
|
||||||
echo "<td style=\"font-weight: bold; text-align: right;\"><nobr>".format_money($typediff)."</nobr></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
|
|
||||||
$totalgoal+=$r->goal;
|
|
||||||
$totaldiff+=$typediff;
|
|
||||||
echo "<tr><td colspan=\"7\"> </td></tr>\n";
|
|
||||||
}
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td colspan=\"2\"><a onclick=\"return popup_fund_editor('fundraising_types.php')\" 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";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
@ -299,9 +299,9 @@
|
|||||||
|
|
||||||
case "setup_save":
|
case "setup_save":
|
||||||
$fye=sprintf("%02d-%02d",intval($_POST['fiscalendmonth']),intval($_POST['fiscalendday']));
|
$fye=sprintf("%02d-%02d",intval($_POST['fiscalendmonth']),intval($_POST['fiscalendday']));
|
||||||
mysql_query("UPDATE config SET val='$fye' WHERE var='fiscal_yearend' AND year='{$config['FAIRYEAR']}'");
|
mysql_query("UPDATE config SET val='$fye' WHERE var='fiscal_yearend' AND conferences_id='{$conference['id']}'");
|
||||||
mysql_query("UPDATE config SET val='".mysql_real_escape_string($_POST['registeredcharity'])."' WHERE var='registered_charity' AND year='{$config['FAIRYEAR']}'");
|
mysql_query("UPDATE config SET val='".mysql_real_escape_string($_POST['registeredcharity'])."' WHERE var='registered_charity' AND conferences_id='{$conference['id']}'");
|
||||||
mysql_query("UPDATE config SET val='".mysql_real_escape_string($_POST['charitynumber'])."' WHERE var='charity_number' AND year='{$config['FAIRYEAR']}'");
|
mysql_query("UPDATE config SET val='".mysql_real_escape_string($_POST['charitynumber'])."' WHERE var='charity_number' AND conferences_id='{$conference['id']}'");
|
||||||
happy_("Fundraising module setup saved");
|
happy_("Fundraising module setup saved");
|
||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
|
@ -1,153 +0,0 @@
|
|||||||
<?
|
|
||||||
/*
|
|
||||||
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_once("../user.inc.php");
|
|
||||||
|
|
||||||
user_auth_required('admin');
|
|
||||||
|
|
||||||
if($_GET['id']) {
|
|
||||||
$id=intval($_GET['id']);
|
|
||||||
$q=mysql_query("SELECT fundraising_donations.*, sponsors.organization FROM fundraising_donations,sponsors WHERE fundraising_donations.id='$id' AND fundraising_donations.sponsors_id=sponsors.id");
|
|
||||||
$sponsorship=mysql_fetch_object($q);
|
|
||||||
$formaction="sponsorshipedit";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$formaction="sponsorshipadd";
|
|
||||||
$fundraising_type=$_GET['fundraising_type'];
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<script type="text/javascript">
|
|
||||||
function typechange() {
|
|
||||||
var t=($("[name=sponsortype]:checked").val());
|
|
||||||
if(t=="organization") {
|
|
||||||
$("#sponsor_type_organization").show();
|
|
||||||
$("#sponsor_type_individual").hide();
|
|
||||||
} else {
|
|
||||||
$("#sponsor_type_organization").hide();
|
|
||||||
$("#sponsor_type_individual").show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?
|
|
||||||
echo "<form id=\"fundraisingsponsorship\">";
|
|
||||||
echo "<input type=\"hidden\" name=\"action\" value=\"$formaction\">";
|
|
||||||
echo "<input type=\"hidden\" name=\"fundraising_donations_id\" value=\"$id\">";
|
|
||||||
echo "<table cellspacing=0 cellpadding=0 class=\"tableedit\">";
|
|
||||||
|
|
||||||
if($formaction=="sponsorshipadd") {
|
|
||||||
echo "<tr><th>".i18n("Donor Type")."</th>";
|
|
||||||
echo "<td>";
|
|
||||||
echo "<input onchange=\"typechange()\" type=\"radio\" name=\"sponsortype\" value=\"organization\"> ".i18n("Organization");
|
|
||||||
echo " "; echo " "; echo " ";
|
|
||||||
echo "<input onchange=\"typechange()\" type=\"radio\" name=\"sponsortype\" value=\"individual\"> ".i18n("Individual");
|
|
||||||
echo "</td></tr>\n";
|
|
||||||
|
|
||||||
echo "<tr><th>".i18n("Donor")."</th>";
|
|
||||||
echo "<td>";
|
|
||||||
|
|
||||||
$q=mysql_query("SELECT * FROM sponsors ORDER BY organization");
|
|
||||||
echo mysql_error();
|
|
||||||
echo "<span id=\"sponsor_type_organization\" style=\"display: none;\">";
|
|
||||||
echo "<select name=\"sponsors_id\">";
|
|
||||||
echo "<option value=\"\">".i18n("Choose")."</option>\n";
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
if($r->id==$sponsorship->sponsors_id) $sel="selected=\"selected\""; else $sel="";
|
|
||||||
echo "<option $sel value=\"$r->id\">$r->organization</option>\n";
|
|
||||||
}
|
|
||||||
echo "</select> <a href=\"donors.php?action=add\">".i18n("Add")."</a>\n";
|
|
||||||
echo "</span>";
|
|
||||||
|
|
||||||
|
|
||||||
$q=mysql_query("SELECT users.*, MAX(year) AS year FROM users WHERE (firstname!='' AND lastname!='') GROUP BY uid HAVING deleted='no' ORDER BY lastname,firstname");
|
|
||||||
echo mysql_error();
|
|
||||||
echo "<span id=\"sponsor_type_individual\" style=\"display: none;\">";
|
|
||||||
echo "<select name=\"users_uid\">";
|
|
||||||
echo "<option value=\"\">".i18n("Choose")."</option>\n";
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
if($r->uid==$sponsorship->users_uid) $sel="selected=\"selected\""; else $sel="";
|
|
||||||
echo "<option $sel value=\"$r->uid\">[$r->year][$r->uid] $r->lastname, $r->firstname ($r->email)</option>\n";
|
|
||||||
}
|
|
||||||
echo "</span>";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "<tr><th>".i18n("Donor Type")."</th>";
|
|
||||||
echo "<td>";
|
|
||||||
if($sponsorship->sponsors_id) echo i18n("Organization");
|
|
||||||
else echo i18n("Individual");
|
|
||||||
echo "</td></tr>\n";
|
|
||||||
|
|
||||||
echo "<tr><th>".i18n("Donor")."</th>";
|
|
||||||
echo "<td>";
|
|
||||||
echo $sponsorship->organization;
|
|
||||||
}
|
|
||||||
echo "</td></tr>\n";
|
|
||||||
|
|
||||||
echo "<tr><th>".i18n("Donation Allocation")."</th>";
|
|
||||||
echo "<td>";
|
|
||||||
$q=mysql_query("SELECT * FROM fundraising WHERE year='{$config['FAIRYEAR']}' ORDER BY name");
|
|
||||||
echo mysql_error();
|
|
||||||
echo "<select name=\"fundraising_type\">";
|
|
||||||
echo "<option value=\"\">".i18n("Choose")."</option>\n";
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
if($r->type==$sponsorship->fundraising_type || $r->type==$fundraising_type) $sel="selected=\"selected\""; else $sel="";
|
|
||||||
echo "<option $sel value=\"$r->type\">$r->name</option>\n";
|
|
||||||
}
|
|
||||||
echo "</select>\n";
|
|
||||||
echo "</td></tr>\n";
|
|
||||||
echo "<tr><th>".i18n("Amount")."</th><td><input type=\"text\" name=\"value\" value=\"$sponsorship->value\"></td></tr>\n";
|
|
||||||
|
|
||||||
echo "<tr><th>".i18n("Status")."</th>";
|
|
||||||
echo "<td>";
|
|
||||||
echo "<select name=\"status\">";
|
|
||||||
echo "<option value=\"\">".i18n("Choose")."</option>\n";
|
|
||||||
$statuses=array("pending","confirmed","received");
|
|
||||||
foreach($statuses AS $status) {
|
|
||||||
if($sponsorship->status==$status) $sel="selected=\"selected\""; else $sel="";
|
|
||||||
echo "<option $sel value=\"$status\">".i18n(ucfirst($status))."</option>\n";
|
|
||||||
}
|
|
||||||
echo "</select>\n";
|
|
||||||
echo "</td></tr>\n";
|
|
||||||
|
|
||||||
echo "<tr><th>".i18n("Probability")."</th>";
|
|
||||||
echo "<td>";
|
|
||||||
echo "<select name=\"probability\">";
|
|
||||||
echo "<option value=\"\">".i18n("Choose")."</option>\n";
|
|
||||||
$probs=array("25","50","75","90","95","99","100");
|
|
||||||
foreach($probs AS $prob) {
|
|
||||||
if($sponsorship->probability==$prob) $sel="selected=\"selected\""; else $sel="";
|
|
||||||
echo "<option $sel value=\"$prob\">$prob%</option>\n";
|
|
||||||
}
|
|
||||||
echo "</select>\n";
|
|
||||||
echo "</td></tr>\n";
|
|
||||||
|
|
||||||
echo "</table>\n";
|
|
||||||
echo "</form>\n";
|
|
||||||
|
|
||||||
?>
|
|
@ -340,9 +340,9 @@
|
|||||||
//this will return 1 if its between the dates, 0 otherwise.
|
//this will return 1 if its between the dates, 0 otherwise.
|
||||||
if($datecheck->datecheck==0) {
|
if($datecheck->datecheck==0) {
|
||||||
if($datecheck->datecheckbefore)
|
if($datecheck->datecheckbefore)
|
||||||
echo notice(i18n("Registration for the %1 %2 is not open yet. Registration will open on %3.",array($config['FAIRYEAR'],$config['fairname'],format_datetime($config['dates']['regopen'])),array("fair year","fair name","registration open date")));
|
echo notice(i18n("Registration for %1 is not open yet. Registration will open on %2.",array($conference['name'],format_datetime($config['dates']['regopen'])),array("conference name","registration open date")));
|
||||||
else if($datecheck->datecheckafter) {
|
else if($datecheck->datecheckafter) {
|
||||||
echo notice(i18n("Registration for the %1 %2 is now closed. Existing registrants can login and view (read only) their information, as well as apply for special awards (if applicable).",array($config['FAIRYEAR'],$config['fairname']),array("fair year","fair name")));
|
echo notice(i18n("Registration for %1 is now closed. Existing registrants can login and view (read only) their information, as well as apply for special awards (if applicable).",array($conference['name']),array("conference name")));
|
||||||
echo i18n("Please enter your email address to login");
|
echo i18n("Please enter your email address to login");
|
||||||
}
|
}
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
|
@ -82,7 +82,7 @@ if($_POST['action']=="save")
|
|||||||
if($_POST['lastname'][$x])
|
if($_POST['lastname'][$x])
|
||||||
{
|
{
|
||||||
//INSERT new record
|
//INSERT new record
|
||||||
mysql_query("INSERT INTO mentors (registrations_id,firstname,lastname,email,phone,organization,position,description,year) VALUES (".
|
mysql_query("INSERT INTO mentors (registrations_id,firstname,lastname,email,phone,organization,position,description,conferences_id) VALUES (".
|
||||||
"'".$_SESSION['registration_id']."', ".
|
"'".$_SESSION['registration_id']."', ".
|
||||||
"'".mysql_escape_string(stripslashes($_POST['firstname'][$x]))."', ".
|
"'".mysql_escape_string(stripslashes($_POST['firstname'][$x]))."', ".
|
||||||
"'".mysql_escape_string(stripslashes($_POST['lastname'][$x]))."', ".
|
"'".mysql_escape_string(stripslashes($_POST['lastname'][$x]))."', ".
|
||||||
@ -91,7 +91,7 @@ if($_POST['action']=="save")
|
|||||||
"'".mysql_escape_string(stripslashes($_POST['organization'][$x]))."', ".
|
"'".mysql_escape_string(stripslashes($_POST['organization'][$x]))."', ".
|
||||||
"'".mysql_escape_string(stripslashes($_POST['position'][$x]))."', ".
|
"'".mysql_escape_string(stripslashes($_POST['position'][$x]))."', ".
|
||||||
"'".mysql_escape_string(stripslashes($_POST['description'][$x]))."', ".
|
"'".mysql_escape_string(stripslashes($_POST['description'][$x]))."', ".
|
||||||
"'".$config['FAIRYEAR']."')");
|
"'".$conference['id']."')");
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
|
|
||||||
echo notice(i18n("%1 %2 successfully added",array($_POST['firstname'][$x],$_POST['lastname'][$x])));
|
echo notice(i18n("%1 %2 successfully added",array($_POST['firstname'][$x],$_POST['lastname'][$x])));
|
||||||
|
@ -351,9 +351,9 @@ if($config['participant_student_personal']=="yes")
|
|||||||
echo "</td><td>\n";
|
echo "</td><td>\n";
|
||||||
|
|
||||||
//the year selector should be based on the min/max ages possible (as set in $config)
|
//the year selector should be based on the min/max ages possible (as set in $config)
|
||||||
// FIXME - this should be converted to use the year in which the conference occurs
|
$fairYear = substr($config['dates']['fairdate'], 0, 4);
|
||||||
$minyearselect = $config['FAIRYEAR'] - $config['maxage'];
|
$minyearselect = $fairYear - $config['maxage'];
|
||||||
$maxyearselect = $config['FAIRYEAR'] - $config['minage'];
|
$maxyearselect = $fairYear - $config['minage'];
|
||||||
emit_year_selector("year[$x]",$year,$minyearselect,$maxyearselect);
|
emit_year_selector("year[$x]",$year,$minyearselect,$maxyearselect);
|
||||||
echo "</td><td>".REQUIREDFIELD."</td></tr></table>\n";
|
echo "</td><td>".REQUIREDFIELD."</td></tr></table>\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
|
@ -116,11 +116,11 @@ echo mysql_error();
|
|||||||
if($_POST['action']=="volunteer") {
|
if($_POST['action']=="volunteer") {
|
||||||
$vname = mysql_escape_string(stripslashes($_POST['vname']));
|
$vname = mysql_escape_string(stripslashes($_POST['vname']));
|
||||||
$vemail = mysql_escape_string(stripslashes($_POST['vemail']));
|
$vemail = mysql_escape_string(stripslashes($_POST['vemail']));
|
||||||
mysql_query("INSERT INTO tours_volunteers (registrations_id,name,email,year) VALUES (".
|
mysql_query("INSERT INTO tours_volunteers (registrations_id,name,email,conferences_id) VALUES (".
|
||||||
"'".$_SESSION['registration_id']."', ".
|
"'".$_SESSION['registration_id']."', ".
|
||||||
"'".$vname."', ".
|
"'".$vname."', ".
|
||||||
"'".$vemail."', ".
|
"'".$vemail."', ".
|
||||||
"'".$config['FAIRYEAR']."'); ");
|
"'".$conference['id']."'); ");
|
||||||
echo happy(i18n("Tour volunteer added. They will be contacted soon."));
|
echo happy(i18n("Tour volunteer added. They will be contacted soon."));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user