示例#1
0
function process_action_fields($action_KEY, $date = NULL)
{
    $action['action_count_unique'] = action_count_unique($action_KEY);
    $action['action_count'] = action_count($action_KEY);
    $action['new_supporters'] = action_new_supporters($action_KEY);
    $action['supporter_count'] = action_new_supporters_deliverable($action_KEY);
    $action['action_count_recent'] = action_count_unique($action_KEY, LAST_WEEK);
    $action['new_supporters_recent'] = action_new_supporters_date($action_KEY, $date);
    $action['new_deliverable_recent'] = action_new_supporters_deliverable_date($action_KEY, $date);
    $action['referrer_count'] = action_referrer_supporter($action_KEY);
    return $action;
}
示例#2
0
function action_detail($key)
{
    global $db;
    $sql = 'select * from action where action_KEY =' . $key;
    $A = $db->CacheExecute($sql) or die($db->errorMsg());
    $a = $A->FetchRow();
    echo '<h2>' . $a['Reference_Name'] . '</h2>';
    echo '<div class="row">';
    echo '<div class="span3">';
    echo 'Unique Actions Taken: ' . action_count_distinct($key) . '<br>';
    echo 'Actions Taken: ' . action_count($key) . '<br>';
    echo '</div>';
    echo '<div class="span3">';
    $options['slug'] = $a['campaign_slug'];
    echo 'New Supporters: ' . action_new_supporters($key) . '<br>';
    echo 'New Supporters Deliverable: ' . action_new_supporters_deliverable($key) . '<br>';
    echo 'Supporter Referrals: ' . action_referrer_supporter($key, $options) . '<br>';
    echo '</div>';
    echo '<div class="span3">';
    echo 'Actions This Week: ' . action_count($key) . '<br>';
    echo 'New This Week: ' . action_new_supporters_date($key, LAST_WEEK) . '<br>';
    echo 'New Deliverable This Week: ' . action_new_supporters_deliverable_date($key, LAST_WEEK) . '<br>';
    echo '</div>';
    echo '</div>';
    $emails = action_emails($key);
    $emails_count = action_emails_count($key);
    $ref = action_referrer($key);
    $partners = action_partners($key);
    if ($emails) {
        $email_blast_options = array('where' => ' and e.email_blast_KEY in (' . $emails . ') ');
        include '../partials/_email_blast_list.php';
    }
    echo '<h3>Action Sources</h3><div class="row">';
    echo '<div class="span4">';
    echo '<h4>Codes</h4>';
    echo '<table class="table">';
    if ($ref) {
        foreach ($ref as $i) {
            echo '<tr>';
            echo '<td>' . $i['referrer'] . '</td>';
            echo '<td>' . $i['count'] . '</td>';
            echo '</tr>';
        }
    }
    echo '</table>';
    echo '</div>';
    echo '<div class="span4">';
    echo '<h4>Emails</h4>';
    echo '<table class="table">';
    if ($emails_count) {
        foreach ($emails_count as $i) {
            echo '<tr>';
            echo '<td><a href="../object.php?object=email_blast&key=' . $i['email_blast_KEY'] . '">' . get_email_blasts_name($i['email_blast_KEY']) . '</a></td>';
            echo '<td>' . $i['count'] . '</td>';
            echo '</tr>';
        }
    }
    echo '</table>';
    echo '</div>';
    if ($partners) {
        echo '<div class="span4">';
        echo '<h4>Partners</h4><br>';
        echo '<table class="table">';
        foreach ($partners as $i) {
            if ($i['partner_code']) {
                echo '<tr>';
                echo '<td>' . $i['partner_code'] . '</td>';
                echo '<td>' . $i['count'] . '</td>';
                echo '</tr>';
            }
        }
        echo '</table>';
        echo '</div>';
    }
    echo '</div>';
    $tell_a_friend_options['where'] = ' where action_KEY = "' . $key . '" ';
    include '../partials/_tell_a_friend_list.php';
    $sql = 'select supporter_KEY, count(supporter_KEY) as count from supporter_action where referrer_supporter_KEY >0 and supporter_KEY != referrer_supporter_KEY and action_KEY = ' . $key . ' group by supporter_KEY order by count desc';
    $Rec = $db->CacheExecute($sql) or die($db->errorMsg());
    $rec = $Rec->GetArray();
    echo '<h3>Recuritment</h3>';
    foreach ($rec as $i) {
        echo $i['count'] . ' <a href="/supporter.php?supporter_KEY=' . $i['supporter_KEY'] . '">' . get_supporter_name($i['supporter_KEY']) . '</a> ' . '<br>';
    }
    echo '<h3>Action Links</h3>';
    action_links($a['campaign_slug']);
    $sql = "select count(distinct supporter_KEY) as count from supporter_action where personal_petition=1 and action_KEY =" . $key;
    $Per = $db->CacheExecute($sql) or die($db->errorMsg() . $sql);
    $per = $Per->FetchRow();
    $sql = "select count(distinct personal_petition_supporter_KEY) as count from supporter_action where personal_petition_supporter_KEY >0 and action_KEY =" . $key;
    $Per_Ct = $db->CacheExecute($sql) or die($db->errorMsg() . $sql);
    $per_ct = $Per_Ct->FetchRow();
    if ($per['count'] > 0) {
        echo '<h3>Personal Petitions</h3>';
        echo '<strong>Petitions Started:</strong>: ' . $per['count'];
        echo '<strong>Petitions Signatures Generated:</strong>: ' . $per_ct['count'];
        $sql = "select distinct supporter_KEY  from supporter_action where personal_petition=1 and action_KEY =" . $key;
        $Pet = $db->CacheExecute($sql) or die($db->errorMsg() . $sql);
        $pet = $Pet->FetchRow();
        foreach ($pet as $i) {
            #echo '<td><a href="'.ACTION_URL.$a['campaign_slug'].'/">'.$i['supporter_KEY'].'</a></td>';
        }
    }
}