Example #1
0
                 }
             }
             if ($err) {
                 $error = "Entry value must be comma-delimited list of proper values.";
             } else {
                 // Check for existing entry with that name!
                 $c = new Criteria();
                 $c->add(NagiosTimeperiodEntryPeer::TIMEPERIOD_ID, $timeperiod->getId());
                 $c->add(NagiosTimeperiodEntryPeer::ENTRY, $entry);
                 $foundEntry = NagiosTimeperiodEntryPeer::doSelectOne($c);
                 if ($foundEntry) {
                     $error = "That entry already exists.  Remove it then add it with the new value.";
                 } else {
                     // Okay, let's add.
                     $newEntry = new NagiosTimeperiodEntry();
                     $newEntry->setTimeperiodId($timeperiod->getId());
                     $newEntry->setEntry($entry);
                     $newEntry->setValue($value);
                     $newEntry->save();
                     $success = "Entry added.";
                     $entry = '';
                     $value = '';
                 }
             }
         }
     }
 } else {
     if ($_POST['request'] == 'exclusion_add') {
         // first hceck to see if the exclusion exists.
         $c = new Criteria();
         $c->add(NagiosTimeperiodExcludePeer::TIMEPERIOD_ID, $timeperiod->getId());