当前位置: 首页>>代码示例>>PHP>>正文


PHP Manufacturer::CreateManufacturer方法代码示例

本文整理汇总了PHP中Manufacturer::CreateManufacturer方法的典型用法代码示例。如果您正苦于以下问题:PHP Manufacturer::CreateManufacturer方法的具体用法?PHP Manufacturer::CreateManufacturer怎么用?PHP Manufacturer::CreateManufacturer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Manufacturer的用法示例。


在下文中一共展示了Manufacturer::CreateManufacturer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: function

//	Params:	none
//	Returns: Record as created
//
$app->put('/manufacturer/:name', function ($name) use($app, $person) {
    $man = new Manufacturer();
    foreach ($app->request->put() as $prop => $val) {
        $man->{$prop} = $val;
    }
    $man->Name = $name;
    $response['error'] = true;
    $response['errorcode'] = 404;
    if (!$person->SiteAdmin) {
        $response['errorcode'] = 403;
        $response['message'] = __("Unauthorized");
    } else {
        if (!$man->CreateManufacturer()) {
            $response['message'] = __("Manufacturer not created: ") . " {$manufacturerid}";
        } else {
            $response['error'] = false;
            $response['errorcode'] = 200;
            $response['manufacturer'] = $man;
        }
    }
    echoResponse(200, $response);
});
/**
 *
 *		API DELETE Methods go here
 *
 *		DELETE Methods are for removing records 
 *
开发者ID:mnibbelink,项目名称:openDCIM,代码行数:31,代码来源:index.php

示例2: DeviceTemplate

}
if (isset($_GET['getTemplateCount']) && isset($_GET['ManufacturerID'])) {
    $temp = new DeviceTemplate();
    $temp->ManufacturerID = $_GET['ManufacturerID'];
    header('Content-Type: application/json');
    echo json_encode($temp->GetTemplateListByManufacturer());
    exit;
}
if (isset($_POST['setManufacturer'])) {
    $mfg->ManufacturerID = $_POST['ManufacturerID'];
    $mfg->GetManufacturerByID();
    $mfg->GlobalID = $_POST['GlobalID'];
    $mfg->Name = $_POST['Name'];
    $mfg->SubscribeToUpdates = isset($_POST['SubscribeToUpdates']) ? 1 : 0;
    if ($mfg->ManufacturerID == "") {
        $mfg->CreateManufacturer();
    } else {
        $mfg->UpdateManufacturer();
    }
    header('Content-Type: application/json');
    echo json_encode($mfg);
    exit;
}
if (isset($_POST['action']) && $_POST["action"] == "Delete") {
    header('Content-Type: application/json');
    $response = false;
    if (isset($_POST["TransferTo"])) {
        $mfg->ManufacturerID = $_POST['ManufacturerID'];
        if ($mfg->DeleteManufacturer($_POST["TransferTo"])) {
            $response = true;
        }
开发者ID:aliyildiz84,项目名称:openDCIM,代码行数:31,代码来源:device_manufacturers.php

示例3:

            $m->GlobalID = $tmpman->ManufacturerID;
            if ($m->getManufacturerByGlobalID()) {
                $m->Name = $tmpman->Name;
                $m->UpdateManufacturer();
            } else {
                // 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();
                }
            }
        }
    }
}
//Installation Complete
if ($nodept == "" && $nodc == "" && $nocab == "") {
    // All three primary sections have had at least one item created
    //enable the finish menu option
    $complete = true;
}
?>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
开发者ID:Gusenichka,项目名称:openDCIM,代码行数:31,代码来源:install.php

示例4: ImportTemplate

 function ImportTemplate($file)
 {
     $result = array();
     $result["status"] = "";
     $result["log"] = array();
     $ierror = 0;
     //validate xml template file with openDCIMdevicetemplate.xsd
     libxml_use_internal_errors(true);
     $xml = new XMLReader();
     $xml->open($file);
     $resp = $xml->setSchema("openDCIMdevicetemplate.xsd");
     while (@$xml->read()) {
     }
     // empty loop
     $errors = libxml_get_errors();
     if (count($errors) > 0) {
         $result["status"] = __("No valid file");
         foreach ($errors as $error) {
             $result["log"][$ierror++] = $error->message;
         }
         return $result;
     }
     libxml_clear_errors();
     $xml->close();
     //read xml template file
     $xmltemplate = simplexml_load_file($file);
     //manufacturer
     $manufacturer = new Manufacturer();
     $manufacturer->Name = transform($xmltemplate->ManufacturerName);
     if (!$manufacturer->GetManufacturerByName()) {
         //New Manufacturer
         $manufacturer->CreateManufacturer();
     }
     $template = new DeviceTemplate();
     $template->ManufacturerID = $manufacturer->ManufacturerID;
     $template->Model = transform($xmltemplate->TemplateReg->Model);
     $template->Height = $xmltemplate->TemplateReg->Height;
     $template->Weight = $xmltemplate->TemplateReg->Weight;
     $template->Wattage = $xmltemplate->TemplateReg->Wattage;
     $template->DeviceType = $xmltemplate->TemplateReg->DeviceType;
     $template->PSCount = $xmltemplate->TemplateReg->PSCount;
     $template->NumPorts = $xmltemplate->TemplateReg->NumPorts;
     $template->Notes = trim($xmltemplate->TemplateReg->Notes);
     $template->Notes = $template->Notes == "<br>" ? "" : $template->Notes;
     $template->FrontPictureFile = $xmltemplate->TemplateReg->FrontPictureFile;
     $template->RearPictureFile = $xmltemplate->TemplateReg->RearPictureFile;
     $template->SNMPVersion = $xmltemplate->TemplateReg->SNMPVersion;
     $template->ChassisSlots = $template->DeviceType == "Chassis" ? $xmltemplate->TemplateReg->ChassisSlots : 0;
     $template->RearChassisSlots = $template->DeviceType == "Chassis" ? $xmltemplate->TemplateReg->RearChassisSlots : 0;
     //Check if picture files exist
     if ($template->FrontPictureFile != "" && file_exists("pictures/" . $template->FrontPictureFile)) {
         $result["status"] = __("Import Error");
         $result["log"][0] = __("Front picture file already exists");
         return $result;
     }
     if ($template->RearPictureFile != "" && file_exists("pictures/" . $template->RearPictureFile)) {
         $result["status"] = __("Import Error");
         $result["log"][0] = __("Rear picture file already exists");
         return $result;
     }
     //create the template
     if (!$template->CreateTemplate()) {
         $result["status"] = __("Import Error");
         $result["log"][0] = __("An error has occurred creating the template.<br>Possibly there is already a template of the same manufacturer and model");
         return $result;
     }
     //get template to this object
     $this->TemplateID = $template->TemplateID;
     $this->GetTemplateByID();
     //slots
     foreach ($xmltemplate->SlotReg as $xmlslot) {
         $slot = new Slot();
         $slot->TemplateID = $this->TemplateID;
         $slot->Position = intval($xmlslot->Position);
         $slot->BackSide = intval($xmlslot->BackSide);
         $slot->X = intval($xmlslot->X);
         $slot->Y = intval($xmlslot->Y);
         $slot->W = intval($xmlslot->W);
         $slot->H = intval($xmlslot->H);
         if ($slot->Position <= $this->ChassisSlots && !$slot->BackSide || $slot->Position <= $this->RearChassisSlots && $slot->BackSide) {
             if (!$slot->CreateSlot()) {
                 $result["status"] = __("Import Warning");
                 $result["log"][$ierror++] = sprintf(__("An error has occurred creating the slot %s"), $slot->Position . "-" . $slot->BackSide ? __("Rear") : __("Front"));
             }
         } else {
             $result["status"] = __("Import Warning");
             $result["log"][$ierror++] = sprintf(__("Ignored slot %s"), $slot->Position . "-" . $slot->BackSide ? __("Rear") : __("Front"));
         }
     }
     //ports
     foreach ($xmltemplate->PortReg as $xmlport) {
         //media type
         $mt = new MediaTypes();
         $mt->MediaType = transform($xmlport->PortMedia);
         if (!$mt->GetTypeByName()) {
             //New media type
             $mt->CreateType();
         }
         //color
         $cc = new ColorCoding();
//.........这里部分代码省略.........
开发者ID:paragm,项目名称:openDCIM,代码行数:101,代码来源:infrastructure.inc.php


注:本文中的Manufacturer::CreateManufacturer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。