Exemple #1
0
        {
            return zbx_date2str(DATE_TIME_FORMAT, $t);
        }
        function format_time2($t)
        {
            return format_time($t);
        }
        break;
}
$table->setHeader($header);
$intervals = array();
for ($t = $from; $t <= $to; $t++) {
    if (($start = get_time($t)) > time()) {
        break;
    }
    if (($end = get_time($t + 1)) > time()) {
        $end = time();
    }
    $intervals[] = array('from' => $start, 'to' => $end);
}
$sla = API::Service()->getSla(array('serviceids' => $service['serviceid'], 'intervals' => $intervals));
$sla = reset($sla);
foreach ($sla['sla'] as $intervalSla) {
    $ok = new CSpan(sprintf('%dd %dh %dm', $intervalSla['okTime'] / SEC_PER_DAY, $intervalSla['okTime'] % SEC_PER_DAY / SEC_PER_HOUR, $intervalSla['okTime'] % SEC_PER_HOUR / SEC_PER_MIN), 'off');
    $problems = new CSpan(sprintf('%dd %dh %dm', $intervalSla['problemTime'] / SEC_PER_DAY, $intervalSla['problemTime'] % SEC_PER_DAY / SEC_PER_HOUR, $intervalSla['problemTime'] % SEC_PER_HOUR / SEC_PER_MIN), 'on');
    $downtime = sprintf('%dd %dh %dm', $intervalSla['downtimeTime'] / SEC_PER_DAY, $intervalSla['downtimeTime'] % SEC_PER_DAY / SEC_PER_HOUR, $intervalSla['downtimeTime'] % SEC_PER_HOUR / SEC_PER_MIN);
    $percentage = new CSpan(sprintf('%2.4f', $intervalSla['sla']), $intervalSla['sla'] >= $service['goodsla'] ? 'off' : 'on');
    $table->addRow(array(format_time($intervalSla['from']), format_time2($intervalSla['to']), $ok, $problems, $downtime, $service['showsla'] ? $percentage : '-', $service['showsla'] ? new CSpan($service['goodsla']) : '-'));
}
$table->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
Exemple #2
0
        }
        function format_time2($t)
        {
            return format_time($t);
        }
        break;
}
$table->SetHeader($header, "vertical_header");
for ($t = $from; $t <= $to; $t++) {
    if (($start = get_time($t)) > time()) {
        break;
    }
    if (($end = get_time($t + 1)) > time()) {
        $end = time();
    }
    $table_row = array(format_time($start), format_time2($end));
    foreach ($users as $userid => $alias) {
        $all = 0;
        $cnt_by_type = array();
        foreach ($media_types as $mediatypeid => $description) {
            $cnt_data = DBfetch(DBselect("select count(*) as cnt from alerts a " . " where a.userid=" . $userid . " and a.mediatypeid=" . $mediatypeid . " and clock>{$start} and clock<{$end} "));
            if (!$cnt_data) {
                $cnt_data = 0;
            } else {
                $cnt_data = $cnt_data['cnt'];
            }
            array_push($cnt_by_type, $cnt_data);
            $all += $cnt_data;
        }
        array_push($table_row, array($all, $media_type == 0 ? SPACE . "(" . implode('/', $cnt_by_type) . ")" : ""));
    }
Exemple #3
0
            $wd = date('w', $time);
            $wd = $wd == 0 ? 6 : $wd - 1;
            return $time + ($w * 7 - $wd) * 24 * 3600;
        }
        function format_time($t)
        {
            return zbx_date2str(S_REPORT3_WEEKLY_DATE_FORMAT, $t);
        }
        function format_time2($t)
        {
            return format_time($t);
        }
        break;
}
$table->SetHeader($header);
for ($t = $from; $t <= $to; $t++) {
    if (($start = get_time($t)) > time()) {
        break;
    }
    if (($end = get_time($t + 1)) > time()) {
        $end = time();
    }
    $stat = calculate_service_availability($service['serviceid'], $start, $end);
    $ok = new CSpan(sprintf('%dd %dh %dm', $stat['ok_time'] / (24 * 3600), $stat['ok_time'] % (24 * 3600) / 3600, $stat['ok_time'] % 3600 / 60), 'off');
    $problems = new CSpan(sprintf('%dd %dh %dm', $stat['problem_time'] / (24 * 3600), $stat['problem_time'] % (24 * 3600) / 3600, $stat['problem_time'] % 3600 / 60), 'on');
    $downtime = sprintf('%dd %dh %dm', $stat['downtime_time'] / (24 * 3600), $stat['downtime_time'] % (24 * 3600) / 3600, $stat['downtime_time'] % 3600 / 60);
    $percentage = new CSpan(sprintf('%2.2f%%', $stat['ok']), 'off');
    $table->addRow(array(format_time($start), format_time2($end), $ok, $problems, $downtime, $percentage, $service['showsla'] == 1 ? new CSpan($service['goodsla'], $stat['ok'] >= $service['goodsla'] ? 'off' : 'on') : '-'));
}
$table->Show();
include_once 'include/page_footer.php';
Exemple #4
0
            $wd = date("w", $time);
            $wd = $wd == 0 ? 6 : $wd - 1;
            return $time + ($w * 7 - $wd) * 24 * 3600;
        }
        function format_time($t)
        {
            return date("d M Y H:i", $t);
        }
        function format_time2($t)
        {
            return format_time($t);
        }
        break;
}
$table->SetHeader($header);
for ($t = $from; $t <= $to; $t++) {
    if (($start = get_time($t)) > time()) {
        break;
    }
    if (($end = get_time($t + 1)) > time()) {
        $end = time();
    }
    $stat = calculate_service_availability($service["serviceid"], $start, $end);
    $ok = new CSpan(sprintf("%dd %dh %dm", $stat["ok_time"] / (24 * 3600), $stat["ok_time"] % (24 * 3600) / 3600, $stat["ok_time"] % 3600 / 60), "off");
    $problems = new CSpan(sprintf("%dd %dh %dm", $stat["problem_time"] / (24 * 3600), $stat["problem_time"] % (24 * 3600) / 3600, $stat["problem_time"] % 3600 / 60), "on");
    $downtime = sprintf("%dd %dh %dm", $stat["downtime_time"] / (24 * 3600), $stat["downtime_time"] % (24 * 3600) / 3600, $stat["downtime_time"] % 3600 / 60);
    $percentage = new CSpan(sprintf("%2.2f%%", $stat["ok"]), "off");
    $table->AddRow(array(format_time($start), format_time2($end), $ok, $problems, $downtime, $percentage, $service["showsla"] == 1 ? new CSpan($service["goodsla"], $stat["ok"] >= $service["goodsla"] ? "off" : "on") : "-"));
}
$table->Show();
include_once "include/page_footer.php";
Exemple #5
0
function format_episode(&$y, &$item, $pm)
{
    if ($item->deleted == "yes") {
        return;
    }
    if ($y->displaymode == "downloadednew" && (!is_dir('prefs/podcasts/' . $pm . '/' . $item->key) && $item->new == "no")) {
        return;
    }
    if ($y->displaymode == "new" && $item->new == "no") {
        return;
    }
    if ($y->displaymode == "unlistened" && $item->listened == "yes") {
        // Track cannot be new and unlistened, that can't happen because it makes no sense
        return;
    }
    if ($y->displaymode == "downloaded" && !is_dir('prefs/podcasts/' . $pm . '/' . $item->key)) {
        return;
    }
    print '<div class="clickable clicktrack item podcastitem draggable" name="' . htmlspecialchars_decode($item->link) . '">';
    print '<div class="containerbox">';
    if ($item->new == "yes") {
        print '<i title="' . get_int_text("podcast_tooltip_new") . '" class="icon-sun fixed newpodicon fridge"></i>';
    } else {
        if ($item->listened == "no") {
            print '<i title="' . get_int_text("podcast_tooltip_notnew") . '" class="icon-unlistened fixed oldpodicon fridge"></i>';
        }
    }
    print '<div class="podtitle expand">' . $item->title . '</div></div>';
    print '<div class="whatdoicallthis padright clearfix"><span class="tleft"><i>' . $item->pubdate . '</i></span>';
    if ($item->duration != 0) {
        print '<span class="tright">' . format_time($item->duration) . '</span>';
    }
    print '</div>';
    if ($y->daysLive > -1 && $item->listened == "no" && !is_dir('prefs/podcasts/' . $pm . '/' . $item->key)) {
        $pubtime = strtotime((string) $item->pubdate);
        $expiretime = $pubtime + $y->daysLive * 86400;
        $timeleft = format_time2($expiretime - time());
        if ($expiretime < time()) {
            print '<div><b>' . get_int_text("podcast_expired") . '</b></div>';
        } else {
            if ($expiretime - time() < 86400) {
                print '<div><b><font color="red">' . get_int_text("podcast_timeleft", array($timeleft)) . "</font></b></div>";
            } else {
                print '<div><b>' . get_int_text("podcast_timeleft", array($timeleft)) . "</b></div>";
            }
        }
    }
    if ($y->hidedescriptions == "true") {
        // Testing for true because podcasts subscribed with rompr < 0.60 won't have this option set at all
    } else {
        print '<div class="whatdoicallthis">' . format_text((string) $item->description) . '</div>';
    }
    print '<div class="clearfix" name="podcontrols_' . $pm . '">';
    if (is_dir('prefs/podcasts/' . $pm . '/' . $item->key)) {
        print '<i class="icon-floppy podicon tleft fridge" title="' . get_int_text("podcast_tooltip_downloaded") . '"></i>';
    } else {
        print '<i class="icon-download podicon clickable clickicon tleft poddownload fridge" title="' . get_int_text("podcast_tooltip_download") . '" name="poddownload_' . $item->key . '"></i>';
    }
    if ($item->listened == "no") {
        print '<i class="icon-headphones podicon clickable clickicon tleft podmarklistened fridge" title="' . get_int_text("podcast_tooltip_mark") . '" name="podmarklistened_' . $item->key . '"></i>';
    }
    print '<i class="icon-cancel-circled podicon clickable clickicon tright podtrackremove fridge" title="' . get_int_text("podcast_tooltip_delepisode") . '" name="podtrackremove_' . $item->key . '" ></i>';
    print '</div>';
    print '</div>';
}