forked from opendcim/openDCIM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreport_xml_CFD.php
More file actions
126 lines (109 loc) · 3.17 KB
/
report_xml_CFD.php
File metadata and controls
126 lines (109 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
require_once("db.inc.php");
require_once("facilities.inc.php");
$datacenter=new DataCenter();
$dcList=$datacenter->GetDCList();
if(!isset($_REQUEST['datacenterid'])){
?>
<!doctype html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>openDCIM Data Center Inventory</title>
<link rel="stylesheet" href="css/inventory.php" type="text/css">
<link rel="stylesheet" href="css/jquery-ui.css" type="text/css">
<!--[if lt IE 9]>
<link rel="stylesheet" href="css/ie.css" type="text/css" />
<![endif]-->
<script type="text/javascript" src="scripts/jquery.min.js"></script>
<script type="text/javascript" src="scripts/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#generate').hide();
$('select[name="datacenterid"]').change(function(){
if($(this).val()!=""){
$('#generate').show();
}else{
$('#generate').hide();
}
});
});
</script>
</head>
<body>
<div id="header"></div>
<div class="page index">
<?php
include( 'sidebar.inc.php' );
echo '
<div class="main">
<h2>'.$config->ParameterArray['OrgName'].'</h2>
<h3>'.__("XML Output for CFD Simulation").'</h3>
<div class="center"><div>
<form method="post">
<div class="table">
<div>
<div>'.__("Data Center").'</div>
<div>
<select name="datacenterid">
<option value="">'.__("Select Data Center").'</option>';
foreach($dcList as $dc){
print "\t\t\t\t<option value=\"$dc->DataCenterID\">$dc->Name</option>\n";
}
echo ' </select>
</div>
<div>
<button id="generate" type="submit">'.__("Generate").'</button>
</div>
</div>
</div>
</form>
</div> <!-- END .center -->
</div> <!-- END .main -->
</div> <!-- END .page -->
</body>
</html>';
}else{
$cab=new Cabinet();
$dev=new Device();
$datacenter->DataCenterID=$_REQUEST["datacenterid"];
$datacenter->GetDataCenter();
$cab->DataCenterID=$datacenter->DataCenterID;
$cabList=$cab->ListCabinetsByDC();
header('Content-type: text/xml');
header('Cache-Control: no-store, no-cache');
header('Content-Disposition: attachment; filename="opendcim.xml"');
print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<datacenter>\n
<ID>$datacenter->DataCenterID</ID>
<Name>$datacenter->Name</Name>
<Size>$datacenter->SquareFootage</Size>\n";
foreach($cabList as $cabRow){
print "\t<cabinet>
<ID>$cabRow->CabinetID</ID>
<Location>$cabRow->Location</Location>
<Height>$cabRow->CabinetHeight</Height>
<FrontEdge>$cabRow->FrontEdge</FrontEdge>
<MapX1>$cabRow->MapX1</MapX1>
<MapY1>$cabRow->MapY1</MapY1>
<MapX2>$cabRow->MapX2</MapX2>
<MapY2>$cabRow->MapY2</MapY2>\n";
$dev->Cabinet=$cabRow->CabinetID;
$devList=$dev->ViewDevicesByCabinet();
$totalWatts=0;
foreach($devList as $devRow){
$power=$devRow->GetDeviceTotalPower();
$totalWatts+=$power;
print "\t\t<Device>
<ID>$devRow->DeviceID</ID>
<Label>$devRow->Label</Label>
<Position>$devRow->Position</Position>
<Height>$devRow->Height</Height>
<Watts>$power</Watts>
</Device>\n";
}
print "\t\t<TotalWatts>$totalWatts</TotalWatts>\n\t</cabinet>\n";
}
print "</datacenter>\n</xml>\n";
}
?>