예제 #1
0
function dashboard_action()
{
    // needed to hide the menu
    $dashboard_active = true;
    // dealing with order form
    if (isset($_POST['client'])) {
        new_order($_POST);
    }
    // dealing with transfers
    if (intval($_POST['transfers']) > 0) {
        new_transfer($_POST['recipient'], $_POST['transfers'], $_POST);
    }
    // dealing with message form
    if (isset($_POST['message'])) {
        add_message($_POST['uid'], $_POST['message']);
    }
    // if order form is needed
    if (isset($_GET['uid'])) {
        // get all the snacks
        $snacks = get_visible_snacks();
        $client = get_user_by_uid($_GET['uid']);
        $client['lastorder'] = get_last_order_timestamp_by_uid($client['uid']);
        $client['lastpayment'] = get_last_payment_by_uid($client['uid']);
        $client['tags'] = get_user_tags($client['uid']);
        $client['equipments'] = get_user_equipments($client['uid']);
        $client['jobs'] = get_jobs_by_uid($client['uid']);
    } else {
        $messages = get_all_messages();
        $events = get_google_calendar_events();
        $first_coffee = get_first_coffee();
        $jobs = get_last_jobs();
    }
    // get all the users
    $users = get_all_users_sorted_by_balance_descending();
    require 'templates/dashboard.php';
}
예제 #2
0
     $payments = get_all_payments();
     $response = array("version" => $version, "response" => $payments);
     echo json_encode($response);
 } elseif ('snacks' == $_GET['uri'] && isset($_GET['id'])) {
     send_headers();
     $snack = get_snack_by_id($_GET['id']);
     $response = array("version" => $version, "response" => $snack);
     echo json_encode($response);
 } elseif ('snacks' == $_GET['uri']) {
     send_headers();
     $snacks = get_all_snacks();
     $response = array("version" => $version, "response" => $snacks);
     echo json_encode($response);
 } elseif ('jobs' == $_GET['uri'] && isset($_GET['id'])) {
     send_headers();
     $jobs = get_jobs_by_uid($_GET['id']);
     $response = array("version" => $version, "response" => $jobs);
     echo json_encode($response);
 } elseif ('equipments' == $_GET['uri'] && isset($_GET['id'])) {
     send_headers();
     $equipment = get_equipment_by_id($_GET['id']);
     $response = array("version" => $version, "response" => $equipment);
     echo json_encode($response);
 } elseif ('equipments' == $_GET['uri']) {
     send_headers();
     $equipments = get_all_equipments();
     echo json_encode($equipments);
 } elseif ('coffees' == $_GET['uri'] && isset($_GET['id'])) {
     // This is a payment request
     $user = get_user_by_uid($_GET['id']);
     if ($user && $_SERVER['REQUEST_METHOD'] == 'GET') {