diff --git a/application/controllers/Logbooks.php b/application/controllers/Logbooks.php index eee2abba..ff59eb6f 100644 --- a/application/controllers/Logbooks.php +++ b/application/controllers/Logbooks.php @@ -27,5 +27,33 @@ class Logbooks extends CI_Controller { $this->load->view('interface_assets/footer'); } + public function create() + { + $this->load->library('form_validation'); + + $this->form_validation->set_rules('stationLogbook_Name', 'Station Logbook Name', 'required'); + + if ($this->form_validation->run() == FALSE) + { + $data['page_title'] = "Create Station Logbook"; + $this->load->view('interface_assets/header', $data); + $this->load->view('logbooks/create'); + $this->load->view('interface_assets/footer'); + } + else + { + $this->load->model('logbooks_model'); + $this->logbooks_model->add(); + + redirect('logbooks'); + } + } + + public function delete($id) { + $this->load->model('logbooks_model'); + $this->logbooks_model->delete($id); + + redirect('logbooks'); + } } \ No newline at end of file diff --git a/application/models/Logbooks_model.php b/application/models/Logbooks_model.php index b1b7e37c..bdaa8187 100644 --- a/application/models/Logbooks_model.php +++ b/application/models/Logbooks_model.php @@ -13,5 +13,26 @@ class Logbooks_model extends CI_Model { $this->db->where('user_id', $this->session->userdata('user_id')); return $this->db->get('station_logbooks'); } + + function add() { + // Create data array with field values + $data = array( + 'user_id' => $this->session->userdata('user_id'), + 'logbook_name' => xss_clean($this->input->post('stationLogbook_Name', true)), + ); + + // Insert Records + $this->db->insert('station_logbooks', $data); + } + + function delete($id) { + // Clean ID + $clean_id = $this->security->xss_clean($id); + + // Delete QSOs + $this->db->where('user_id', $this->session->userdata('user_id')); + $this->db->where('logbook_id', $id); + $this->db->delete('station_logbooks'); + } } ?> \ No newline at end of file diff --git a/application/views/logbooks/create.php b/application/views/logbooks/create.php new file mode 100644 index 00000000..a28cd066 --- /dev/null +++ b/application/views/logbooks/create.php @@ -0,0 +1,41 @@ +
+ +
+ session->flashdata('message')) { ?> + +
+

session->flashdata('message'); ?>

+
+ + +
+
+ +
+
+ session->flashdata('notice')) { ?> +
+ session->flashdata('notice'); ?> +
+ + + load->helper('form'); ?> + + + +
+
+ + + You can call a station logbook anything. +
+ + + +
+
+
+ +
+ +
diff --git a/application/views/logbooks/index.php b/application/views/logbooks/index.php index 589037ae..cc1c8635 100644 --- a/application/views/logbooks/index.php +++ b/application/views/logbooks/index.php @@ -41,7 +41,7 @@ - logbook_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete station profile station_profile_name; ?> this will delete all QSOs within this station logbook?');"> Delete Station Logbook + logbook_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete station profile logbook_name; ?> this will delete all QSOs within this station logbook?');"> Delete Station Logbook