DXCC awards has links to show stations worked on that band and country
这个提交包含在:
父节点
98a17832c9
当前提交
34212d2976
共有 6 个文件被更改,包括 120 次插入 和 35 次删除
|
|
@ -151,13 +151,15 @@ class API extends CI_Controller {
|
|||
$this->load->model('user_model');
|
||||
|
||||
$arguments = $this->_retrieve();
|
||||
print_r($arguments);
|
||||
return;
|
||||
|
||||
if((!$this->user_model->authorize(3)) && ($this->api_model->authorize($arguments['key']) == 0)) {
|
||||
$this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard');
|
||||
}
|
||||
$this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard');
|
||||
}
|
||||
|
||||
// Retrieve the arguments from the query string
|
||||
$data['data']['format'] = $arguments['format'];
|
||||
$data['data']['format'] = $arguments['format'];
|
||||
|
||||
// Call the parser within the API model to build the query
|
||||
$query = $this->api_model->select_parse($arguments);
|
||||
|
|
@ -166,33 +168,45 @@ class API extends CI_Controller {
|
|||
$s = $this->logbook_model->api_search_query($query);
|
||||
$a = 0;
|
||||
|
||||
if(isset($s['results'])) {
|
||||
$results = $s['results'];
|
||||
// Print query results using original column names and exit
|
||||
if ($arguments['format'] == 'original'){
|
||||
$results = array();
|
||||
foreach($s['results']->result() as $row){
|
||||
//print_r($row);
|
||||
array_push($results, $row);
|
||||
}
|
||||
|
||||
// Cycle through the results, and translate between MySQL column names
|
||||
// and more friendly, descriptive names
|
||||
if($results->num_rows != 0)
|
||||
{
|
||||
foreach ($results->result() as $row) {
|
||||
$record = (array)$row;
|
||||
$r[$a]['rid'] = $a;
|
||||
while (list($key, $val) = each($record)) {
|
||||
$r[$a][$this->api_model->name($key)] = $val;
|
||||
}
|
||||
$a++;
|
||||
}
|
||||
// Add the result record to the main results array
|
||||
$data['data']['search_Result']['results'] = $r;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We've got no results, so make this empty for completeness
|
||||
$data['data']['search_Result']['results'] = "";
|
||||
}
|
||||
} else {
|
||||
$data['data']['error'] = $s['error'];
|
||||
$data['data']['search_Result']['results'] = "";
|
||||
}
|
||||
print json_encode($results);
|
||||
return;
|
||||
}
|
||||
|
||||
if(isset($s['results'])) {
|
||||
$results = $s['results'];
|
||||
|
||||
// Cycle through the results, and translate between MySQL column names
|
||||
// and more friendly, descriptive names
|
||||
if($results->num_rows != 0)
|
||||
{
|
||||
foreach ($results->result() as $row) {
|
||||
$record = (array)$row;
|
||||
$r[$a]['rid'] = $a;
|
||||
while (list($key, $val) = each($record)) {
|
||||
$r[$a][$this->api_model->name($key)] = $val;
|
||||
}
|
||||
$a++;
|
||||
}
|
||||
// Add the result record to the main results array
|
||||
$data['data']['search_Result']['results'] = $r;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We've got no results, so make this empty for completeness
|
||||
$data['data']['search_Result']['results'] = "";
|
||||
}
|
||||
} else {
|
||||
$data['data']['error'] = $s['error'];
|
||||
$data['data']['search_Result']['results'] = "";
|
||||
}
|
||||
|
||||
// Add some debugging information to the XML output
|
||||
$data['data']['queryInfo']['call'] = "search";
|
||||
|
|
@ -204,6 +218,31 @@ class API extends CI_Controller {
|
|||
$this->load->view('api/index', $data);
|
||||
}
|
||||
|
||||
/*
|
||||
* version of search that is callable internally
|
||||
* $arguments is an array of columns to query
|
||||
*/
|
||||
function api_search($arguments){
|
||||
// Load the API and Logbook models
|
||||
$this->load->model('api_model');
|
||||
$this->load->model('logbook_model');
|
||||
$this->load->model('user_model');
|
||||
|
||||
if((!$this->user_model->authorize(3)) && ($this->api_model->authorize($arguments['key']) == 0)) {
|
||||
$this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard');
|
||||
}
|
||||
|
||||
// Retrieve the arguments from the query string
|
||||
$data['data']['format'] = $arguments['format'];
|
||||
|
||||
// Call the parser within the API model to build the query
|
||||
$query = $this->api_model->select_parse($arguments);
|
||||
|
||||
// Execute the query, and retrieve the results
|
||||
$s = $this->logbook_model->api_search_query($query);
|
||||
return $s;
|
||||
}
|
||||
|
||||
function validate()
|
||||
{
|
||||
// Load the API and Logbook models
|
||||
|
|
|
|||
|
|
@ -30,6 +30,41 @@ class Awards extends CI_Controller {
|
|||
$this->load->view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
public function dxcc_details(){
|
||||
$a = $this->input->get();
|
||||
$q = "";
|
||||
foreach ($a as $key => $value) {
|
||||
$q .= $key."=".$value.("(and)");
|
||||
}
|
||||
$q = substr($q, 0, strlen($q)-13);
|
||||
|
||||
$arguments["query"] = $q;
|
||||
$arguments["fields"] = '';
|
||||
$arguments["format"] = "json";
|
||||
$arguments["limit"] = '';
|
||||
$arguments["order"] = '';
|
||||
|
||||
// print_r($arguments);
|
||||
// return;
|
||||
|
||||
// Load the API and Logbook models
|
||||
$this->load->model('api_model');
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
// Call the parser within the API model to build the query
|
||||
$query = $this->api_model->select_parse($arguments);
|
||||
|
||||
// Execute the query, and retrieve the results
|
||||
$data = $this->logbook_model->api_search_query($query);
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = "Log View - DXCC";
|
||||
$data['filter'] = $a["Country"] . " and " . $a["Band"];
|
||||
$this->load->view('layout/header', $data);
|
||||
$this->load->view('awards/dxcc/details');
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
|
||||
/*
|
||||
Handles Displaying of WAB Squares worked.
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ class Logbook extends CI_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
function search_result($id) {
|
||||
function search_result($id="") {
|
||||
$this->load->model('user_model');
|
||||
|
||||
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
|
||||
|
|
@ -304,7 +304,7 @@ class Logbook extends CI_Controller {
|
|||
if ($query->num_rows() > 0)
|
||||
{
|
||||
$data['results'] = $query;
|
||||
$this->load->view('search/result_search.php', $data);
|
||||
$this->load->view('view_log/partial/log.php', $data);
|
||||
} else {
|
||||
$this->load->model('search');
|
||||
|
||||
|
|
@ -313,7 +313,7 @@ class Logbook extends CI_Controller {
|
|||
if ($iota_search->num_rows() > 0)
|
||||
{
|
||||
$data['results'] = $iota_search;
|
||||
$this->load->view('search/result_search.php', $data);
|
||||
$this->load->view('view_log/partial/log.php', $data);
|
||||
} else {
|
||||
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
|
||||
// Lookup using QRZ
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ class DXCC extends CI_Model {
|
|||
$results[$row->COL_COUNTRY][$row->COL_BAND] = $row->cnt;
|
||||
}
|
||||
|
||||
//print_r($results);
|
||||
// print_r($results);
|
||||
// return;
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
|
@ -75,6 +76,11 @@ class DXCC extends CI_Model {
|
|||
}
|
||||
}
|
||||
|
||||
function search(){
|
||||
print_r($this->input->get());
|
||||
return;
|
||||
}
|
||||
|
||||
function empty_table($table) {
|
||||
$this->db->empty_table($table);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,8 +35,11 @@
|
|||
foreach($dxcc as $country=>$val){
|
||||
print("<tr><td>$country</td>");
|
||||
foreach($val as $band=>$count){
|
||||
$count = ($count == 0)?" ":$count;
|
||||
print("<td>$count</td>");
|
||||
if ($count == 0){
|
||||
print("<td> </td>");
|
||||
}else{
|
||||
printf("<td><a href='dxcc_details?Country=\"%s\"&Band=\"%s\"'>%d</a></td>", $country, $band, $count);
|
||||
}
|
||||
}
|
||||
print("</tr>");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,9 +88,11 @@
|
|||
|
||||
</table>
|
||||
|
||||
<?php if (isset($this->pagination)){ ?>
|
||||
<div class="pagination">
|
||||
<?php echo $this->pagination->create_links(); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
正在加载…
在新工单中引用