diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index 2268d553..fa7a69e6 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -8,6 +8,23 @@ class eqsl extends CI_Controller { $this->load->helper(array('form', 'url')); } + // Default view when loading controller. + public function index() { + + $this->lang->load('qslcard'); + $folder_name = "assets/qslcard"; + $data['storage_used'] = $this->sizeFormat($this->folderSize($folder_name)); + + // Render Page + $data['page_title'] = "eQSL Cards"; + + $this->load->model('eqsl_images'); + $data['qslarray'] = $this->eqsl_images->eqsl_qso_list(); + + $this->load->view('interface_assets/header', $data); + $this->load->view('eqslcard/index'); + $this->load->view('interface_assets/footer'); + } public function import() { $this->load->model('user_model'); if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } @@ -599,5 +616,49 @@ class eqsl extends CI_Controller { $status = $this->uploadQso($adif, $qsl); } } - + +// Functions for storage, these need shifted to a libary to use across Cloudlog + function folderSize($dir){ + $count_size = 0; + $count = 0; + $dir_array = scandir($dir); + foreach($dir_array as $key=>$filename){ + if($filename!=".." && $filename!="."){ + if(is_dir($dir."/".$filename)){ + $new_foldersize = foldersize($dir."/".$filename); + $count_size = $count_size+ $new_foldersize; + }else if(is_file($dir."/".$filename)){ + $count_size = $count_size + filesize($dir."/".$filename); + $count++; + } + } + } + return $count_size; + } + + 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'; + } + } + } // end class diff --git a/application/models/Eqsl_images.php b/application/models/Eqsl_images.php index 88137b01..521f8fba 100644 --- a/application/models/Eqsl_images.php +++ b/application/models/Eqsl_images.php @@ -24,6 +24,13 @@ class Eqsl_images extends CI_Model { $this->db->insert('eQSL_images', $data); } + function eqsl_qso_list() { + $this->db->select('qso_id, COL_CALL, COL_MODE, , COL_SUBMODE, COL_TIME_ON, COL_BAND, COL_SAT_NAME, image_file'); + $this->db->join($this->config->item('table_name'), 'qso_id = COL_PRIMARY_KEY', 'left outer'); + $this->db->order_by('COL_TIME_ON', 'DESC'); + return $this->db->get('eQSL_images'); + } + } -?> \ No newline at end of file +?> diff --git a/application/views/eqslcard/index.php b/application/views/eqslcard/index.php new file mode 100644 index 00000000..979f4ee3 --- /dev/null +++ b/application/views/eqslcard/index.php @@ -0,0 +1,59 @@ +
| '.$this->lang->line('gen_hamradio_callsign').' | +'.$this->lang->line('gen_hamradio_mode').' | +'.$this->lang->line('general_word_date').' | +'.$this->lang->line('general_word_time').' | +'.$this->lang->line('gen_hamradio_band').' | +'.$this->lang->line('gen_hamradio_qsl').' | ++ |
|---|---|---|---|---|---|---|
| ' . $qsl->COL_CALL . ' | '; + echo ''; + echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; + echo ' | '; + echo ''; + $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); + echo ' | '; + echo ''; + $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); + echo ' | '; + echo ''; + if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; + echo ' | '; + echo '' . $qsl->image_file . ' | '; + echo ''; + echo ' |