[Advanced search] When saving a query, we add this to the dropdown.

pull/1212/head
Andreas 2021-09-25 18:08:31 +02:00
rodzic d71ba5a0c6
commit 0717fa74ff
2 zmienionych plików z 5 dodań i 11 usunięć

Wyświetl plik

@ -54,8 +54,6 @@ class Search extends CI_Controller {
if(isset($_POST['search'])) {
$result = $this->fetchQueryResult($_POST['search'], false);
echo json_encode($result->result_array());
} else {
echo "Noooooooob";
}
}
@ -69,18 +67,13 @@ class Search extends CI_Controller {
if(isset($_POST['search'])) {
$data['results'] = $this->fetchQueryResult($_POST['search'], false);
$this->load->view('search/search_result_ajax', $data);
} else {
echo "Noooooooob";
}
}
function export_to_adif() {
if(isset($_POST['search'])) {
$data['qsos'] = $this->fetchQueryResult($_POST['search'], false);
$this->load->view('adif/data/exportall', $data);
} else {
echo "Noooooooob";
}
}
@ -112,9 +105,9 @@ class Search extends CI_Controller {
);
$this->db->insert('queries', $data);
} else {
echo "Noooooooob";
$last_id = $this->db->insert_id();
header('Content-Type: application/json');
echo json_encode(array('id' => $last_id, 'description' => xss_clean($_POST['description'])));
}
}

Wyświetl plik

@ -154,6 +154,7 @@ $('#btn-save').on('click', function() {
$.post( "<?php echo site_url('search/save_query');?>", { search: JSON.stringify(resultquery, null, 2), description: $(".getqueryname").val() })
.done(function( data ) {
alert('Query saved!');
$('#querydropdown').append( new Option(data.description, data.id) ); // We add the saved query to the dropdown
});
}
},