From 1296656dd6a38ef88602910fbd7c10937d17ae1e Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Thu, 13 Aug 2020 17:24:07 +0100 Subject: [PATCH] Created the start of the frontend to display uploaded certificates. --- application/config/migration.php | 2 +- application/controllers/Lotw.php | 16 ++++- .../042_add_userid_to_lotw_certs.php | 21 +++++++ application/models/Lotw.php | 16 ----- application/models/LotwCert.php | 22 +++++++ application/views/lotw_views/index.php | 58 +++++++++++++++++++ 6 files changed, 117 insertions(+), 18 deletions(-) create mode 100644 application/migrations/042_add_userid_to_lotw_certs.php delete mode 100644 application/models/Lotw.php create mode 100644 application/models/LotwCert.php create mode 100644 application/views/lotw_views/index.php diff --git a/application/config/migration.php b/application/config/migration.php index 37cfddba..bb6a07c3 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 41; +$config['migration_version'] = 42; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 3ea55646..f2a7ec80 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -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'; diff --git a/application/migrations/042_add_userid_to_lotw_certs.php b/application/migrations/042_add_userid_to_lotw_certs.php new file mode 100644 index 00000000..09892fa0 --- /dev/null +++ b/application/migrations/042_add_userid_to_lotw_certs.php @@ -0,0 +1,21 @@ +dbforge->add_column('lotw_certs', $fields); + } + + public function down() + { + $this->dbforge->drop_column('lotw_certs', 'user_id'); + } +} \ No newline at end of file diff --git a/application/models/Lotw.php b/application/models/Lotw.php deleted file mode 100644 index 8b74cb30..00000000 --- a/application/models/Lotw.php +++ /dev/null @@ -1,16 +0,0 @@ -db->empty_table($table); - } -} -?> \ No newline at end of file diff --git a/application/models/LotwCert.php b/application/models/LotwCert.php new file mode 100644 index 00000000..447cddae --- /dev/null +++ b/application/models/LotwCert.php @@ -0,0 +1,22 @@ +db->where('user_id', $user_id); + $query = $this->db->get('lotw_certs'); + + return $query; + } + + function empty_table($table) { + $this->db->empty_table($table); + } +} +?> \ No newline at end of file diff --git a/application/views/lotw_views/index.php b/application/views/lotw_views/index.php new file mode 100644 index 00000000..6366fcc4 --- /dev/null +++ b/application/views/lotw_views/index.php @@ -0,0 +1,58 @@ +
+ +

+ + +
+
+ Upload CertificateAvailable Certificates +
+ +
+ + + + + num_rows() > 0) { ?> + +
+ + + + + + + + + + + + + + result() as $row) { ?> + + + + + + + + + + +
CallsignDXCCDate CreatedDate ExpiresStatus
callsign; ?>cert_dxcc; ?>date_created; ?>date_expires; ?>
+
+ + + + + +
+
+ + +