Пример #1
0
            // We don't already have this one linked, so search for a candidate or add as a new one
            $m->Name = $tmpman->Name;
            if ($m->GetManufacturerByName()) {
                // Reset to the values from the repo (especially CaSe)
                $m->GlobalID = $tmpman->ManufacturerID;
                $m->Name = $tmpman->Name;
                $m->UpdateManufacturer();
            } else {
                $m->ManufacturerID = $tmpman->ManufacturerID;
                $m->Name = $tmpman->Name;
                $m->CreateManufacturer();
            }
        }
    }
}
$mList = $m->getSubscriptionList();
foreach ($mList as $man) {
    curl_setopt($c, CURLOPT_URL, 'https://repository.opendcim.org/api/template/bymanufacturer/' . $man->GlobalID);
    curl_setopt($c, CURLOPT_CUSTOMREQUEST, 'GET');
    $result = curl_exec($c);
    $jr = json_decode($result);
    if (@$jr->errorcode == 200) {
        if (is_array($jr->templates)) {
            foreach ($jr->templates as $tem) {
                $tm = new Manufacturer();
                $cs = new Slot();
                $tp = new TemplatePorts();
                $tpp = new TemplatePowerPorts();
                foreach ($t as $prop => $val) {
                    @($t->{$prop} = $tem->{$prop});
                }