[Station Location] Allow user to claim a location and also only show those of the user or non claimed.

pull/1152/head
Peter Goodhall 2021-08-23 15:50:19 +01:00
rodzic 605395264e
commit 6cc96d2128
3 zmienionych plików z 25 dodań i 0 usunięć

Wyświetl plik

@ -97,6 +97,16 @@ class Station extends CI_Controller {
}
}
// This function allows a user to claim ownership of a station location
function claim_user($id) {
// $id is the profile id
$this->load->model('stations');
$this->stations->claim_user($id);
//$this->stations->logbook_session_data();
redirect('station');
}
function reassign_profile($id) {
// $id is the profile that needs reassigned to QSOs
$this->load->model('stations');

Wyświetl plik

@ -14,6 +14,8 @@ class Stations extends CI_Model {
$this->db->from('station_profile');
$this->db->join($this->config->item('table_name'),'station_profile.station_id = '.$this->config->item('table_name').'.station_id','left');
$this->db->group_by('station_profile.station_id');
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
$this->db->or_where('station_profile.user_id =', NULL);
return $this->db->get();
}
@ -114,6 +116,16 @@ class Stations extends CI_Model {
$this->db->delete($this->config->item('table_name'));
}
function claim_user($id) {
$data = array(
'user_id' => $this->session->userdata('user_id')
);
$this->db->where('station_id', xss_clean($id, true));
$this->db->update('station_profile', $data);
}
function set_active($current, $new) {
// Clean inputs

Wyświetl plik

@ -75,6 +75,9 @@
<span class="badge badge-light"><?php echo $row->qso_total;?> QSOs</span>
</td>
<td>
<?php if($row->user_id == "") { ?>
<a href="<?php echo site_url('station/claim_user')."/".$row->station_id; ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-user-plus"></i> Claim Ownership</a>
<?php } ?>
<a href="<?php echo site_url('station/edit')."/".$row->station_id; ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i> Edit</a>
</td>
<td>