コード例 #1
0
ファイル: events.php プロジェクト: afbjorklund/ganglia-web
        if (isset($_REQUEST['end_time'])) {
            if ($_REQUEST['end_time'] == "now") {
                $end_time = time();
            } else {
                if (is_numeric($_REQUEST['end_time'])) {
                    $end_time = $_REQUEST['end_time'];
                } else {
                    $end_time = strtotime($_REQUEST['end_time']);
                }
            }
            $event['end_time'] = $end_time;
        }
        $message = ganglia_events_add($event);
        break;
    case "edit":
        $message = ganglia_event_modify($_REQUEST);
        break;
    case "remove":
    case "delete":
        if (!isset($_REQUEST['event_id'])) {
            api_return_error("No event_id has been supplied.");
        }
        $message = ganglia_event_delete($_REQUEST['event_id']);
        break;
    case "list":
        $message = ganglia_events_get();
        break;
    default:
        api_return_error("No valid action specified");
        break;
}
コード例 #2
0
ファイル: events.php プロジェクト: vvuksan/ganglia-misc
            } else {
                $start_time = strtotime($_GET['start_time']);
            }
        }
        $grid = isset($_GET['grid']) ? $_GET['grid'] : "*";
        $cluster = isset($_GET['cluster']) ? $_GET['cluster'] : "*";
        $description = isset($_GET['description']) ? $_GET['description'] : "";
        // Generate a unique event ID. This is so we can reference it later
        $event_id = uniqid();
        $event = array("event_id" => $event_id, "start_time" => $start_time, "summary" => $_GET['summary'], "grid" => $grid, "cluster" => $cluster, "host_regex" => $_GET['host_regex']);
        if (isset($_GET['end_time'])) {
            $event['end_time'] = $_GET['end_time'] == "now" ? time() : strtotime($_GET['end_time']);
        }
        $message = ganglia_events_add($event);
        break;
    case "edit":
        $message = ganglia_event_modify($_GET);
        break;
    case "remove":
    case "delete":
        if (!isset($_GET['event_id'])) {
            api_return_error("No event_id has been supplied.");
        }
        $message = ganglia_event_delete($_GET['event_id']);
        break;
    default:
        api_return_error("No valid action specified");
        break;
}
// end of switch ( $_GET['action'] ) {
print json_encode($message);