Started on writing form viewing log files on the "Activity Log" tab

This commit is contained in:
jacob 2009-10-05 22:01:06 +00:00
parent 50eebd3245
commit e3633a3cf4

@ -22,11 +22,11 @@
*/
?>
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
switch($_GET['action']) {
switch($_GET['action']) {
case 'organizationinfo_load':
$id=intval($_GET['id']);
$q=mysql_query("SELECT * FROM sponsors WHERE id='$id'");
@ -69,7 +69,6 @@
}
exit;
break;
case 'sponsorshipinfo_load':
$id=intval($_GET['id']);
$ret=array();
@ -93,9 +92,20 @@
delete_contact();
exit;
break;
}
case 'activityinfo_load':
// make sure a donor id has been selected
if($_GET['id']){
draw_activityinfo_form();
}
exit;
break;
case 'activityinfo_save':
save_activityinfo();
exit;
break;
}
send_header("Donor/Sponsor Management",
send_header("Donor/Sponsor Management",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Fundraising' => 'admin/fundraising.php')
@ -237,7 +247,7 @@ function draw_contactsinfo_form($contact = null){
}
// draw a form in which to enter contact info
// draw a form in which to enter information about the various contacts
function draw_contact_form($sponsor_id, $contact = null){
if($contact != null){
$id = $contact["id"];
@ -305,6 +315,59 @@ function draw_contact_form($sponsor_id, $contact = null){
<?php
}
function draw_activityinfo_form(){
$sponsorid = $_GET['id'];
// we'll start by drawing the table header
?>
<form id="activityinfo">
<table class="tableview" style="width:90%">
<thead><tr>
<th>Date</th>
<th>User</th>
<!--th>Contact Type</th>
<th>Campaign name</th-->
<th>Notes</th>
</tr></thead>
<tbody>
<?php
$query = "SELECT (users.firstname && \" \" && users.lastname) AS name, fdl.dt, fdl.log
FROM fundraising_donor_logs AS fdl
JOIN users ON fdl.users_id=users.id
WHERE sponsors_id=" . $sponsorid;
//echo "<tr><td colspan=\"3\">" . $query . "</td></tr>";
$results = mysql_query($query);
$row = mysql_fetch_array($results);
if($row){
do{
echo "<tr><td>" . $results["dt"];
echo "<tr><td>" . $results["name"];
echo "</td><td>" . $results["log"];
echo "</td></tr>\n";
}while($row = mysql_fetch_array($results));
}else{
echo "<tr><td colspan=\"3\" style=\"text-align:center\">" . i18n("No records") . "</td></tr>";
}
?>
<tr>
<td align="center" width="10%"><input type="submit" value="<?=i18n("Save")?>" onClick="return activityinfo_save()" /></td>
<td align="center" width="10%"><?=$_SESSION['name']?></td>
<td><input type="text" name="comment" style="width:100%"/></td>
</tr>
</tbody></table>
</form>
<?php
}
function save_activityinfo(){
happy_("foo!");
$query = "INSERT INTO fundraising_donor_logs (sponsors_id, dt, users_id, log)";
$query .= "VALUES (" . $_GET['id'] . ", NOW())";
echo $query;
}
?>
<script type="text/javascript">
/* Setup the popup window */
@ -463,15 +526,21 @@ function contactsinfo_delete(uid) {
function update_activityinfo()
{
var id=sponsor_id;
$("#editor_tab_activity").load("<?=$_SERVER['PHP_SELF']?>?action=activityinfo_load&id="+id);
/*
var id=sponsor_id;
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=activityinfo_load&id="+id,
function(json){
$("#sponsor_id").val(json.id);
});
*/
return false;
}
function activityinfo_save() {
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=activityinfo_save", $("#activityinfo").serializeArray());
var id=sponsor_id;
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=activityinfo_save&id="+id, $("#activityinfo").serializeArray());
return false;
}