Пример #1
0
        }
    }
    if (in_array(trim($_GET['donation_status']), array("Expected", "Pledged", "Received"))) {
        $where_clauses[] = "donation_status = '" . strtolower(trim($_GET['donation_status'])) . "'";
    }
}
$where = count($where_clauses) > 0 ? " AND " . implode(" AND ", $where_clauses) : "";
$query_donations = "SELECT \r\n    donation_id, \r\n    donation_value, \r\n    donation_status, \r\n    donation_is_cash, \r\n    donation_pledge_date, \r\n    donation_received_date,\r\n    donation_description,\r\n    contacts.*,\r\n    contact_company IS NULL AS isnull\r\n  FROM donations \r\n  LEFT JOIN contacts USING (`contact_id`) \r\n  WHERE campaign_id = " . $campaign['campaign_id'] . $where . " ORDER BY isnull, contact_company, contact_first, contact_last";
$donations = mysql_query($query_donations, $contacts) or die(mysql_error());
$row_donations = mysql_fetch_assoc($donations);
$totalRows_donations = mysql_num_rows($donations);
$query_targets = "SELECT\r\n    contact_id,\r\n    contact_first,\r\n    contact_last,\r\n    contact_title,\r\n    contact_company\r\n  FROM targets\r\n  LEFT JOIN contacts using (contact_id)\r\n  WHERE campaign_id = " . $campaign['campaign_id'] . " AND\r\n        (SELECT COUNT(*) \r\n         FROM donations \r\n         WHERE campaign_id = " . $campaign['campaign_id'] . " AND \r\n               donations.contact_id = targets.contact_id\r\n        ) = 0";
$targets = mysql_query($query_targets, $contacts) or die(mysql_error());
$row_targets = mysql_fetch_assoc($targets);
$totalRows_targets = mysql_num_rows($targets);
$stats = donation_stats($campaign['campaign_id'], $where);
$title_text = "Campaign - " . $campaign['campaign_name'];
$back_track = array('title' => "Campaigns", 'url' => "campaigns.php");
$display = isset($_GET['display']) ? $_GET['display'] : "html";
if (!in_array($display, array("csv", "html"))) {
    $display = "html";
}
switch ($display) {
    case "csv":
        $out = fopen('php://output', 'w');
        header('Content-type: text/csv');
        header('Content-Disposition: attachment; filename="donations.csv"');
        header("Cache-Control: no-cache, must-revalidate");
        // HTTP/1.1
        header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
        // Date in the past
Пример #2
0
    die;
}
$cwhere = "WHERE history_status = 1";
mysql_select_db($database_contacts, $contacts);
$query_notes = "SELECT * FROM notes INNER JOIN contacts ON note_contact = contact_id ORDER BY note_date DESC LIMIT 0, 20";
$notes = mysql_query($query_notes, $contacts) or die(mysql_error());
$row_notes = mysql_fetch_assoc($notes);
$totalRows_notes = mysql_num_rows($notes);
mysql_select_db($database_contacts, $contacts);
$query_contacts = "SELECT * FROM history INNER JOIN contacts ON contact_id = history_contact {$cwhere} ORDER BY history_date DESC LIMIT 0, 20";
$contacts = mysql_query($query_contacts, $contacts) or die(mysql_error());
$row_contacts = mysql_fetch_assoc($contacts);
$totalRows_contacts = mysql_num_rows($contacts);
$default_campaign = get_default_campaign();
if ($default_campaign) {
    $stats = donation_stats($default_campaign['campaign_id']);
}
if ($totalRows_contacts < 1 && !isset($_GET['s'])) {
    header('Location: contact.php');
}
include 'includes/header.php';
?>
<div class="container">
  <div class="leftcolumn">

<?php 
if ($totalRows_contacts > 0) {
    ?>
    <h2>Contacts</h2>
    <?php 
    $i = 1;