Ejemplo n.º 1
0
    if (!$error) {
        $app->response->status(201);
        echo json_encode($facilitator);
    } else {
        $app->response->status(400);
        echo $error;
        return;
    }
});
$app->get("/calendar/facilitators/request/:id", function ($id) use($app) {
    $config = Configuration::get_configuration('calendar');
    if (!$config["facilitator"]) {
        return;
    }
    $conn = Persistence::get_database_object();
    $event = Postmortem::get_event($id, $conn);
    $user = MorgueAuth::get_auth_data();
    $userHtml = Contact::get_html_for_user($user['username']);
    $domain = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
    $to = implode(", ", $config["facilitators_email"]);
    $to .= ', ' . Contact::get_email_for_user($user['username']);
    $from = "Morgue <*****@*****.**>";
    $subject = "Facilitator needed [PM-{$id}]";
    $message = '
        <html>
        <head>
          <title>Facilitator Needed for PM-' . $id . '</title>
        </head>
        <body style="font-family: \'Helvetica Neue\', Helvetica,Arial, sans-serif;">
          <h3>' . $userHtml . ' has requested a facilitator for this event :</h3>
          <a href="' . $domain . '/events/' . $id . '" style="text-decoration:none;"><h3>' . $event["title"] . '</h3></a>
Ejemplo n.º 2
0
    header("Content-Type: application/json");
    echo json_encode(array("summary" => $event["summary"]));
});
$app->get('/events/:id/lock', function ($id) use($app) {
    header("Content-Type: application/json");
    $event = Postmortem::get_event($id);
    $status = Postmortem::get_event_edit_status($event);
    if ($status === Postmortem::EDIT_UNLOCKED) {
        Postmortem::set_event_edit_status($id);
    }
    $return = ["status" => $status, "modifier" => $event["modifier"]];
    echo json_encode($return);
});
$app->put('/events/:id', function ($id) use($app) {
    // get the base event data
    $old_event = Postmortem::get_event($id);
    if (is_null($old_event["id"])) {
        $app->response->status(500);
        return;
    }
    $event = ["title" => $old_event["title"], "id" => $id];
    $params = $app->request->params();
    foreach ($params as $key => $value) {
        switch ($key) {
            case "title":
                $event["title"] = $value;
                break;
            case "summary":
                $event["summary"] = $value;
                break;
            case "why_surprised":
Ejemplo n.º 3
0
<?php

$app->get('/history/:event_id/:history_id', function ($event_id, $history_id) use($app) {
    $event = Postmortem::get_event($event_id);
    $history = Postmortem::get_history_event($history_id);
    $timezone = getUserTimezone();
    $tz = new DateTimeZone($timezone);
    $edited = new DateTime();
    $edited->setTimestamp($history['create_date']);
    $edited->setTimezone($tz);
    $edited = $edited->format('m/d/Y G:ia');
    $edited = " @ " . $edited;
    $content = "history/views/diff";
    $show_sidebar = false;
    $page_title = "Event History";
    include "views/page.php";
});