Built interface to display station locations when editing Station Logbooks

This commit is contained in:
Peter Goodhall 2021-08-23 17:34:00 +01:00
parent 6cc96d2128
commit 831f249938
4 changed files with 26 additions and 6 deletions

View File

@ -54,12 +54,14 @@ class Logbooks extends CI_Controller {
$this->load->library('form_validation'); $this->load->library('form_validation');
$this->load->model('logbooks_model'); $this->load->model('logbooks_model');
$this->load->model('stations');
$station_logbook_id = $this->security->xss_clean($id); $station_logbook_id = $this->security->xss_clean($id);
$station_logbook_details_query = $this->logbooks_model->logbook($station_logbook_id); $station_logbook_details_query = $this->logbooks_model->logbook($station_logbook_id);
$data['station_logbook_details'] = $station_logbook_details_query->row(); $data['station_logbook_details'] = $station_logbook_details_query->row();
$data['station_locations_list'] = $this->stations->all();
$data['page_title'] = "Edit Station Logbook"; $data['page_title'] = "Edit Station Logbook";

View File

@ -102,8 +102,9 @@ class Station extends CI_Controller {
// $id is the profile id // $id is the profile id
$this->load->model('stations'); $this->load->model('stations');
$this->stations->claim_user($id); $this->stations->claim_user($id);
echo $this->session->userdata('user_id');
//$this->stations->logbook_session_data();
redirect('station'); redirect('station');
} }

View File

@ -20,6 +20,7 @@ class Stations extends CI_Model {
} }
function all() { function all() {
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
return $this->db->get('station_profile'); return $this->db->get('station_profile');
} }
@ -117,13 +118,12 @@ class Stations extends CI_Model {
} }
function claim_user($id) { function claim_user($id) {
$data = array( $data = array(
'user_id' => $this->session->userdata('user_id') 'user_id' => $this->session->userdata('user_id'),
); );
$this->db->where('station_id', xss_clean($id, true)); $this->db->where('station_id', $id);
$this->db->update('station_profile', $data); $this->db->update('station_profile', $data);
} }
function set_active($current, $new) { function set_active($current, $new) {

View File

@ -36,6 +36,23 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-md">
<div class="card">
<div class="card-header">Station Locations</div>
<div class="card-body">
<div class="form-group">
<label for="StationLocationsSelect">Select Available Station Locations</label>
<select name="SelectedStationLocations[]" class="form-control" id="StationLocationsSelect" multiple aria-describedby="StationLocationSelectHelp">
<?php foreach ($station_locations_list->result() as $row) { ?>
<option value=" <?php echo $row->station_id;?>"><?php echo $row->station_profile_name;?> (Callsign: <?php echo $row->station_callsign;?> DXCC: <?php echo $row->station_country;?>)</option>
<?php } ?>
</select>
<small id="StationLocationSelectHelp" class="form-text text-muted">Hold down the Ctrl (windows) or Command (Mac) button to select multiple options.</small>
</div>
</div>
</div>
</div>
</div> </div>