示例#1
0
文件: routes.php 项目: lursu/morgue
     return;
 }
 if (empty($config['mailto'])) {
     return;
 }
 $content = "anniversary/views/anniversary-mail";
 $show_sidebar = false;
 $page_title = "Today in Post Mortem History";
 $today = date("Y-m-d", time());
 $get_date = trim($app->request->get('date'));
 if ($get_date) {
     $get_date = date("Y-m-d", strtotime($get_date));
     $today = $get_date;
 }
 $conn = Persistence::get_database_object();
 $pm_ids = Anniversary::get_ids($today, $conn);
 $human_readable_date = date("F jS", strtotime($today));
 $pms = array();
 if ($pm_ids['status'] === 0) {
     foreach ($pm_ids['values'] as $k => $v) {
         $pm = Persistence::get_postmortem($v['id'], $conn);
         $pms[] = $pm;
     }
 } else {
     $message = $pm_ids['error'];
     $content = "error";
     include 'views/page.php';
     return;
 }
 if (count($pms)) {
     // get the tags for each PM we found so we can display them
示例#2
0
/**
 * Version of the anniversay page suitble to email
 */
print <<<CSS
    <base href="http://{$_SERVER['SERVER_NAME']}" />
    <style>
        .label.tag {
            margin-right: 20px;
            background-color: #999;
            padding:5px;
            color: white;
        }
        #tag_well {
            margin-top:10px;
        }
    </style>
CSS;
$count = count($pms);
if ($count) {
    if ($count === 1) {
        $outage = "an outage";
    } else {
        $outage = $count . " outages";
    }
    $subject = "{$human_readable_date} is the anniversary of {$outage}.";
    echo "<h3>{$subject}</h3>";
    foreach ($pms as $k => $v) {
        print Anniversary::render_outage($v);
    }
}