예제 #1
0
     $man->ManufacturerID = $tmpl->ManufacturerID;
     $man->GetManufacturerByID();
     $tooltip .= __($row["Label"]) . ": [{$man->Name}] {$tmpl->Model}<br>\n";
     break;
 case "ChassisSlots":
     if ($dev->DeviceType == 'Chassis') {
         $tooltip .= __($row["Label"]) . " " . $dev->{$row}["Field"] . "<br>\n";
     }
     break;
 case "Model":
     $template = new CDUTemplate();
     $manufacturer = new Manufacturer();
     $template->TemplateID = $pdu->TemplateID;
     $template->GetTemplate();
     $manufacturer->ManufacturerID = $template->ManufacturerID;
     $manufacturer->GetManufacturerByID();
     $tooltip .= __($row["Label"]) . ": [{$manufacturer->Name}] {$template->Model}<br>\n";
     break;
 case "NumOutlets":
     $template = new CDUTemplate();
     $powerConn = new PowerConnection();
     $template->TemplateID = $pdu->TemplateID;
     $template->GetTemplate();
     $powerConn->PDUID = $pdu->PDUID;
     $connList = $powerConn->GetConnectionsByPDU();
     $tooltip .= __($row["Label"]) . ": " . count($connList) . "/" . ($template->NumOutlets + 1) . "<br>\n";
     break;
 case "Uptime":
     $tooltip .= __($row["Label"]) . ": " . $pdu->GetSmartCDUUptime() . "<br>\n";
     break;
 case "PanelID":
예제 #2
0
//
//	URL:	/api/v1/manufacturer
//	Method:	POST
//	Params:	none
//	Returns: true/false on update operation
//
$app->post('/manufacturer/:manufacturerid', function ($manufacturerid) use($app, $person) {
    $man = new Manufacturer();
    $man->ManufacturerID = $manufacturerid;
    $response['error'] = true;
    $response['errorcode'] = 404;
    if (!$person->SiteAdmin) {
        $response['errorcode'] = 403;
        $response['message'] = __("Unauthorized");
    } else {
        if (!$man->GetManufacturerByID()) {
            $response['message'] = __("Manufacturer not found with id: ") . " {$manufacturerid}";
        } else {
            foreach ($app->request->post() as $prop => $val) {
                $man->{$prop} = $val;
            }
            if (!$man->UpdateManufacturer()) {
                $response['message'] = __("Manufacturer update failed");
            } else {
                $response['error'] = false;
                $response['errorcode'] = 200;
            }
        }
    }
    echoResponse(200, $response);
});
예제 #3
0
}
echo '		</div>
		<div>
			<div><label for="TemplateID">', __("Device Class"), '</label></div>
			<div><select name="TemplateID" id="TemplateID">
				<option value=0>', __("Select a template..."), '</option>';
foreach ($templateList as $tempRow) {
    // $devarray is helping to remove invalid device templates from child devices
    if (in_array($tempRow->DeviceType, array_keys($devarray))) {
        if ($dev->TemplateID == $tempRow->TemplateID) {
            $selected = " selected";
        } else {
            $selected = "";
        }
        $mfg->ManufacturerID = $tempRow->ManufacturerID;
        $mfg->GetManufacturerByID();
        print "\t\t\t\t<option value=\"{$tempRow->TemplateID}\"{$selected}>{$mfg->Name} - {$tempRow->Model}</option>\n";
    }
}
echo '			</select>
			</div>
		</div>
		<div>
		   <div><label for="Height">', $dev->ParentDevice == 0 ? __("Height") : __("Number of slots"), '</label></div>
		   <div><input type="number" class="required,validate[custom[onlyNumberSp]]" name="Height" id="Height" value="', $dev->Height, '"></div>
		</div>
		<div>
		   <div><label for="Position">', __("Position"), '</label></div>
		   <div><input type="number" class="required,validate[custom[onlyNumberSp],min[1],max[', $cab->CabinetHeight, ']]" name="Position" id="Position" value="', $dev->Position, '"></div>
		</div>
		';
