Copyright (C) 2005-2008 James Grant 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. */ ?> 'committee_main.php', 'Administration' => 'admin/index.php', 'Donor' => 'admin/donors.php')); if($_GET['sponsors_id']) $sponsors_id=$_GET['sponsors_id']; else if($_POST['sponsors_id']) $sponsors_id=$_POST['sponsors_id']; ?> "; echo ""; echo ""; if($sponsors_id) { if($_POST['save']=="edit" || $_POST['save']=="add") { $p = ($_POST['primary']=='yes')?'yes':'no'; if($_POST['save']=="add") { $u=user_create("sponsor", $_POST['email']); $id=$u['id']; } else { $u=user_load($_POST['id']); $id=intval($_POST['id']); } if($p == 'no') { /* Make sure this sponsor ($sponsors_id) has a primary */ $q = mysql_query("SELECT users_id FROM users_sponsor, users WHERE users_sponsor.users_id=users.id AND sponsors_id='$sponsors_id' AND `primary`='yes' AND conferences_id='".$conference['id']."' AND users_id!='$id'"); if(mysql_num_rows($q) == 0) { /* This must be the primary */ $p = 'yes'; } } else { /* Unset all other primaries */ mysql_query("UPDATE users_sponsor SET `primary`='no' WHERE sponsors_id='$sponsors_id'"); } $u['primary']=$p; $u['salutation']=$_POST['salutation']; $u['firstname']=$_POST['firstname']; $u['lastname']=$_POST['lastname']; $u['position']=$_POST['position']; $u['phonework']=$_POST['phonework']; $u['phonecell']=$_POST['phonecell']; $u['phonehome']=$_POST['phonehome']; $u['fax']=$_POST['fax']; $u['email']=$_POST['email']; $u['notes']=$_POST['notes']; $u['sponsors_id']=$sponsors_id; user_save($u); if($_POST['save']=="add") echo happy(i18n("Contact successfully added")); else echo happy(i18n("Successfully saved changes to contact")); } if($_GET['action']=="delete" && $_GET['delete']) { user_delete(intval($_GET['delete'])); echo happy("Contact successfully deleted"); } if($_GET['action']=="edit" || $_GET['action']=="add") { echo "<< ".i18n("Back to %1 Contacts",array($sponsors_organization))."\n"; if($_GET['action']=="edit") { echo "

".i18n("Edit %1 Contact",array($sponsors_organization))."

\n"; $buttontext="Save Contact"; // $q=mysql_query("SELECT * FROM sponsor_contacts WHERE id='".$_GET['edit']."'"); // $r=mysql_fetch_object($q); $u=user_load(intval($_GET['edit'])); } else if($_GET['action']=="add") { echo "

".i18n("Add %1 Contact",array($sponsors_organization))."

\n"; $buttontext="Add Contact"; } $buttontext=i18n($buttontext); echo "
\n"; echo "\n"; echo "\n"; if($_GET['action']=="edit") echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
".i18n("Salutation")."
".i18n("First Name")."
".i18n("Last Name")."
".i18n("Position")."
".i18n("Phone (Work)")."
".i18n("Phone (Cell)")."
".i18n("Phone (Home)")."
".i18n("Fax")."
".i18n("Email")."
".i18n("Notes")."
".i18n("Primary Contact")."
\n"; echo "
\n"; } else { echo "
"; echo "".i18n("Add New Contact to %1",array($sponsors_organization))."\n"; echo "
"; $q=mysql_query("SELECT * FROM users LEFT JOIN users_sponsor ON users_sponsor.users_id=users.id WHERE conferences_id='".$conference['id']."' AND sponsors_id='$sponsors_id' AND deleted='no' ORDER BY lastname,firstname"); echo mysql_Error(); if(mysql_num_rows($q)) { echo ""; echo ""; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo "\n"; while($r=mysql_fetch_object($q)) { echo "\n"; echo " \n"; echo " "; echo " \n"; echo " \n"; $p = i18n(($r->primary=='yes')?'Yes':'No'); echo " \n"; echo " \n"; echo "\n"; } echo "
".i18n("Name")."".i18n("Email")."".i18n("Phone (Work)")."".i18n("Phone (Cell)")."".i18n("Primary")."Actions
"; if($r->salutation) echo $r->salutation." "; echo "$r->firstname $r->lastname"; if($r->email) { list($eb,$ea)=explode("@",$r->email); echo ""; } else echo " "; echo " $r->phonework$r->phonecell$p"; //FIXME: should we just go to /user_personal.php here instead? echo "id\">"; echo " "; echo "id\">"; echo "
\n"; } } } send_footer(); ?>