Beispiel #1
0
//
$app->get('/device/:deviceid/getpicture', function ($deviceid) {
    $dev = new Device($deviceid);
    $response['error'] = true;
    $response['errorcode'] = 404;
    $response['message'] = __("Unknown error");
    if (!$dev->GetDevice()) {
        $response['message'] = __("Device not found");
    } else {
        // we filter out most of the details if you don't have rights in the
        // GetDevicePicture function so this might lead to some probing but
        // should be minimal
        $response['error'] = false;
        $response['errorcode'] = 200;
        $response['message'] = "";
        $response['picture'] = $dev->GetDevicePicture(isset($_GET['rear']));
    }
    echoResponse(200, $response);
});
$app->get('/device/:deviceid/getsensorreadings', function ($deviceid) {
    $dev = new Device();
    $dev->DeviceID = intval($deviceid);
    if (!$dev->GetDevice(false)) {
        $response['error'] = true;
        $response['errorcode'] = 404;
        $response['message'] = __("Device not found");
    } else {
        $reading = $dev->GetSensorReading(false);
        if (!$reading) {
            $response['error'] = true;
            $response['errorcode'] = 404;
Beispiel #2
0
    // is no chance for phantom data
    $cab = new Cabinet();
    if ($dev->ParentDevice > 0) {
        $pdev = new Device();
        $pdev->DeviceID = $dev->GetRootDeviceID();
        $pdev->GetDevice();
        $cab->CabinetID = $pdev->Cabinet;
    } else {
        $cab->CabinetID = $dev->Cabinet;
    }
    $cab->GetCabinet();
    $devTmpl = new DeviceTemplate();
    $devTmpl->TemplateID = $dev->TemplateID;
    $devTmpl->GetTemplateByID();
    $position = $dev->Height == 1 ? $dev->Position : $dev->Position . "-" . ($dev->Position + $dev->Height - 1);
    print "<div><div>{$cab->Location}</div><div>{$position}</div><div>{$dev->Label}</div><div>" . $dev->GetDevicePicture('', '', 'nolinks') . "</div></div>\n";
}
print '</div>
<a href="export_port_connections.php?deviceid=wo"><button type="button">' . __("Export Connections") . '</button></a>';
?>

<button type="button" id="clear"><?php 
print __("Clear");
?>
</button>
</div></div>
</div><!-- END div.main -->
</div><!-- END div.page -->
</body>
</html>