예제 #4
0
/**
 * Compute the device class of a device
 *
 * @param DeviceTemplate $devTemplates
 * @param Device $device
 * @return (string|string)[] Manufacturer, Model
 */
function getDeviceTemplateName($devTemplates, $device)
{
    // Compute the device class of a device
    $retval = array('_NoDevModel', '_NoManufDefined');
    $templID = $device->TemplateID;
    if ($templID != 0) {
        // Data validation error
        if (!isset($devTemplates[$templID])) {
            $devTemplates[$templID] = new DeviceTemplate();
            $devTemplates[$templID]->TemplateID = $templID;
            $devTemplates[$templID]->ManufacturerID = 0;
            $devTemplates[$templID]->Model = __("Template Missing");
        }
        $manufacturer = new Manufacturer();
        $manufacturer->ManufacturerID = $devTemplates[$templID]->ManufacturerID;
        $retcode = $manufacturer->GetManufacturerByID();
        if ($retcode) {
            $manufName = $manufacturer->Name;
        } else {
            $manufName = '_NoManufDefined';
        }
        $retval = array($manufName, $devTemplates[$templID]->Model);
    }
    return $retval;
}
예제 #5
0
 function UpdateManufacturer()
 {
     $this->MakeSafe();
     $sql = "UPDATE fac_Manufacturer SET Name=\"{$this->Name}\", GlobalID={$this->GlobalID}, SubscribeToUpdates={$this->SubscribeToUpdates} WHERE ManufacturerID={$this->ManufacturerID};";
     $old = new Manufacturer();
     $old->ManufacturerID = $this->ManufacturerID;
     $old->GetManufacturerByID();
     $this->MakeDisplay();
     class_exists('LogActions') ? LogActions::LogThis($this, $old) : '';
     return $this->query($sql);
 }
예제 #6
0
/**
 * Compute the device class of a device
 *
 * @param DeviceTemplate $devTemplates
 * @param Device $device
 * @return (string|string)[] Manufacturer, Model
 */
function getDeviceTemplateName($devTemplates, $device)
{
    // Compute the device class of a device
    $retval = array('_NoDevModel', '_NoManufDefined');
    $templID = $device->TemplateID;
    if ($templID != 0) {
        $manufacturer = new Manufacturer();
        $manufacturer->ManufacturerID = $devTemplates[$templID]->ManufacturerID;
        $retcode = $manufacturer->GetManufacturerByID();
        if ($retcode) {
            $manufName = $manufacturer->Name;
        } else {
            $manufName = '_NoManufDefined';
        }
        $retval = array($manufName, $devTemplates[$templID]->Model);
    }
    return $retval;
}
예제 #7
0
$ct = new CDUTemplate();
$sen = new SensorTemplate();
$tList = $t->GetTemplateShareList();
$c = curl_init('https://repository.opendcim.org/api/template');
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($c, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_COOKIEFILE, "/tmp/repocookies.txt");
curl_setopt($c, CURLOPT_COOKIEJAR, "/tmp/repocookies.txt");
curl_setopt($c, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($c, CURLOPT_HTTPHEADER, array("UserID: " . $config->ParameterArray["APIUserID"], "APIKey: " . $config->ParameterArray["APIKey"], "Content-Type: application/json"));
foreach ($tList as $temp) {
    if ($temp->ManufacturerID != $m->ManufacturerID) {
        $m->ManufacturerID = $temp->ManufacturerID;
        $m->GetManufacturerByID();
    }
    $temp->ManufacturerID = $m->GlobalID;
    $tp = new TemplatePorts();
    $tp->TemplateID = $temp->TemplateID;
    $tpList = $tp->getPorts();
    // Convert the base template object to an associative array for easier manipulation
    $postData["template"] = json_decode(json_encode($temp), true);
    $postData["templateports"] = array();
    foreach ($tpList as $tport) {
        array_push($postData["templateports"], json_decode(json_encode($tport), true));
    }
    $tpp = new TemplatePowerPorts();
    $tpp->TemplateID = $temp->TemplateID;
    $tppList = $tpp->getPorts();
    $postData["templatepowerports"] = array();