Exemplo n.º 1
0
if (isset($_POST['request'])) {
    if ($_POST['request'] == 'add_host_template') {
        // Check for pre-existing host template with same name
        if ($lilac->host_template_exists($_POST['template_name'])) {
            $error = "A host template with that name already exists!";
        } else {
            // Field Error Checking
            if ($_POST['template_name'] == '' || $_POST['template_description'] == '') {
                $addError = 1;
                $error = "Fields shown are required and cannot be left blank.";
            } else {
                $template = new NagiosHostTemplate();
                $template->setName($_POST['template_name']);
                $template->setDescription($_POST['template_description']);
                $template->save();
                header("Location: host_template.php?id=" . $template->getId());
                die;
            }
        }
    }
}
print_header("Host Template Editor");
print_window_header("Add Host Template", "100%");
?>
<form name="host_template_add_form" method="post" action="add_host_template.php">
<input type="hidden" name="request" value="add_host_template" />
<?php 
double_pane_form_window_start();
?>
<tr bgcolor="f0f0f0">
	<td colspan="2" class="formcell">
Exemplo n.º 2
0
 /**
  * Declares an association between this object and a NagiosHostTemplate object.
  *
  * @param      NagiosHostTemplate $v
  * @return     NagiosEscalation The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setNagiosHostTemplate(NagiosHostTemplate $v = null)
 {
     if ($v === null) {
         $this->setHostTemplate(NULL);
     } else {
         $this->setHostTemplate($v->getId());
     }
     $this->aNagiosHostTemplate = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the NagiosHostTemplate object, it will not be re-added.
     if ($v !== null) {
         $v->addNagiosEscalation($this);
     }
     return $this;
 }
Exemplo n.º 3
0
 /**
  * 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      NagiosHostTemplate $value A NagiosHostTemplate object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(NagiosHostTemplate $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }