diff --git a/application/controllers/Visitor.php b/application/controllers/Visitor.php index f751637b..567f7f0d 100644 --- a/application/controllers/Visitor.php +++ b/application/controllers/Visitor.php @@ -431,5 +431,15 @@ class Visitor extends CI_Controller { $this->load->view('gridsquares/index'); $this->load->view('visitor/layout/footer'); } - -} \ No newline at end of file + + public function oqrs_enabled($slug) { + $this->load->model('oqrs_model'); + $this->load->model('Logbooks_model'); + $logbook_id = $this->Logbooks_model->public_slug_exists_logbook_id($slug); + if (!empty($this->oqrs_model->getOqrsStationsFromSlug($logbook_id))) { + return true; + } else { + return false; + } + } +} diff --git a/application/models/Oqrs_model.php b/application/models/Oqrs_model.php index 9214a35e..92f303d2 100644 --- a/application/models/Oqrs_model.php +++ b/application/models/Oqrs_model.php @@ -249,4 +249,16 @@ class Oqrs_model extends CI_Model { return ''; } -} \ No newline at end of file + + function getOqrsStationsFromSlug($logbook_id) { + $sql = 'SELECT station_callsign FROM `station_logbooks_relationship` JOIN `station_profile` ON station_logbooks_relationship.station_location_id = station_profile.station_id WHERE station_profile.oqrs = 1 AND station_logbook_id = '.$logbook_id.';'; + + $query = $this->db->query($sql); + + if ($query->num_rows() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/application/views/visitor/layout/header.php b/application/views/visitor/layout/header.php index 70e23d78..7895870d 100644 --- a/application/views/visitor/layout/header.php +++ b/application/views/visitor/layout/header.php @@ -49,6 +49,14 @@