Example #1
0
    echo json_encode($periods);
    return;
} else {
    $period = "";
    // Check that a specified period is passed
    if (empty($_REQUEST['period'])) {
        if (empty($_REQUEST['period_id'])) {
            echo 'error: args';
            return;
        } else {
            $period_id = mysql_real_escape_string($_REQUEST['period_id']);
        }
    } else {
        $period = mysql_real_escape_string($_REQUEST['period']);
    }
    $results = Rewarder::getResultsForPeriod($period, $period_id);
    // Create an array to hold the point values
    $points = array();
    $percentage = array();
    // Create an array to hold the users
    $users = array();
    // Create an array to hold the givers
    $givers = array();
    $team_givers = array();
    // Relation array
    $relation = array();
    foreach ($results as $result) {
        $points[] = $result['received_points'];
        $percentage[] = $result['received_percentage'];
        $users[] = $result['nickname'];
        $givers[] = $result['givers'];