One more adjustment
This commit is contained in:
parent
b7cb91d4ca
commit
dca0090d8a
399
public/index.php
399
public/index.php
@ -32,238 +32,229 @@ if (isset($_GET["backgroundcolor"]) && !empty($_GET["backgroundcolor"]) && preg_
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if (!isset($_GET["embed"])) { ?>
|
||||
<div class="container mt-4">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-md-8">
|
||||
<?php } else { ?>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12">
|
||||
<?php } ?>
|
||||
<?php
|
||||
if (empty($_GET["id"]) || (!Machine::exists($_GET["id"]) && !Machine::serialExists($_GET["id"]))) {
|
||||
?>
|
||||
<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 class="container mt-4">
|
||||
<div class="row justify-content-center">
|
||||
<div class="<?php if (!isset($_GET["embed"])) { ?>col-12 col-md-8<?php } else { ?>col-12<?php } ?>">
|
||||
<?php
|
||||
if (empty($_GET["id"]) || (!Machine::exists($_GET["id"]) && !Machine::serialExists($_GET["id"]))) {
|
||||
?>
|
||||
<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
|
||||
} else {
|
||||
if (Machine::exists($_GET["id"])) {
|
||||
$machine = new Machine($_GET['id']);
|
||||
} else {
|
||||
$machine = new Machine(Machine::getIDFromSerial($_GET['id']));
|
||||
if (!empty($_GET["id"])) {
|
||||
?>
|
||||
<p class="text-danger">No machine with ID <code><?php echo htmlspecialchars($_GET['id']); ?></code> could be found.</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<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">
|
||||
<div class="row">
|
||||
<div class="col-12 mb-3">
|
||||
<div class="list-group">
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("ID"); ?></b>: <?php echo htmlspecialchars($machine->getID()); ?>
|
||||
</div>
|
||||
<?php if (!empty($machine->getOS())) { ?>
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("OS/Software"); ?></b>: <?php echo htmlspecialchars($machine->getOS()); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if (!empty($machine->getSerial())) { ?>
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($machine->getSerial()); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if (!empty($machine->getManufacturer())) { ?>
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("Manufacturer"); ?></b>: <?php echo htmlspecialchars($machine->getManufacturer()); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if (!empty($machine->getModel())) { ?>
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("Model"); ?></b>: <?php echo htmlspecialchars($machine->getModel()); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
if ($machine->getCondition() > 0) {
|
||||
?>
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("Condition"); ?></b>: <?php
|
||||
$val = $machine->getCondition();
|
||||
$filled = floor($val);
|
||||
$empty = 10;
|
||||
while ($filled > 0) {
|
||||
$filled--;
|
||||
$empty--;
|
||||
echo "<i class=\"fas fa-star\"></i> ";
|
||||
}
|
||||
if ($val - floor($val) > 0.75) {
|
||||
$empty--;
|
||||
echo "<i class=\"fas fa-star\"></i> ";
|
||||
} else if ($val - floor($val) > 0.25) {
|
||||
$empty--;
|
||||
echo "<i class=\"fas fa-star-half-alt\"></i> ";
|
||||
}
|
||||
while ($empty > 0) {
|
||||
$empty--;
|
||||
echo "<i class=\"far fa-star\"></i> ";
|
||||
}
|
||||
echo " ($val/10)";
|
||||
?>
|
||||
</div>
|
||||
<?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>
|
||||
<?php
|
||||
} else {
|
||||
if (Machine::exists($_GET["id"])) {
|
||||
$machine = new Machine($_GET['id']);
|
||||
} else {
|
||||
$machine = new Machine(Machine::getIDFromSerial($_GET['id']));
|
||||
}
|
||||
?>
|
||||
<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">
|
||||
<div class="row">
|
||||
<div class="col-12 mb-3">
|
||||
<div class="list-group">
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("ID"); ?></b>: <?php echo htmlspecialchars($machine->getID()); ?>
|
||||
</div>
|
||||
<?php if (!empty($machine->getOS())) { ?>
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("OS/Software"); ?></b>: <?php echo htmlspecialchars($machine->getOS()); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if (!empty($machine->getSerial())) { ?>
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($machine->getSerial()); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if (!empty($machine->getManufacturer())) { ?>
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("Manufacturer"); ?></b>: <?php echo htmlspecialchars($machine->getManufacturer()); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if (!empty($machine->getModel())) { ?>
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("Model"); ?></b>: <?php echo htmlspecialchars($machine->getModel()); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
if ($machine->getCondition() > 0) {
|
||||
?>
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("Condition"); ?></b>: <?php
|
||||
$val = $machine->getCondition();
|
||||
$filled = floor($val);
|
||||
$empty = 10;
|
||||
while ($filled > 0) {
|
||||
$filled--;
|
||||
$empty--;
|
||||
echo "<i class=\"fas fa-star\"></i> ";
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if ($machine->getPrice() > 0) {
|
||||
?>
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($machine->getPrice(), 2); ?>
|
||||
</div>
|
||||
<?php
|
||||
if ($val - floor($val) > 0.75) {
|
||||
$empty--;
|
||||
echo "<i class=\"fas fa-star\"></i> ";
|
||||
} else if ($val - floor($val) > 0.25) {
|
||||
$empty--;
|
||||
echo "<i class=\"fas fa-star-half-alt\"></i> ";
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if (!empty($machine->getPublicNotes())) {
|
||||
?>
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("Notes"); ?></b>: <?php echo htmlspecialchars($machine->getPublicNotes()); ?>
|
||||
</div>
|
||||
<?php
|
||||
while ($empty > 0) {
|
||||
$empty--;
|
||||
echo "<i class=\"far fa-star\"></i> ";
|
||||
}
|
||||
echo " ($val/10)";
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
$components = $machine->getComponents();
|
||||
|
||||
if (count($components) > 0) {
|
||||
if ($machine->getPrice() > 0) {
|
||||
?>
|
||||
<div class="col-sm-6 mb-3">
|
||||
<h6>Components:</h6>
|
||||
<div class="list-group">
|
||||
<div class="list-group-item">
|
||||
<b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($machine->getPrice(), 2); ?>
|
||||
</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
|
||||
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())) {
|
||||
?>
|
||||
<b><?php $Strings->get("Capacity"); ?></b>: <?php echo htmlspecialchars($c->getCapacity()); ?><br />
|
||||
<?php
|
||||
}
|
||||
|
||||
if (!empty($c->getCapacity())) {
|
||||
?>
|
||||
<b><?php $Strings->get("Capacity"); ?></b>: <?php echo htmlspecialchars($c->getCapacity()); ?><br />
|
||||
<?php
|
||||
}
|
||||
if (!empty($c->getSerial())) {
|
||||
?>
|
||||
<b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($c->getSerial()); ?><br />
|
||||
<?php
|
||||
}
|
||||
|
||||
if (!empty($c->getSerial())) {
|
||||
?>
|
||||
<b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($c->getSerial()); ?><br />
|
||||
<?php
|
||||
}
|
||||
if (!empty($c->getTestedDate())) {
|
||||
?>
|
||||
<b><?php $Strings->get("Tested On"); ?></b>: <?php echo date($SETTINGS["datetime_format"], strtotime($c->getTestedDate())); ?><br />
|
||||
<?php
|
||||
}
|
||||
|
||||
if (!empty($c->getTestedDate())) {
|
||||
?>
|
||||
<b><?php $Strings->get("Tested On"); ?></b>: <?php echo date($SETTINGS["datetime_format"], strtotime($c->getTestedDate())); ?><br />
|
||||
<?php
|
||||
}
|
||||
if (!empty($c->getPrice())) {
|
||||
?>
|
||||
<b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($c->getPrice(), 2); ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (!empty($c->getPrice())) {
|
||||
?>
|
||||
<b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($c->getPrice(), 2); ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (!empty($c->getPublicNotes())) {
|
||||
?>
|
||||
<div>
|
||||
<b>Notes:</b><br />
|
||||
<div class="ml-3"><?php echo htmlspecialchars($c->getPublicNotes()); ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
if (!empty($c->getPublicNotes())) {
|
||||
?>
|
||||
<div>
|
||||
<b>Notes:</b><br />
|
||||
<div class="ml-3"><?php echo htmlspecialchars($c->getPublicNotes()); ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
$history = $machine->getEvents();
|
||||
|
||||
if (count($history) > 0) {
|
||||
?>
|
||||
<div class="col-sm-6 mb-3">
|
||||
<h6>Events:</h6>
|
||||
<div class="list-group">
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
$history = $machine->getEvents();
|
||||
|
||||
if (count($history) > 0) {
|
||||
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 class="col-sm-6 mb-3">
|
||||
<h6>Events:</h6>
|
||||
<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
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</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 } ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php if (!isset($_GET["embed"])) { ?>
|
||||
</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>
|
||||
<?php } else { ?></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Send message to parent frame with our height so they can adjust the iframe
|
||||
|
Loading…
x
Reference in New Issue
Block a user