One more adjustment

master
Skylar Ittner 4 years ago
parent b7cb91d4ca
commit dca0090d8a

@ -32,238 +32,229 @@ if (isset($_GET["backgroundcolor"]) && !empty($_GET["backgroundcolor"]) && preg_
} }
?> ?>
<?php if (!isset($_GET["embed"])) { ?> <div class="container mt-4">
<div class="container mt-4"> <div class="row justify-content-center">
<div class="row justify-content-center"> <div class="<?php if (!isset($_GET["embed"])) { ?>col-12 col-md-8<?php } else { ?>col-12<?php } ?>">
<div class="col-12 col-md-8"> <?php
<?php } else { ?> if (empty($_GET["id"]) || (!Machine::exists($_GET["id"]) && !Machine::serialExists($_GET["id"]))) {
<div class="row justify-content-center"> ?>
<div class="col-12"> <div class="card">
<?php } ?> <h3 class="card-header d-flex">
<?php <div>
if (empty($_GET["id"]) || (!Machine::exists($_GET["id"]) && !Machine::serialExists($_GET["id"]))) { <i class="fas fa-desktop"></i> <?php $Strings->get("Machine Info"); ?>
?>
<div class="card">
<h3 class="card-header d-flex">
<div>
<i class="fas fa-desktop"></i> <?php $Strings->get("Machine Info"); ?>
</div>
</h3>
<div class="card-body">
<?php
if (!empty($_GET["id"])) {
?>
<p class="text-danger">No machine with ID <code><?php echo htmlspecialchars($_GET['id']); ?></code> could be found.</p>
<?php
}
?>
<p>
Enter a Netsyms machine ID number or serial number.
</p>
<form method="GET">
<input type="text" name="id" class="form-control" placeholder="Machine ID Number" required />
<button type="submit" class="btn btn-primary btn-block mt-2">Get Info</button>
</form>
</div>
</div> </div>
</h3>
<div class="card-body">
<?php <?php
} else { if (!empty($_GET["id"])) {
if (Machine::exists($_GET["id"])) { ?>
$machine = new Machine($_GET['id']); <p class="text-danger">No machine with ID <code><?php echo htmlspecialchars($_GET['id']); ?></code> could be found.</p>
} else { <?php
$machine = new Machine(Machine::getIDFromSerial($_GET['id']));
} }
?> ?>
<div class="card"> <p>
<h3 class="card-header d-flex"> Enter a Netsyms machine ID number or serial number.
<div> </p>
<i class="fas fa-desktop"></i> <?php $Strings->get("Machine Info"); ?> <form method="GET">
</div> <input type="text" name="id" class="form-control" placeholder="Machine ID Number" required />
</h3> <button type="submit" class="btn btn-primary btn-block mt-2">Get Info</button>
<div class="card-body"> </form>
<div class="row"> </div>
<div class="col-12 mb-3"> </div>
<div class="list-group"> <?php
<div class="list-group-item"> } else {
<b><?php $Strings->get("ID"); ?></b>: <?php echo htmlspecialchars($machine->getID()); ?> if (Machine::exists($_GET["id"])) {
</div> $machine = new Machine($_GET['id']);
<?php if (!empty($machine->getOS())) { ?> } else {
<div class="list-group-item"> $machine = new Machine(Machine::getIDFromSerial($_GET['id']));
<b><?php $Strings->get("OS/Software"); ?></b>: <?php echo htmlspecialchars($machine->getOS()); ?> }
</div> ?>
<?php } ?> <div class="card">
<?php if (!empty($machine->getSerial())) { ?> <h3 class="card-header d-flex">
<div class="list-group-item"> <div>
<b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($machine->getSerial()); ?> <i class="fas fa-desktop"></i> <?php $Strings->get("Machine Info"); ?>
</div> </div>
<?php } ?> </h3>
<?php if (!empty($machine->getManufacturer())) { ?> <div class="card-body">
<div class="list-group-item"> <div class="row">
<b><?php $Strings->get("Manufacturer"); ?></b>: <?php echo htmlspecialchars($machine->getManufacturer()); ?> <div class="col-12 mb-3">
</div> <div class="list-group">
<?php } ?> <div class="list-group-item">
<?php if (!empty($machine->getModel())) { ?> <b><?php $Strings->get("ID"); ?></b>: <?php echo htmlspecialchars($machine->getID()); ?>
<div class="list-group-item"> </div>
<b><?php $Strings->get("Model"); ?></b>: <?php echo htmlspecialchars($machine->getModel()); ?> <?php if (!empty($machine->getOS())) { ?>
</div> <div class="list-group-item">
<?php } ?> <b><?php $Strings->get("OS/Software"); ?></b>: <?php echo htmlspecialchars($machine->getOS()); ?>
<?php </div>
if ($machine->getCondition() > 0) { <?php } ?>
?> <?php if (!empty($machine->getSerial())) { ?>
<div class="list-group-item"> <div class="list-group-item">
<b><?php $Strings->get("Condition"); ?></b>: <?php <b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($machine->getSerial()); ?>
$val = $machine->getCondition(); </div>
$filled = floor($val); <?php } ?>
$empty = 10; <?php if (!empty($machine->getManufacturer())) { ?>
while ($filled > 0) { <div class="list-group-item">
$filled--; <b><?php $Strings->get("Manufacturer"); ?></b>: <?php echo htmlspecialchars($machine->getManufacturer()); ?>
$empty--; </div>
echo "<i class=\"fas fa-star\"></i> "; <?php } ?>
} <?php if (!empty($machine->getModel())) { ?>
if ($val - floor($val) > 0.75) { <div class="list-group-item">
$empty--; <b><?php $Strings->get("Model"); ?></b>: <?php echo htmlspecialchars($machine->getModel()); ?>
echo "<i class=\"fas fa-star\"></i> "; </div>
} else if ($val - floor($val) > 0.25) { <?php } ?>
$empty--; <?php
echo "<i class=\"fas fa-star-half-alt\"></i> "; if ($machine->getCondition() > 0) {
} ?>
while ($empty > 0) { <div class="list-group-item">
$empty--; <b><?php $Strings->get("Condition"); ?></b>: <?php
echo "<i class=\"far fa-star\"></i> "; $val = $machine->getCondition();
} $filled = floor($val);
echo " ($val/10)"; $empty = 10;
?> while ($filled > 0) {
</div> $filled--;
<?php $empty--;
echo "<i class=\"fas fa-star\"></i> ";
} }
?> if ($val - floor($val) > 0.75) {
<?php $empty--;
if ($machine->getPrice() > 0) { echo "<i class=\"fas fa-star\"></i> ";
?> } else if ($val - floor($val) > 0.25) {
<div class="list-group-item"> $empty--;
<b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($machine->getPrice(), 2); ?> echo "<i class=\"fas fa-star-half-alt\"></i> ";
</div>
<?php
} }
?> while ($empty > 0) {
<?php $empty--;
if (!empty($machine->getPublicNotes())) { echo "<i class=\"far fa-star\"></i> ";
?>
<div class="list-group-item">
<b><?php $Strings->get("Notes"); ?></b>: <?php echo htmlspecialchars($machine->getPublicNotes()); ?>
</div>
<?php
} }
echo " ($val/10)";
?> ?>
</div> </div>
</div> <?php
}
?>
<?php <?php
$components = $machine->getComponents(); if ($machine->getPrice() > 0) {
if (count($components) > 0) {
?> ?>
<div class="col-sm-6 mb-3"> <div class="list-group-item">
<h6>Components:</h6> <b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($machine->getPrice(), 2); ?>
<div class="list-group"> </div>
<?php
}
?>
<?php
if (!empty($machine->getPublicNotes())) {
?>
<div class="list-group-item">
<b><?php $Strings->get("Notes"); ?></b>: <?php echo htmlspecialchars($machine->getPublicNotes()); ?>
</div>
<?php
}
?>
</div>
</div>
<?php
$components = $machine->getComponents();
if (count($components) > 0) {
?>
<div class="col-sm-6 mb-3">
<h6>Components:</h6>
<div class="list-group">
<?php
foreach ($components as $c) {
?>
<div class = "list-group-item">
<b><?php echo $c->getTypeName(); ?></b><br />
<?php <?php
foreach ($components as $c) { if (!empty($c->getModel())) {
?> ?>
<div class = "list-group-item"> <b><?php $Strings->get("Model"); ?></b>: <?php echo htmlspecialchars($c->getModel()); ?><br />
<?php
<b><?php echo $c->getTypeName(); ?></b><br /> }
<?php
if (!empty($c->getModel())) {
?>
<b><?php $Strings->get("Model"); ?></b>: <?php echo htmlspecialchars($c->getModel()); ?><br />
<?php
}
if (!empty($c->getCapacity())) { if (!empty($c->getCapacity())) {
?> ?>
<b><?php $Strings->get("Capacity"); ?></b>: <?php echo htmlspecialchars($c->getCapacity()); ?><br /> <b><?php $Strings->get("Capacity"); ?></b>: <?php echo htmlspecialchars($c->getCapacity()); ?><br />
<?php <?php
} }
if (!empty($c->getSerial())) { if (!empty($c->getSerial())) {
?> ?>
<b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($c->getSerial()); ?><br /> <b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($c->getSerial()); ?><br />
<?php <?php
} }
if (!empty($c->getTestedDate())) { if (!empty($c->getTestedDate())) {
?> ?>
<b><?php $Strings->get("Tested On"); ?></b>: <?php echo date($SETTINGS["datetime_format"], strtotime($c->getTestedDate())); ?><br /> <b><?php $Strings->get("Tested On"); ?></b>: <?php echo date($SETTINGS["datetime_format"], strtotime($c->getTestedDate())); ?><br />
<?php <?php
} }
if (!empty($c->getPrice())) { if (!empty($c->getPrice())) {
?> ?>
<b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($c->getPrice(), 2); ?> <b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($c->getPrice(), 2); ?>
<?php <?php
} }
if (!empty($c->getPublicNotes())) { if (!empty($c->getPublicNotes())) {
?> ?>
<div> <div>
<b>Notes:</b><br /> <b>Notes:</b><br />
<div class="ml-3"><?php echo htmlspecialchars($c->getPublicNotes()); ?></div> <div class="ml-3"><?php echo htmlspecialchars($c->getPublicNotes()); ?></div>
</div>
<?php } ?>
</div> </div>
<?php } ?> <?php } ?>
</div> </div>
</div> <?php } ?>
<?php </div>
} </div>
<?php
}
$history = $machine->getEvents(); $history = $machine->getEvents();
if (count($history) > 0) { if (count($history) > 0) {
?> ?>
<div class="col-sm-6 mb-3"> <div class="col-sm-6 mb-3">
<h6>Events:</h6> <h6>Events:</h6>
<div class="list-group"> <div class="list-group">
<?php
foreach ($history as $h) {
echo "<div class=\"list-group-item\">\n";
echo "<b>$h[eventname]</b> on " . date($SETTINGS["datetime_format"], strtotime($h['date'])) . "<br />\n";
if (!empty($h['publicnotes'])) {
echo "<div><b>Notes:</b><br /><div class=\"ml-3\">" . htmlspecialchars($h['publicnotes']) . "</div></div>";
}
echo "\n</div>\n";
}
?>
</div>
</div>
<?php <?php
} foreach ($history as $h) {
?> echo "<div class=\"list-group-item\">\n";
</div> echo "<b>$h[eventname]</b> on " . date($SETTINGS["datetime_format"], strtotime($h['date'])) . "<br />\n";
</div> if (!empty($h['publicnotes'])) {
<?php /* Hide this box if we're embedded in another page */ if (!isset($_GET["embed"])) { ?> echo "<div><b>Notes:</b><br /><div class=\"ml-3\">" . htmlspecialchars($h['publicnotes']) . "</div></div>";
<div class="card-body"> }
<p> echo "\n</div>\n";
Look up another machine: }
</p> ?>
<form method="GET"> </div>
<input type="text" name="id" class="form-control" placeholder="Machine ID Number" required />
<button type="submit" class="btn btn-primary btn-block mt-2">Get Info</button>
</form>
</div> </div>
<?php } ?> <?php
}
?>
</div> </div>
<?php
}
?>
<?php if (!isset($_GET["embed"])) { ?>
</div> </div>
<?php /* Hide this box if we're embedded in another page */ if (!isset($_GET["embed"])) { ?>
<div class="card-body">
<p>
Look up another machine:
</p>
<form method="GET">
<input type="text" name="id" class="form-control" placeholder="Machine ID Number" required />
<button type="submit" class="btn btn-primary btn-block mt-2">Get Info</button>
</form>
</div>
<?php } ?>
</div> </div>
</div> <?php
<?php } else { ?></div> }
?>
</div>
</div> </div>
<?php } ?> </div>
<?php <?php
// Send message to parent frame with our height so they can adjust the iframe // Send message to parent frame with our height so they can adjust the iframe

Loading…
Cancel
Save