mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Added slug for grouped search and widget
This commit is contained in:
@@ -89,8 +89,14 @@ class Oqrs extends CI_Controller {
|
||||
|
||||
public function get_qsos_grouped() {
|
||||
$this->load->model('oqrs_model');
|
||||
$data['result'] = $this->oqrs_model->getQueryDataGrouped($this->input->post('callsign', TRUE));
|
||||
$this->load->model('publicsearch');
|
||||
|
||||
$slug = $this->input->post('slug', TRUE);
|
||||
$userid = $this->publicsearch->get_userid_for_slug($slug);
|
||||
|
||||
$data['result'] = $this->oqrs_model->getQueryDataGrouped($this->input->post('callsign', TRUE), $userid);
|
||||
$data['callsign'] = $this->input->post('callsign', TRUE);
|
||||
$data['userid'] = $this->input->post('userid', TRUE);
|
||||
|
||||
if($this->input->post('widget') != 'true') {
|
||||
$this->load->view('oqrs/request_grouped', $data);
|
||||
|
||||
@@ -48,7 +48,7 @@ class Widgets extends CI_Controller {
|
||||
|
||||
// date format
|
||||
$data['date_format'] = $this->config->item('qso_date_format'); // date format from /config/wavelog.php
|
||||
|
||||
|
||||
$this->load->model('logbook_model');
|
||||
$this->load->model('logbooks_model');
|
||||
$this->load->model('stationsetup_model');
|
||||
@@ -72,7 +72,7 @@ class Widgets extends CI_Controller {
|
||||
$user_id = $this->stationsetup_model->public_slug_exists_userid($logbook_slug);
|
||||
$widget_options = $this->get_qso_widget_options($user_id);
|
||||
|
||||
$data['show_time'] = $widget_options->display_qso_time;
|
||||
$data['show_time'] = $widget_options->display_qso_time;
|
||||
$data['last_qsos_list'] = $this->logbook_model->get_last_qsos($qso_count, $logbooks_locations_array);
|
||||
|
||||
$this->load->view('widgets/qsos', $data);
|
||||
@@ -88,9 +88,9 @@ class Widgets extends CI_Controller {
|
||||
return;
|
||||
}
|
||||
|
||||
$slug = $this->input->get('slug', TRUE);
|
||||
if ($slug != null) {
|
||||
$data['logo_url'] = base_url() . 'index.php/visitor/' . $slug;
|
||||
$data['slug'] = $this->input->get('slug', TRUE);
|
||||
if ($data['slug'] != null) {
|
||||
$data['logo_url'] = base_url() . 'index.php/visitor/' . $data['slug'];
|
||||
} else {
|
||||
$data['logo_url'] = 'https://github.com/wavelog/wavelog';
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class Oqrs_model extends CI_Model {
|
||||
function get_station_info($station_id) {
|
||||
|
||||
$binding = [];
|
||||
$sql = 'select
|
||||
$sql = 'select
|
||||
count(*) as count,
|
||||
min(col_time_on) as mindate,
|
||||
max(col_time_on) as maxdate
|
||||
@@ -67,17 +67,19 @@ class Oqrs_model extends CI_Model {
|
||||
/*
|
||||
* Builds query depending on what we are searching for
|
||||
*/
|
||||
function getQueryDataGrouped($callsign) {
|
||||
function getQueryDataGrouped($callsign, $userid) {
|
||||
|
||||
$binding = [];
|
||||
|
||||
$sql = 'select lower(col_mode) col_mode, coalesce(col_submode, "") col_submode, col_band, station_callsign, station_profile_name, l.station_id from ' . $this->config->item('table_name') . ' as l join station_profile on l.station_id = station_profile.station_id where station_profile.oqrs = "1" and l.col_call = ? and l.col_prop_mode != "SAT"';
|
||||
$sql = 'select lower(col_mode) col_mode, coalesce(col_submode, "") col_submode, col_band, station_callsign, station_profile_name, l.station_id from ' . $this->config->item('table_name') . ' as l join station_profile on l.station_id = station_profile.station_id where station_profile.oqrs = "1" and l.col_call = ? and l.col_prop_mode != "SAT" and station_profile.user_id = ?';
|
||||
$binding[] = $callsign;
|
||||
$binding[] = $userid;
|
||||
|
||||
$sql .= ' union all select lower(col_mode) col_mode, coalesce(col_submode, "") col_submode, "SAT" col_band, station_callsign, station_profile_name, l.station_id from ' .
|
||||
$this->config->item('table_name') . ' l' .
|
||||
' join station_profile on l.station_id = station_profile.station_id where station_profile.oqrs = "1" and col_call = ? and col_prop_mode = "SAT"';
|
||||
$sql .= ' union all select lower(col_mode) col_mode, coalesce(col_submode, "") col_submode, "SAT" col_band, station_callsign, station_profile_name, l.station_id from ' .
|
||||
$this->config->item('table_name') . ' l' .
|
||||
' join station_profile on l.station_id = station_profile.station_id where station_profile.oqrs = "1" and col_call = ? and col_prop_mode = "SAT" and station_profile.user_id = ?';
|
||||
$binding[] = $callsign;
|
||||
$binding[] = $userid;
|
||||
|
||||
$query = $this->db->query($sql, $binding);
|
||||
|
||||
@@ -145,7 +147,7 @@ class Oqrs_model extends CI_Model {
|
||||
$data['status'] = '2';
|
||||
}
|
||||
$data['qsoid'] = $qsoid;
|
||||
|
||||
|
||||
$this->db->insert('oqrs', $data);
|
||||
if(!in_array($postdata['station_id'], $station_ids)){
|
||||
array_push($station_ids, $postdata['station_id']);
|
||||
@@ -178,9 +180,9 @@ class Oqrs_model extends CI_Model {
|
||||
$data['status'] = '2';
|
||||
}
|
||||
$data['qsoid'] = $qsoid;
|
||||
|
||||
|
||||
$this->db->insert('oqrs', $data);
|
||||
|
||||
|
||||
if(!in_array($qso[4], $station_ids)){
|
||||
array_push($station_ids, $qso[4]);
|
||||
}
|
||||
@@ -228,7 +230,7 @@ class Oqrs_model extends CI_Model {
|
||||
|
||||
$binding = [];
|
||||
|
||||
$sql = 'select * from ' . $this->config->item('table_name') .
|
||||
$sql = 'select * from ' . $this->config->item('table_name') .
|
||||
' where (col_band = ? or col_prop_mode = ?)
|
||||
and col_call = ?
|
||||
and date(col_time_on) = ?
|
||||
@@ -236,7 +238,7 @@ class Oqrs_model extends CI_Model {
|
||||
or col_submode = ?)
|
||||
and timediff(time(col_time_on), ?) <= 3000
|
||||
and station_id = ?';
|
||||
|
||||
|
||||
$binding[] = $qsodata['band'];
|
||||
$binding[] = $qsodata['band'];
|
||||
$binding[] = $qsodata['requestcallsign'];
|
||||
@@ -245,7 +247,7 @@ class Oqrs_model extends CI_Model {
|
||||
$binding[] = $qsodata['mode'];
|
||||
$binding[] = $qsodata['time'];
|
||||
$binding[] = $qsodata['station_id'];
|
||||
|
||||
|
||||
$query = $this->db->query($sql, $binding);
|
||||
|
||||
if ($result = $query->result()) {
|
||||
@@ -310,9 +312,9 @@ class Oqrs_model extends CI_Model {
|
||||
$data = array(
|
||||
'status' => '2',
|
||||
);
|
||||
|
||||
|
||||
$this->db->where('id', $id);
|
||||
|
||||
|
||||
$this->db->update('oqrs', $data);
|
||||
}
|
||||
|
||||
@@ -325,7 +327,7 @@ class Oqrs_model extends CI_Model {
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
$row = $query->row();
|
||||
$row = $query->row();
|
||||
return $row->oqrs_text;
|
||||
}
|
||||
|
||||
@@ -341,7 +343,7 @@ class Oqrs_model extends CI_Model {
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
$row = $query->row();
|
||||
$row = $query->row();
|
||||
return $row->oqrs_email;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!--
|
||||
|
||||
This is an OQRS widget to place in your QRZ.com Bio or somewhere else.
|
||||
<!--
|
||||
|
||||
This is an OQRS widget to place in your QRZ.com Bio or somewhere else.
|
||||
|
||||
To use this widget insert this Element:
|
||||
|
||||
@@ -87,6 +87,7 @@ To use this widget insert this Element:
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<input type="hidden" name="widget" value="true">
|
||||
<input hidden class="form-control me-sm-2 w-auto" id="slug" type="search" name="slug" value = '<?php echo $slug; ?>'>
|
||||
<button type="submit" class="btn btn-sm btn-primary"><?= __("Submit Request"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -49,7 +49,7 @@ function searchOqrsGrouped() {
|
||||
$.ajax({
|
||||
url: base_url+'index.php/oqrs/get_qsos_grouped',
|
||||
type: 'post',
|
||||
data: {'callsign': ($("#oqrssearch").val() || '').toUpperCase()},
|
||||
data: {'callsign': ($("#oqrssearch").val() || '').toUpperCase(), 'slug': $("#slug").val()},
|
||||
success: function (data) {
|
||||
$(".searchinfo").append(data);
|
||||
$('.qsotime').change(function() {
|
||||
|
||||
Reference in New Issue
Block a user