Added objects table view format
Can now view servers, shared hosting and domains as a table with the icon switcher.
This commit is contained in:
parent
c5656bb681
commit
c74609c406
2
assets/css/all.min.css
vendored
2
assets/css/all.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -331,13 +331,13 @@ textarea {
|
|||
|
||||
.table td, .table th {
|
||||
padding: .75rem;
|
||||
vertical-align: top;
|
||||
border-top: 1px solid #dee2e6
|
||||
}
|
||||
|
||||
.table thead th {
|
||||
vertical-align: bottom;
|
||||
border-bottom: 2px solid #dee2e6
|
||||
border-bottom: 2px solid #dee2e6;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.table-sm td, .table-sm th {
|
||||
|
@ -1142,10 +1142,71 @@ button.close {
|
|||
color: #bf5151;
|
||||
}
|
||||
|
||||
.fa-th, .fa-table {
|
||||
color: #8787ff;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.os-td {
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.objects-table td, .objects-table th {
|
||||
padding: 0.6rem 0.4rem;
|
||||
}
|
||||
|
||||
.objects-table tr {
|
||||
transition: ease-in-out 0.4s;
|
||||
}
|
||||
|
||||
.objects-table tr:hover {
|
||||
background: #f2f7fb;
|
||||
}
|
||||
|
||||
.td-text-sml {
|
||||
font-size: 86%;
|
||||
}
|
||||
|
||||
.td-text-med {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
.td-special-price {
|
||||
background: #ffd70014;
|
||||
}
|
||||
|
||||
.td-due-soon {
|
||||
background: #ff00000f;
|
||||
}
|
||||
|
||||
.td-not-due-soon {
|
||||
background: #00ff340f;
|
||||
}
|
||||
|
||||
.objects-table th:first-child, .objects-table td:first-child {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.table-btn {
|
||||
font-size: 0.8rem;
|
||||
padding: .01rem 0.6rem;
|
||||
}
|
||||
|
||||
.td-nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tab-pane {
|
||||
margin-top: .8rem
|
||||
}
|
||||
|
||||
.mt-1 {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.input-group-text {
|
||||
color: #2d3032;
|
||||
background-color: #dbe4ee;
|
||||
|
|
33
assets/js/scripts.min.js
vendored
33
assets/js/scripts.min.js
vendored
|
@ -313,6 +313,39 @@ $(document).on("click", "#checkUpStatus", function () {
|
|||
}
|
||||
});
|
||||
|
||||
$(document).on("click", "#viewSwitcherIcon", function () {
|
||||
var icon = $(this).children().first();
|
||||
if ($("#serversTable").children().length == 0){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "calls.php",
|
||||
data: {"type": "object_tables"},
|
||||
success: function (result) {
|
||||
$("#tableViewDiv").append(result);
|
||||
}
|
||||
});
|
||||
icon.removeClass("fa-table");
|
||||
icon.addClass("fa-th");
|
||||
$("#cardsViewDiv" ).hide();
|
||||
$("#tableViewDiv" ).show();
|
||||
$('#viewSwitchIcon').prop('title', 'Switch to cards');
|
||||
} else {
|
||||
if (icon.hasClass("fa-table")) {
|
||||
icon.removeClass("fa-table");
|
||||
icon.addClass("fa-th");
|
||||
$( "#cardsViewDiv" ).hide();
|
||||
$( "#tableViewDiv" ).show();
|
||||
$('#viewSwitchIcon').prop('title', 'Switch to cards');
|
||||
} else if (icon.hasClass("fa-th")) {
|
||||
icon.removeClass("fa-th");
|
||||
icon.addClass("fa-table");
|
||||
$( "#tableViewDiv" ).hide();
|
||||
$( "#cardsViewDiv" ).show();
|
||||
$('#viewSwitchIcon').prop('title', 'Switch to table');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#virt').change(function(){
|
||||
if($(this).val() == 'DEDI'){
|
||||
$('#dedi_cpu').prop("checked", true);
|
||||
|
|
|
@ -40,6 +40,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
|||
$idle->getIpForDomain($_GET['hostname'], $_GET['type']);
|
||||
} elseif ($_GET['type'] == 'check_up') {
|
||||
echo $idle->checkIsUp($_GET['host']);
|
||||
} elseif ($_GET['type'] == 'object_tables') {
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
echo $idle->objectTables();
|
||||
}
|
||||
}
|
||||
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
|
261
class.php
261
class.php
|
@ -14,6 +14,9 @@ class idlersConfig
|
|||
const DB_NAME = 'idlers';
|
||||
const DB_USERNAME = 'root';
|
||||
const DB_PASSWORD = '';
|
||||
|
||||
//Have slight background color for server table values: was special price and due soon
|
||||
const COLOR_TABLE = true;
|
||||
}
|
||||
|
||||
class elementHelpers extends idlersConfig
|
||||
|
@ -153,10 +156,10 @@ class elementHelpers extends idlersConfig
|
|||
$this->tagClose("ul");
|
||||
}
|
||||
|
||||
protected function tableHeader(array $headers)
|
||||
protected function tableHeader(array $headers, string $class = 'table table-striped table-bordered table-sm', string $id = 'orderTable')
|
||||
{
|
||||
$this->tagOpen('div', 'table-responsive');
|
||||
$this->outputString("<table class='table table-striped table-bordered table-sm' id='orderTable'>");
|
||||
$this->outputString("<table class='$class' id='$id'>");
|
||||
$this->tagOpen('thead');
|
||||
$this->tagOpen('tr');
|
||||
foreach ($headers as $th) {
|
||||
|
@ -165,6 +168,13 @@ class elementHelpers extends idlersConfig
|
|||
$this->outputString('</tr></thead><tbody>');
|
||||
}
|
||||
|
||||
protected function tableTd(string $class, $content)
|
||||
{
|
||||
$this->tagOpen('td', $class);
|
||||
$this->outputString($content);
|
||||
$this->tagClose('td');
|
||||
}
|
||||
|
||||
protected function virtSelectOptions()
|
||||
{
|
||||
$this->selectOption('KVM', 'KVM', true);
|
||||
|
@ -585,10 +595,15 @@ class idlers extends helperFunctions
|
|||
$this->navTabs(array('Services', 'Add', 'Order', 'Info', 'Search'), array('#services', '#add_server', '#order', '#info', '#search'));
|
||||
$this->outputString('<div id="myTabContent" class="tab-content">');
|
||||
$this->outputString('<div class="tab-pane server-cards fade active show" id="services">');
|
||||
$this->viewSwitcherIcon();
|
||||
$this->tagOpen('div', '', 'cardsViewDiv');
|
||||
$this->serverCards();
|
||||
$this->sharedHostingCards();
|
||||
$this->domainCards();
|
||||
$this->tagClose('div');
|
||||
$this->tagOpen('div', '', 'tableViewDiv');
|
||||
//Objects tables
|
||||
$this->tagClose('div', 2);
|
||||
$this->outputString('<div class="tab-pane fade" id="add_server">');
|
||||
//BTN Bar
|
||||
$this->rowColOpen('row text-center', 'col-12 btn-bar-col');
|
||||
|
@ -856,6 +871,41 @@ class idlers extends helperFunctions
|
|||
$this->tagClose('div');
|
||||
}
|
||||
|
||||
protected function serverTable()
|
||||
{
|
||||
if (self::SRV_SORT_TYPE == 'HOSTNAME_DESC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `hostname` DESC;");
|
||||
} elseif (self::SRV_SORT_TYPE == 'HOSTNAME_ASC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `hostname`;");
|
||||
} elseif (self::SRV_SORT_TYPE == 'OWNED_SINCE_DESC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `owned_since` DESC;");
|
||||
} elseif (self::SRV_SORT_TYPE == 'OWNED_SINCE_ASC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `owned_since`;");
|
||||
} elseif (self::SRV_SORT_TYPE == 'PRICE_DESC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `as_usd` DESC;");
|
||||
} elseif (self::SRV_SORT_TYPE == 'PRICE_ASC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `as_usd`;");
|
||||
} elseif (self::SRV_SORT_TYPE == 'DUE_DESC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `next_dd` DESC;");
|
||||
} elseif (self::SRV_SORT_TYPE == 'DUE_ASC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `next_dd`;");
|
||||
} else {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `servers`;");
|
||||
}
|
||||
$select->execute();
|
||||
$count = $select->rowCount();
|
||||
if ($count > 0) {
|
||||
$this->HTMLPhrase('h4', 'card-section-header', 'Servers <span class="object-count">' . $count . '</span>');
|
||||
$this->tagOpen('div', 'row');
|
||||
$this->tableHeader(array('Hostname', '', '', 'Type', 'CPU', 'RAM', 'Disk', 'Price', 'OS', 'Location', 'Provider', 'Due', 'Owned', 'IPv4', 'IPv6', 'Tags'), 'table objects-table', 'serversTable');
|
||||
while ($row = $select->fetch(PDO::FETCH_ASSOC)) {
|
||||
$this->vpsTableRow($row['id']);
|
||||
}
|
||||
$this->outputString('</tbody></table></div>');
|
||||
$this->tagClose('div');
|
||||
}
|
||||
}
|
||||
|
||||
protected function vpsCard(string $id)
|
||||
{
|
||||
$select = $this->dbConnect()->prepare("
|
||||
|
@ -920,6 +970,206 @@ class idlers extends helperFunctions
|
|||
$this->tagClose('div', 5);
|
||||
}
|
||||
|
||||
protected function locationForTable(string $location)
|
||||
{
|
||||
if (strpos($location, ',') !== false) {
|
||||
return explode(',', $location)[0];
|
||||
} else {
|
||||
return $location;
|
||||
}
|
||||
}
|
||||
|
||||
public function objectTables()
|
||||
{
|
||||
$this->serverTable();
|
||||
$this->sharedHostingTable();
|
||||
$this->domainTable();
|
||||
}
|
||||
|
||||
protected function vpsTableRow(string $id)
|
||||
{
|
||||
$select = $this->dbConnect()->prepare("
|
||||
SELECT servers.id,servers.hostname,servers.ipv4,servers.ipv6,servers.`cpu`,servers.cpu_freq,servers.ram,servers.ram_type,servers.`disk`,
|
||||
servers.disk_type,servers.os,servers.virt,servers.tags, DATE_FORMAT(`owned_since`, '%d %b %Y') as dt, servers.was_special,locations.name as location,providers.name as provider,pricing.price,pricing.currency,pricing.term,pricing.next_dd
|
||||
FROM servers INNER JOIN locations on servers.location = locations.id INNER JOIN providers on servers.provider = providers.id
|
||||
INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;");
|
||||
$select->execute([$id]);
|
||||
$data = $select->fetchAll(PDO::FETCH_ASSOC)[0];
|
||||
if (self::COLOR_TABLE) {
|
||||
($data['was_special'] == 1) ? $special_class = 'td-special-price' : $special_class = '';
|
||||
if ($this->processDueDate($data['id'], $data['term'], $data['next_dd']) < 7) {
|
||||
$ds_class = 'td-due-soon';
|
||||
} elseif ($this->processDueDate($data['id'], $data['term'], $data['next_dd']) > 300) {
|
||||
$ds_class = 'td-not-due-soon';
|
||||
} else {
|
||||
$ds_class = '';
|
||||
}
|
||||
} else {
|
||||
$special_class = $ds_class = '';
|
||||
}
|
||||
(empty($data['ipv4']) || is_null($data['ipv4'])) ? $host = $data['hostname'] : $host = $data['ipv4'];
|
||||
$this->tagOpen('tr');
|
||||
$this->tableTd('', $data['hostname']);
|
||||
$this->tableTd('', '<a class="btn btn-main table-btn" id="viewMoreServer" value="' . $data['id'] . '" data-target="#viewMoreServerModal" data-toggle="modal" href="#" role="button">More</a>');
|
||||
$this->tableTd('', '<a class="btn btn-second table-btn" id="editServer" value="' . $data['id'] . '" data-target="#editServerModal" data-toggle="modal" href="#" role="button">Edit</a>');
|
||||
$this->tableTd('td-text-sml', $data['virt']);
|
||||
$this->tableTd('td-nowrap', $data['cpu'] . '<span class="data-type">@' . $this->mhzToGhz($data['cpu_freq']) . 'Ghz</span>');
|
||||
$this->tableTd('td-nowrap', $data['ram'] . '<span class="data-type">' . $data['ram_type'] . '</span>');
|
||||
$this->tableTd('td-nowrap', $data['disk'] . '<span class="data-type">' . $data['disk_type'] . '</span>');
|
||||
$this->tableTd('td-nowrap ' . $special_class . '', $data['price'] . ' <span class="data-type">' . $data['currency'] . ' ' . $this->paymentTerm($data['term']) . '</span>');
|
||||
$this->tableTd('', '<a id="checkUpStatus" href="#" value="' . $host . '">' . $this->osIntToIcon($data['os']) . '</a>');
|
||||
$this->tableTd('td-nowrap td-text-med', '<div class="td-nowrap">' . $this->locationForTable($data['location']) . '</div>');
|
||||
$this->tableTd('td-nowrap td-text-med', '<div class="td-nowrap">' . $data['provider'] . '</div>');
|
||||
$this->tableTd('td-nowrap td-text-sml ' . $ds_class . '', '<div class="td-nowrap">' . $this->processDueDate($data['id'], $data['term'], $data['next_dd']) . ' days</div>');
|
||||
$this->tableTd('td-nowrap td-text-sml', '<div class="td-nowrap">' . $data['dt'] . '</div>');
|
||||
$this->tableTd('td-nowrap td-text-sml', '<div class="td-nowrap">' . $data['ipv4'] . '</div>');
|
||||
$this->tableTd('td-nowrap td-text-sml', '<div class="td-nowrap">' . $data['ipv6'] . '</div>');
|
||||
$this->tableTd('td-nowrap td-text-sml', '<div class="td-nowrap">' . $data['tags'] . '</div>');
|
||||
$this->tagClose('tr');
|
||||
}
|
||||
|
||||
protected function sharedHostingTable()
|
||||
{
|
||||
if (self::SH_SORT_TYPE == 'DOMAIN_DESC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` ORDER BY `domain` DESC;");
|
||||
} elseif (self::SH_SORT_TYPE == 'DOMAIN_ASC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` ORDER BY `domain`;");
|
||||
} elseif (self::SH_SORT_TYPE == 'OWNED_SINCE_DESC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` ORDER BY `owned_since` DESC;");
|
||||
} elseif (self::SH_SORT_TYPE == 'OWNED_SINCE_ASC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` ORDER BY `owned_since`;");
|
||||
} elseif (self::SH_SORT_TYPE == 'PRICE_DESC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` INNER JOIN `pricing` ON shared_hosting.id = pricing.server_id ORDER BY `as_usd` DESC;");
|
||||
} elseif (self::SH_SORT_TYPE == 'PRICE_ASC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` INNER JOIN `pricing` ON shared_hosting.id = pricing.server_id ORDER BY `as_usd`;");
|
||||
} elseif (self::SH_SORT_TYPE == 'DUE_DESC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` INNER JOIN `pricing` ON shared_hosting.id = pricing.server_id ORDER BY `next_dd` DESC;");
|
||||
} elseif (self::SH_SORT_TYPE == 'DUE_ASC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` INNER JOIN `pricing` ON shared_hosting.id = pricing.server_id ORDER BY `next_dd`;");
|
||||
} else {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting`;");
|
||||
}
|
||||
$select->execute();
|
||||
$count = $select->rowCount();
|
||||
if ($count > 0) {
|
||||
$this->HTMLPhrase('h4', 'card-section-header mt-1', 'Shared hosting <span class="object-count">' . $count . '</span>');
|
||||
$this->tagOpen('div', 'row');
|
||||
$this->tableHeader(array('Domain', '', '', 'Type', 'Disk', 'Price', 'Location', 'Provider', 'Due', 'BWidth', 'Domains', 'Emails', 'FTPs', 'DBs', 'Since'), 'table objects-table', 'sharedHostingTable');
|
||||
while ($row = $select->fetch(PDO::FETCH_ASSOC)) {
|
||||
$this->sharedHostingTableRow($row['id']);
|
||||
}
|
||||
$this->outputString('</tbody></table></div>');
|
||||
$this->tagClose('div');
|
||||
}
|
||||
}
|
||||
|
||||
protected function domainTable()
|
||||
{
|
||||
if (self::DC_SORT_TYPE == 'DOMAIN_DESC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` ORDER BY `domain` DESC;");
|
||||
} elseif (self::DC_SORT_TYPE == 'DOMAIN_ASC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` ORDER BY `domain`;");
|
||||
} elseif (self::DC_SORT_TYPE == 'OWNED_SINCE_DESC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` ORDER BY `owned_since` DESC;");
|
||||
} elseif (self::DC_SORT_TYPE == 'OWNED_SINCE_ASC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` ORDER BY `owned_since`;");
|
||||
} elseif (self::DC_SORT_TYPE == 'PRICE_DESC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` INNER JOIN `pricing` ON domains.id = pricing.server_id ORDER BY `as_usd` DESC;");
|
||||
} elseif (self::DC_SORT_TYPE == 'PRICE_ASC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` INNER JOIN `pricing` ON domains.id = pricing.server_id ORDER BY `as_usd`;");
|
||||
} elseif (self::DC_SORT_TYPE == 'DUE_DESC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` INNER JOIN `pricing` ON domains.id = pricing.server_id ORDER BY `next_dd` DESC;");
|
||||
} elseif (self::DC_SORT_TYPE == 'DUE_ASC') {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` INNER JOIN `pricing` ON domains.id = pricing.server_id ORDER BY `next_dd`;");
|
||||
} else {
|
||||
$select = $this->dbConnect()->prepare("SELECT `id` FROM `domains`;");
|
||||
}
|
||||
$select->execute();
|
||||
$count = $select->rowCount();
|
||||
if ($count > 0) {
|
||||
$this->HTMLPhrase('h4', 'card-section-header mt-1', 'Domains <span class="object-count">' . $count . '</span>');
|
||||
$this->tagOpen('div', 'row');
|
||||
$this->tableHeader(array('Domain', '', '', 'NS1', 'NS2', 'Price', 'Provider', 'Due', 'Since'), 'table objects-table', 'domainsTable');
|
||||
while ($row = $select->fetch(PDO::FETCH_ASSOC)) {
|
||||
$this->domainTableRow($row['id']);
|
||||
}
|
||||
$this->outputString('</tbody></table></div>');
|
||||
$this->tagClose('div');
|
||||
}
|
||||
}
|
||||
|
||||
protected function domainTableRow(string $id)
|
||||
{
|
||||
$select = $this->dbConnect()->prepare("
|
||||
SELECT domains.id,domains.domain,domains.attached_to,domains.ns1,domains.ns2,DATE_FORMAT(`owned_since`, '%d %b %Y') as dt,providers.name as provider, pricing.price,pricing.currency,pricing.term,pricing.next_dd
|
||||
FROM domains INNER JOIN providers on domains.provider = providers.id
|
||||
INNER JOIN pricing on domains.id = pricing.server_id WHERE domains.id = ? LIMIT 1;");
|
||||
$select->execute([$id]);
|
||||
$data = $select->fetchAll(PDO::FETCH_ASSOC)[0];
|
||||
if (self::COLOR_TABLE) {
|
||||
if ($this->processDueDate($data['id'], $data['term'], $data['next_dd']) < 7) {
|
||||
$ds_class = 'td-due-soon';
|
||||
} elseif ($this->processDueDate($data['id'], $data['term'], $data['next_dd']) > 300) {
|
||||
$ds_class = 'td-not-due-soon';
|
||||
} else {
|
||||
$ds_class = '';
|
||||
}
|
||||
} else {
|
||||
$ds_class = '';
|
||||
}
|
||||
$this->tagOpen('tr');
|
||||
$this->tableTd('td-nowrap', $data['domain']);
|
||||
$this->tableTd('', '<a class="btn btn-main table-btn" id="viewMoreDomain" value="' . $data['id'] . '" data-target="#viewMoreModalDomain" data-toggle="modal" href="#" role="button">More</a>');
|
||||
$this->tableTd('', '<a class="btn btn-second table-btn" id="editDomain" value="' . $data['id'] . '" data-target="#editModalDomain" data-toggle="modal" href="#" role="button">Edit</a>');
|
||||
$this->tableTd('td-nowrap', '<code>' . $data['ns1'] . '<code>');
|
||||
$this->tableTd('td-nowrap', '<code>' . $data['ns2'] . '<code>');
|
||||
$this->tableTd('td-nowrap', $data['price'] . ' <span class="data-type">' . $data['currency'] . ' ' . $this->paymentTerm($data['term']) . '</span>');
|
||||
$this->tableTd('td-nowrap td-text-med', '<div class="td-nowrap">' . $data['provider'] . '</div>');
|
||||
$this->tableTd('td-nowrap td-text-sml ' . $ds_class . '', '<div class="td-nowrap">' . $this->processDueDate($data['id'], $data['term'], $data['next_dd']) . ' days</div>');
|
||||
$this->tableTd('td-nowrap', $data['dt']);
|
||||
$this->tagClose('tr');
|
||||
}
|
||||
|
||||
protected function sharedHostingTableRow(string $id)
|
||||
{
|
||||
$select = $this->dbConnect()->prepare("
|
||||
SELECT shared_hosting.id,shared_hosting.domain,shared_hosting.type,shared_hosting.was_special,shared_hosting.disk,shared_hosting.disk_type,shared_hosting.bandwidth,shared_hosting.domains_limit,shared_hosting.emails,
|
||||
shared_hosting.ftp,shared_hosting.db,DATE_FORMAT(`owned_since`, '%d %b %Y') as dt,locations.name as location,providers.name as provider,pricing.price,pricing.currency,pricing.term,pricing.next_dd
|
||||
FROM shared_hosting INNER JOIN locations on shared_hosting.location = locations.id INNER JOIN providers on shared_hosting.provider = providers.id
|
||||
INNER JOIN pricing on shared_hosting.id = pricing.server_id WHERE shared_hosting.id = ? LIMIT 1;");
|
||||
$select->execute([$id]);
|
||||
$data = $select->fetchAll(PDO::FETCH_ASSOC)[0];
|
||||
if (self::COLOR_TABLE) {
|
||||
($data['was_special'] == 1) ? $special_class = 'td-special-price' : $special_class = '';
|
||||
if ($this->processDueDate($data['id'], $data['term'], $data['next_dd']) < 7) {
|
||||
$ds_class = 'td-due-soon';
|
||||
} elseif ($this->processDueDate($data['id'], $data['term'], $data['next_dd']) > 300) {
|
||||
$ds_class = 'td-not-due-soon';
|
||||
} else {
|
||||
$ds_class = '';
|
||||
}
|
||||
} else {
|
||||
$special_class = $ds_class = '';
|
||||
}
|
||||
$this->tagOpen('tr');
|
||||
$this->tableTd('td-nowrap', $data['domain']);
|
||||
$this->tableTd('', '<a class="btn btn-main table-btn" id="viewMoreSharedHosting" value="' . $data['id'] . '" data-target="#viewMoreModalSharedHosting" data-toggle="modal" href="#" role="button">More</a>');
|
||||
$this->tableTd('', '<a class="btn btn-second table-btn" id="editSharedHosting" value="' . $data['id'] . '" data-target="#editModalSharedHosting" data-toggle="modal" href="#" role="button">Edit</a>');
|
||||
$this->tableTd('td-nowrap td-text-sml', $data['type']);
|
||||
$this->tableTd('td-nowrap', $data['disk'] . '<span class="data-type">' . $data['disk_type'] . '</span>');
|
||||
$this->tableTd('td-nowrap ' . $special_class . '', $data['price'] . ' <span class="data-type">' . $data['currency'] . ' ' . $this->paymentTerm($data['term']) . '</span>');
|
||||
$this->tableTd('td-nowrap td-text-med', '<div class="td-nowrap">' . $this->locationForTable($data['location']) . '</div>');
|
||||
$this->tableTd('td-nowrap td-text-med', '<div class="td-nowrap">' . $data['provider'] . '</div>');
|
||||
$this->tableTd('td-nowrap td-text-sml ' . $ds_class . '', '<div class="td-nowrap">' . $this->processDueDate($data['id'], $data['term'], $data['next_dd']) . ' days</div>');
|
||||
$this->tableTd('td-nowrap', $data['bandwidth'] . '<span class="data-type">TB</span>');
|
||||
$this->tableTd('td-nowrap', $data['domains_limit']);
|
||||
$this->tableTd('td-nowrap', $data['emails']);
|
||||
$this->tableTd('td-nowrap', $data['ftp']);
|
||||
$this->tableTd('td-nowrap', $data['db']);
|
||||
$this->tableTd('td-nowrap', $data['dt']);
|
||||
$this->tagClose('tr');
|
||||
}
|
||||
|
||||
protected function SharedHostingCard(string $id)
|
||||
{
|
||||
$select = $this->dbConnect()->prepare("
|
||||
|
@ -2827,6 +3077,13 @@ class idlers extends helperFunctions
|
|||
return $result;
|
||||
}
|
||||
|
||||
protected function viewSwitcherIcon()
|
||||
{
|
||||
$this->rowColOpen('row text-center', 'col-12');
|
||||
$this->outputString('<a id="viewSwitcherIcon"><i class="fas fa-table" id="viewSwitchIcon" title="Switch to table"></i></a>');
|
||||
$this->tagClose('div', 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class itemInsert extends idlers
|
||||
|
|
Loading…
Reference in New Issue
Block a user