Created the start of the frontend to display uploaded certificates.

这个提交包含在:
Peter Goodhall 2020-08-13 17:24:07 +01:00
父节点 c86d95af60
当前提交 1296656dd6
共有 6 个文件被更改,包括 117 次插入18 次删除

查看文件

@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 41;
$config['migration_version'] = 42;
/*
|--------------------------------------------------------------------------

查看文件

@ -9,6 +9,20 @@ class Lotw extends CI_Controller {
$this->load->helper(array('form', 'url'));
}
public function index() {
$this->load->model('LotwCert');
$data['lotw_cert_results'] = $this->LotwCert->lotw_certs($this->session->userdata('user_id'));
$data['page_title'] = "Logbook of the World";
$this->load->view('interface_assets/header', $data);
$this->load->view('lotw_views/index');
$this->load->view('interface_assets/footer');
}
private function loadFromFile($filepath)
{
$this->load->model('user_model');
@ -206,7 +220,7 @@ class Lotw extends CI_Controller {
$this->load->model('user_model');
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
$data['page_title'] = "LoTW .TQ8 Upload";
$data['page_title'] = "LoTW .TQ8 Upload";
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'tq8|TQ8';

查看文件

@ -0,0 +1,21 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Migration_add_userid_to_lotw_certs extends CI_Migration {
public function up()
{
$fields = array(
'user_id int(11) DEFAULT NULL',
);
$this->dbforge->add_column('lotw_certs', $fields);
}
public function down()
{
$this->dbforge->drop_column('lotw_certs', 'user_id');
}
}

查看文件

@ -1,16 +0,0 @@
<?php
class LOTW extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function empty_table($table) {
$this->db->empty_table($table);
}
}
?>

查看文件

@ -0,0 +1,22 @@
<?php
class LotwCert extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function lotw_certs($user_id) {
$this->db->where('user_id', $user_id);
$query = $this->db->get('lotw_certs');
return $query;
}
function empty_table($table) {
$this->db->empty_table($table);
}
}
?>

查看文件

@ -0,0 +1,58 @@
<div class="container lotw">
<h1><?php echo $page_title; ?></h1>
<!-- Card Starts -->
<div class="card">
<div class="card-header">
<a class="btn btn-success btn-sm float-right" href="#" role="button"><i class="fas fa-cloud-upload-alt"></i> Upload Certificate</a>Available Certificates
</div>
<div class="card-body">
<?php if(isset($error)) { ?>
<div class="alert alert-danger" role="alert">
<?php echo $error; ?>
</div>
<?php } ?>
<?php if ($lotw_cert_results->num_rows() > 0) { ?>
<div class="table-responsive">
<table class="table table-hover">
<thead class="thead-light">
<tr>
<th scope="col">Callsign</th>
<th scope="col">DXCC</th>
<th scope="col">Date Created</th>
<th scope="col">Date Expires</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
<?php foreach ($lotw_cert_results->result() as $row) { ?>
<tr>
<td><?php echo $row->callsign; ?></td>
<td><?php echo $row->cert_dxcc; ?></td>
<td><?php echo $row->date_created; ?></td>
<td><?php echo $row->date_expires; ?></td>
<td></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } else { ?>
<div class="alert alert-info" role="alert">
You need to upload some LoTW p12 certificates to use this area.
</div>
<?php } ?>
</div>
</div>
<!-- Card Ends -->
</div>