Exemplo n.º 1
0
        $response['error'] = true;
        $response['errorcode'] = 403;
        $response['message'] = __("Unauthorized");
    } else {
        if (!$s->GetSlot()) {
            $response['error'] = true;
            $response['errorcode'] = 404;
            $response['message'] = __("Template slot not found with id: ") . " {$templateid}:{$slotnum}";
        } else {
            foreach ($app->request->post() as $prop => $val) {
                $s->{$prop} = $val;
            }
            // Just to make sure
            $s->TemplateID = $templateid;
            $s->PortNumber = $slotnum;
            if (!$s->UpdateSlot()) {
                $response['error'] = true;
                $response['errorcode'] = 404;
                $response['message'] = __("Template slot update failed");
            } else {
                $response['error'] = false;
                $response['errorcode'] = 200;
                $response['dataport'] = $s;
            }
        }
    }
    echoResponse(200, $response);
});
//
//	URL:	/api/v1/manufacturer
//	Method:	POST
Exemplo n.º 2
0
     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();
         }
     }
 }
 if ($t->DeviceType == "Sensor" && is_object(@$t->sensortemplate)) {
     $sen->ManufacturerID = $t->ManufacturerID;
     $sen->Model = $t->Model;
     foreach ($t->sensortemplate as $prop => $val) {
         $sen->{$prop} = $val;
     }
     $sen->TemplateID = $t->TemplateID;
     if (!$updating) {
         $sen->CreateTemplate($t->TemplateID);
     } else {
         $sen->UpdateTemplate();
     }