delete_contact_notification_command($_GET['contact_notification_command_id']); $success = "Command Deleted"; unset($_GET['command_id']); unset($tempData); } else if($_GET['request'] == "delete" && $_GET['section'] == 'groups') { $lilac->get_contact_membership_list($_GET['contact_id'], $tempGroupList); $numOfGroups = count($tempGroupList); if($numOfGroups > 1) { $c = new Criteria(); $c->add(NagiosContactGroupMemberPeer::CONTACT, $_GET['contact_id']); $c->add(NagiosContactGroupMemberPeer::CONTACTGROUP, $_GET['contactgroup_id']); $membership = NagiosContactGroupMemberPeer::doSelectOne($c); if($membership) { $membership->delete(); $success = "Membership Deleted."; } } else { $error = "There must be at least one contact group!"; } } else if($_GET['request'] == "delete" && $_GET['section'] == 'general') { $lilac->get_contact_list($tempList); $numOfContacts = count($tempList); if($numOfContacts > 1) { $lilac->delete_contact($_GET['contact_id']); $success = "Contact deleted."; unset($tempData); unset($_GET['contact_id']); } else { $error = "There must be at least one contact in the system."; } } else if($_GET['request'] == "delete" && $_GET['section'] == 'addresses') { // !!!!!!!!!!!!!! This is where we do dependency error checking $lilac->delete_contact_address($_GET['contactaddress_id']); $success = "Contact address deleted."; unset($tempData); } } if(isset($_POST['request'])) { // Load Up The Session Data if(count($_POST['contact_manage'])) { foreach($_POST['contact_manage'] as $key=>$value) { $tempData[$key] = $value; } } if($_POST['request'] == 'add_contact') { // Error check! if(count($tempData)) { foreach($tempData as $tempVariable) $tempVariable = trim($tempVariable); } // We have checkboxes, let's verify the data against POST if(!isset($_POST['contact_manage']['host_notification_options_down'])) $tempData['host_notification_options_down'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_unreachable'])) $tempData['host_notification_options_unreachable'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_recovery'])) $tempData['host_notification_options_recovery'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_flapping'])) $tempData['host_notification_options_flapping'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_scheduled_downtime'])) $tempData['host_notification_options_scheduled_downtime'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_warning'])) $tempData['service_notification_options_warning'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_unknown'])) $tempData['service_notification_options_unknown'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_critical'])) $tempData['service_notification_options_critical'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_recovery'])) $tempData['service_notification_options_recovery'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_flapping'])) $tempData['service_notification_options_flapping'] = 0; if(!isset($_POST['contact_manage']['can_submit_commands'])) $tempData['can_submit_commands'] = 0; if(!isset($_POST['contact_manage']['retain_status_information'])) $tempData['retain_status_information'] = 0; if(!isset($_POST['contact_manage']['retain_nonstatus_information'])) $tempData['retain_nonstatus_information'] = 0; if(!isset($_POST['contact_manage']['host_notifications_enabled'])) $tempData['host_notifications_enabled'] = 0; if(!isset($_POST['contact_manage']['service_notifications_enabled'])) $tempData['service_notifications_enabled'] = 0; // Field Error Checking if($tempData['contact_name'] == '' || $tempData['alias'] == '') { $addError = 1; $error = "Fields shown are required and cannot be left blank."; } else { // Check for pre-existing contact with same name if($lilac->contact_exists($tempData['contact_name'])) { $error = "A contact with that name already exists!"; } else { $tempContactGroup = $tempData['contact_group']; unset($tempData['contact_group']); // All is well for error checking, add the contact into the db. $contact = $lilac->add_contact($tempData); $success = "Contact added"; if( $tempContactGroup && $tempContactGroup != 0) { $contactGroup = NagiosContactGroupPeer::retrieveByPK($tempContactGroup); if($contactGroup && $contact) { $contactGroupMember = new NagiosContactGroupMember(); $contactGroupMember->setContact($contact->getId()); $contactGroupMember->setContactgroup($contactGroup->getId()); $contactGroupMember->save(); } } unset($_GET['contact_add']); } } } else if($_POST['request'] == 'modify_contact') { // Error check! if(count($tempData)) { foreach($tempData as $tempVariable) $tempVariable = trim($tempVariable); } // We have checkboxes, let's verify the data against POST if(!isset($_POST['contact_manage']['host_notification_options_down'])) $tempData['host_notification_options_down'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_unreachable'])) $tempData['host_notification_options_unreachable'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_recovery'])) $tempData['host_notification_options_recovery'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_flapping'])) $tempData['host_notification_options_flapping'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_scheduled_downtime'])) $tempData['host_notification_options_scheduled_downtime'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_warning'])) $tempData['service_notification_options_warning'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_unknown'])) $tempData['service_notification_options_unknown'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_critical'])) $tempData['service_notification_options_critical'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_recovery'])) $tempData['service_notification_options_recovery'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_flapping'])) $tempData['service_notification_options_flapping'] = 0; if(!isset($_POST['contact_manage']['can_submit_commands'])) $tempData['can_submit_commands'] = 0; if(!isset($_POST['contact_manage']['retain_status_information'])) $tempData['retain_status_information'] = 0; if(!isset($_POST['contact_manage']['retain_nonstatus_information'])) $tempData['retain_nonstatus_information'] = 0; if(!isset($_POST['contact_manage']['host_notifications_enabled'])) $tempData['host_notifications_enabled'] = 0; if(!isset($_POST['contact_manage']['service_notifications_enabled'])) $tempData['service_notifications_enabled'] = 0; // Field Error Checking if($tempData['contact_name'] == '' || $tempData['alias'] == '') { $addError = 1; $error = "Fields shown are required and cannot be left blank."; } else { if($tempData['contact_name'] != $tempContactInfo->getName() && $lilac->contact_exists($tempData['contact_name'])) { $error = "A contact with that name already exists!"; } else { // All is well for error checking, modify the contact. $lilac->modify_contact($_POST['contact_id'], $tempData); // Remove session data unset($tempData); $success = "Contact modified."; unset($_GET['edit']); } $_GET['section'] = "general"; } } else if($_POST['request'] == 'add_notification_command') { if($lilac->contact_has_notification_command($_GET['contact_id'], $tempData['notification_add'])) { $error = "That notification command already exists in that list!"; unset($tempData); } else { $lilac->add_contacts_notification_command($_GET['contact_id'], $tempData['notification_add']); $success = "Notification Command added."; unset($tempData); } } else if($_POST['request'] == 'add_member_command') { if($lilac->contactgroup_has_member($tempData['group_add']['contactgroup_id'], $_GET['contact_id'])) { $error = "That member already exists in that list!"; unset($tempData); } else { $lilac->add_contactgroup_member($tempData['group_add']['contactgroup_id'], $_GET['contact_id']); $success = "New Group membership added."; unset($tempData); } } else if($_POST['request'] == 'contact_address_add') { // All is well for error checking, modify the contact. $lilac->add_contact_address($_GET['contact_id'], $tempData); // Remove session data unset($tempData); $success = "Contact Address added."; } } if(isset($_GET['contact_id'])) { $tempContactInfo = NagiosContactPeer::retrieveByPK($_GET['contact_id']); if(!$tempContactInfo) { header("Location: welcome.php"); } } $lilac->get_contact_list($contact_list); $numOfContacts = count($contact_list); $lilac->return_period_list($tempList); $period_list = array(); foreach($tempList as $tempPeriod) { $period_list[] = array("timeperiod_id" => $tempPeriod->getId(), "timeperiod_name" => $tempPeriod->getName()); } print_header("Contact Editor"); ?> 'General', 'notification' => 'Notification Commands', 'groups' => 'Group Membership', 'addresses' => 'Addresses' ); // PLACEHOLDER TO PUT CONTACT INFO print_window_header("Contact Info for " . $tempContactInfo->getName(), "100%"); print_subnav($subnav, $_GET['section'], "section", $_SERVER['PHP_SELF'] . "?contact_id=" . $tempContactInfo->getId()); if($_GET['section'] == 'general') { ?>
Contact Name:
element_desc("contact_name", "nagios_contacts_desc"); ?>

Description:

element_desc("alias", "nagios_contacts_desc"); ?>

getCanSubmitCommands() == 1) ? "CHECKED" : '');?>>Can Submit Commands

