DXCC awards has links to show stations worked on that band and country

这个提交包含在:
Andy 2016-02-15 17:46:33 +00:00
父节点 98a17832c9
当前提交 34212d2976
共有 6 个文件被更改,包括 120 次插入35 次删除

查看文件

@ -151,13 +151,15 @@ class API extends CI_Controller {
$this->load->model('user_model'); $this->load->model('user_model');
$arguments = $this->_retrieve(); $arguments = $this->_retrieve();
print_r($arguments);
return;
if((!$this->user_model->authorize(3)) && ($this->api_model->authorize($arguments['key']) == 0)) { 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 // 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 // Call the parser within the API model to build the query
$query = $this->api_model->select_parse($arguments); $query = $this->api_model->select_parse($arguments);
@ -166,33 +168,45 @@ class API extends CI_Controller {
$s = $this->logbook_model->api_search_query($query); $s = $this->logbook_model->api_search_query($query);
$a = 0; $a = 0;
if(isset($s['results'])) { // Print query results using original column names and exit
$results = $s['results']; 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 print json_encode($results);
// and more friendly, descriptive names return;
if($results->num_rows != 0) }
{
foreach ($results->result() as $row) { if(isset($s['results'])) {
$record = (array)$row; $results = $s['results'];
$r[$a]['rid'] = $a;
while (list($key, $val) = each($record)) { // Cycle through the results, and translate between MySQL column names
$r[$a][$this->api_model->name($key)] = $val; // and more friendly, descriptive names
} if($results->num_rows != 0)
$a++; {
} foreach ($results->result() as $row) {
// Add the result record to the main results array $record = (array)$row;
$data['data']['search_Result']['results'] = $r; $r[$a]['rid'] = $a;
} while (list($key, $val) = each($record)) {
else $r[$a][$this->api_model->name($key)] = $val;
{ }
// We've got no results, so make this empty for completeness $a++;
$data['data']['search_Result']['results'] = ""; }
} // Add the result record to the main results array
} else { $data['data']['search_Result']['results'] = $r;
$data['data']['error'] = $s['error']; }
$data['data']['search_Result']['results'] = ""; 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 // Add some debugging information to the XML output
$data['data']['queryInfo']['call'] = "search"; $data['data']['queryInfo']['call'] = "search";
@ -204,6 +218,31 @@ class API extends CI_Controller {
$this->load->view('api/index', $data); $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() function validate()
{ {
// Load the API and Logbook models // Load the API and Logbook models

查看文件

@ -31,6 +31,41 @@ class Awards extends CI_Controller {
} }
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. Handles Displaying of WAB Squares worked.
Comment field - WAB:# Comment field - WAB:#

查看文件

@ -291,7 +291,7 @@ class Logbook extends CI_Controller {
} }
} }
function search_result($id) { function search_result($id="") {
$this->load->model('user_model'); $this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } 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) if ($query->num_rows() > 0)
{ {
$data['results'] = $query; $data['results'] = $query;
$this->load->view('search/result_search.php', $data); $this->load->view('view_log/partial/log.php', $data);
} else { } else {
$this->load->model('search'); $this->load->model('search');
@ -313,7 +313,7 @@ class Logbook extends CI_Controller {
if ($iota_search->num_rows() > 0) if ($iota_search->num_rows() > 0)
{ {
$data['results'] = $iota_search; $data['results'] = $iota_search;
$this->load->view('search/result_search.php', $data); $this->load->view('view_log/partial/log.php', $data);
} else { } else {
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) { if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
// Lookup using QRZ // Lookup using QRZ

查看文件

@ -40,7 +40,8 @@ class DXCC extends CI_Model {
$results[$row->COL_COUNTRY][$row->COL_BAND] = $row->cnt; $results[$row->COL_COUNTRY][$row->COL_BAND] = $row->cnt;
} }
//print_r($results); // print_r($results);
// return;
return $results; return $results;
} }
@ -75,6 +76,11 @@ class DXCC extends CI_Model {
} }
} }
function search(){
print_r($this->input->get());
return;
}
function empty_table($table) { function empty_table($table) {
$this->db->empty_table($table); $this->db->empty_table($table);
} }

查看文件

@ -35,8 +35,11 @@
foreach($dxcc as $country=>$val){ foreach($dxcc as $country=>$val){
print("<tr><td>$country</td>"); print("<tr><td>$country</td>");
foreach($val as $band=>$count){ foreach($val as $band=>$count){
$count = ($count == 0)?"&nbsp;":$count; if ($count == 0){
print("<td>$count</td>"); print("<td>&nbsp;</td>");
}else{
printf("<td><a href='dxcc_details?Country=\"%s\"&Band=\"%s\"'>%d</a></td>", $country, $band, $count);
}
} }
print("</tr>"); print("</tr>");
} }

查看文件

@ -88,9 +88,11 @@
</table> </table>
<?php if (isset($this->pagination)){ ?>
<div class="pagination"> <div class="pagination">
<?php echo $this->pagination->create_links(); ?> <?php echo $this->pagination->create_links(); ?>
</div> </div>
<?php } ?>
</div> </div>