本文整理汇总了PHP中Device::GetDevicesbyOwner方法的典型用法代码示例。如果您正苦于以下问题:PHP Device::GetDevicesbyOwner方法的具体用法?PHP Device::GetDevicesbyOwner怎么用?PHP Device::GetDevicesbyOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Device
的用法示例。
在下文中一共展示了Device::GetDevicesbyOwner方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DeleteDepartment
function DeleteDepartment($TransferTo = null)
{
// Make sure we have a real department to delete so we don't pull some bonehead move and delete everything set to 0
if (!$this->GetDeptByID()) {
return false;
}
// Get people and objects that still belong to this department
$dev = new Device();
$cab = new Cabinet();
$dev->Owner = $cab->AssignedTo = $this->DeptID;
$person = new People();
$devices = $dev->GetDevicesbyOwner();
$cabinets = $cab->GetCabinetsByDept();
$users = $person->GetPeopleByDepartment($this->DeptID);
foreach ($devices as $d) {
// We've designated a new owner for this equipment, zero is valid as they might be setting it to general
if (!is_null($TransferTo)) {
$d->Owner = $TransferTo;
$d->UpdateDevice();
} else {
// This option is not being provided but us at this time, maybe through the API
$d->DeleteDevice();
}
}
foreach ($cabinets as $c) {
// We've designated a new owner for these cabinets, zero is valid as they might be setting it to general
if (!is_null($TransferTo)) {
$c->AssignedTo = $TransferTo;
$c->UpdateCabinet();
} else {
// This option is not being provided but us at this time, maybe through the API
$c->DeleteCabinet();
}
}
foreach ($users as $p) {
// If we don't have a value over 0 then we're just removing this department and they won't be added to another group
if (!is_null($TransferTo) && intval($TransferTo) > 0) {
// Add this user into the new department
$sql = "INSERT INTO fac_DeptContacts SET DeptID=" . intval($TransferTo) . ", ContactID={$p->PersonID};";
$this->exec($sql);
}
}
// Clear any users from this department
$sql = "DELETE FROM fac_DeptContacts WHERE DeptID={$this->DeptID};";
$this->exec($sql);
// By this point all devices, objects, and users should have been shoved into a new department so finish cleaning up.
$sql = "DELETE FROM fac_Department WHERE DeptID={$this->DeptID};";
if (!$this->exec($sql)) {
global $dbh;
$info = $dbh->errorInfo();
error_log("PDO Error: {$info[2]} SQL={$sql}");
return false;
}
class_exists('LogActions') ? LogActions::LogThis($this) : '';
return true;
}
示例2: array
$pdf->SetFont($config->ParameterArray['PDFfont'], '', 8);
$pdf->SetFillColor(0, 0, 0);
$pdf->SetTextColor(255);
$pdf->SetDrawColor(128, 0, 0);
$pdf->SetLineWidth(0.3);
$pdf->SetfillColor(224, 235, 255);
$pdf->SetTextColor(0);
$pdf->Bookmark('Departments');
$pdf->AddPage();
$pdf->Bookmark('Unknown Owner', 1, 0);
$pdf->SetFont($config->ParameterArray['PDFfont'], 'B', 12);
$pdf->Cell(80, 5, __("Department") . ': ' . __("Unknown"));
$pdf->SetFont($config->ParameterArray['PDFfont'], '', 8);
$pdf->Ln();
$dev->Owner = 0;
$devList = $dev->GetDevicesbyOwner();
$headerTags = array(__("Device Name"), __("Serial Number"), __("From Template"), __("Power Cords"), __("DC Room"), __("Cabinet"), __("Position"), __("Rack Units"));
$cellWidths = array(50, 30, 20, 20, 20, 20, 20, 20);
$maxval = count($headerTags);
for ($col = 0; $col < $maxval; $col++) {
$pdf->Cell($cellWidths[$col], 7, $headerTags[$col], 1, 0, 'C', 1);
}
$pdf->Ln();
$fill = 0;
foreach ($devList as $devRow) {
if ($devRow->TemplateID > 0 && ($devRow->PowerSupplyCount > 0 && $devRow->DeviceType != 'Physical Infrastructure')) {
continue;
}
if ($devRow->Cabinet != $cab->CabinetID) {
$cab->CabinetID = $devRow->Cabinet;
$cab->GetCabinet();
示例3: header
require_once 'db.inc.php';
require_once 'facilities.inc.php';
$subheader = __("Data Center Department Detail");
if (!$person->ContactAdmin) {
// No soup for you.
header('Location: ' . redirect());
exit;
}
// AJAX requests
if (isset($_GET['objectcount'])) {
$cab = new Cabinet();
$dev = new Device();
$cab->AssignedTo = $dev->Owner = $_GET['deptid'];
$return = array();
$return['cabinets'] = count($cab->GetCabinetsByDept());
$return['devices'] = count($dev->GetDevicesbyOwner());
$return['people'] = count($person->GetPeopleByDepartment($dev->Owner));
header('Content-Type: application/json');
echo json_encode($return);
exit;
}
if (isset($_POST['action']) && $_POST["action"] == "Delete") {
header('Content-Type: application/json');
$response = false;
if (isset($_POST["TransferTo"])) {
$dept = new Department();
$dept->DeptID = $_POST['deptid'];
if ($dept->DeleteDepartment($_POST["TransferTo"])) {
$response = true;
}
}