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


PHP Device::Search方法代码示例

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


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

示例1: foreach

    $response['errorcode'] = 200;
    // Verify the userids are real
    foreach (array('peopleid', 'newpeopleid') as $var) {
        $p = new People();
        $p->UserID = ${$var};
        if (!$p->GetPerson() && ($var != 'newpeopleid' && ${$var} == 0)) {
            $response['error'] = true;
            $response['message'] = "{$var} is not valid";
            continue;
        }
    }
    // If we error above don't attempt to make changes
    if (!$response['error']) {
        $dev = new Device();
        $dev->PrimaryContact = $peopleid;
        foreach ($dev->Search() as $d) {
            $d->PrimaryContact = $newpeopleid;
            if (!$d->UpdateDevice()) {
                // If we encounter an error stop immediately
                $response['error'] = true;
                $response['message'] = __("Device update has failed");
                continue;
            }
        }
    }
    echoResponse(200, $response);
});
//
//	URL:	/api/v1/powerport/:deviceid
//	Method:	POST
//	Params:
开发者ID:mnibbelink,项目名称:openDCIM,代码行数:31,代码来源:index.php

示例2: Device

                $d = new Device($port->DeviceID);
                // These should all be valid but just in case, skip it
                if ($d->GetDevice()) {
                    $devList[$d->DeviceID] = $d;
                }
            }
        }
    }
    $resultcount = count($devList) + count($cabList);
    $title = __("Notes search results for") . " "{$searchTerm}"";
} elseif ($searchKey = "dev") {
    // This is gonna be a generic catch all
    foreach ($dev as $prop => $val) {
        $dev->{$prop} = isset($_GET[$prop]) ? $_GET[$prop] : $val;
    }
    $devList = $dev->Search(true);
    $resultcount = count($devList);
} else {
    $devList = array();
}
$x = 0;
$temp = array();
// Store all devices for display
$cabtemp = array();
// List of all cabinet ids for outerloop
$childList = array();
// List of all blade devices
$dctemp = array();
// List of datacenters involved with result set
$pduList = array();
// List of CDUs
开发者ID:rhizalpatrax64bit,项目名称:openDCIM,代码行数:31,代码来源:search.php

示例3: People

$audit->AuditStamp = __("Never");
$audit->GetLastAudit();
if ($audit->UserID != "") {
    $tmpUser = new People();
    $tmpUser->UserID = $audit->UserID;
    $tmpUser->GetUserRights();
    $AuditorName = $tmpUser->FirstName . " " . $tmpUser->LastName;
}
$pdu->CabinetID = $cab->CabinetID;
$PDUList = $pdu->GetPDUbyCabinet();
$dev->Cabinet = $cab->CabinetID;
$devList = $dev->ViewDevicesByCabinet();
$search = new Device();
$search->Cabinet = $cab->CabinetID;
$search->DeviceType = "Sensor";
$SensorList = $search->Search();
$stats = $cab->getStats($cab->CabinetID);
$totalWatts = $stats->Wattage;
$totalWeight = $stats->Weight;
$totalMoment = 0;
if ($config->ParameterArray["ReservedColor"] != "#FFFFFF" || $config->ParameterArray["FreeSpaceColor"] != "#FFFFFF") {
    $head .= "\t\t<style type=\"text/css\">\n\t\t\t.reserved {background-color: {$config->ParameterArray['ReservedColor']} !important;}\n\t\t\t.freespace {background-color: {$config->ParameterArray['FreeSpaceColor']};}\n";
    // Only show reserved in the legend if the color is something other than white
    if ($config->ParameterArray["ReservedColor"] != "#FFFFFF") {
        $legend .= "\t\t<div class=\"legenditem hide\"><span class=\"reserved colorbox border\"></span> - " . __("Reservation") . "</div>\n";
    }
    if ($config->ParameterArray["FreeSpaceColor"] != "#FFFFFF") {
        $legend .= '<div class="legenditem"><span class="freespace colorbox border"></span> - ' . __("Free Space") . '</div>' . "\n";
    }
}
$noOwnerFlag = false;
开发者ID:olivierbeytrison,项目名称:openDCIM,代码行数:31,代码来源:cabnavigator.php

