mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Notes: basic support in the QSO view page
This commit is contained in:
@@ -617,6 +617,12 @@ class Logbook extends CI_Controller {
|
||||
$data['query'] = $this->logbook_model->get_qso($id);
|
||||
$data['dxccFlag'] = $this->dxccflag->get($data['query']->result()[0]->COL_DXCC);
|
||||
|
||||
// Check for note for this callsign and current user
|
||||
$callsign = $data['query']->result()[0]->COL_CALL;
|
||||
$user_id = $this->session->userdata('user_id');
|
||||
$this->load->model('note');
|
||||
$data['contacts_note_id'] = $this->note->get_note_id_by_category($user_id, 'Contacts', $callsign);
|
||||
|
||||
if ($this->session->userdata('user_measurement_base') == NULL) {
|
||||
$data['measurement_base'] = $this->config->item('measurement_base');
|
||||
}
|
||||
|
||||
@@ -253,31 +253,17 @@ class Notes extends CI_Controller {
|
||||
$category = $this->input->get('category', TRUE);
|
||||
$title = $this->input->get('title', TRUE);
|
||||
$id = $this->input->get('id', TRUE); // Optional, for edit
|
||||
$check_title = $title;
|
||||
if ($category === 'Contacts') {
|
||||
$this->load->library('callbook');
|
||||
$check_title = strtoupper($this->callbook->get_plaincall($title));
|
||||
}
|
||||
$where = [
|
||||
'cat' => $category,
|
||||
'user_id' => $user_id,
|
||||
'title' => $check_title
|
||||
];
|
||||
$query = $this->db->get_where('notes', $where);
|
||||
$exists = false;
|
||||
$note_id = null;
|
||||
if ($id) {
|
||||
foreach ($query->result() as $note) {
|
||||
if ($note->id != $id) {
|
||||
$exists = true;
|
||||
$note_id = $note->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($query->num_rows() > 0) {
|
||||
$this->load->model('note');
|
||||
$note_id_found = $this->note->get_note_id_by_category($user_id, $category, $title);
|
||||
if ($note_id_found) {
|
||||
// If editing, ignore current note
|
||||
if ($id && $note_id_found == $id) {
|
||||
$exists = false;
|
||||
} else {
|
||||
$exists = true;
|
||||
$note_id = $query->row()->id;
|
||||
$note_id = $note_id_found;
|
||||
}
|
||||
}
|
||||
$response = ['exists' => $exists];
|
||||
|
||||
@@ -162,6 +162,24 @@ class Note extends CI_Model {
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Return note ID for given category and title (callsign for Contacts), else false
|
||||
public function get_note_id_by_category($user_id, $category, $title) {
|
||||
$check_title = $title;
|
||||
if ($category === 'Contacts') {
|
||||
$this->load->library('callbook'); // Used for callsign parsing
|
||||
$check_title = strtoupper($this->callbook->get_plaincall($title));
|
||||
}
|
||||
$query = $this->db->get_where('notes', [
|
||||
'cat' => $category,
|
||||
'user_id' => $user_id,
|
||||
'title' => $check_title
|
||||
]);
|
||||
if ($query->num_rows() > 0) {
|
||||
return $query->row()->id;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Search notes with pagination and sorting for the logged-in user
|
||||
public function search_paginated($criteria = [], $page = 1, $per_page = 25, $sort_col = null, $sort_dir = null) {
|
||||
$user_id = $this->session->userdata('user_id');
|
||||
|
||||
@@ -81,7 +81,13 @@
|
||||
|
||||
<tr>
|
||||
<td><?= __("Callsign"); ?></td>
|
||||
<td><b><?php echo str_replace("0","Ø",strtoupper($row->COL_CALL)); ?></b> <a target="_blank" href="https://www.qrz.com/db/<?php echo strtoupper($row->COL_CALL); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/qrz.png" alt="Lookup <?php echo strtoupper($row->COL_CALL); ?> on QRZ.com"></a> <a target="_blank" href="https://www.hamqth.com/<?php echo strtoupper($row->COL_CALL); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/hamqth.png" alt="Lookup <?php echo strtoupper($row->COL_CALL); ?> on HamQTH"></a> <a target="_blank" href="http://www.eqsl.cc/Member.cfm?<?php echo strtoupper($row->COL_CALL); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/eqsl.png" alt="Lookup <?php echo strtoupper($row->COL_CALL); ?> on eQSL.cc"></a> <a target="_blank" href="https://clublog.org/logsearch.php?log=<?php echo strtoupper($row->COL_CALL); ?>&call=<?php echo strtoupper($row->station_callsign); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/clublog.png" alt="Clublog Log Search"></a></td>
|
||||
<td><b><?php echo str_replace("0","Ø",strtoupper($row->COL_CALL)); ?></b> <a target="_blank" href="https://www.qrz.com/db/<?php echo strtoupper($row->COL_CALL); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/qrz.png" alt="Lookup <?php echo strtoupper($row->COL_CALL); ?> on QRZ.com"></a> <a target="_blank" href="https://www.hamqth.com/<?php echo strtoupper($row->COL_CALL); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/hamqth.png" alt="Lookup <?php echo strtoupper($row->COL_CALL); ?> on HamQTH"></a> <a target="_blank" href="http://www.eqsl.cc/Member.cfm?<?php echo strtoupper($row->COL_CALL); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/eqsl.png" alt="Lookup <?php echo strtoupper($row->COL_CALL); ?> on eQSL.cc"></a> <a target="_blank" href="https://clublog.org/logsearch.php?log=<?php echo strtoupper($row->COL_CALL); ?>&call=<?php echo strtoupper($row->station_callsign); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/clublog.png" alt="Clublog Log Search"></a>
|
||||
<?php if (!empty($contacts_note_id)) { ?>
|
||||
<a href="<?php echo base_url(); ?>index.php/notes/view/<?php echo $contacts_note_id; ?>" target="_blank" title="<?= __("View note for this callsign"); ?>" style="margin-left:2px;vertical-align:middle;">
|
||||
<i class="fa fa-sticky-note text-info" style="font-size:16px;vertical-align:middle;"></i>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user