Merge pull request #1488 from phl0/logbookNames

Add logbook and station profile name to Logbook page
pull/1510/head
Peter Goodhall 2022-06-15 14:48:28 +01:00 zatwierdzone przez GitHub
commit f257ec1843
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 36 dodań i 2 usunięć

Wyświetl plik

@ -26,6 +26,7 @@ class Logbook extends CI_Controller {
// user is not logged in
redirect('user/login');
}
$this->load->model('stations');
// If environment is set to development then show the debug toolbar
if(ENVIRONMENT == 'development') {

Wyświetl plik

@ -81,6 +81,23 @@ class Logbooks_model extends CI_Model {
return $this->db->get('station_logbooks');
}
function find_name($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('logbook_id', $clean_id);
$query = $this->db->get('station_logbooks');
if ($query->num_rows() > 0){
foreach ($query->result() as $row)
{
return $row->logbook_name;
}
}
else{
return "n/a";
}
}
// Creates relationship between a logbook and a station location
function create_logbook_location_link($logbook_id, $location_id) {
@ -253,4 +270,4 @@ class Logbooks_model extends CI_Model {
return false;
}
}
?>
?>

Wyświetl plik

@ -202,6 +202,21 @@ class Stations extends CI_Model {
}
}
public function find_name() {
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_active', 1);
$query = $this->db->get('station_profile');
if($query->num_rows() >= 1) {
foreach ($query->result() as $row)
{
return $row->station_profile_name;
}
} else {
return "0";
}
}
public function reassign($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
@ -314,4 +329,4 @@ class Stations extends CI_Model {
}
}
?>
?>

Wyświetl plik

@ -1,6 +1,7 @@
<div class="container logbook">
<h2><?php echo $this->lang->line('gen_hamradio_logbook'); ?></h2>
<h6><?php echo $this->lang->line('gen_hamradio_logbook').": ".$this->logbooks_model->find_name($this->session->userdata('active_station_logbook')); ?> <?php echo $this->lang->line('general_word_location').": ".$this->stations->find_name(); ?></h6>
<?php if($this->session->flashdata('notice')) { ?>
<div class="alert alert-info" role="alert">