[Advanced search] Adif export for search result.
这个提交包含在:
父节点
4cfc4451e6
当前提交
915a470d8c
共有 3 个文件被更改,包括 305 次插入 和 255 次删除
|
|
@ -50,262 +50,275 @@ class Search extends CI_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
function json_result() {
|
function json_result() {
|
||||||
|
|
||||||
if(isset($_POST['search'])) {
|
if(isset($_POST['search'])) {
|
||||||
$json = $_POST['search'];
|
$result = $this->fetchQueryResult($_POST['search']);
|
||||||
|
echo json_encode($result->result_array());
|
||||||
$search_items = json_decode($json, true);
|
} else {
|
||||||
|
|
||||||
$search_type = "";
|
|
||||||
|
|
||||||
foreach($search_items as $key=>$value){
|
|
||||||
|
|
||||||
|
|
||||||
if($value == "AND") {
|
|
||||||
$search_type = "AND";
|
|
||||||
}
|
|
||||||
if ($value == "OR") {
|
|
||||||
$search_type = "OR";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(is_array($value)) {
|
|
||||||
foreach($value as $values)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(isset($values['rules'])) {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->group_start();
|
|
||||||
} else {
|
|
||||||
$this->db->or_group_start();
|
|
||||||
}
|
|
||||||
foreach($values['rules'] as $group_value)
|
|
||||||
{
|
|
||||||
if($group_value['operator'] == "equal") {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->where($group_value['field'], $group_value['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($group_value['field'], $group_value['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($group_value['operator'] == "not_equal") {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->where($group_value['field'].' !=', $group_value['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($group_value['field'].' !=', $group_value['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($group_value['operator'] == "begins_with") {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->where($group_value['field'].' like ', $group_value['value']."%");
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($group_value['field'].' like ', $group_value['value']."%");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($group_value['operator'] == "contains") {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->where($group_value['field'].' like ', "%".$group_value['value']."%");
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($group_value['field'].' like ', "%".$group_value['value']."%");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($group_value['operator'] == "ends_with") {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->where($group_value['field'].' like ', "%".$group_value['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($group_value['field'].' like ', "%".$group_value['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($group_value['operator'] == "is_empty") {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->where($group_value['field'], "''");
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($group_value['field'], "''");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($group_value['operator'] == "is_not_empty") {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->where($group_value['field'].' !=', "''");
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($group_value['field'].' !=', "''");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($group_value['operator'] == "is_null") {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->where($group_value['field'].' is ', NULL);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($group_value['field'].' is ', NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($group_value['operator'] == "is_not_null") {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->where($group_value['field'].' is not ', NULL);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($group_value['field'].' is not ', NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if($group_value['operator'] == "less") {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->where($group_value['field'].' <', $group_value['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($group_value['field'].' <', $group_value['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($group_value['operator'] == "less_or_equal") {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->where($group_value['field'].' <=', $group_value['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($group_value['field'].' <=', $group_value['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($group_value['operator'] == "greater") {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->where($group_value['field'].' >', $group_value['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($group_value['field'].' >', $group_value['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($group_value['operator'] == "greater_or_equal") {
|
|
||||||
if($values['condition'] == "AND") {
|
|
||||||
$this->db->where($group_value['field'].' >=', $group_value['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($group_value['field'].' >=', $group_value['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
$this->db->group_end();
|
|
||||||
} else {
|
|
||||||
//print_r($values['field']);
|
|
||||||
if(isset($values['operator'])) {
|
|
||||||
|
|
||||||
}
|
|
||||||
if($values['operator'] == "equal") {
|
|
||||||
if($search_type == "AND") {
|
|
||||||
$this->db->where($values['field'], $values['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($values['field'], $values['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($values['operator'] == "not_equal") {
|
|
||||||
if($search_type == "AND") {
|
|
||||||
$this->db->where($values['field'].' !=', $values['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($values['field'].' !=', $values['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($values['operator'] == "begins_with") {
|
|
||||||
if($search_type == "AND") {
|
|
||||||
$this->db->where($values['field'].' like ', $values['value']."%");
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($values['field'].' like ', $values['value']."%");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($values['operator'] == "contains") {
|
|
||||||
if($search_type == "AND") {
|
|
||||||
$this->db->where($values['field'].' like ', "%".$values['value']."%");
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($values['field'].' like ', "%".$values['value']."%");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($values['operator'] == "ends_with") {
|
|
||||||
if($search_type == "AND") {
|
|
||||||
$this->db->where($values['field'].' like ', "%".$values['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($values['field'].' like ', "%".$values['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($values['operator'] == "is_empty") {
|
|
||||||
if($search_type == "AND") {
|
|
||||||
$this->db->where($values['field'], "");
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($values['field'], "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($values['operator'] == "is_not_empty") {
|
|
||||||
if($search_type == "AND") {
|
|
||||||
$this->db->where($values['field'].' !=', "");
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($values['field'].' !=', "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($values['operator'] == "is_null") {
|
|
||||||
if($search_type == "AND") {
|
|
||||||
$this->db->where($values['field'].' is ', NULL);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($values['field'].' is ', NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($values['operator'] == "is_not_null") {
|
|
||||||
if($search_type == "AND") {
|
|
||||||
$this->db->where($values['field'].' is not ', NULL);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($values['field'].' is not ', NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($values['operator'] == "less") {
|
|
||||||
if($search_type == "AND") {
|
|
||||||
$this->db->where($values['field'].' <', $values['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($values['field'].' <', $values['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($values['operator'] == "less_or_equal") {
|
|
||||||
if($search_type == "AND") {
|
|
||||||
$this->db->where($values['field'].' <=', $values['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($values['field'].' <=', $values['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($values['operator'] == "greater") {
|
|
||||||
if($search_type == "AND") {
|
|
||||||
$this->db->where($values['field'].' >', $values['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($values['field'].' >', $values['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($values['operator'] == "greater_or_equal") {
|
|
||||||
if($search_type == "AND") {
|
|
||||||
$this->db->where($values['field'].' >=', $values['value']);
|
|
||||||
} else {
|
|
||||||
$this->db->or_where($values['field'].' >=', $values['value']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->db->order_by('COL_TIME_ON', 'DESC');
|
|
||||||
$query = $this->db->get($this->config->item('table_name'));
|
|
||||||
echo json_encode($query->result_array());
|
|
||||||
} else {
|
|
||||||
echo "Noooooooob";
|
echo "Noooooooob";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function export_to_adif() {
|
||||||
|
if(isset($_POST['search'])) {
|
||||||
|
$data['qsos'] = $this->fetchQueryResult($_POST['search']);
|
||||||
|
|
||||||
|
$this->load->view('adif/data/exportall', $data);
|
||||||
|
} else {
|
||||||
|
echo "Noooooooob";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetchQueryResult($json) {
|
||||||
|
|
||||||
|
$search_items = json_decode($json, true);
|
||||||
|
|
||||||
|
$search_type = "";
|
||||||
|
|
||||||
|
foreach($search_items as $key=>$value){
|
||||||
|
|
||||||
|
|
||||||
|
if($value == "AND") {
|
||||||
|
$search_type = "AND";
|
||||||
|
}
|
||||||
|
if ($value == "OR") {
|
||||||
|
$search_type = "OR";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_array($value)) {
|
||||||
|
foreach($value as $values)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(isset($values['rules'])) {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->group_start();
|
||||||
|
} else {
|
||||||
|
$this->db->or_group_start();
|
||||||
|
}
|
||||||
|
foreach($values['rules'] as $group_value)
|
||||||
|
{
|
||||||
|
if($group_value['operator'] == "equal") {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->where($group_value['field'], $group_value['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($group_value['field'], $group_value['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($group_value['operator'] == "not_equal") {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->where($group_value['field'].' !=', $group_value['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($group_value['field'].' !=', $group_value['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($group_value['operator'] == "begins_with") {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->where($group_value['field'].' like ', $group_value['value']."%");
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($group_value['field'].' like ', $group_value['value']."%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($group_value['operator'] == "contains") {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->where($group_value['field'].' like ', "%".$group_value['value']."%");
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($group_value['field'].' like ', "%".$group_value['value']."%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($group_value['operator'] == "ends_with") {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->where($group_value['field'].' like ', "%".$group_value['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($group_value['field'].' like ', "%".$group_value['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($group_value['operator'] == "is_empty") {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->where($group_value['field'], "''");
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($group_value['field'], "''");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($group_value['operator'] == "is_not_empty") {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->where($group_value['field'].' !=', "''");
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($group_value['field'].' !=', "''");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($group_value['operator'] == "is_null") {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->where($group_value['field'].' is ', NULL);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($group_value['field'].' is ', NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($group_value['operator'] == "is_not_null") {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->where($group_value['field'].' is not ', NULL);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($group_value['field'].' is not ', NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($group_value['operator'] == "less") {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->where($group_value['field'].' <', $group_value['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($group_value['field'].' <', $group_value['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($group_value['operator'] == "less_or_equal") {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->where($group_value['field'].' <=', $group_value['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($group_value['field'].' <=', $group_value['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($group_value['operator'] == "greater") {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->where($group_value['field'].' >', $group_value['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($group_value['field'].' >', $group_value['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($group_value['operator'] == "greater_or_equal") {
|
||||||
|
if($values['condition'] == "AND") {
|
||||||
|
$this->db->where($group_value['field'].' >=', $group_value['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($group_value['field'].' >=', $group_value['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$this->db->group_end();
|
||||||
|
} else {
|
||||||
|
//print_r($values['field']);
|
||||||
|
if(isset($values['operator'])) {
|
||||||
|
|
||||||
|
}
|
||||||
|
if($values['operator'] == "equal") {
|
||||||
|
if($search_type == "AND") {
|
||||||
|
$this->db->where($values['field'], $values['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($values['field'], $values['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($values['operator'] == "not_equal") {
|
||||||
|
if($search_type == "AND") {
|
||||||
|
$this->db->where($values['field'].' !=', $values['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($values['field'].' !=', $values['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($values['operator'] == "begins_with") {
|
||||||
|
if($search_type == "AND") {
|
||||||
|
$this->db->where($values['field'].' like ', $values['value']."%");
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($values['field'].' like ', $values['value']."%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($values['operator'] == "contains") {
|
||||||
|
if($search_type == "AND") {
|
||||||
|
$this->db->where($values['field'].' like ', "%".$values['value']."%");
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($values['field'].' like ', "%".$values['value']."%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($values['operator'] == "ends_with") {
|
||||||
|
if($search_type == "AND") {
|
||||||
|
$this->db->where($values['field'].' like ', "%".$values['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($values['field'].' like ', "%".$values['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($values['operator'] == "is_empty") {
|
||||||
|
if($search_type == "AND") {
|
||||||
|
$this->db->where($values['field'], "");
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($values['field'], "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($values['operator'] == "is_not_empty") {
|
||||||
|
if($search_type == "AND") {
|
||||||
|
$this->db->where($values['field'].' !=', "");
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($values['field'].' !=', "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($values['operator'] == "is_null") {
|
||||||
|
if($search_type == "AND") {
|
||||||
|
$this->db->where($values['field'].' is ', NULL);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($values['field'].' is ', NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($values['operator'] == "is_not_null") {
|
||||||
|
if($search_type == "AND") {
|
||||||
|
$this->db->where($values['field'].' is not ', NULL);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($values['field'].' is not ', NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($values['operator'] == "less") {
|
||||||
|
if($search_type == "AND") {
|
||||||
|
$this->db->where($values['field'].' <', $values['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($values['field'].' <', $values['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($values['operator'] == "less_or_equal") {
|
||||||
|
if($search_type == "AND") {
|
||||||
|
$this->db->where($values['field'].' <=', $values['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($values['field'].' <=', $values['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($values['operator'] == "greater") {
|
||||||
|
if($search_type == "AND") {
|
||||||
|
$this->db->where($values['field'].' >', $values['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($values['field'].' >', $values['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($values['operator'] == "greater_or_equal") {
|
||||||
|
if($search_type == "AND") {
|
||||||
|
$this->db->where($values['field'].' >=', $values['value']);
|
||||||
|
} else {
|
||||||
|
$this->db->or_where($values['field'].' >=', $values['value']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->db->order_by('COL_TIME_ON', 'DESC');
|
||||||
|
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||||
|
$query = $this->db->get($this->config->item('table_name'));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,41 @@ $(".search-results-box").hide();
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("#btn-export").on("click", function(){
|
||||||
|
|
||||||
|
var result = $('#builder').queryBuilder('getRules');
|
||||||
|
if (!$.isEmptyObject(result)) {
|
||||||
|
// Data to post
|
||||||
|
data = {
|
||||||
|
search: JSON.stringify(result, null, 2), temp: "testvar"
|
||||||
|
};
|
||||||
|
|
||||||
|
xhttp = new XMLHttpRequest();
|
||||||
|
xhttp.onreadystatechange = function() {
|
||||||
|
var a;
|
||||||
|
if (xhttp.readyState === 4 && xhttp.status === 200) {
|
||||||
|
// Trick for making downloadable link
|
||||||
|
a = document.createElement('a');
|
||||||
|
a.href = window.URL.createObjectURL(xhttp.response);
|
||||||
|
// Give filename you wish to download
|
||||||
|
a.download = "advanced_search_export.adi";
|
||||||
|
a.style.display = 'none';
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// Post data to URL which handles post request
|
||||||
|
xhttp.open("POST", "<?php echo site_url('search/export_to_adif');?>", true);
|
||||||
|
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||||
|
// You should set responseType as blob for binary responses
|
||||||
|
xhttp.responseType = 'blob';
|
||||||
|
xhttp.send("search=" + JSON.stringify(result, null, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
$('#btn-get').on('click', function() {
|
$('#btn-get').on('click', function() {
|
||||||
var result = $('#builder').queryBuilder('getRules');
|
var result = $('#builder').queryBuilder('getRules');
|
||||||
if (!$.isEmptyObject(result)) {
|
if (!$.isEmptyObject(result)) {
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,13 @@
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="card-text" id="builder"></div>
|
<div class="card-text" id="builder"></div>
|
||||||
|
|
||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
<button class="btn btn-primary" id="btn-get">Search</button>
|
<button class="btn btn-primary" id="btn-get">Search</button>
|
||||||
|
|
||||||
<button class="btn btn-warning" id="btn-reset">Reset</button>
|
<button class="btn btn-warning" id="btn-reset">Reset</button>
|
||||||
|
|
||||||
|
<button class="btn btn-primary" id="btn-export">Export to ADIF</button>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<span class="badge badge-info">Info</span> You can find out how to use the <a href="https://github.com/magicbug/Cloudlog/wiki/Search----Filter" target="_blank">search filter functions</a> in the wiki.</a>
|
<span class="badge badge-info">Info</span> You can find out how to use the <a href="https://github.com/magicbug/Cloudlog/wiki/Search----Filter" target="_blank">search filter functions</a> in the wiki.</a>
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用