Add button and more nicely format

This commit is contained in:
phl0
2024-12-12 13:25:53 +01:00
parent 8c5b381f6c
commit 4c598f95a3
4 changed files with 26 additions and 9 deletions

View File

@@ -397,8 +397,12 @@ class Update extends CI_Controller {
public function update_lotw_sats() {
$this->load->model('Update_model');
$result = $this->Update_model->lotw_sats();
echo $result;
$bodyData['satupdates'] = $this->Update_model->lotw_sats();
$data['page_title'] = __("LoTW SAT Update");
$this->load->view('interface_assets/header', $data);
$this->load->view('lotw/satupdate', $bodyData);
$this->load->view('interface_assets/footer');
//echo $result;
}
function version_check() {

View File

@@ -393,13 +393,13 @@ class Update_model extends CI_Model {
$existingSats[$row->name] = array($row->lotw, $row->displayname);
}
print '<table>';
print '<tr><th>'.__('Name').'</th><th>'.__('Display Name').'</th><th>'.__('Start Date').'</th><th>'.__('End Date').'</th><th>'.__('Status').'</th></tr>';
$result = array();
foreach ($xml->tqslconfig->satellites->satellite as $sat) {
$name = $sat->attributes()->{'name'};
$name = ($sat->attributes()->{'name'} ?? '')->__toString();
$startDate = $sat->attributes()->{'startDate'};
$endDate = $sat->attributes()->{'endDate'};
$displayname = $sat;
$displayname = ($sat ?? '')->__toString();
$status = '';
if (array_key_exists("$name", $existingSats)) {
@@ -437,10 +437,9 @@ class Update_model extends CI_Model {
$status = __('New SAT. Insert failed.');
}
}
print('<tr><td>'.$name.'</td><td>'.$displayname.'</td><td>'.$startDate.'</td><td>'.$endDate.'</td><td>'.$status.'</td></tr>');
array_push($result, array('name' => $name, 'displayname' => $displayname, 'startDate' => $startDate, 'endDate' => $endDate, 'status' => $status));
}
print '</table>';
return;
return $result;
}
}

View File

@@ -0,0 +1,13 @@
<div class="container">
<h2><?php echo $page_title; ?></h2>
<?php
print '<table class="table table-striped table-hover">';
print '<tr><th>'.__('Name').'</th><th>'.__('Display Name').'</th><th>'.__('Start Date').'</th><th>'.__('End Date').'</th><th>'.__('Status').'</th></tr>';
foreach ($satupdates as $sat) {
print('<tr><td>'.$sat['name'].'</td><td>'.$sat['displayname'].'</td><td>'.$sat['startDate'].'</td><td>'.$sat['endDate'].'</td><td>'.$sat['status'].'</td></tr>');
}
print '</table>';
?>
</div>

View File

@@ -13,6 +13,7 @@
<div class="card">
<div class="card-body">
<button onclick="createSatelliteDialog();" class="btn btn-primary btn-sm"><i class="fas fa-plus"></i> <?= __("Add a satellite"); ?></button>
<a class="btn btn-primary btn-sm" href="<?php echo site_url('/update/update_lotw_sats'); ?>" role="button"><i class="fas fa-sync-alt"></i> <?= __("Sync Satellites from LoTW"); ?></a>
<div class="table-responsive">
<table style="width:100%" class="sattable table table-sm table-striped">