diff --git a/application/config/migration.php b/application/config/migration.php index 976c37a6..46d1487d 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 86; +$config['migration_version'] = 87; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 083c662d..a2c94ec4 100755 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -126,11 +126,14 @@ class Logbook extends CI_Controller { "bearing" => "", "workedBefore" => false, "lotw_member" => $lotw_member, + "image" => "", ]; $return['dxcc'] = $this->dxcheck($callsign); $return['partial'] = $this->partial($callsign); + $callbook = $this->logbook_model->loadCallBook($callsign, $this->config->item('use_fullname')); + // Do we have local data for the Callsign? if($this->logbook_model->call_name($callsign) != null) { @@ -148,6 +151,17 @@ class Logbook extends CI_Controller { $return['callsign_state'] = $this->logbook_model->call_state($callsign); $return['bearing'] = $this->bearing($return['callsign_qra'], $measurement_base, $station_id); $return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $type, $band, $mode); + if ($this->session->userdata('user_show_qrz_image')) { + if (isset($callbook)) { + if ($callbook['image'] == "") { + $return['image'] = "n/a"; + } else { + $return['image'] = $callbook['image']; + } + } else { + $return['image'] = "n/a"; + } + } if ($return['callsign_qra'] != "") { $return['latlng'] = $this->qralatlng($return['callsign_qra']); @@ -157,8 +171,6 @@ class Logbook extends CI_Controller { return; } - $callbook = $this->logbook_model->loadCallBook($callsign, $this->config->item('use_fullname')); - if (isset($callbook)) { $return['callsign_name'] = $callbook['name']; @@ -167,6 +179,13 @@ class Logbook extends CI_Controller { $return['callsign_iota'] = $callbook['iota']; $return['callsign_state'] = $callbook['state']; $return['callsign_us_county'] = $callbook['us_county']; + if ($this->session->userdata('user_show_qrz_image')) { + if ($callbook['image'] == "") { + $return['image'] = "n/a"; + } else { + $return['image'] = $callbook['image']; + } + } if(isset($callbook['qslmgr'])) { $return['qsl_manager'] = $callbook['qslmgr']; diff --git a/application/controllers/User.php b/application/controllers/User.php index dbb48912..a2de73ce 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -74,6 +74,7 @@ class User extends CI_Controller { $data['user_column3'] = $this->input->post('user_column3'); $data['user_column4'] = $this->input->post('user_column4'); $data['user_column5'] = $this->input->post('user_column5'); + $data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image'); $this->load->view('user/add', $data); } else { $this->load->view('user/add', $data); @@ -100,7 +101,8 @@ class User extends CI_Controller { $this->input->post('user_column2'), $this->input->post('user_column3'), $this->input->post('user_column4'), - $this->input->post('user_column5'))) { + $this->input->post('user_column5'), + $this->input->post('user_show_qrz_image'))) { // Check for errors case EUSERNAMEEXISTS: $data['username_error'] = 'Username '.$this->input->post('user_name').' already in use!'; @@ -137,6 +139,7 @@ class User extends CI_Controller { $data['user_column3'] = $this->input->post('user_column3'); $data['user_column4'] = $this->input->post('user_column4'); $data['user_column5'] = $this->input->post('user_column5'); + $data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image'); $this->load->view('user/add', $data); $this->load->view('interface_assets/footer'); } @@ -308,6 +311,12 @@ class User extends CI_Controller { $data['user_show_notes'] = $q->user_show_notes; } + if($this->input->post('user_show_qrz_image')) { + $data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image', false); + } else { + $data['user_show_qrz_image'] = $q->user_show_qrz_image; + } + if($this->input->post('user_column1')) { $data['user_column1'] = $this->input->post('user_column1', true); } else { @@ -387,6 +396,7 @@ class User extends CI_Controller { $data['user_column4'] = $this->input->post('user_column4'); $data['user_column4'] = $this->input->post('user_column4'); $data['user_column5'] = $this->input->post('user_column5'); + $data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image'); $this->load->view('user/edit'); $this->load->view('interface_assets/footer'); } @@ -599,4 +609,4 @@ class User extends CI_Controller { redirect('user/login'); } } -} \ No newline at end of file +} diff --git a/application/language/english/qso_lang.php b/application/language/english/qso_lang.php index 944f0d2a..a59ce307 100644 --- a/application/language/english/qso_lang.php +++ b/application/language/english/qso_lang.php @@ -6,6 +6,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['qso_title_qso_map'] = 'QSO Map'; $lang['qso_title_suggestions'] = 'Suggestions'; $lang['qso_title_pervious_contacts'] = 'Previous Contacts'; +$lang['qso_title_image'] = 'Profile Picture from qrz.com'; // Input Help Text on the /QSO Display $lang['qso_transmit_power_helptext'] = 'Give power value in Watts. Include only numbers in the input.'; diff --git a/application/language/german/qso_lang.php b/application/language/german/qso_lang.php index 462a43a8..3d3bac52 100644 --- a/application/language/german/qso_lang.php +++ b/application/language/german/qso_lang.php @@ -6,6 +6,7 @@ defined('BASEPATH') OR exit('Direkter Zugriff auf Skripte ist nicht erlaubt'); $lang['qso_title_qso_map'] = 'QSO-Karte'; $lang['qso_title_suggestions'] = 'Vorschläge'; $lang['qso_title_pervious_contacts'] = 'Vorherige Kontakte'; +$lang['qso_title_image'] = 'Profilbild von qrz.com'; // Input Help Text on the /QSO Display $lang['qso_transmit_power_helptext'] = 'Gib die Ausgangsleistung in Watt an. Erfasse nur Zahlen bei der Eingabe.'; diff --git a/application/libraries/Qrz.php b/application/libraries/Qrz.php index d1a26f30..1e0289d4 100755 --- a/application/libraries/Qrz.php +++ b/application/libraries/Qrz.php @@ -88,6 +88,7 @@ class Qrz { $data['long'] = (string)$xml->Callsign->lon; $data['iota'] = (string)$xml->Callsign->iota; $data['qslmgr'] = (string)$xml->Callsign->qslmgr; + $data['image'] = (string)$xml->Callsign->image; if ($xml->Callsign->country == "United States") { $data['state'] = (string)$xml->Callsign->state; diff --git a/application/migrations/087_add_qrz_image_option.php b/application/migrations/087_add_qrz_image_option.php new file mode 100644 index 00000000..2abf6593 --- /dev/null +++ b/application/migrations/087_add_qrz_image_option.php @@ -0,0 +1,29 @@ +db->field_exists('user_show_qrz_image', 'users')) { + $fields = array( + 'user_show_qrz_image BOOLEAN DEFAULT FALSE', + ); + $this->dbforge->add_column('users', $fields, 'user_column5'); + } + } + + public function down() + { + $this->dbforge->drop_column('users', 'user_show_qrz_image'); + } +} diff --git a/application/models/User_model.php b/application/models/User_model.php index 5f18f212..d9e2b360 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -113,7 +113,7 @@ class User_Model extends CI_Model { // Add a user function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone, $measurement, $user_date_format, $user_stylesheet, $user_sota_lookup, $user_show_notes, - $user_column1, $user_column2, $user_column3, $user_column4, $user_column5) { + $user_column1, $user_column2, $user_column3, $user_column4, $user_column5, $user_show_qrz_image) { // Check that the user isn't already used if(!$this->exists($username)) { $data = array( @@ -136,6 +136,7 @@ class User_Model extends CI_Model { 'user_column3' => xss_clean($user_column3), 'user_column4' => xss_clean($user_column4), 'user_column5' => xss_clean($user_column5), + 'user_show_qrz_image' => xss_clean($user_show_qrz_image), ); // Check the password is valid @@ -184,6 +185,7 @@ class User_Model extends CI_Model { 'user_column3' => xss_clean($fields['user_column3']), 'user_column4' => xss_clean($fields['user_column4']), 'user_column5' => xss_clean($fields['user_column5']), + 'user_show_qrz_image' => xss_clean($fields['user_show_qrz_image']), ); // Check to see if the user is allowed to change user levels @@ -293,6 +295,7 @@ class User_Model extends CI_Model { 'user_stylesheet' => $u->row()->user_stylesheet, 'user_sota_lookup' => isset($u->row()->user_sota_lookup) ? $u->row()->user_sota_lookup : 0, 'user_show_notes' => isset($u->row()->user_show_notes) ? $u->row()->user_show_notes : 1, + 'user_show_qrz_image' => isset($u->row()->user_show_qrz_image) ? $u->row()->user_show_qrz_image : 0, 'user_column1' => isset($u->row()->user_column1) ? $u->row()->user_column1: 'Mode', 'user_column2' => isset($u->row()->user_column2) ? $u->row()->user_column2: 'RSTS', 'user_column3' => isset($u->row()->user_column3) ? $u->row()->user_column3: 'RSTR', diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 096def04..c2019933 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -521,6 +521,17 @@
+ session->userdata('user_show_qrz_image')) { ?> + + +