diff --git a/application/controllers/Qsl.php b/application/controllers/Qsl.php
index 8d2470a6..2dbd11b6 100644
--- a/application/controllers/Qsl.php
+++ b/application/controllers/Qsl.php
@@ -143,7 +143,32 @@ class Qsl extends CI_Controller {
}
}
+ function loadSearchForm() {
+ $data['filename'] = $this->input->post('filename');
+ $this->load->view('qslcard/searchform', $data);
+ }
+ function searchQsos() {
+ $this->load->model('Qsl_model');
+ $callsign = $this->input->post('callsign');
+
+ $data['results'] = $this->Qsl_model->searchQsos($callsign);
+ $data['filename'] = $this->input->post('filename');
+ $this->load->view('qslcard/searchresult', $data);
+ }
+
+ function addQsoToQsl() {
+ $qsoid = $this->input->post('qsoid');
+ $filename = $this->input->post('filename');
+
+ $this->load->model('Qsl_model');
+ $insertid = $this->Qsl_model->addQsotoQsl($qsoid, $filename);
+ header("Content-type: application/json");
+ $result['status'] = 'Success';
+ $result['insertid'] = $insertid;
+ $result['filename'] = $filename;
+ echo json_encode($result);
+ }
}
@@ -166,27 +191,27 @@ function folderSize($dir){
return $count_size;
}
-function sizeFormat($bytes){
+function sizeFormat($bytes){
$kb = 1024;
$mb = $kb * 1024;
$gb = $mb * 1024;
$tb = $gb * 1024;
-
+
if (($bytes >= 0) && ($bytes < $kb)) {
return $bytes . ' B';
-
+
} elseif (($bytes >= $kb) && ($bytes < $mb)) {
return ceil($bytes / $kb) . ' KB';
-
+
} elseif (($bytes >= $mb) && ($bytes < $gb)) {
return ceil($bytes / $mb) . ' MB';
-
+
} elseif (($bytes >= $gb) && ($bytes < $tb)) {
return ceil($bytes / $gb) . ' GB';
-
+
} elseif ($bytes >= $tb) {
return ceil($bytes / $tb) . ' TB';
} else {
return $bytes . ' B';
}
-}
\ No newline at end of file
+}
diff --git a/application/models/Qsl_model.php b/application/models/Qsl_model.php
index cb7640c9..0e07bd4b 100644
--- a/application/models/Qsl_model.php
+++ b/application/models/Qsl_model.php
@@ -60,4 +60,31 @@ class Qsl_model extends CI_Model {
return $this->db->get();
}
-}
\ No newline at end of file
+
+ function searchQsos($callsign) {
+ $CI =& get_instance();
+ $CI->load->model('Stations');
+ $station_id = $CI->Stations->find_active();
+
+ $this->db->select('*');
+ $this->db->from($this->config->item('table_name'));
+ $this->db->where('station_id', $station_id);
+ $this->db->where('col_call', $callsign);
+
+ return $this->db->get();
+ }
+
+ function addQsotoQsl($qsoid, $filename) {
+ $clean_qsoid = $this->security->xss_clean($qsoid);
+ $clean_filename = $this->security->xss_clean($filename);
+
+ $data = array(
+ 'qsoid' => $qsoid,
+ 'filename' => $filename
+ );
+
+ $this->db->insert('qsl_images', $data);
+
+ return $this->db->insert_id();
+ }
+}
diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php
index be883106..fec31558 100644
--- a/application/views/interface_assets/footer.php
+++ b/application/views/interface_assets/footer.php
@@ -1793,6 +1793,66 @@ function deleteQsl(id) {
});
}
+
uri->segment(1) == "contesting") { ?>