[Bands] Added WWFF support to bands

pull/1610/head
Andreas 2022-09-20 17:25:50 +02:00
rodzic e98f6b5627
commit 9e110039f3
7 zmienionych plików z 41 dodań i 6 usunięć

Wyświetl plik

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

Wyświetl plik

@ -127,6 +127,7 @@ class Band extends CI_Controller {
$band['sota'] = $this->security->xss_clean($this->input->post('sota'));
$band['uscounties'] = $this->security->xss_clean($this->input->post('uscounties'));
$band['was'] = $this->security->xss_clean($this->input->post('was'));
$band['wwff'] = $this->security->xss_clean($this->input->post('wwff'));
$band['vucc'] = $this->security->xss_clean($this->input->post('vucc'));
$this->load->model('bands');

Wyświetl plik

@ -0,0 +1,26 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Migration_add_wwff_to_bandxuser extends CI_Migration {
public function up()
{
if (!$this->db->field_exists('wwff', 'bandxuser')) {
$fields = array(
'wwff' => array(
'type' => 'INT',
'constraint' => 20,
'unsigned' => TRUE,
),
);
$this->dbforge->add_column('bandxuser', $fields);
$this->db->query("update bandxuser set wwff = 1");
}
}
public function down()
{
$this->dbforge->drop_column('bandxuser', 'wwff');
}
}

Wyświetl plik

@ -251,6 +251,7 @@ class Bands extends CI_Model {
'sota' => $band['sota'] == "true" ? '1' : '0',
'uscounties' => $band['uscounties'] == "true" ? '1' : '0',
'was' => $band['was'] == "true" ? '1' : '0',
'wwff' => $band['wwff'] == "true" ? '1' : '0',
'vucc' => $band['vucc'] == "true" ? '1' : '0'
);
@ -278,8 +279,8 @@ class Bands extends CI_Model {
$this->db->insert('bands', $data);
}
$this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, sig, sota, uscounties, was, vucc)
select bands.id, " . $this->session->userdata('user_id') . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands where band ='".$data['band']."' and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . " and bandid = bands.id);");
$this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, sig, sota, uscounties, was, wwff, vucc)
select bands.id, " . $this->session->userdata('user_id') . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands where band ='".$data['band']."' and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . " and bandid = bands.id);");
}
function getband($id) {

Wyświetl plik

@ -152,7 +152,7 @@ class User_Model extends CI_Model {
// Add user and insert bandsettings for user
$this->db->insert($this->config->item('auth_table'), $data);
$insert_id = $this->db->insert_id();
$this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, sig, sota, uscounties, was, vucc) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;");
$this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, sig, sota, uscounties, was, wwff, vucc) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;");
return OK;
} else {
return EUSERNAMEEXISTS;

Wyświetl plik

@ -11,7 +11,12 @@ class Wwff extends CI_Model {
return null;
}
$this->load->model('bands');
$bandslots = $this->bands->get_worked_bands('wwff');
$this->db->where_in("station_id", $logbooks_locations_array);
$this->db->where_in("col_band", $bandslots);
$this->db->order_by("COL_WWFF_REF", "ASC");
$this->db->where('COL_WWFF_REF !=', '');

Wyświetl plik

@ -35,8 +35,9 @@
<th>SIG</th>
<th>SOTA</th>
<th>US Counties</th>
<th>WAS</th>
<th>VUCC</th>
<th>WAS</th>
<th>WWFF</th>
<th>Bandgroup</th>
<th>SSB QRG</th>
<th>DATA QRG</th>
@ -57,8 +58,9 @@
<td class='sig_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->sig == 1) {echo 'checked';}?>></td>
<td class='sota_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->sota == 1) {echo 'checked';}?>></td>
<td class='uscounties_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->uscounties == 1) {echo 'checked';}?>></td>
<td class='was_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->was == 1) {echo 'checked';}?>></td>
<td class='vucc_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->vucc == 1) {echo 'checked';}?>></td>
<td class='was_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->was == 1) {echo 'checked';}?>></td>
<td class='wwff_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->wwff == 1) {echo 'checked';}?>></td>
<td><?php echo $band->bandgroup;?></td>
<td><?php echo $band->ssb;?></td>
<td><?php echo $band->data;?></td>