diff --git a/application/controllers/Update.php b/application/controllers/Update.php index ceeef55a3..2ed5ce49e 100644 --- a/application/controllers/Update.php +++ b/application/controllers/Update.php @@ -491,7 +491,7 @@ class Update extends CI_Controller { public function update_hamsofnote() { $this->load->model('Update_model'); - $bodyData['satupdates'] = $this->Update_model->update_hams_of_note(); + $bodyData['hamsofnote'] = $this->Update_model->update_hams_of_note(); $data['page_title'] = __("Update of Hams of Note"); $this->load->view('interface_assets/header', $data); $this->load->view('update/hamsofnote', $bodyData); diff --git a/application/models/Update_model.php b/application/models/Update_model.php index f29d2722c..0291b4288 100644 --- a/application/models/Update_model.php +++ b/application/models/Update_model.php @@ -488,6 +488,7 @@ class Update_model extends CI_Model { $this->db->empty_table("hams_of_note"); $this->db->query("ALTER TABLE hams_of_note AUTO_INCREMENT 1"); $file = 'https://www.ham2k.com/data/hams-of-note.txt'; + $result = array(); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $file); curl_setopt($ch, CURLOPT_HEADER, false); @@ -504,12 +505,13 @@ class Update_model extends CI_Model { $index = strpos($line, ' '); $call = substr($line, 0, $index); $name = substr($line, strpos($line, ' ')); - $linkname = $link = ''; + $linkname = $link = null; if (strpos($name, '[')) { $linkname = substr($name, strpos($name, '[')+1, (strpos($name, ']') - strpos($name, '[')-1)); $link= substr($name, strpos($name, '(')+1, (strpos($name, ')') - strpos($name, '(')-1)); $name = substr($name, 0, strpos($name, '[')); } + array_push($result, array('callsign' => $call, 'name' => $name, 'linkname' => $linkname, 'link' => $link)); $hon[$i]['callsign'] = $call; $hon[$i]['description'] = $name; $hon[$i]['linkname'] = $linkname; @@ -522,7 +524,7 @@ class Update_model extends CI_Model { } } $this->db->insert_batch('hams_of_note', $hon); - return; + return $result; } } diff --git a/application/views/update/hamsofnote.php b/application/views/update/hamsofnote.php index 6d63a9610..37f08f2d2 100644 --- a/application/views/update/hamsofnote.php +++ b/application/views/update/hamsofnote.php @@ -2,11 +2,11 @@
'; - echo '