Uses Callbytxt to lookup Gridsquare & name if not in logbook

这个提交包含在:
Peter Goodhall 2011-11-08 17:42:59 +00:00
父节点 1cfef832b2
当前提交 3993326b08
共有 3 个文件被更改,包括 43 次插入1 次删除

查看文件

@ -137,5 +137,15 @@ class Dashboard extends CI_Controller {
echo "}";
}
function test() {
$this->load->library('callbytxt');
$callbook = $this->callbytxt->callsign('m3ph');
print_r($callbook);
}
}

查看文件

@ -0,0 +1,32 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Callbytxt {
/*
Communicates with the Callbytxt API functions
*/
public function callsign($callsign)
{
ini_set ('display_errors', 1);
$jsonurl = "http://callbytxt.org/db/".$callsign.".json";
$json = @file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json);
if(isset($json_output)) {
$data['callsign'] = $json_output->calls->callsign;
$data['name'] = ucfirst(strtolower(($json_output->calls->first_name)));
$data['gridsquare'] = ucfirst($json_output->calls->gridsquare);
$data['city'] = ucfirst(strtolower(($json_output->calls->city)));
$data['lat'] = ucfirst($json_output->calls->lat);
$data['long'] = ucfirst($json_output->calls->long);
return $data;
}
}
}
/* End of file Callbytxt.php */

查看文件

@ -330,7 +330,7 @@
});
/* On Callsign Change */
$("#callsign").keyup(function(){
$("#callsign").focusout(function(){
if ($(this).val()) {
/* Find Callsign Matches */
$('#partial_view').load("logbook/partial/" + $(this).val()).fadeIn("slow");