当前提交
						7a6bdf3fbc
					
				
					共有  8 个文件被更改,包括 739 次插入 和 134 次删除
				
			
		|  | @ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | |||
| | be upgraded / downgraded to. | ||||
| | | ||||
| */ | ||||
| $config['migration_version'] = 70; | ||||
| $config['migration_version'] = 71; | ||||
| 
 | ||||
| /* | ||||
| |-------------------------------------------------------------------------- | ||||
|  |  | |||
|  | @ -32,6 +32,7 @@ class Search extends CI_Controller { | |||
|         $this->load->model('Search_filter'); | ||||
| 
 | ||||
|         $data['get_table_names'] = $this->Search_filter->get_table_columns(); | ||||
| 		$data['stored_queries'] = $this->Search_filter->get_stored_queries(); | ||||
| 
 | ||||
|         //print_r($this->Search_filter->get_table_columns());
 | ||||
| 
 | ||||
|  | @ -51,24 +52,85 @@ class Search extends CI_Controller { | |||
| 
 | ||||
|     function json_result() { | ||||
|           if(isset($_POST['search'])) { | ||||
| 			  $result = $this->fetchQueryResult($_POST['search']); | ||||
| 			  $result = $this->fetchQueryResult($_POST['search'], false); | ||||
| 			  echo json_encode($result->result_array()); | ||||
| 		  } else { | ||||
| 				echo "Noooooooob"; | ||||
|           } | ||||
| 		  } | ||||
|     } | ||||
| 
 | ||||
| 	function export_to_adif() { | ||||
| 		if(isset($_POST['search'])) { | ||||
| 			$data['qsos'] = $this->fetchQueryResult($_POST['search']); | ||||
| 	function get_stored_queries() { | ||||
| 		$this->load->model('Search_filter'); | ||||
| 		$data['result'] = $this->Search_filter->get_stored_queries(); | ||||
| 		$this->load->view('search/stored_queries', $data); | ||||
| 	} | ||||
| 
 | ||||
| 			$this->load->view('adif/data/exportall', $data); | ||||
| 		} else { | ||||
| 			echo "Noooooooob"; | ||||
| 	function search_result() { | ||||
| 		if(isset($_POST['search'])) { | ||||
| 			$data['results'] = $this->fetchQueryResult($_POST['search'], false); | ||||
| 			$this->load->view('search/search_result_ajax', $data); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	function fetchQueryResult($json) { | ||||
| 	function export_to_adif() { | ||||
| 		if(isset($_POST['search'])) { | ||||
| 			$data['qsos'] = $this->fetchQueryResult($_POST['search'], false); | ||||
| 			$this->load->view('adif/data/exportall', $data); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	function export_stored_query_to_adif() { | ||||
| 		$this->db->where('id', xss_clean($this->input->post('id'))); | ||||
| 		$sql = $this->db->get('queries')->result(); | ||||
| 
 | ||||
| 		$data['qsos'] = $this->db->query($sql[0]->query); | ||||
| 		$this->load->view('adif/data/exportall', $data); | ||||
| 	} | ||||
| 
 | ||||
| 	function run_query() { | ||||
| 		$this->db->where('id', xss_clean($this->input->post('id'))); | ||||
| 		$sql = $this->db->get('queries')->result(); | ||||
| 		$sql = $sql[0]->query; | ||||
| 
 | ||||
| 		if (stristr($sql, 'select', ) && !stristr($sql, 'delete') && !stristr($sql, 'update')) { | ||||
| 			$data['results'] = $this->db->query($sql); | ||||
| 
 | ||||
| 			$this->load->view('search/search_result_ajax', $data); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	function save_query() { | ||||
| 		if(isset($_POST['search'])) { | ||||
| 			$query = $this->fetchQueryResult($_POST['search'], true); | ||||
| 
 | ||||
| 			$data = array( | ||||
| 				'userid' => xss_clean($this->session->userdata('user_id')), | ||||
| 				'query' => $query, | ||||
| 				'description' => xss_clean($_POST['description']) | ||||
| 			); | ||||
| 
 | ||||
| 			$this->db->insert('queries', $data); | ||||
| 			$last_id = $this->db->insert_id(); | ||||
| 			header('Content-Type: application/json'); | ||||
| 			echo json_encode(array('id' => $last_id, 'description' => xss_clean($_POST['description']))); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	function delete_query() { | ||||
| 		$id = xss_clean($this->input->post('id')); | ||||
| 		$this->load->model('search_filter'); | ||||
| 		$this->search_filter->delete_query($id); | ||||
| 	} | ||||
| 
 | ||||
| 	function save_edited_query() { | ||||
| 		$data = array( | ||||
| 			'description' => xss_clean($this->input->post('description')), | ||||
| 		); | ||||
| 
 | ||||
| 		$this->db->where('id', xss_clean($this->input->post('id'))); | ||||
| 		$this->db->where('userid', $this->session->userdata['user_id']); | ||||
| 		$this->db->update('queries', $data); | ||||
| 	} | ||||
| 
 | ||||
| 	function fetchQueryResult($json, $returnquery) { | ||||
| 
 | ||||
| 		$search_items = json_decode($json, true); | ||||
| 
 | ||||
|  | @ -316,9 +378,15 @@ class Search extends CI_Controller { | |||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		$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')); | ||||
| 
 | ||||
| 		if ($returnquery) { | ||||
| 			$query = $this->db->get_compiled_select($this->config->item('table_name')); | ||||
| 		} else { | ||||
| 			$query = $this->db->get($this->config->item('table_name')); | ||||
| 		} | ||||
| 		return $query; | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1,14 @@ | |||
| <?php defined('BASEPATH') OR exit('No direct script access allowed'); | ||||
| 
 | ||||
| class Migration_add_queries_table extends CI_Migration | ||||
| { | ||||
| 	public function up() | ||||
| 	{ | ||||
| 		$this->db->query("create table if not exists queries (id integer not null auto_increment, query text, description text, userid integer not null, primary key (id)) ENGINE=myisam DEFAULT CHARSET=utf8;"); | ||||
| 	} | ||||
| 
 | ||||
| 	public function down() | ||||
| 	{ | ||||
| 		$this->db->query(""); | ||||
| 	} | ||||
| } | ||||
|  | @ -13,6 +13,15 @@ class Search_filter extends CI_Model { | |||
| 		return $query; | ||||
| 	} | ||||
| 
 | ||||
| 	function get_stored_queries() { | ||||
| 		$this->db->where('userid', $this->session->userdata('user_id')); | ||||
| 		return $this->db->get('queries')->result(); | ||||
| 	} | ||||
| 
 | ||||
| 	function delete_query($id) { | ||||
| 		$this->db->delete('queries', array('id' => xss_clean($id), 'userid' =>$this->session->userdata('user_id'))); | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
| ?>
 | ||||
|  |  | |||
|  | @ -52,122 +52,320 @@ function load_was_map() { | |||
| 
 | ||||
| <?php if ($this->uri->segment(1) == "search" && $this->uri->segment(2) == "filter") { ?>
 | ||||
| 
 | ||||
| <script type="text/javascript" src="<?php echo base_url() ;?>assets/js/query-builder.standalone.min.js"></script> | ||||
| <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/query-builder.standalone.min.js"></script> | ||||
| 
 | ||||
| <script type="text/javascript"> | ||||
| 
 | ||||
| $(".search-results-box").hide(); | ||||
|     $(".search-results-box").hide(); | ||||
| 
 | ||||
|     $('#builder').queryBuilder({ | ||||
|     filters: [ | ||||
|       <?php foreach ($get_table_names->result() as $row) { | ||||
|         $value_name = str_replace("COL_", "", $row->Field); | ||||
|         if ($value_name != "PRIMARY_KEY" && strpos($value_name, 'MY_') === false && strpos($value_name, '_INTL') == false) { ?>
 | ||||
|         { | ||||
|           id: '<?php echo $row->Field; ?>', | ||||
|           label: '<?php echo $value_name; ?>', | ||||
|           <?php if (strpos($row->Type, 'int(') !== false) { ?>
 | ||||
|           type: 'integer', | ||||
|           operators: ['equal', 'not_equal', 'less', 'less_or_equal', 'greater', 'greater_or_equal'] | ||||
|           <?php } elseif(strpos($row->Type, 'double') !== false) { ?>
 | ||||
|           type: 'double', | ||||
|           operators: ['equal', 'not_equal', 'less', 'less_or_equal', 'greater', 'greater_or_equal'] | ||||
|           <?php } elseif(strpos($row->Type, 'datetime') !== false) { ?>
 | ||||
|           type: 'datetime', | ||||
|           operators: ['equal', 'not_equal', 'less', 'less_or_equal', 'greater', 'greater_or_equal'] | ||||
|           <?php } else { ?>
 | ||||
|           type: 'string', | ||||
|           operators: ['equal', 'not_equal', 'begins_with', 'contains', 'ends_with', 'is_empty', 'is_not_empty', 'is_null', 'is_not_null'] | ||||
|           <?php } ?>
 | ||||
|         }, | ||||
|         <?php } ?>
 | ||||
|       <?php } ?>
 | ||||
|     ] | ||||
|   }); | ||||
|         filters: [ | ||||
|             <?php foreach ($get_table_names->result() as $row) { | ||||
|                 $value_name = str_replace("COL_", "", $row->Field); | ||||
|                 if ($value_name != "PRIMARY_KEY" && strpos($value_name, 'MY_') === false && strpos($value_name, '_INTL') == false) { ?> {
 | ||||
|                         id: '<?php echo $row->Field; ?>', | ||||
|                         label: '<?php echo $value_name; ?>', | ||||
|                         <?php if (strpos($row->Type, 'int(') !== false) { ?>
 | ||||
|                             type: 'integer', | ||||
|                             operators: ['equal', 'not_equal', 'less', 'less_or_equal', 'greater', 'greater_or_equal'] | ||||
|                         <?php } elseif (strpos($row->Type, 'double') !== false) { ?>
 | ||||
|                             type: 'double', | ||||
|                             operators: ['equal', 'not_equal', 'less', 'less_or_equal', 'greater', 'greater_or_equal'] | ||||
|                         <?php } elseif (strpos($row->Type, 'datetime') !== false) { ?>
 | ||||
|                             type: 'datetime', | ||||
|                             operators: ['equal', 'not_equal', 'less', 'less_or_equal', 'greater', 'greater_or_equal'] | ||||
|                         <?php } else { ?>
 | ||||
|                             type: 'string', | ||||
|                             operators: ['equal', 'not_equal', 'begins_with', 'contains', 'ends_with', 'is_empty', 'is_not_empty', 'is_null', 'is_not_null'] | ||||
|                         <?php } ?>
 | ||||
|                     }, | ||||
|                 <?php } ?>
 | ||||
|             <?php } ?>
 | ||||
|         ] | ||||
|     }); | ||||
| 
 | ||||
| 
 | ||||
| $("#btn-export").on("click", function(){ | ||||
|     function export_search_result() { | ||||
|         var result = $('#builder').queryBuilder('getRules'); | ||||
|         if (!$.isEmptyObject(result)) { | ||||
|             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)); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 	var result = $('#builder').queryBuilder('getRules'); | ||||
| 	if (!$.isEmptyObject(result)) { | ||||
| 		// Data to post
 | ||||
| 		data = { | ||||
| 			search: JSON.stringify(result, null, 2), temp: "testvar" | ||||
| 		}; | ||||
|     function export_stored_query(id) { | ||||
|         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_stored_query_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("id=" + id); | ||||
|     } | ||||
| 
 | ||||
| 		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-save').on('click', function() { | ||||
|         var resultquery = $('#builder').queryBuilder('getRules'); | ||||
|         if (!$.isEmptyObject(resultquery)) { | ||||
|             let message = 'Description: <input class="form-control input-group-sm getqueryname">' | ||||
| 
 | ||||
|             BootstrapDialog.confirm({ | ||||
|                 title: 'Query description', | ||||
|                 size: BootstrapDialog.SIZE_NORMAL, | ||||
|                 cssClass: 'description-dialog', | ||||
|                 closable: true, | ||||
|                 nl2br: false, | ||||
|                 message: message, | ||||
|                 btnCancelLabel: 'Cancel', | ||||
|                 btnOKLabel: 'Save', | ||||
|                 callback: function(result) { | ||||
|                     if (result) { | ||||
|                         $.post("<?php echo site_url('search/save_query'); ?>", { | ||||
|                                 search: JSON.stringify(resultquery, null, 2), | ||||
|                                 description: $(".getqueryname").val() | ||||
|                             }) | ||||
|                             .done(function(data) { | ||||
|                                 $(".alert").remove(); | ||||
|                                 $(".card-body.main").append('<div class="alert alert-success"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>Your query has been saved!</div>'); | ||||
|                                 $('#querydropdown').append(new Option(data.description, data.id)); // We add the saved query to the dropdown
 | ||||
|                             }); | ||||
|                     } | ||||
|                 }, | ||||
|             }); | ||||
| 
 | ||||
| }); | ||||
|         } else { | ||||
|             BootstrapDialog.show({ | ||||
|                 title: 'Stored Queries', | ||||
|                 type: BootstrapDialog.TYPE_WARNING, | ||||
|                 size: BootstrapDialog.SIZE_NORMAL, | ||||
|                 cssClass: 'queries-dialog', | ||||
|                 nl2br: false, | ||||
|                 message: 'You need to make a query before you search!', | ||||
|                 buttons: [{ | ||||
|                     label: 'Close', | ||||
|                     action: function(dialogItself) { | ||||
|                         dialogItself.close(); | ||||
|                     } | ||||
|                 }] | ||||
|             }); | ||||
|         } | ||||
|     }); | ||||
| 
 | ||||
|   $('#btn-get').on('click', function() { | ||||
|     var result = $('#builder').queryBuilder('getRules'); | ||||
|     if (!$.isEmptyObject(result)) { | ||||
|       //alert(JSON.stringify(result, null, 2));
 | ||||
|     function run_query() { | ||||
|         $(".alert").remove(); | ||||
|         $(".runbutton").addClass('running'); | ||||
|         $(".runbutton").prop('disabled', true); | ||||
|         let id = $('#querydropdown').val(); | ||||
|         $.post("<?php echo site_url('search/run_query'); ?>", { | ||||
|                 id: id | ||||
|             }) | ||||
|             .done(function(data) { | ||||
| 
 | ||||
|       $.post( "<?php echo site_url('search/json_result');?>", { search: JSON.stringify(result, null, 2), temp: "testvar" }) | ||||
|       .done(function( data ) { | ||||
|         //console.log(data)
 | ||||
|         //alert( "Data Loaded: " + data );
 | ||||
|         $('.qso').remove(); | ||||
|         $(".search-results-box").show(); | ||||
|                 $('.exportbutton').html('<button class="btn btn-sm btn-primary" onclick="export_stored_query(' + id + ')">Export to ADIF</button>'); | ||||
|                 $('.card-body.result').empty(); | ||||
|                 $(".search-results-box").show(); | ||||
| 
 | ||||
|         $.each(JSON.parse(data), function(i, item) { | ||||
|                 $('.card-body.result').append(data); | ||||
|                 $('.table').DataTable({ | ||||
|                     "pageLength": 25, | ||||
|                     responsive: false, | ||||
|                     ordering: false, | ||||
|                     "scrollY": "400px", | ||||
|                     "scrollCollapse": true, | ||||
|                     "paging": false, | ||||
|                     "scrollX": true, | ||||
|                     dom: 'Bfrtip', | ||||
|                     buttons: [ | ||||
|                         'csv' | ||||
|                     ] | ||||
|                 }); | ||||
|                 // change color of csv-button if dark mode is chosen
 | ||||
|                 if (isDarkModeTheme()) { | ||||
|                     $(".buttons-csv").css("color", "white"); | ||||
|                 } | ||||
|                 $(".runbutton").removeClass('running'); | ||||
|                 $(".runbutton").prop('disabled', false); | ||||
|             }); | ||||
|     } | ||||
| 
 | ||||
|           var band = ""; | ||||
|           if(item.COL_SAT_NAME != "") { | ||||
|             band = item.COL_SAT_NAME; | ||||
|           } else { | ||||
|             band = item.COL_BAND; | ||||
|           } | ||||
|           var callsign = '<a href="javascript:displayQso(' + item.COL_PRIMARY_KEY + ');" >' + item.COL_CALL + '</a>'; | ||||
|           if (item.COL_SUBMODE == '' || item.COL_SUBMODE == null) { | ||||
|             $('#results').append('<tr class="qso"><td>' + item.COL_TIME_ON + '</td><td>' + callsign + '</td><td>' + item.COL_MODE + '</td><td>' + item.COL_RST_SENT + '</td><td>' + item.COL_RST_RCVD + '</td><td>' + band + '</td><td>' + item.COL_COUNTRY + '</td><td></td></tr>'); | ||||
|           } | ||||
|           else { | ||||
|             $('#results').append('<tr class="qso"><td>' + item.COL_TIME_ON + '</td><td>' + callsign + '</td><td>' + item.COL_SUBMODE + '</td><td>' + item.COL_RST_SENT + '</td><td>' + item.COL_RST_RCVD + '</td><td>' + band + '</td><td>' + item.COL_COUNTRY + '</td><td></td></tr>'); | ||||
|           } | ||||
|     function delete_stored_query(id) { | ||||
|         BootstrapDialog.confirm({ | ||||
|             title: 'DANGER', | ||||
|             message: 'Warning! Are you sure you want delete this stored query?', | ||||
|             type: BootstrapDialog.TYPE_DANGER, | ||||
|             closable: true, | ||||
|             draggable: true, | ||||
|             btnOKClass: 'btn-danger', | ||||
|             callback: function(result) { | ||||
|                 if (result) { | ||||
|                     $.ajax({ | ||||
|                         url: base_url + 'index.php/search/delete_query', | ||||
|                         type: 'post', | ||||
|                         data: { | ||||
|                             'id': id | ||||
|                         }, | ||||
|                         success: function(data) { | ||||
|                             $(".bootstrap-dialog-message").prepend('<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>The stored query has been deleted!</div>'); | ||||
|                             $("#query_" + id).remove(); // removes query from table in dialog
 | ||||
|                             $("#querydropdown option[value='" + id + "']").remove(); // removes query from dropdown
 | ||||
|                         }, | ||||
|                         error: function() { | ||||
|                             $(".bootstrap-dialog-message").prepend('<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>The stored query could not be deleted. Please try again!</div>'); | ||||
|                         }, | ||||
|                     }); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|       }); | ||||
|     } | ||||
|     else{ | ||||
|       //console.log("invalid object :");
 | ||||
|     } | ||||
|   }); | ||||
| 
 | ||||
|   $('#btn-set').on('click', function() { | ||||
|     //$('#builder').queryBuilder('setRules', rules_basic);
 | ||||
|     var result = $('#builder').queryBuilder('getRules'); | ||||
|     if (!$.isEmptyObject(result)) { | ||||
|       rules_basic = result; | ||||
|     function edit_stored_query(id) { | ||||
|         $('#description_' + id).attr('contenteditable', 'true'); | ||||
|         $('#description_' + id).focus(); | ||||
|         $('#edit_' + id).html('<a class="btn btn-primary btn-sm" href="javascript:save_edited_query(' + id + ');">Save</a>'); // Change to save button
 | ||||
|     } | ||||
|   }); | ||||
| 
 | ||||
|   //When rules changed :
 | ||||
|   $('#builder').on('getRules.queryBuilder.filter', function(e) { | ||||
|     //$log.info(e.value);
 | ||||
|   }); | ||||
|     function save_edited_query(id) { | ||||
|         $('#description_' + id).attr('contenteditable', 'false'); | ||||
|         $('#edit_' + id).html('<a class="btn btn-outline-primary btn-sm" href="javascript:edit_stored_query(' + id + ');">Edit</a>'); | ||||
|         $.ajax({ | ||||
|             url: base_url + 'index.php/search/save_edited_query', | ||||
|             type: 'post', | ||||
|             data: { | ||||
|                 id: id, | ||||
|                 description: $('#description_' + id).html(), | ||||
|             }, | ||||
|             success: function(html) { | ||||
|                 $('#edit_' + id).html('<a class="btn btn-outline-primary btn-sm" href="javascript:edit_stored_query(' + id + ');">Edit</a>'); // Change to edit button
 | ||||
|                 $(".bootstrap-dialog-message").prepend('<div class="alert alert-success"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>The query description has been updated!</div>'); | ||||
|                 $("#querydropdown option[value='" + id + "']").text($('#description_' + id).html()); // Change text in dropdown
 | ||||
|             }, | ||||
|             error: function() { | ||||
|                 $(".bootstrap-dialog-message").prepend('<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>Something went wrong with the save. Please try again!</div>'); | ||||
|             }, | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     $('#btn-edit').on('click', function() { | ||||
|         $(".alert").remove(); | ||||
|         $.ajax({ | ||||
|             url: base_url + 'index.php/search/get_stored_queries', | ||||
|             type: 'post', | ||||
|             success: function(html) { | ||||
|                 BootstrapDialog.show({ | ||||
|                     title: 'Stored Queries', | ||||
|                     size: BootstrapDialog.SIZE_WIDE, | ||||
|                     cssClass: 'queries-dialog', | ||||
|                     nl2br: false, | ||||
|                     message: html, | ||||
|                     buttons: [{ | ||||
|                         label: 'Close', | ||||
|                         action: function(dialogItself) { | ||||
|                             dialogItself.close(); | ||||
|                         } | ||||
|                     }] | ||||
|                 }); | ||||
|             } | ||||
|         }); | ||||
|     }); | ||||
| 
 | ||||
|     $('#btn-get').on('click', function() { | ||||
|         $(".alert").remove(); | ||||
|         var result = $('#builder').queryBuilder('getRules'); | ||||
|         if (!$.isEmptyObject(result)) { | ||||
|             $(".searchbutton").addClass('running'); | ||||
|             $(".searchbutton").prop('disabled', true); | ||||
| 
 | ||||
|             $.post("<?php echo site_url('search/search_result'); ?>", { | ||||
|                     search: JSON.stringify(result, null, 2), | ||||
|                     temp: "testvar" | ||||
|                 }) | ||||
|                 .done(function(data) { | ||||
|                     $('.exportbutton').html('<button class="btn btn-sm btn-primary" onclick="export_search_result();">Export to ADIF</button>'); | ||||
| 
 | ||||
|                     $('.card-body.result').empty(); | ||||
|                     $(".search-results-box").show(); | ||||
| 
 | ||||
|                     $('.card-body.result').append(data); | ||||
|                     $('.table').DataTable({ | ||||
|                         "pageLength": 25, | ||||
|                         responsive: false, | ||||
|                         ordering: false, | ||||
|                         "scrollY": "400px", | ||||
|                         "scrollCollapse": true, | ||||
|                         "paging": false, | ||||
|                         "scrollX": true, | ||||
|                         dom: 'Bfrtip', | ||||
|                         buttons: [ | ||||
|                             'csv' | ||||
|                         ] | ||||
|                     }); | ||||
|                     // change color of csv-button if dark mode is chosen
 | ||||
|                     if (isDarkModeTheme()) { | ||||
|                         $(".buttons-csv").css("color", "white"); | ||||
|                     } | ||||
|                     $(".searchbutton").removeClass('running'); | ||||
|                     $(".searchbutton").prop('disabled', false); | ||||
|                     $("#btn-save").show(); | ||||
|                 }); | ||||
|         } else { | ||||
|             BootstrapDialog.show({ | ||||
|                 title: 'Stored Queries', | ||||
|                 type: BootstrapDialog.TYPE_WARNING, | ||||
|                 size: BootstrapDialog.SIZE_NORMAL, | ||||
|                 cssClass: 'queries-dialog', | ||||
|                 nl2br: false, | ||||
|                 message: 'You need to make a query before you search!', | ||||
|                 buttons: [{ | ||||
|                     label: 'Close', | ||||
|                     action: function(dialogItself) { | ||||
|                         dialogItself.close(); | ||||
|                     } | ||||
|                 }] | ||||
|             }); | ||||
|         } | ||||
|     }); | ||||
| 
 | ||||
|     $('#btn-set').on('click', function() { | ||||
|         //$('#builder').queryBuilder('setRules', rules_basic);
 | ||||
|         var result = $('#builder').queryBuilder('getRules'); | ||||
|         if (!$.isEmptyObject(result)) { | ||||
|             rules_basic = result; | ||||
|         } | ||||
|     }); | ||||
| 
 | ||||
|     //When rules changed :
 | ||||
|     $('#builder').on('getRules.queryBuilder.filter', function(e) { | ||||
|         //$log.info(e.value);
 | ||||
|     }); | ||||
| </script> | ||||
| <?php } ?>
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -24,19 +24,41 @@ | |||
| 	      </li> | ||||
| 	    </ul> | ||||
| 	  </div> | ||||
| 	  <div class="card-body"> | ||||
| 	  <div class="card-body main"> | ||||
| 
 | ||||
| 		<div class="card-text" id="builder"></div> | ||||
| 
 | ||||
| 		<p class="card-text"> | ||||
| 		<button class="btn btn-primary" id="btn-get">Search</button> | ||||
| 		<button class="btn btn-sm btn-primary ld-ext-right searchbutton" id="btn-get">Search<div class="ld ld-ring ld-spin"></div></button> | ||||
| 
 | ||||
| 		<button class="btn btn-warning" id="btn-reset">Reset</button> | ||||
| 
 | ||||
| 		<button class="btn btn-primary" id="btn-export">Export to ADIF</button> | ||||
| 		<button class="btn btn-sm btn-warning" id="btn-reset">Reset</button> | ||||
| 		</p> | ||||
| 	  <p> | ||||
| 		<button style="display:none;" class="btn btn-sm btn-primary" id="btn-save">Save query</button> | ||||
| 
 | ||||
| 	    	<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> | ||||
| 		  <?php if ($stored_queries) { ?>
 | ||||
| 			<button class="btn btn-sm btn-primary" id="btn-edit">Edit queries</button></p> | ||||
| 
 | ||||
| 
 | ||||
| 		  <div class="form-group row"> | ||||
| 			  <label class="col-md-2 control-label" for="querydropdown">  Stored queries:</label> | ||||
| 			  <div class="col-md-3"> | ||||
| 				  <select id="querydropdown" name="querydropdown" class="form-control custom-select-sm"> | ||||
| 					  <?php | ||||
| 					  foreach($stored_queries as $q){ | ||||
| 						  echo '<option value="' . $q->id . '">'. $q->description . '</option>'."\n"; | ||||
| 					  } | ||||
| 					  ?>
 | ||||
| 				  </select> | ||||
| 			  </div> | ||||
| 			  <button class="btn btn-sm btn-primary ld-ext-right runbutton" onclick="run_query()">Run Query<div class="ld ld-ring ld-spin"></div></button> | ||||
| 		  </div> | ||||
| 
 | ||||
| 			<?php | ||||
| 		  } | ||||
| 		  ?>
 | ||||
| 
 | ||||
| 	    	<div style="display:none;"><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></div> | ||||
| 	    </p> | ||||
| 
 | ||||
| 	  </div> | ||||
|  | @ -47,24 +69,9 @@ | |||
| 	<!-- Search Results here --> | ||||
| 	<div class="card search-results-box"> | ||||
| 	  <div class="card-header"> | ||||
| 	    Search Results | ||||
| 	    Search Results:  <div class="exportbutton"><button class="btn btn-sm btn-primary" id="btn-export">Export to ADIF</button></div> | ||||
| 	  </div> | ||||
| 	  <div class="card-body"> | ||||
| 
 | ||||
| 		<div class="table-responsive"> | ||||
| 			<table id="results" class="table table-striped table-hover"> | ||||
| 				<tr class="titles"> | ||||
| 					<td>Date/Time</td> | ||||
| 					<td>Call</td> | ||||
| 					<td>Mode</td> | ||||
| 					<td>Sent</td> | ||||
| 					<td>Recv'd</td> | ||||
| 					<td>Band</td> | ||||
| 					<td>Country</td> | ||||
| 					<td></td> | ||||
| 				</tr> | ||||
| 	    	</table> | ||||
| 	    </div> | ||||
| 	  <div class="card-body result"> | ||||
| 
 | ||||
| 	  </div> | ||||
| 	</div> | ||||
|  |  | |||
|  | @ -0,0 +1,282 @@ | |||
| <div class="table-responsive"> | ||||
| 	<table style="width:100%" class="table table-sm tablewas table-bordered table-hover table-striped table-condensed text-center"> | ||||
| 		<thead> | ||||
|         <tr class="titles"> | ||||
|             <td><?php echo $this->lang->line('general_word_date'); ?></td>
 | ||||
|             <?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time'))) { ?>
 | ||||
|             <td><?php echo $this->lang->line('general_word_time'); ?></td>
 | ||||
|             <?php } ?>
 | ||||
|             <td><?php echo $this->lang->line('gen_hamradio_call'); ?></td>
 | ||||
| <?php | ||||
| 			echo '<td>'; | ||||
| 				switch($this->session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1')) { | ||||
| 					case 'Mode': echo $this->lang->line('gen_hamradio_mode'); break; | ||||
| 					case 'RSTS': echo $this->lang->line('gen_hamradio_rsts'); break; | ||||
| 					case 'RSTR': echo $this->lang->line('gen_hamradio_rstr'); break; | ||||
| 					case 'Country': echo $this->lang->line('general_word_country'); break; | ||||
| 					case 'IOTA': echo $this->lang->line('gen_hamradio_iota'); break; | ||||
| 					case 'SOTA': echo $this->lang->line('gen_hamradio_sota'); break; | ||||
| 					case 'State': echo $this->lang->line('gen_hamradio_state'); break; | ||||
| 					case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; | ||||
| 					case 'Band': echo $this->lang->line('gen_hamradio_band'); break; | ||||
| 				} | ||||
| 			echo '</td>'; | ||||
| 			echo '<td>'; | ||||
| 				switch($this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2')) { | ||||
| 					case 'Mode': echo $this->lang->line('gen_hamradio_mode'); break; | ||||
| 					case 'RSTS': echo $this->lang->line('gen_hamradio_rsts'); break; | ||||
| 					case 'RSTR': echo $this->lang->line('gen_hamradio_rstr'); break; | ||||
| 					case 'Country': echo $this->lang->line('general_word_country'); break; | ||||
| 					case 'IOTA': echo $this->lang->line('gen_hamradio_iota'); break; | ||||
| 					case 'State': echo $this->lang->line('gen_hamradio_state'); break; | ||||
| 					case 'SOTA': echo $this->lang->line('gen_hamradio_sota'); break; | ||||
| 					case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; | ||||
| 					case 'Band': echo $this->lang->line('gen_hamradio_band'); break; | ||||
| 				} | ||||
| 			echo '</td>'; | ||||
| 			echo '<td>'; | ||||
| 				switch($this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3')) { | ||||
| 					case 'Mode': echo $this->lang->line('gen_hamradio_mode'); break; | ||||
| 					case 'RSTS': echo $this->lang->line('gen_hamradio_rsts'); break; | ||||
| 					case 'RSTR': echo $this->lang->line('gen_hamradio_rstr'); break; | ||||
| 					case 'Country': echo $this->lang->line('general_word_country'); break; | ||||
| 					case 'IOTA': echo $this->lang->line('gen_hamradio_iota'); break; | ||||
| 					case 'SOTA': echo $this->lang->line('gen_hamradio_sota'); break; | ||||
| 					case 'State': echo $this->lang->line('gen_hamradio_state'); break; | ||||
| 					case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; | ||||
| 					case 'Band': echo $this->lang->line('gen_hamradio_band'); break; | ||||
| 				} | ||||
| 			echo '</td>'; | ||||
| 			echo '<td>'; | ||||
| 				switch($this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')) { | ||||
| 					case 'Mode': echo $this->lang->line('gen_hamradio_mode'); break; | ||||
| 					case 'RSTS': echo $this->lang->line('gen_hamradio_rsts'); break; | ||||
| 					case 'RSTR': echo $this->lang->line('gen_hamradio_rstr'); break; | ||||
| 					case 'Country': echo $this->lang->line('general_word_country'); break; | ||||
| 					case 'IOTA': echo $this->lang->line('gen_hamradio_iota'); break; | ||||
| 					case 'SOTA': echo $this->lang->line('gen_hamradio_sota'); break; | ||||
| 					case 'State': echo $this->lang->line('gen_hamradio_state'); break; | ||||
| 					case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; | ||||
| 					case 'Band': echo $this->lang->line('gen_hamradio_band'); break; | ||||
| 				} | ||||
| 			echo '</td>'; | ||||
| 			echo '<td>'; | ||||
| 			switch($this->session->userdata('user_column5')==""?'Country':$this->session->userdata('user_column5')) { | ||||
| 				case 'Mode': echo $this->lang->line('gen_hamradio_mode'); break; | ||||
| 				case 'RSTS': echo $this->lang->line('gen_hamradio_rsts'); break; | ||||
| 				case 'RSTR': echo $this->lang->line('gen_hamradio_rstr'); break; | ||||
| 				case 'Country': echo $this->lang->line('general_word_country'); break; | ||||
| 				case 'IOTA': echo $this->lang->line('gen_hamradio_iota'); break; | ||||
| 				case 'SOTA': echo $this->lang->line('gen_hamradio_sota'); break; | ||||
| 				case 'State': echo $this->lang->line('gen_hamradio_state'); break; | ||||
| 				case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; | ||||
| 				case 'Band': echo $this->lang->line('gen_hamradio_band'); break; | ||||
| 			} | ||||
| 			echo '</td>'; | ||||
| 
 | ||||
|             	if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { ?>
 | ||||
|                 <td>QSL</td> | ||||
|                 <?php if($this->session->userdata('user_eqsl_name') != "") { ?>
 | ||||
|                     <td>eQSL</td> | ||||
|                 <?php } ?>
 | ||||
|                 <?php if($this->session->userdata('user_lotw_name') != "") { ?>
 | ||||
|                     <td>LoTW</td> | ||||
|                 <?php } ?>
 | ||||
|             <?php } ?>
 | ||||
|                 <td><?php echo $this->lang->line('gen_hamradio_station'); ?></td>
 | ||||
|             <?php if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { ?>
 | ||||
|                 <td></td> | ||||
|             <?php } ?>
 | ||||
|         </tr> | ||||
| 		</thead> | ||||
| 		<tbody> | ||||
|         <?php  $i = 0;  foreach ($results->result() as $row) { ?>
 | ||||
| 
 | ||||
|             <?php | ||||
|                 // Get Date format
 | ||||
|                 if($this->session->userdata('user_date_format')) { | ||||
|                     // If Logged in and session exists
 | ||||
|                     $custom_date_format = $this->session->userdata('user_date_format'); | ||||
|                 } else { | ||||
|                     // Get Default date format from /config/cloudlog.php
 | ||||
|                     $custom_date_format = $this->config->item('qso_date_format'); | ||||
|                 } | ||||
|             ?>
 | ||||
|             <?php  echo '<tr class="tr'.($i & 1).'" id ="qso_'. $row->COL_PRIMARY_KEY .'">'; ?>
 | ||||
|             <td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date($custom_date_format, $timestamp); ?></td>
 | ||||
|             <?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time'))) { ?>
 | ||||
|                 <td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('H:i', $timestamp); ?></td>
 | ||||
|             <?php } ?>
 | ||||
|             <td> | ||||
|                 <a id="edit_qso" href="javascript:displayQso(<?php echo $row->COL_PRIMARY_KEY; ?>)"><?php echo str_replace("0","Ø",strtoupper($row->COL_CALL)); ?></a>
 | ||||
|             </td> | ||||
| 			<?php | ||||
| 
 | ||||
| 			switch($this->session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1')) { | ||||
| 				case 'Mode':    echo '<td>'; echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; break; | ||||
| 				case 'RSTS':    echo '<td>' . $row->COL_RST_SENT; if ($row->COL_STX) { echo '<span class="badge badge-light">' . $row->COL_STX . '</span>';}if ($row->COL_STX_STRING) { echo '<span class="badge badge-light">' . $row->COL_STX_STRING . '</span>';}; break; | ||||
| 				case 'RSTR':    echo '<td>' . $row->COL_RST_RCVD; if ($row->COL_SRX) { echo '<span class="badge badge-light">' . $row->COL_SRX . '</span>';}if ($row->COL_SRX_STRING) { echo '<span class="badge badge-light">' . $row->COL_SRX_STRING . '</span>';}; break; | ||||
| 				case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));; break; | ||||
| 				case 'IOTA':    echo '<td>' . ($row->COL_IOTA); break; | ||||
| 				case 'SOTA':    echo '<td>' . ($row->COL_SOTA_REF); break; | ||||
| 				case 'Grid':    echo '<td>'; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break; | ||||
| 				case 'Band':    echo '<td>'; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break; | ||||
| 				case 'State':   echo '<td>' . ($row->COL_STATE); break; | ||||
| 			} | ||||
| 			echo '</td>'; | ||||
| 			switch($this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2')) { | ||||
| 				case 'Mode':    echo '<td>'; echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; break; | ||||
| 				case 'RSTS':    echo '<td>' . $row->COL_RST_SENT; if ($row->COL_STX) { echo '<span class="badge badge-light">' . $row->COL_STX . '</span>';}if ($row->COL_STX_STRING) { echo '<span class="badge badge-light">' . $row->COL_STX_STRING . '</span>';}; break; | ||||
| 				case 'RSTR':    echo '<td>' . $row->COL_RST_RCVD; if ($row->COL_SRX) { echo '<span class="badge badge-light">' . $row->COL_SRX . '</span>';}if ($row->COL_SRX_STRING) { echo '<span class="badge badge-light">' . $row->COL_SRX_STRING . '</span>';}; break; | ||||
| 				case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));; break; | ||||
| 				case 'IOTA':    echo '<td>' . ($row->COL_IOTA); break; | ||||
| 				case 'SOTA':    echo '<td>' . ($row->COL_SOTA_REF); break; | ||||
| 				case 'Grid':    echo '<td>'; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break; | ||||
| 				case 'Band':    echo '<td>'; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break; | ||||
| 				case 'State':   echo '<td>' . ($row->COL_STATE); break; | ||||
| 			} | ||||
| 			echo '</td>'; | ||||
| 
 | ||||
| 			switch($this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3')) { | ||||
| 				case 'Mode':    echo '<td>'; echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; break; | ||||
| 				case 'RSTS':    echo '<td>' . $row->COL_RST_SENT; if ($row->COL_STX) { echo '<span class="badge badge-light">' . $row->COL_STX . '</span>';}if ($row->COL_STX_STRING) { echo '<span class="badge badge-light">' . $row->COL_STX_STRING . '</span>';}; break; | ||||
| 				case 'RSTR':    echo '<td>' . $row->COL_RST_RCVD; if ($row->COL_SRX) { echo '<span class="badge badge-light">' . $row->COL_SRX . '</span>';}if ($row->COL_SRX_STRING) { echo '<span class="badge badge-light">' . $row->COL_SRX_STRING . '</span>';}; break; | ||||
| 				case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));; break; | ||||
| 				case 'IOTA':    echo '<td>' . ($row->COL_IOTA); break; | ||||
| 				case 'SOTA':    echo '<td>' . ($row->COL_SOTA_REF); break; | ||||
| 				case 'Grid':    echo '<td>'; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break; | ||||
| 				case 'Band':    echo '<td>'; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break; | ||||
| 				case 'State':   echo '<td>' . ($row->COL_STATE); break; | ||||
| 			} | ||||
| 			echo '</td>'; | ||||
| 			switch($this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')) { | ||||
| 				case 'Mode':    echo '<td>'; echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; break; | ||||
| 				case 'RSTS':    echo '<td>' . $row->COL_RST_SENT; if ($row->COL_STX) { echo '<span class="badge badge-light">' . $row->COL_STX . '</span>';}if ($row->COL_STX_STRING) { echo '<span class="badge badge-light">' . $row->COL_STX_STRING . '</span>';}; break; | ||||
| 				case 'RSTR':    echo '<td>' . $row->COL_RST_RCVD; if ($row->COL_SRX) { echo '<span class="badge badge-light">' . $row->COL_SRX . '</span>';}if ($row->COL_SRX_STRING) { echo '<span class="badge badge-light">' . $row->COL_SRX_STRING . '</span>';}; break; | ||||
| 				case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));; break; | ||||
| 				case 'IOTA':    echo '<td>' . ($row->COL_IOTA); break; | ||||
| 				case 'SOTA':    echo '<td>' . ($row->COL_SOTA_REF); break; | ||||
| 				case 'Grid':    echo '<td>'; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break; | ||||
| 				case 'Band':    echo '<td>'; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break; | ||||
| 				case 'State':   echo '<td>' . ($row->COL_STATE); break; | ||||
| 			} | ||||
| 			echo '</td>'; | ||||
| 			switch($this->session->userdata('user_column5')==""?'Country':$this->session->userdata('user_column5')) { | ||||
| 				case 'Mode':    echo '<td>'; echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; break; | ||||
| 				case 'RSTS':    echo '<td>' . $row->COL_RST_SENT; if ($row->COL_STX) { echo '<span class="badge badge-light">' . $row->COL_STX . '</span>';}if ($row->COL_STX_STRING) { echo '<span class="badge badge-light">' . $row->COL_STX_STRING . '</span>';}; break; | ||||
| 				case 'RSTR':    echo '<td>' . $row->COL_RST_RCVD; if ($row->COL_SRX) { echo '<span class="badge badge-light">' . $row->COL_SRX . '</span>';}if ($row->COL_SRX_STRING) { echo '<span class="badge badge-light">' . $row->COL_SRX_STRING . '</span>';}; break; | ||||
| 				case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));; break; | ||||
| 				case 'IOTA':    echo '<td>' . ($row->COL_IOTA); break; | ||||
| 				case 'SOTA':    echo '<td>' . ($row->COL_SOTA_REF); break; | ||||
| 				case 'Grid':    echo '<td>'; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break; | ||||
| 				case 'Band':    echo '<td>'; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break; | ||||
| 				case 'State':   echo '<td>' . ($row->COL_STATE); break; | ||||
| 			} | ||||
| 			echo '</td>'; | ||||
| 				if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { ?>
 | ||||
|                 <td class="qsl"> | ||||
| 				<span class="qsl-<?php
 | ||||
|                 switch ($row->COL_QSL_SENT) { | ||||
|                     case "Y": | ||||
|                         echo "green"; | ||||
|                         break; | ||||
|                     case "Q": | ||||
|                         echo "yellow"; | ||||
|                         break; | ||||
|                     case "R": | ||||
|                         echo "yellow"; | ||||
|                         break; | ||||
|                     case "I": | ||||
|                         echo "grey"; | ||||
|                         break; | ||||
|                     default: | ||||
|                         echo "red"; | ||||
|                 } | ||||
|                 ?>">▲</span>
 | ||||
|                     <span class="qsl-<?php
 | ||||
|                     switch ($row->COL_QSL_RCVD) { | ||||
|                         case "Y": | ||||
|                             echo "green"; | ||||
|                             break; | ||||
|                         case "Q": | ||||
|                             echo "yellow"; | ||||
|                             break; | ||||
|                         case "R": | ||||
|                             echo "yellow"; | ||||
|                             break; | ||||
|                         case "I": | ||||
|                             echo "grey"; | ||||
|                             break; | ||||
|                         default: | ||||
|                             echo "red"; | ||||
|                     } | ||||
|                     ?>">▼</span>
 | ||||
|                 </td> | ||||
| 
 | ||||
|                 <?php if ($this->session->userdata('user_eqsl_name') != ""){ ?>
 | ||||
|                     <td class="eqsl"> | ||||
|                         <span class="eqsl-<?php echo ($row->COL_EQSL_QSL_SENT=='Y')?'green':'red'?>">▲</span>
 | ||||
|                         <span class="eqsl-<?php echo ($row->COL_EQSL_QSL_RCVD=='Y')?'green':'red'?>"> | ||||
| 			    	<?php if($row->COL_EQSL_QSL_RCVD =='Y') { ?>
 | ||||
|                         <a style="color: green" href="<?php echo site_url("eqsl/image/".$row->COL_PRIMARY_KEY); ?>" data-fancybox="images" data-width="528" data-height="336">▼</a>
 | ||||
|                     <?php } else { ?>
 | ||||
|                         ▼
 | ||||
|                     <?php } ?>
 | ||||
| 			    </span> | ||||
|                     </td> | ||||
|                 <?php } ?>
 | ||||
| 
 | ||||
|                 <?php if($this->session->userdata('user_lotw_name') != "") { ?>
 | ||||
|                     <td class="lotw"> | ||||
|                         <?php if ($row->COL_LOTW_QSL_SENT != ''){ ?>
 | ||||
|                             <span class="lotw-<?php echo ($row->COL_LOTW_QSL_SENT=='Y')?'green':'red'?>">▲</span>
 | ||||
|                             <span class="lotw-<?php echo ($row->COL_LOTW_QSL_RCVD=='Y')?'green':'red'?>">▼</span>
 | ||||
|                         <?php } ?>
 | ||||
|                     </td> | ||||
|                 <?php } ?>
 | ||||
| 
 | ||||
|             <?php } ?>
 | ||||
| 
 | ||||
|                     <?php if(isset($row->station_callsign)) { ?>
 | ||||
|                         <td> | ||||
|                             <span class="badge badge-light"><?php echo $row->station_callsign; ?></span>
 | ||||
|                         </td> | ||||
|                     <?php } ?>
 | ||||
| 
 | ||||
|             <?php if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { ?>
 | ||||
|                 <td> | ||||
|                     <div class="dropdown"> | ||||
|                         <a class="btn btn-sm btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||||
|                             <i class="fas fa-cog"></i> | ||||
|                         </a> | ||||
| 
 | ||||
|                         <div class="dropdown-menu" aria-labelledby="dropdownMenuLink"> | ||||
|                             <a class="dropdown-item" id="edit_qso" href="javascript:qso_edit(<?php echo $row->COL_PRIMARY_KEY; ?>)"><i class="fas fa-edit"></i> <?php echo $this->lang->line('general_edit_qso'); ?></a>
 | ||||
|                             <div class="qsl_<?php echo $row->COL_PRIMARY_KEY; ?>"> | ||||
|                             <div class="dropdown-divider"></div> | ||||
| 
 | ||||
|                             <?php if($row->COL_QSL_RCVD !='Y') { ?>
 | ||||
|                                 <a class="dropdown-item" href="javascript:qsl_rcvd(<?php echo $row->COL_PRIMARY_KEY; ?>, 'B')" ><i class="fas fa-envelope"></i> <?php echo $this->lang->line('general_mark_qsl_rx_bureau'); ?></a>
 | ||||
|                                 <a class="dropdown-item" href="javascript:qsl_rcvd(<?php echo $row->COL_PRIMARY_KEY; ?>, 'D')" ><i class="fas fa-envelope"></i> <?php echo $this->lang->line('general_mark_qsl_rx_direct'); ?></a>
 | ||||
|                                 <a class="dropdown-item" href="javascript:qsl_requested(<?php echo $row->COL_PRIMARY_KEY; ?>, 'D')" ><i class="fas fa-envelope"></i> Mark QSL Card Requested</a> | ||||
|                             <?php } ?>
 | ||||
| 
 | ||||
|                             <a class="dropdown-item" href="javascript:qsl_ignore(<?php echo $row->COL_PRIMARY_KEY; ?>, 'D')" ><i class="fas fa-envelope"></i> Mark QSL Card Not Required</a> | ||||
| 
 | ||||
|                             <div class="dropdown-divider"></div> | ||||
| 
 | ||||
|                             <a class="dropdown-item" href="https://www.qrz.com/db/<?php echo $row->COL_CALL; ?>" target="_blank"><i class="fas fa-question"></i> Lookup on QRZ</a> | ||||
| 
 | ||||
|                             <div class="dropdown-divider"></div> | ||||
| 
 | ||||
|                             <a class="dropdown-item" href="javascript:qso_delete(<?php echo $row->COL_PRIMARY_KEY; ?>, '<?php echo $row->COL_CALL; ?>')"><i class="fas fa-trash-alt"></i> <?php echo $this->lang->line('general_delete_qso'); ?></a>
 | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </td> | ||||
|             <?php } ?>
 | ||||
|             </tr> | ||||
|             <?php $i++; } ?>
 | ||||
| 			</tbody> | ||||
|     </table> | ||||
| 
 | ||||
| </div> | ||||
|  | @ -0,0 +1,27 @@ | |||
| <?php | ||||
| $i = 1; | ||||
| ?>
 | ||||
| <table class="table-sm table table-bordered table-hover table-striped table-condensed text-center"> | ||||
| 	<thead> | ||||
| 		<tr> | ||||
| 			<th>#</th>
 | ||||
| 			<th>Description</th> | ||||
| 			<th>Query</th> | ||||
| 			<th></th> | ||||
| 			<th></th> | ||||
| 		</tr> | ||||
| 	</thead> | ||||
| 	<tbody> | ||||
| 		<?php | ||||
| 		foreach ($result as $q) { | ||||
| 			echo '<tr id="query_' . $q->id . '">'; | ||||
| 			echo '<td>' . $i++ . '</td>'; | ||||
| 			echo '<td contenteditable="false" id="description_' . $q->id . '">' . $q->description . '</td>'; | ||||
| 			echo '<td>' . $q->query . '</td>'; | ||||
| 			echo '<td id="edit_' . $q->id . '"><a class="btn btn-outline-primary btn-sm" href="javascript:edit_stored_query(' . $q->id . ');">Edit</a></>'; | ||||
| 			echo '<td><a class="btn btn-danger btn-sm" href="javascript:delete_stored_query(' . $q->id . ');">Delete</a></td>'; | ||||
| 			echo '</tr>'; | ||||
| 		} | ||||
| 		?>
 | ||||
| 	</tbody> | ||||
| </table> | ||||
		正在加载…
	
		在新工单中引用