getRetainStatusInformation() == 1) ? "CHECKED" : '');?>>Retain Status Information

getRetainNonstatusInformation() == 1) ? "CHECKED" : '');?>>Retain Non-Status Information

getHostNotificationsEnabled() == 1) ? "CHECKED" : '');?>>Host Notifications Enabled

getServiceNotificationsEnabled() == 1) ? "CHECKED" : '');?>>Service Notifications Enabled

Host Notification Period: getHostNotificationPeriod() != null) ? $tempContactInfo->getHostNotificationPeriod() : '');?>
element_desc("host_notification_period", "nagios_contacts_desc"); ?>

Service Notification Period: getHostNotificationPeriod() != null) ? $tempContactInfo->getServiceNotificationPeriod() : '');?>
element_desc("service_notification_period", "nagios_contacts_desc"); ?>

Host Notification Options:
getHostNotificationOnDown() == 1) ? "CHECKED" : '');?> name="contact_manage[host_notification_options_down]" value="1">Down
getHostNotificationOnUnreachable() == 1) ? "CHECKED" : '');?> name="contact_manage[host_notification_options_unreachable]" value="1">Unreachable
getHostNotificationOnRecovery() == 1) ? "CHECKED" : '');?> name="contact_manage[host_notification_options_recovery]" value="1">Recovery
getHostNotificationOnFlapping() == 1) ? "CHECKED" : '');?> name="contact_manage[host_notification_options_flapping]" value="1">Flapping
getHostNotificationOnScheduledDowntime() == 1) ? "CHECKED" : '');?> name="contact_manage[host_notification_options_scheduled_downtime]" value="1">Scheduled Downtime
element_desc("host_notification_options", "nagios_contacts_desc"); ?>

