/**
 * Filter to show the number of pledgers of a project and its children
 */
function id_number_pledges_parent($pledgers, $post_id)
{
    // Getting the children projects if any to add the total in $amount
    $project_children = get_post_meta($post_id, 'ign_project_children', true);
    if (!empty($project_children)) {
        foreach ($project_children as $child_project) {
            $child_project_id = get_post_meta($child_project, 'ign_project_id', true);
            $project = new ID_Project($child_project_id);
            $orders = $project->get_project_orders();
            $pledgers = $pledgers + $orders;
            $sub_children = get_post_meta($child_project, 'ign_project_children', true);
            if (!empty($sub_children)) {
                foreach ($sub_children as $subchild_id) {
                    $subchild_project_id = get_post_meta($subchild_id, 'ign_project_id', true);
                    $subproject = new ID_Project($subchild_project_id);
                    $orders = $subproject->get_project_orders();
                    $pledgers = $pledgers + $orders;
                }
            }
        }
    }
    return $pledgers;
}
function id_projectUsers($attrs)
{
    if (isset($attrs['product'])) {
        $project_id = $attrs['product'];
        $project = new ID_Project($project_id);
        //$orders = $project->get_project_orders();
        $orders = apply_filters('id_number_pledges', $project->get_project_orders(), $project->get_project_postid());
        return '<span class="product-Users" style="clear: both;">' . $orders . '</span>';
    } else {
        return null;
    }
}
 function hDeck()
 {
     //$the_project = parent::the_project();
     $prod_settings = parent::get_project_settings();
     if (empty($prod_settings)) {
         $prod_settings = getProductDefaultSettings();
     }
     $post_id = parent::get_project_postid();
     $end_type = get_post_meta($post_id, 'ign_end_type', true);
     $item_fund_goal = apply_filters('id_project_goal', parent::the_goal(), $post_id);
     $p_current_sale = apply_filters('id_funds_raised', parent::get_project_raised(), $post_id);
     //
     $item_fund_end = parent::end_date();
     $end_day = parent::end_day();
     $end_month = parent::end_month();
     $end_year = parent::end_year();
     $days_left = parent::days_left();
     //
     $rating_per = apply_filters('id_percentage_raised', parent::percent(), apply_filters('id_funds_raised', parent::get_project_raised(), $post_id, true), $post_id, apply_filters('id_project_goal', parent::the_goal(), $post_id, true));
     //$p_count = new stdClass;
     //$p_count->p_number = parent::get_project_orders();
     $p_number = apply_filters('id_number_pledges', parent::get_project_orders(), $post_id);
     $currencyCodeValue = $prod_settings->currency_code;
     $cCode = setCurrencyCode($currencyCodeValue);
     $hDeck = new stdClass();
     $hDeck->end_type = $end_type;
     $hDeck->goal = $item_fund_goal;
     $hDeck->total = $p_current_sale;
     // what is this for?
     //$hDeck->show_dates = $show_dates;
     $hDeck->end = $item_fund_end;
     $hDeck->day = $end_day;
     $hDeck->month = apply_filters('id_end_month', $end_month);
     $hDeck->year = $end_year;
     $hDeck->days_left = apply_filters('id_project_days_left', $days_left, $post_id);
     //
     $hDeck->percentage = $rating_per;
     $hDeck->pledges = $p_number;
     $hDeck->currency_code = $cCode;
     return $hDeck;
 }
Exemple #4
0
function the_project_summary($id)
{
    $post = get_post($id);
    $project_id = get_post_meta($id, 'ign_project_id', true);
    $project = new ID_Project($project_id);
    $image_url = the_project_image($id, "1");
    $name = $post->post_title;
    $short_desc = html_entity_decode(get_post_meta($id, 'ign_project_description', true));
    $total = apply_filters('id_funds_raised', $project->get_project_raised(), $id);
    $goal = apply_filters('id_project_goal', $project->the_goal(), $id);
    $end = get_post_meta($id, 'ign_fund_end', true);
    $end_type = get_post_meta($id, 'ign_end_type', true);
    $days_left = $project->days_left();
    $pledgers = apply_filters('id_number_pledges', $project->get_project_orders(), $id);
    // ID Function
    // GETTING product default settings
    $default_prod_settings = getProductDefaultSettings();
    // Getting product settings and if they are not present, set the default settings as product settings
    $prod_settings = getProductSettings($project_id);
    if (empty($prod_settings)) {
        $prod_settings = $default_prod_settings;
    }
    $currency_code = $prod_settings->currency_code;
    //GETTING the currency symbols
    $cCode = setCurrencyCode($currency_code);
    if ($end !== '') {
        $show_dates = true;
    } else {
        $show_dates = false;
    }
    // percentage bar
    $percentage = apply_filters('id_percentage_raised', $project->percent(), apply_filters('id_funds_raised', $project->get_project_raised(), $id, true), $id, apply_filters('id_project_goal', $project->the_goal(), $id, true));
    $successful = get_post_meta($id, 'ign_project_success', true);
    $summary = new stdClass();
    $summary->end_type = $end_type;
    $summary->image_url = $image_url;
    $summary->name = $name;
    $summary->short_description = $short_desc;
    $summary->total = $total;
    $summary->goal = $goal;
    $summary->pledgers = $pledgers;
    $summary->show_dates = $show_dates;
    if ($show_dates == true) {
        $summary->days_left = $days_left;
    }
    $summary->percentage = $percentage;
    $summary->successful = $successful;
    $summary->currency_code = $cCode;
    return $summary;
}