mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge pull request #1433 from int2001/optimize_club_users
[WIP] Cluboptimizing
This commit is contained in:
@@ -237,7 +237,7 @@ class API extends CI_Controller {
|
||||
}
|
||||
// in case the provided op call is the same as the clubstation callsign, we need to use the creator of the API key as the operator
|
||||
$recorded_operator = $record['operator'] ?? '';
|
||||
if ($real_operator != null && ($record['operator'] == $record['station_callsign']) || ($recorded_operator == '')) {
|
||||
if (key_exists('operator',$record) && $real_operator != null && ($record['operator'] == $record['station_callsign']) || ($recorded_operator == '')) {
|
||||
$record['operator'] = $real_operator;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class Bandmap extends CI_Controller {
|
||||
function index() {
|
||||
$this->load->model('cat');
|
||||
$this->load->model('bands');
|
||||
$data['radios'] = $this->cat->radios();
|
||||
$data['radios'] = $this->cat->radios(true);
|
||||
$data['bands'] = $this->bands->get_user_bands_for_qso_entry();
|
||||
|
||||
$footerData = [];
|
||||
|
||||
@@ -56,7 +56,6 @@ class Club extends CI_Controller
|
||||
$data['page_title'] = __("Club Permissions");
|
||||
$data['club'] = $club;
|
||||
$data['club_members'] = $this->club_model->get_club_members($cid);
|
||||
$data['users'] = $this->user_model->users();
|
||||
$data['permissions'] = $this->permissions;
|
||||
|
||||
$footerData = [];
|
||||
@@ -241,4 +240,4 @@ class Club extends CI_Controller
|
||||
return $this->email->send();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,12 +40,18 @@ class Migration_clubstations extends CI_Migration {
|
||||
$this->db->query("ALTER TABLE `cat` MODIFY operator INT(6) NOT NULL;");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
// Due the risk of data loss we can't drop any new created columns or tables
|
||||
// But we can drop some of the timestamp columns
|
||||
$this->db->query("ALTER TABLE `users` DROP COLUMN created_at;");
|
||||
$this->db->query("ALTER TABLE `users` DROP COLUMN modified_at;");
|
||||
$this->db->query("ALTER TABLE `api` DROP COLUMN created_at;");
|
||||
public function down() {
|
||||
// Due the risk of data loss we can't drop any new created columns or tables
|
||||
// But we can drop some of the timestamp columns
|
||||
if ($this->db->field_exists('created_at', 'users')) {
|
||||
$this->db->query("ALTER TABLE `users` DROP COLUMN created_at;");
|
||||
}
|
||||
if ($this->db->field_exists('modified_at', 'users')) {
|
||||
$this->db->query("ALTER TABLE `users` DROP COLUMN modified_at;");
|
||||
}
|
||||
if ($this->db->field_exists('created_at', 'api')) {
|
||||
$this->db->query("ALTER TABLE `api` DROP COLUMN created_at;");
|
||||
}
|
||||
}
|
||||
|
||||
private function add_column_if_not_exists($table, $column, $definition) {
|
||||
@@ -61,4 +67,4 @@ class Migration_clubstations extends CI_Migration {
|
||||
log_message('info', "Mig 230 - Column '$column' already exists in table '$table', skipping ALTER TABLE.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
function radios($only_operator = false) {
|
||||
$this->db->select('id, radio');
|
||||
$this->db->where('user_id', $this->session->userdata('user_id'));
|
||||
if ($only_operator || ($this->session->userdata('clubstation') == 1 && !clubaccess_check(9))) {
|
||||
if ($only_operator && ($this->session->userdata('clubstation') == 1 && !clubaccess_check(9))) {
|
||||
$this->db->where('operator', $this->session->userdata('source_uid'));
|
||||
}
|
||||
$query = $this->db->get('cat');
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</a>
|
||||
</td>
|
||||
<td style="text-align: left; vertical-align: middle;">
|
||||
<?php echo $row->user_callsign; ?>
|
||||
<?php echo str_replace("0", "Ø", $row->user_callsign); ?>
|
||||
</td>
|
||||
<td style="text-align: left; vertical-align: middle;">
|
||||
<a href="mailto:<?php echo $row->user_email; ?>">
|
||||
@@ -158,7 +158,7 @@
|
||||
foreach ($clubs->result() as $row) { ?>
|
||||
<?php echo '<tr class="tr' . ($i & 1) . '">'; ?>
|
||||
<td style="text-align: left; vertical-align: middle;"><a href="<?php echo site_url('user/edit') . "/" . $row->user_id; ?>"><?php echo $row->user_name; ?></a></td>
|
||||
<td style="text-align: left; vertical-align: middle;"><?php echo $row->user_callsign; ?></td>
|
||||
<td style="text-align: left; vertical-align: middle;"><?php echo str_replace("0", "Ø", $row->user_callsign); ?></td>
|
||||
<td style="text-align: left; vertical-align: middle;"><a href="mailto:<?php echo $row->user_email; ?>"><?php echo $row->user_email; ?></a></td>
|
||||
<td style="text-align: left; vertical-align: middle;"><?php echo $row->lastoperator; ?></td>
|
||||
<td style="text-align: left; vertical-align: middle;"><?php
|
||||
|
||||
Reference in New Issue
Block a user