示例4: BuildCabinet

 function BuildCabinet($cabid, $face = "front")
 {
     $cab = new Cabinet($cabid);
     $cab->GetCabinet();
     $order = $cab->U1Position == "Top" ? false : true;
     $dev = new Device();
     $dev->Cabinet = $cab->CabinetID;
     $dev->ParentDevice = 0;
     $bounds = array('max' => array('position' => 0, 'height' => 0), 'min' => array('position' => 0, 'height' => 0));
     // Read in all the devices and make sure they fit the cabinet.  If not expand it
     foreach ($dev->Search() as $device) {
         if ($device->Position == 0) {
             continue;
         }
         $pos = $order ? $device->Position : $device->Position - $device->Height;
         if ($device->Position > $bounds['max']['position']) {
             $bounds['max']['position'] = $device->Position;
             $bounds['max']['height'] = $device->Height;
         }
         if ($pos < $bounds['min']['position']) {
             $bounds['min']['position'] = $pos;
             $bounds['min']['height'] = 1;
         }
     }
     if ($order) {
         $top = max($cab->CabinetHeight, $bounds['max']['position'] + $bounds['max']['height'] - 1);
         $bottom = min(0, $bounds['min']['position']);
     } else {
         // Reverse order
         $top = min(1, $bounds['min']['position'] - $bounds['min']['height']);
         $bottom = max($cab->CabinetHeight, $bounds['max']['position']);
     }
     // Build cabinet HTML
     switch ($face) {
         case "rear":
             $cab->Location = "{$cab->Location} (" . __("Rear") . ")";
             break;
         case "side":
             $cab->Location = "{$cab->Location} (" . __("Side") . ")";
             break;
         default:
             // Leave the location alone
     }
     // helper function to print the rows of the cabinet table
     if (!function_exists("printrow")) {
         function printrow($i, $top, $bottom, $order, $face, &$htmlcab, $cabobject)
         {
             $error = $i > $cabobject->CabinetHeight || $i <= 0 && $order || $i < 0 && !$order ? ' error' : '';
             if ($order) {
                 $x = $i <= 0 ? $i - 1 : $i;
             } else {
                 $x = $i >= 0 ? $i + 1 : $i;
             }
             if ($i == $top) {
                 if ($face == "rear") {
                     $rs = "-rear";
                 } elseif ($face == "side") {
                     $rs = "-side";
                 } else {
                     $rs = "";
                 }
                 $rowspan = abs($top) + abs($bottom);
                 $height = (abs($top) + abs($bottom)) * ceil(220 * (1.75 / 19)) . "px";
                 $htmlcab .= "\t<tr id=\"pos{$x}\"><td class=\"pos{$error}\">{$x}</td><td rowspan={$rowspan}><div id=\"servercontainer{$rs}\" class=\"freespace\" style=\"width: 220px; height: {$height}\" data-face=\"{$face}\"></div></td></tr>\n";
             } else {
                 $htmlcab .= "\t<tr id=\"pos{$x}\"><td class=\"pos{$error}\">{$x}</td></tr>\n";
             }
         }
     }
     // If they have rights to the device then make the picture clickable
     $clickable = $cab->Rights != "None" ? "\t\t<a href=\"cabnavigator.php?cabinetid={$cab->CabinetID}\">\n\t" : "";
     $clickableend = $cab->Rights != "None" ? "\n\t\t</a>\n" : "";
     $htmlcab = "<table class=\"cabinet\" id=\"cabinet{$cab->CabinetID}\">\n\t<tr><th colspan=2>{$clickable}{$cab->Location}{$clickableend}</th></tr>\n\t<tr><td>Pos</td><td>Device</td></tr>\n";
     // loop here for the height
     // numbered high to low, top to bottom
     if ($order) {
         for ($i = $top; $i > $bottom; $i--) {
             printrow($i, $top, $bottom, $order, $face, $htmlcab, $cab);
         }
     } else {
         // numbered low to high, top to bottom
         for ($i = $top; $bottom > $i; $i++) {
             printrow($i, $top, $bottom, $order, $face, $htmlcab, $cab);
         }
     }
     $htmlcab .= "</table>\n";
     // Wrap it in a nice div
     $htmlcab = '<div class="cabinet">' . $htmlcab . '</div>';
     // debug information
     // print "Cabinet:  $cab->CabinetID   Top: $top   Bottom: $bottom<br>\n";
     return $htmlcab;
 }
开发者ID:paragm,项目名称:openDCIM,代码行数:92,代码来源:misc.inc.php


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