Added a function to assign all QSOs to station profile number 1 and added table field into station profile for eqsl nickname

pull/360/head
Peter Goodhall 2019-10-03 12:56:25 +01:00
rodzic 6736777d05
commit 2a8f7f9272
7 zmienionych plików z 55 dodań i 3 usunięć

Wyświetl plik

@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 33;
$config['migration_version'] = 34;
/*
|--------------------------------------------------------------------------

Wyświetl plik

@ -31,6 +31,9 @@ class Dashboard extends CI_Controller {
} else {
$data['qra'] = "none";
}
$this->load->model('stations');
$data['current_active'] = $this->stations->find_active();
// Store info
$data['todays_qsos'] = $this->logbook_model->todays_qsos();

Wyświetl plik

@ -78,6 +78,13 @@ class Station extends CI_Controller {
redirect('station');
}
function assign_all() {
$this->load->model('Logbook_model');
$this->Logbook_model->update_all_station_ids();
redirect('station');
}
public function delete($id) {
$this->load->model('stations');
$this->stations->delete($id);

Wyświetl plik

@ -0,0 +1,20 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Migration_add_eqslqthnickname_to_stationprofile extends CI_Migration {
public function up()
{
$fields = array(
'eqslqthnickname varchar(255) DEFAULT NULL',
);
$this->dbforge->add_column('station_profile', $fields);
}
public function down()
{
$this->dbforge->drop_column('station_profile', 'eqslqthnickname');
}
}

Wyświetl plik

@ -1429,8 +1429,9 @@ class Logbook_model extends CI_Model {
print("$count updated\n");
}
public function check_for_station_id() {
$this->db->where('station_id !=', "");
$this->db->where('station_id =', 'NULL');
$query = $this->db->get($this->config->item('table_name'));
if($query->num_rows() >= 1) {
return 1;
@ -1439,6 +1440,17 @@ class Logbook_model extends CI_Model {
}
}
public function update_all_station_ids() {
$data = array(
'station_id' => '1',
);
$this->db->where(array('station_id' => NULL));
return $this->db->update($this->config->item('table_name'), $data);
}
public function parse_frequency($frequency)
{
if (is_int($frequency))

Wyświetl plik

@ -10,6 +10,13 @@
<span class="badge badge-info">Important</span> <i class="fas fa-broadcast-tower"></i> You have made no QSOs today, time to turn on the radio!
</div>
<?php } ?>
<?php if($current_active == 0) { ?>
<div class="alert alert-danger" role="alert">
Attention you need to set an active station profile.
</div>
<?php } ?>
<?php } ?>
<!-- Map -->

Wyświetl plik

@ -24,9 +24,11 @@
</div>
<?php } ?>
<?php if($is_there_qsos_with_no_station_id == 0) { ?>
<?php if($is_there_qsos_with_no_station_id >= 1) { ?>
<div class="alert alert-danger" role="alert">
<span class="badge badge-pill badge-warning">Warning</span> Due to recent changes within Cloudlog you need to reassign QSOs to your station profiles.
If you haven't any station profiles, create a profile then <a href="<?php echo site_url('station/assign_all/'); ?>" class="btn btn-danger" onclick="return confirm('Assign All QSOs to Default Station ID"><i class="fas fa-trash-alt"></i> Press this Button to assign all QSOs to the the #1 station ID</a>
</div>
<?php } ?>
@ -79,6 +81,7 @@
<table>
<?php } ?>
<p><a href="<?php echo site_url('station/create'); ?>" class="btn btn-primary"><i class="fas fa-plus"></i> Create a Station Profile</a></p>
</div>
</div>