function lhg_return_donation_targets() { # returns two arrays # 1 ... name of company/organization to which donation will go # 2 ... amount of points for this company/organization # 3 ... number of users that donated to this company/organization global $donation; # returns collected points of ongoing quarter list($donation_target_sums, $donation_target_users) = lhg_return_donation_results(false, false); $j = 0; foreach ($donation_target_sums as $key => $points) { $donation_targets[$j] = $donation[$key]["Name"]; $donation_points[$j] = $points; $donation_users[$j] = $donation_target_users[$key]; $j++; } # also include points from hardware scans $start_timestamp = cp_StartOfQuarter(); $points_scan = lhg_points_from_hwscans($start_timestamp, time()); foreach ($points_scan as $key => $points) { #error_log("Pts: $points -> $key"); $total_points += $points; $donation_points[$key] += $points; $donation_targets[$j] = $donation[$key]["Name"]; $donation_points[$j] = $points; $donation_users[$j] = 0; $j++; } return array($donation_targets, $donation_points, $donation_users); }
function lhg_hardware_scans_points_shortcode($attr) { global $lang; global $donation; $start = $attr['start']; $end = $attr['end']; $start_timestamp = strtotime($start); $end_timestamp = strtotime($enddate); if ($start == "") { $start_timestamp = cp_StartOfQuarter(); } if ($end == "") { $end_timestamp = time(); } # $total_points = 0; # collects all points collected in this time frame $donation_points = array(); # collects all points per donation target in this time frame # # donation points by hardware scans # $points_scan = lhg_points_from_hwscans($start_timestamp, $end_timestamp); foreach ($points_scan as $key => $points) { #error_log("Pts: $points -> $key"); $total_points += $points; $donation_points[$key] += $points; } # sort by points arsort($points_scan); $distri = lhg_get_distribution_array(); $logo = $distri[$distri_name]["logo"]; foreach ($points_scan as $key => $points) { $distri_name = lhg_get_distri_name($donation[$key]["Name"]); $logo = $distri[$distri_name]["logo"]; $url = $distri[$distri_name]["url"]; $scan_output .= '<div class="donations-short-user-list"> <div class="donations-short-user-list-avatar">' . '<a href="' . $url . '">' . "<img src=\"" . $logo . "\" width=45px></a>\n </div>\n\n " . '<div class="donations-short-user-list-text"> <center> <a href="' . $url . '">' . $donation[$key]["Name"] . "</a><br><b>{$points} points</b>\n \t</center>\n </div>\n\n </div>"; } return $scan_output; }