Changed it over to user profile. Fetches data from session instead.
这个提交包含在:
父节点
d38deea64a
当前提交
6c07de7f2c
共有 9 个文件被更改,包括 38 次插入 和 49 次删除
|
|
@ -99,7 +99,7 @@ class Logbook extends CI_Controller {
|
|||
$return['callsign_qth'] = $this->logbook_model->call_qth($callsign);
|
||||
$return['callsign_iota'] = $this->logbook_model->call_iota($callsign);
|
||||
$return['qsl_manager'] = $this->logbook_model->call_qslvia($callsign);
|
||||
$return['bearing'] = $this->bearing($return['callsign_qra'], $this->getMeasurementBase());
|
||||
$return['bearing'] = $this->bearing($return['callsign_qra'], $this->session->userdata('user_measurement_base'));
|
||||
$return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $type, $band, $mode);
|
||||
|
||||
if ($return['callsign_qra'] != "") {
|
||||
|
|
@ -161,7 +161,7 @@ class Logbook extends CI_Controller {
|
|||
}
|
||||
$return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $type, $band, $mode);
|
||||
}
|
||||
$return['bearing'] = $this->bearing($return['callsign_qra'], $this->getMeasurementBase());
|
||||
$return['bearing'] = $this->bearing($return['callsign_qra'], $this->session->userdata('user_measurement_base'));
|
||||
|
||||
echo json_encode($return, JSON_PRETTY_PRINT);
|
||||
|
||||
|
|
@ -367,7 +367,7 @@ class Logbook extends CI_Controller {
|
|||
|
||||
$this->load->model('logbook_model');
|
||||
$data['query'] = $this->logbook_model->get_qso($id);
|
||||
$data['measurement_base'] = $this->getMeasurementBase();
|
||||
$data['measurement_base'] = $this->session->userdata('user_measurement_base');
|
||||
|
||||
$this->load->view('interface_assets/mini_header', $data);
|
||||
$this->load->view('view_log/qso');
|
||||
|
|
@ -591,7 +591,7 @@ class Logbook extends CI_Controller {
|
|||
$mylocator = $this->config->item('locator');
|
||||
}
|
||||
|
||||
$bearing = $this->qra->bearing($mylocator, $locator, $this->getMeasurementBase());
|
||||
$bearing = $this->qra->bearing($mylocator, $locator, $this->session->userdata('user_measurement_base'));
|
||||
|
||||
echo $bearing;
|
||||
}
|
||||
|
|
@ -631,25 +631,6 @@ class Logbook extends CI_Controller {
|
|||
print json_encode($latlng);
|
||||
}
|
||||
|
||||
function getMeasurementBase() {
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
|
||||
$this->db->select('measurement_base');
|
||||
|
||||
$this->db->from('station_profile');
|
||||
|
||||
$this->db->where('station_id', $station_id);
|
||||
|
||||
$result = $this->db->get();
|
||||
|
||||
return $result->row()->measurement_base;
|
||||
}
|
||||
|
||||
function get_qsos($num, $offset) {
|
||||
$this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_NAME, '.$this->config->item('table_name').'.COL_COUNTRY, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, station_profile.*');
|
||||
$this->db->from($this->config->item('table_name'));
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ class User extends CI_Controller {
|
|||
$data['user_callsign'] = $this->input->post('user_callsign');
|
||||
$data['user_locator'] = $this->input->post('user_locator');
|
||||
$data['user_timezone'] = $this->input->post('user_timezone');
|
||||
$data['user_measurement_base'] = $this->input->post('user_measurement_base');
|
||||
$this->load->view('user/add', $data);
|
||||
} else {
|
||||
$this->load->view('user/add', $data);
|
||||
|
|
@ -88,6 +89,7 @@ class User extends CI_Controller {
|
|||
$data['user_lastname'] = $this->input->post('user_lastname');
|
||||
$data['user_callsign'] = $this->input->post('user_callsign');
|
||||
$data['user_locator'] = $this->input->post('user_locator');
|
||||
$data['user_measurement_base'] = $this->input->post('user_measurement_base');
|
||||
$this->load->view('user/add', $data);
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
|
@ -225,6 +227,12 @@ class User extends CI_Controller {
|
|||
} else {
|
||||
$data['user_eqsl_password'] = $q->user_eqsl_password;
|
||||
}
|
||||
|
||||
if($this->input->post('user_measurement_base')) {
|
||||
$data['user_measurement_base'] = $this->input->post('user_measurement_base', true);
|
||||
} else {
|
||||
$data['user_measurement_base'] = $q->user_measurement_base;
|
||||
}
|
||||
|
||||
|
||||
$this->load->view('user/edit', $data);
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ class Migration_add_stationprofile_measurement_base extends CI_Migration {
|
|||
public function up()
|
||||
{
|
||||
$fields = array(
|
||||
'measurement_base varchar(1) DEFAULT "K"',
|
||||
'user_measurement_base varchar(1) DEFAULT "K"',
|
||||
);
|
||||
|
||||
$this->dbforge->add_column('station_profile', $fields);
|
||||
$this->dbforge->add_column('users', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dbforge->drop_column('station_profile', 'measurement_base');
|
||||
$this->dbforge->drop_column('users', 'user_measurement_base');
|
||||
}
|
||||
}
|
||||
|
|
@ -47,7 +47,6 @@ class Stations extends CI_Model {
|
|||
'state' => xss_clean($this->input->post('station_state', true)),
|
||||
'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)),
|
||||
'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)),
|
||||
'measurement_base' => xss_clean($this->input->post('measurement_base', true)),
|
||||
);
|
||||
|
||||
$this->db->insert('station_profile', $data);
|
||||
|
|
@ -69,7 +68,6 @@ class Stations extends CI_Model {
|
|||
'state' => xss_clean($this->input->post('station_state', true)),
|
||||
'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)),
|
||||
'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)),
|
||||
'measurement_base' => xss_clean($this->input->post('measurement_base', true)),
|
||||
);
|
||||
|
||||
$this->db->where('station_id', xss_clean($this->input->post('station_id', true)));
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ class User_Model extends CI_Model {
|
|||
'user_lotw_name' => xss_clean($fields['user_lotw_name']),
|
||||
'user_eqsl_name' => xss_clean($fields['user_eqsl_name']),
|
||||
'user_clublog_name' => xss_clean($fields['user_clublog_name']),
|
||||
'user_measurement_base' => xss_clean($fields['user_measurement_base']),
|
||||
);
|
||||
|
||||
// Check to see if the user is allowed to change user levels
|
||||
|
|
@ -241,7 +242,8 @@ class User_Model extends CI_Model {
|
|||
'user_eqsl_qth_nickname' => $u->row()->user_eqsl_qth_nickname,
|
||||
'user_hash' => $this->_hash($u->row()->user_id."-".$u->row()->user_type),
|
||||
'radio' => isset($_COOKIE["radio"])?$_COOKIE["radio"]:"",
|
||||
'station_profile_id' => isset($_COOKIE["station_profile_id"])?$_COOKIE["station_profile_id"]:""
|
||||
'station_profile_id' => isset($_COOKIE["station_profile_id"])?$_COOKIE["station_profile_id"]:"",
|
||||
'user_measurement_base' => $u->row()->user_measurement_base,
|
||||
);
|
||||
|
||||
$this->session->set_userdata($userdata);
|
||||
|
|
|
|||
|
|
@ -165,16 +165,6 @@
|
|||
<small id="qrzApiKeyHelp" class="form-text text-muted">Your QRZ.com Logbook API can be found in the <a href="https://logbook.qrz.com/logbook" target="_blank">settings page</a></small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="measurement_base">Measurement preference</label>
|
||||
<select class="custom-select" id="measurement_base" name="measurement_base" required>
|
||||
<option value='K' selected='selected'>Kilometers</option>
|
||||
<option value='M'>Miles</option>
|
||||
<option value='N'>Nautical miles</option>
|
||||
</select>
|
||||
<small id="measurement_base_Help" class="form-text text-muted">Choose which unit distances will be shown in.</small>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Create Station Profile</button>
|
||||
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -179,16 +179,6 @@
|
|||
<small id="qrzApiKeyHelp" class="form-text text-muted">Your QRZ.com Logbook API can be found in the <a href="https://logbook.qrz.com/logbook" target="_blank">settings page</a></small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="measurement_base">Measurement preference</label>
|
||||
<select class="custom-select" id="measurement_base" name="measurement_base" required>
|
||||
<option value='K' <?php if ($my_station_profile->measurement_base == "K") { echo " selected=\"selected\""; } ?>>Kilometers</option>
|
||||
<option value='M' <?php if ($my_station_profile->measurement_base == "M") { echo " selected=\"selected\""; } ?>>Miles</option>
|
||||
<option value='N' <?php if ($my_station_profile->measurement_base == "N") { echo " selected=\"selected\""; } ?>>Nautical miles</option>
|
||||
</select>
|
||||
<small id="measurement_base_Help" class="form-text text-muted">Choose which unit distances will be shown in.</small>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Update Station Profile</button>
|
||||
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -82,6 +82,16 @@
|
|||
?>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="user_measurement_base">Measurement preference</label>
|
||||
<select class="custom-select" id="user_measurement_base" name="user_measurement_base" required>
|
||||
<option value='K' selected='selected'>Kilometers</option>
|
||||
<option value='M'>Miles</option>
|
||||
<option value='N'>Nautical miles</option>
|
||||
</select>
|
||||
<small id="user_measurement_base_Help" class="form-text text-muted">Choose which unit distances will be shown in.</small>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
|
||||
<button type="submit" class="btn btn-primary">Create Account</button>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -135,6 +135,16 @@
|
|||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="user_measurement_base">Measurement preference</label>
|
||||
<select class="custom-select" id="user_measurement_base" name="user_measurement_base" required>
|
||||
<option value='K' <?php if($user_measurement_base == "K") { echo "selected=\"selected\""; } ?>>Kilometers</option>
|
||||
<option value='M' <?php if($user_measurement_base == "M") { echo "selected=\"selected\""; } ?>>Miles</option>
|
||||
<option value='N' <?php if($user_measurement_base == "N") { echo "selected=\"selected\""; } ?>>Nautical miles</option>
|
||||
</select>
|
||||
<small id="user_measurement_base_Help" class="form-text text-muted">Choose which unit distances will be shown in.</small>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
|
||||
<button type="submit" class="btn btn-primary">Update Account</button>
|
||||
</form>
|
||||
|
|
|
|||
正在加载…
在新工单中引用