Beispiel #1
0
        $lilac->delete_escalation($_GET['escalation_id']);
        $success = "Escalation Deleted";
        unset($host);
    }
    if ($_GET['request'] == "delete" && $_GET['section'] == 'checkcommand') {
        $commandParameter = NagiosHostCheckCommandParameterPeer::retrieveByPK($_GET['checkcommandparameter_id']);
        if ($commandParameter) {
            $commandParameter->delete();
        }
        $success = "Check Command Parameter Deleted.";
    }
    if ($_GET['request'] == "delete" && $_GET['section'] == 'parents') {
        $c = new Criteria();
        $c->add(NagiosHostParentPeer::CHILD_HOST, $host->getId());
        $c->add(NagiosHostParentPeer::PARENT_HOST, $_GET['parent_id']);
        $parentRelationship = NagiosHostParentPeer::doSelectOne($c);
        if (!$parentRelationship) {
            $error = "That parent relationship was not found.";
        } else {
            $parentRelationship->delete();
            $success = "Parent relationship removed.";
        }
    }
}
if (isset($_POST['request'])) {
    $modifiedData = array();
    if (isset($_POST['host_manage']) && count($_POST['host_manage'])) {
        foreach ($_POST['host_manage'] as $key => $value) {
            if (is_array($value)) {
                $modifiedData[$key] = $value;
            } else {
Beispiel #2
0
 function addParentByName($name)
 {
     $parentId = $this->getParentHost();
     $c = new Criteria();
     $c->add(NagiosHostPeer::NAME, $name);
     $c->setIgnoreCase(true);
     $host = NagiosHostPeer::doSelectOne($c);
     if (!$host) {
         return false;
     }
     if (empty($parentId)) {
         $this->setParentHost($host->getId());
         return true;
     }
     // Okay, let's first see if there's a parent relationship around
     $id = $this->getId();
     if (!empty($id)) {
         $c = new Criteria();
         $c->add(NagiosHostParentPeer::CHILD_HOST_TEMPLATE, $this->getId());
         $c->add(NagiosHostParentPeer::PARENT_HOST, $host->getId());
         $relationship = NagiosHostParentPeer::doSelectOne($c);
         if ($relationship) {
             return false;
         }
     }
     // Okay, relationship doesn't exist, let's add it!
     $relationship = new NagiosHostParent();
     $relationship->setNagiosHostTemplate($this);
     $relationship->setNagiosHostRelatedByParentHost($host);
     $relationship->save();
     return true;
 }