mirror of
https://github.com/magicbug/Cloudlog
synced 2024-11-23 01:59:14 +00:00
[Station Logbooks] Added code to create and delete station logbooks
This commit is contained in:
parent
ef65494eb6
commit
ee0a93b48a
@ -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');
|
||||
}
|
||||
|
||||
}
|
@ -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');
|
||||
}
|
||||
}
|
||||
?>
|
41
application/views/logbooks/create.php
Normal file
41
application/views/logbooks/create.php
Normal file
@ -0,0 +1,41 @@
|
||||
<div class="container" id="create_station_profile">
|
||||
|
||||
<br>
|
||||
<?php if($this->session->flashdata('message')) { ?>
|
||||
<!-- Display Message -->
|
||||
<div class="alert-message error">
|
||||
<p><?php echo $this->session->flashdata('message'); ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<?php echo $page_title; ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php if($this->session->flashdata('notice')) { ?>
|
||||
<div id="message" >
|
||||
<?php echo $this->session->flashdata('notice'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php $this->load->helper('form'); ?>
|
||||
|
||||
<?php echo validation_errors(); ?>
|
||||
|
||||
<form method="post" action="<?php echo site_url('logbooks/create'); ?>" name="create_profile">
|
||||
<div class="form-group">
|
||||
<label for="stationLogbookNameInput">Station Logbook Name</label>
|
||||
<input type="text" class="form-control" name="stationLogbook_Name" id="stationLogbookNameInput" aria-describedby="stationLogbookNameHelp" placeholder="Home QTH" required>
|
||||
<small id="stationLogbookNameHelp" class="form-text text-muted">You can call a station logbook anything.</small>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Create Station Logbook</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
</div>
|
@ -41,7 +41,7 @@
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<a href="<?php echo site_url('station/delete')."/".$row->logbook_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete station profile <?php echo $row->station_profile_name; ?> this will delete all QSOs within this station logbook?');"><i class="fas fa-trash-alt"></i> Delete Station Logbook</a>
|
||||
<a href="<?php echo site_url('Logbooks/delete')."/".$row->logbook_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete station profile <?php echo $row->logbook_name; ?> this will delete all QSOs within this station logbook?');"><i class="fas fa-trash-alt"></i> Delete Station Logbook</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user