kopia lustrzana https://github.com/magicbug/Cloudlog
Added Search Callsign function which returns results as json
rodzic
a4d023d225
commit
fe14cdc111
|
@ -2,6 +2,33 @@
|
|||
|
||||
class API extends CI_Controller {
|
||||
|
||||
/*
|
||||
TODOs
|
||||
- Search Callsign (Return Json)
|
||||
- Add QSO return json
|
||||
*/
|
||||
|
||||
|
||||
function search_callsign($callsign) {
|
||||
$this->db->select('COL_PRIMARY_KEY, COL_CALL, COL_MODE, COL_BAND, COL_COUNTRY, COL_FREQ, COL_GRIDSQUARE, COL_RST_RCVD, COL_RST_SENT, COL_SAT_MODE, COL_SAT_NAME, COL_TIME_ON');
|
||||
$this->db->select("DATE_FORMAT(COL_TIME_ON, '%H:%i') AS time_on", FALSE );
|
||||
$this->db->select("DATE_FORMAT(COL_TIME_ON, '%d/%c/%Y') AS date_on", FALSE );
|
||||
$this->db->like('COL_CALL', $callsign);
|
||||
$this->db->or_like('COL_GRIDSQUARE', $callsign);
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
|
||||
$results = array();
|
||||
|
||||
foreach ($query->result() as $result)
|
||||
{
|
||||
$results [] = $result;
|
||||
}
|
||||
|
||||
echo json_encode($results);
|
||||
|
||||
}
|
||||
|
||||
// Do absolutely nothing
|
||||
function index()
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue