Exemplo n.º 1
0
    $_GET['section'] = 'general';
}
if (isset($_GET['timeperiod_id'])) {
    $timeperiod = NagiosTimeperiodPeer::retrieveByPK($_GET['timeperiod_id']);
    if (!$timeperiod) {
        header("Location: timeperiods.php");
    }
} else {
    header("Location: timeperiods.php");
}
// Dummy values for entry form.
$entry = '';
$value = '';
if (isset($_GET['request'])) {
    if ($_GET['request'] == "removeentry") {
        $tempEntry = NagiosTimeperiodEntryPeer::retrieveByPK($_GET['entry_id']);
        if (!$tempEntry || $tempEntry->getTimeperiodId() != $timeperiod->getId()) {
            $error = "That entry either does not exist or does not belong to that timeperiod.";
        } else {
            $tempEntry->delete();
            $success = "Entry deleted.";
        }
    }
    if ($_GET['request'] == "delete" && $_GET['section'] == "exclusions") {
        $exclusion = NagiosTimeperiodExcludePeer::retrieveByPK($_GET['exclude_id']);
        if (!$exclusion) {
            $error = "That exclusion does not exist.";
        } else {
            if ($exclusion->getNagiosTimeperiodRelatedByTimeperiodId()->getId() != $timeperiod->getId()) {
                $error = "That exclusion does not belong to this timeperiod.";
            } else {