<?php
    if(dw_campaigns_get_selected_type()!='walking')
        return;

    global $location_string;
    global $selected;

    $campaign = dw_campaigns_get_selected_campaign();

    $campaign_id = NULL;

    if(!is_null($campaign)) {
        $leaders        = _dw_campaigns_campaign_leaders($campaign, $show_cnt);
        $campaign_id    = $campaign->nid;
    } else {
        $leaders        = _dw_campaigns_all_leaders($show_cnt);
    }
    

?>

<h2><?php echo t('Top Fundraisers'); ?></h2>
<?php
    if($show_cnt<10) {
        $leaderboard_path       = '/dw/campaign/current/leaderboard';
        
        if(!is_null($campaign_id)) {
            $leaderboard_path   = dw_campaigns_get_campaign_path($campaign_id, '/dw/campaign', 'leaderboard');
        }
?>
        <a href="<?php echo $leaderboard_path;?>" class="see-all"><?php echo t('see all'); ?></a>
<?php
    if(!is_null($campaign)) {
        $leaders = _dw_campaigns_campaign_leaders($campaign, 9999);
    } else {
        $leaders = _dw_campaigns_all_leaders(9999);
    }

    $num_per_page = 40;

    $headers        = array(
        array(
            'data'  => 'Position',
            'field' => 'position',
        ),
        array(
            'data'  => 'Name',
            'field' => 'name'
        ),
        array(
            'data'  => 'Location',
            'field' => 'location',
        ),
        array(
            'data'  => 'Donations',
            'field' => 'donations',
        ),
        array(
            'data'  => 'Total Raised',
            'field' => 'amount',
            'sort'  => 'desc'
        )