<?php
# Page variables
define("PAGE_ID","timeperiodedit");
define("PAGE_TITLE","Timeperiod object");
define("OBJECTTYPE","timeperiod");
define("OBJECTTYPE","TimePeriod");
require_once("includes/main.inc.php");
include_once("html_wrap/head2.inc.php");
$rowcolor = '';
$object = NULL;
$cntinh = 0;
if (!isset($objectid) ) $objectid = NULL;
if (!is_array($object)) {
$object = $Plugin->GetObjectById($objectid,OBJECTTYPE);
}
$timeperiodname = isset($object[OBJECTTYPE."_name"]) ? $object[OBJECTTYPE."_name"] : $object['name'];
if (!empty($object['name'])) {
$cntinh = NagiosCountInherited(OBJECTTYPE,$timeperiodname);
}
if (!empty($object['use'])) {
$inhobject = $Plugin->GetObjectByName($object['use'],OBJECTTYPE);
foreach($inhobject as $key => $value) {
$object['++'.$key] = $value;
}
}
foreach ($confobjects[OBJECTTYPE] as $key => $propconf) {
$required = 'label';
$value = isset($object[$key]) ? $object[$key] : '';
$inhhtml = "";
if (isset($object["++".$key])) {
$inhhtml = " <td>".$object["++".$key]."</td>\n";
$reqclass = 'requiredok';
} else {
$inhhtml = " <td> </td>";
$reqclass = 'required';
}
$show = str_replace(",", ",<br> ", $value);
if (empty($object[$key])) {
$required = $propconf[2] == TRUE ? $reqclass : 'label';
}
$rowcolor = ($rowcolor != "dataOdd") ? "dataOdd" : "dataEven";
$key=ucfirst(str_replace("_", " ", $key));
$rows[$key] = <<<HTML
<tr class="{$rowcolor}">
<td>$key</td>
<td class="$required" with="3"> </td>
<td>
$show
</td>
$inhhtml
</tr>
HTML;
}
?>
<div align="center">
<table cellpadding="2" border="0">
<tr>
<td colspan="3" align="left">
<b> </b>
</td>
</tr>
<tr class="class">
<th class="data" colspan="3">Properties</th>
<?
if (!empty($object['use'])) {
$parent = $Plugin->GetObjectByName($object['use'],OBJECTTYPE);
print <<<HTML
<th>
Inherits from <a href="timeperiodedit.php?objectid={$parent['__objectid']}"><b>{$parent['name']}</b></a>
</th>
HTML;
} else {
echo "<th class=\"data\"> </th>";
}
echo "</tr>";
echo implode("\n", $rows);
if ( $cntinh > 0 ) {
print ObjectInheritance($timeperiodname, OBJECTTYPE, 'view');
}
if (!empty($object['name'])) {
$userobjs = NagiosObjectUsage($timeperiodname, OBJECTTYPE);
if ($userobjs != NULL) {
print ObjectUsage($timeperiodname, OBJECTTYPE, $userobjs, 'view');
}
}
?>
<tr>
<td colspan="4" align="center">
<hr>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<form method="post">
<input type="submit" value="Close" onclick="parent.close('')">
</form>
</td>
</tr>
</table>
</div>
<?
include_once("html_wrap/tail2.inc.php");
?>