Example #1
0
 function UpdateTemplate()
 {
     $this->MakeSafe();
     $sql = "UPDATE fac_DeviceTemplate SET ManufacturerID={$this->ManufacturerID},\n\t\t\tModel=\"{$this->Model}\", Height={$this->Height}, Weight={$this->Weight}, \n\t\t\tWattage={$this->Wattage}, DeviceType=\"{$this->DeviceType}\", \n\t\t\tPSCount={$this->PSCount}, NumPorts={$this->NumPorts}, Notes=\"{$this->Notes}\", \n\t\t\tFrontPictureFile=\"{$this->FrontPictureFile}\", RearPictureFile=\"{$this->RearPictureFile}\",\n\t\t\tChassisSlots={$this->ChassisSlots}, RearChassisSlots={$this->RearChassisSlots}, SNMPVersion=\"{$this->SNMPVersion}\",\n\t\t\tGlobalID={$this->GlobalID}, ShareToRepo={$this->ShareToRepo}, KeepLocal={$this->KeepLocal}\n\t\t\tWHERE TemplateID={$this->TemplateID};";
     $old = new DeviceTemplate();
     $old->TemplateID = $this->TemplateID;
     $old->GetTemplateByID();
     if ($old->DeviceType == "CDU" && $this->DeviceType != $old->DeviceType) {
         // Template changed from CDU to something else, clean up the mess
         $cdut = new CDUTemplate();
         $cdut->TemplateID = $this->TemplateID;
         $cdut->DeleteTemplate();
     } elseif ($this->DeviceType == "CDU" && $this->DeviceType != $old->DeviceType) {
         // Template changed to CDU from something else, make the extra stuff
         $cdut = new CDUTemplate();
         $cdut->Model = $this->Model;
         $cdut->ManufacturerID = $this->ManufacturerID;
         $cdut->CreateTemplate($this->TemplateID);
     }
     if ($old->DeviceType == "Sensor" && $this->DeviceType != $old->DeviceType) {
         // Template changed from Sensor to something else, clean up the mess
         $st = new SensorTemplate();
         $st->TemplateID = $this->TemplateID;
         $st->DeleteTemplate();
     } elseif ($this->DeviceType == "Sensor" && $this->DeviceType != $old->DeviceType) {
         // Template changed to Sensor from something else, make the extra stuff
         $st = new SensorTemplate();
         $st->Model = $this->Model;
         $st->ManufacturerID = $this->ManufacturerID;
         $st->CreateTemplate($this->TemplateID);
     }
     if (!$this->query($sql)) {
         return false;
     } else {
         class_exists('LogActions') ? LogActions::LogThis($this, $old) : '';
         $this->MakeDisplay();
         return true;
     }
 }
Example #2
0
    $template->Managed = isset($_REQUEST['managed']) ? 1 : 0;
    $template->ATS = isset($_REQUEST['ats']) ? 1 : 0;
    $template->SNMPVersion = $_REQUEST['snmpversion'];
    $template->VersionOID = $_REQUEST['versionoid'];
    $template->Multiplier = $_REQUEST['multiplier'];
    $template->OID1 = $_REQUEST['oid1'];
    $template->OID2 = $_REQUEST['oid2'];
    $template->OID3 = $_REQUEST['oid3'];
    $template->ATSStatusOID = $_REQUEST['atsstatusoid'];
    $template->ATSDesiredResult = $_REQUEST['atsdesiredresult'];
    $template->ProcessingProfile = $_REQUEST['processingprofile'];
    $template->Voltage = $_REQUEST["voltage"];
    $template->Amperage = $_REQUEST["amperage"];
    $template->NumOutlets = $_REQUEST["numoutlets"];
    if ($_REQUEST['action'] == 'Create') {
        $template->CreateTemplate();
    } else {
        $status = __("Updated");
        $template->UpdateTemplate();
    }
}
$templateList = $template->GetTemplateList();
$ManufacturerList = $manufacturer->GetManufacturerList();
$managed = $template->Managed ? " checked" : "";
$ats = $template->ATS ? " checked" : "";
?>
<!doctype html>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Example #3
0
     $t->UpdateTemplate();
     $updating = true;
 } else {
     $t->TemplateID = 0;
     $t->CreateTemplate();
     $updating = false;
 }
 if ($t->DeviceType == "CDU" && is_object(@$t->cdutemplate)) {
     $ct->ManufacturerID = $t->ManufacturerID;
     $ct->Model = $t->Model;
     foreach ($t->cdutemplate as $prop => $val) {
         $ct->{$prop} = $val;
     }
     $ct->TemplateID = $t->TemplateID;
     if (!$updating) {
         $ct->CreateTemplate($t->TemplateID);
     } else {
         $ct->UpdateTemplate();
     }
 }
 if ($t->DeviceType == "Chassis" && is_array(@$tem->slots)) {
     foreach ($tem->slots as $sl) {
         foreach ($sl as $prop => $val) {
             $cs->{$prop} = $val;
         }
         $cs->TemplateID = $t->TemplateID;
         if (!$updating) {
             $cs->CreateSlot();
         } else {
             $cs->UpdateSlot();
         }