Service Notification Options:
getServiceNotificationOnWarning() == 1) ? "CHECKED" : '');?> name="contact_manage[service_notification_options_warning]" value="1">Warning
getServiceNotificationOnUnknown() == 1) ? "CHECKED" : '');?> name="contact_manage[service_notification_options_unknown]" value="1">Unknown
getServiceNotificationOnCritical() == 1) ? "CHECKED" : '');?> name="contact_manage[service_notification_options_critical]" value="1">Critical
getServiceNotificationOnRecovery() == 1) ? "CHECKED" : '');?> name="contact_manage[service_notification_options_recovery]" value="1">Recovery
getServiceNotificationOnFlapping() == 1) ? "CHECKED" : '');?> name="contact_manage[service_notification_options_flapping]" value="1">Flapping
element_desc("service_notification_options", "nagios_contacts_desc"); ?>

Email:

element_desc("email", "nagios_contacts_desc"); ?>

Pager:

 [ Cancel ]
Contact Name: getName();?>
Description: getAlias();?>
Email: getEmail();?>
Pager: getPager();?>

Can Submit Commands:getCanSubmitCommands()) ? "Yes" : "No";?>
Retain Status Information:getRetainStatusInformation()) ? "Yes" : "No";?>
Retain Non-Status Information:getRetainNonstatusInformation()) ? "Yes" : "No";?>

Host Notifications Enabled:getHostNotificationsEnabled()) ? "Yes" : "No";?>
Service Notifications Enabled:getServiceNotificationsEnabled()) ? "Yes" : "No";?>

Host Notification Period: return_period_name($tempContactInfo->getHostNotificationPeriod());?>
Service Notification Period: return_period_name($tempContactInfo->getServiceNotificationPeriod());?>
Host Notification On: getHostNotificationOnDown() && !$tempContactInfo->getHostNotificationOnUnreachable() && !$tempContactInfo->getHostNotificationOnRecovery() && !$tempContactInfo->getHostNotificationOnFlapping() && !$tempContactInfo->getHostNotificationOnScheduledDowntime()) { print("None"); } else { if($tempContactInfo->getHostNotificationOnDown()) { print("Down"); if($tempContactInfo->getHostNotificationOnUnreachable() || $tempContactInfo->getHostNotificationOnRecovery() || $tempContactInfo->getHostNotificationOnFlapping() || $tempContactInfo->getHostNotificationOnScheduledDowntime()) print(","); } if($tempContactInfo->getHostNotificationOnUnreachable()) { print("Unreachable"); if($tempContactInfo->getHostNotificationOnRecovery() || $tempContactInfo->getHostNotificationOnFlapping() || $tempContactInfo->getHostNotificationOnScheduledDowntime()) print(","); } if($tempContactInfo->getHostNotificationOnRecovery()) { print("Recovery"); if($tempContactInfo->getHostNotificationOnFlapping() || $tempContactInfo->getHostNotificationOnScheduledDowntime()) print(","); } if($tempContactInfo->getHostNotificationOnFlapping()) { print("Flapping"); if($tempContactInfo->getHostNotificationOnScheduledDowntime()) print(","); } if($tempContactInfo->getHostNotificationOnScheduledDowntime()) { print("Scheduled Downtime"); } } ?>
Service Notification On: getServiceNotificationOnWarning() && !$tempContactInfo->getServiceNotificationOnUnknown() && !$tempContactInfo->getServiceNotificationOnCritical() && !$tempContactInfo->getServiceNotificationOnRecovery()) print("None"); else { if($tempContactInfo->getServiceNotificationOnWarning()) { print("Warning"); if($tempContactInfo->getServiceNotificationOnUnknown() || $tempContactInfo->getServiceNotificationOnCritical() || $tempContactInfo->getServiceNotificationOnRecovery()) print(","); } if($tempContactInfo->getServiceNotificationOnUnknown()) { print("Unknown"); if($tempContactInfo->getServiceNotificationOnCritical() || $tempContactInfo->getServiceNotificationOnRecovery()) print(","); } if($tempContactInfo->getServiceNotificationOnCritical()) { print("Critical"); if($tempContactInfo->getServiceNotificationOnRecovery() || $tempContactInfo->getServiceNotificationOnFlapping()) print(","); } if($tempContactInfo->getServiceNotificationOnRecovery()) { print("Recovery"); if($tempContactInfo->getServiceNotificationOnFlapping()) print(","); } if($tempContactInfo->getServiceNotificationOnFlapping()) { print("Flapping"); } } ?>

[ Edit ]

[ Delete This Contact ] return_command_list($tempList); foreach($tempList as $command) { $command_list[] = array("command_id" => $command->getId(), "command_name" => $command->getName()); } $numOfHostCommands = 0; $numOfServiceCommands = 0; $lilac->get_contacts_notification_commands($_GET['contact_id'], $contactNotificationCommands); if(isset($contactNotificationCommands['host'])) $numOfHostCommands = count($contactNotificationCommands['host']); if(isset($contactNotificationCommands['service'])) $numOfServiceCommands = count($contactNotificationCommands['service']); ?>
Host Notification Commands:
 [ Delete ] getNagiosCommand()->getName();?>


Add New Host Notification Command: No Commands Available

element_desc("host_notification_commands", "nagios_contacts_desc"); ?>


Service Notification Commands:
 [ Delete ] getNagiosCommand()->getName();?>


Add New Service Notification Command: No Commands Available

element_desc("service_notification_commands", "nagios_contacts_desc"); ?>

get_contact_membership_list($_GET['contact_id'], $group_list); $numOfGroups = count($group_list); // Get list of contact groups $lilac->get_contactgroup_list($tempList); $contactgroups_list = array(); foreach($tempList as $contactgroup) { $contactgroups_list[] = array('contactgroup_id' => $contactgroup->getId(), 'contactgroup_name' => $contactgroup->getName()); } $numOfContactGroups = count($contactgroups_list); ?>
Contact Group Membership:
 [ Delete ] getNagiosContactGroup()->getName();?>: getNagiosContactGroup()->getAlias();?>


Add New Group Membership: No Contact Groups Available

element_desc("members", "nagios_contactgroups_desc"); ?>

get_contact_addresses($_GET['contact_id'], $contactAddresses); $numOfAddresses = count($contactAddresses); ?>
Additional Addresses:
 [ Delete ] $CONTACTADDRESS$: getAddress();?>


Value for $CONTACTADDRESS$:
element_desc("address", "nagios_contacts_desc"); ?>



 Add A New Contact

Contact Name Description
 getName();?> getAlias();?>
No Contacts Exist
get_contactgroup_list($tempList); $contactgroups_list = array(); foreach($tempList as $contactgroup) { $contactgroups_list[] = array('contactgroup_id' => $contactgroup->getId(), 'contactgroup_name' => $contactgroup->getName()); } $contactgroups_list = array_merge( array( array( 'contactgroup_id'=>0, 'contactgroup_name'=>"None")), $contactgroups_list); print_window_header("Add A Contact", "100%"); ?>
Contact Name:
element_desc("contact_name", "nagios_contacts_desc"); ?>

Description:

element_desc("alias", "nagios_contacts_desc"); ?>

Host Notification Period:
element_desc("host_notification_period", "nagios_contacts_desc"); ?>

Service Notification Period:
element_desc("service_notification_period", "nagios_contacts_desc"); ?>

Can Submit Commands

Retain Status Information

Retain Non-Status Information

Host Notifications Enabled

Service Notifications Enabled

Host Notification Options:
Down
Unreachable
Recovery
Flapping
Scheduled Downtime
element_desc("host_notification_options", "nagios_contacts_desc"); ?>

Service Notification Options:
Warning
Unknown
Critical
Recovery
Flapping
element_desc("service_notification_options", "nagios_contacts_desc"); ?>

Initial Contact Group:
element_desc("members", "nagios_contactgroups_desc"); ?>

Email:

element_desc("email", "nagios_contacts_desc"); ?>

Pager:

element_desc("pager", "nagios_contacts_desc"); ?>


 [ Cancel ]