Exemple #1
0
                 $hostTemplate->save();
                 unset($modifiedData);
                 $success = "Host template modified.";
                 unset($_GET['edit']);
             } else {
                 if ($_POST['request'] == 'host_template_add_autodiscovery_service') {
                     if (count($modifiedData)) {
                         foreach ($modifiedData as $tempVariable) {
                             $tempVariable = trim($tempVariable);
                         }
                     }
                     if (empty($modifiedData['protocol']) || empty($modifiedData['port']) || !is_numeric($modifiedData['port'])) {
                         $error = "Port is required and must be numeric for Auto-Discovery service filter.";
                     } else {
                         // Error checking is good, let's create a service filter
                         $serviceFilter = new NagiosHostTemplateAutodiscoveryService();
                         $serviceFilter->setExtraInformation($modifiedData['extra_information']);
                         $serviceFilter->setNagiosHostTemplate($hostTemplate);
                         $serviceFilter->setName($modifiedData['name']);
                         $serviceFilter->setPort($modifiedData['port']);
                         $serviceFilter->setProduct($modifiedData['product']);
                         $serviceFilter->setProtocol($modifiedData['protocol']);
                         $serviceFilter->setVersion($modifiedData['version']);
                         $serviceFilter->save();
                         $success = "Auto-Discovery Service Filter Created";
                     }
                 }
             }
         }
     }
 }
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      NagiosHostTemplateAutodiscoveryService $value A NagiosHostTemplateAutodiscoveryService object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(NagiosHostTemplateAutodiscoveryService $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }