Skip to content

Commit 117f7c3

Browse files
authored
Merge pull request wavelog#2653 from int2001/show_stationlist
Show stationlist for ClubMembers
2 parents 2924bbb + 9beec84 commit 117f7c3

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

application/controllers/Station.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
class Station extends CI_Controller
88
{
99

10-
function __construct()
11-
{
10+
function __construct() {
1211
parent::__construct();
1312
$this->load->helper(array('form', 'url'));
1413

1514
$this->load->model('user_model');
16-
if (!$this->user_model->authorize(2)) {
17-
$this->session->set_flashdata('error', __("You're not allowed to do that!"));
18-
redirect('dashboard');
15+
if (($this->router->method == 'stationProfileCoords') && $this->user_model->authorize(2) && ((clubaccess_check(3) || clubaccess_check(6)))) { return; } // Allow Clubmembers and Clubmembers ADIF to access list_locations
16+
if (!$this->user_model->authorize(2) || !clubaccess_check(9)) {
17+
$this->session->set_flashdata('error', __("You're not allowed to do that!"));
18+
redirect('dashboard');
1919
}
2020
}
2121

application/controllers/Stationsetup.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function __construct()
1212
$this->load->helper(array('form', 'url'));
1313

1414
$this->load->model('user_model');
15+
if (($this->router->method == 'list_locations') && $this->user_model->authorize(2) && ((clubaccess_check(3) || clubaccess_check(6)))) { return; } // Allow Clubmembers and Clubmembers ADIF to access list_locations
1516
if(!$this->user_model->authorize(2) || !clubaccess_check(9)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); }
1617
}
1718

@@ -524,6 +525,7 @@ public function list_locations() {
524525
$this->load->model('stationsetup_model');
525526
$data['locations'] = $this->stationsetup_model->list_all_locations();
526527
$data['page_title'] = __("Station location list");
528+
$data['cd_p_level'] = ($this->session->userdata('cd_p_level') ?? 0);
527529
$this->load->view('interface_assets/header', $data);
528530
$this->load->view('stationsetup/locationlist');
529531
$this->load->view('interface_assets/footer');

application/views/interface_assets/header.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,8 @@ function handleKeyPress(event) {
470470

471471
<div class="dropdown-divider"></div>
472472

473+
<?php } if ((clubaccess_check(3) || clubaccess_check(3)) && !(clubaccess_check(9))) { ?> <!-- Club Access Check -->
474+
<li><a class="dropdown-item" href="<?php echo site_url('stationsetup/list_locations'); ?>" title="Manage station setup"><i class="fas fa-home"></i> <?= __("Station Setup"); ?></a></li>
473475
<?php } if (clubaccess_check(6) || clubaccess_check(9)) { ?> <!-- Club Access Check -->
474476
<li><a class="dropdown-item" href="<?php echo site_url('adif'); ?>" title="Amateur Data Interchange Format (ADIF) import / export"><i class="fas fa-sync"></i> <?= __("ADIF Import / Export"); ?></a></li>
475477
<?php } if (clubaccess_check(9)) { ?> <!-- Club Access Check -->

application/views/stationsetup/locationlist.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@
4545
<td><?php echo $loc->station_id; ?></td>
4646
<td><?php echo $loc->station_active ? 'Yes' : 'No' ?></td>
4747
<td><?php echo $loc->qso_total; ?></td>
48+
<?php if (!($cd_p_level == 3) && !($cd_p_level == 6)) { // ClubOfficer (9) and normal User can click on a link, while ClubOfficer (ADIF) (3,6) can only see. ?>
4849
<td><a href="<?php echo site_url('station/edit')."/".$loc->station_id; ?>"><?php echo $loc->station_profile_name; ?></a></td>
50+
<?php } else { ?>
51+
<td><?php echo $loc->station_profile_name; ?></td>
52+
<?php } ?>
4953
<td><?php echo $loc->station_callsign; ?></td>
5054
<td><?php echo $loc->station_gridsquare; ?></td>
5155
<td><?php echo $loc->station_city; ?></td>
@@ -116,6 +120,7 @@ className: 'mb-1 btn btn-sm btn-primary', // same Bootstrap style
116120
$(node).removeClass('dt-button').addClass('btn btn-primary');
117121
}
118122
},
123+
<?php if (!($cd_p_level == 3) && !($cd_p_level == 6)) { // ClubOfficer (9) and normal User can import, while ClubOfficer (ADIF) (3,6) can only see. ?>
119124
{
120125
text: 'Import Locations',
121126
className: 'mb-1 btn btn-sm btn-primary',
@@ -158,6 +163,7 @@ className: 'mb-1 btn btn-sm btn-primary',
158163
$(node).removeClass('dt-button').addClass('btn btn-primary');
159164
}
160165
}
166+
<?php } ?>
161167

162168
]
163169
});

0 commit comments

Comments
 (0)