2022-03-16 11:27:54 +01:00
< ? php if ( ! defined ( 'BASEPATH' )) exit ( 'No direct script access allowed' );
class Csv extends CI_Controller {
public function index () {
2025-01-02 10:22:23 +01:00
if ( ! $this -> user_model -> authorize ( 2 ) || ! clubaccess_check ( 9 )) { $this -> session -> set_flashdata ( 'error' , __ ( " You're not allowed to do that! " )); redirect ( 'dashboard' ); }
2022-03-16 11:27:54 +01:00
$this -> load -> model ( 'modes' );
$this -> load -> model ( 'logbook_model' );
$this -> load -> model ( 'stations' );
$this -> load -> model ( 'bands' );
$data [ 'station_profile' ] = $this -> stations -> all_of_user (); // Used in the view for station location select
$data [ 'worked_bands' ] = $this -> bands -> get_worked_bands (); // Used in the view for band select
$data [ 'modes' ] = $this -> modes -> active (); // Used in the view for mode select
$data [ 'dxcc' ] = $this -> logbook_model -> fetchDxcc (); // Used in the view for dxcc select
2026-05-07 22:07:12 +02:00
$data [ 'adif_propmodes' ] = $this -> config -> item ( 'adif_propmodes' );
2022-03-16 11:27:54 +01:00
2024-06-08 11:01:59 +02:00
$data [ 'page_title' ] = __ ( " SOTA CSV Export " );
2022-03-16 11:27:54 +01:00
$this -> load -> view ( 'interface_assets/header' , $data );
$this -> load -> view ( 'csv/index' );
$this -> load -> view ( 'interface_assets/footer' );
}
public function export () {
2024-08-16 10:08:44 +02:00
if ( ! $this -> user_model -> authorize ( 2 )) { $this -> session -> set_flashdata ( 'error' , __ ( " You're not allowed to do that! " )); redirect ( 'dashboard' ); }
2023-08-08 17:13:01 +00:00
$this -> load -> model ( 'csv_model' );
2022-03-16 11:27:54 +01:00
// Parameters
$station_id = $this -> security -> xss_clean ( $this -> input -> post ( 'station_profile' ));
$band = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
$mode = $this -> security -> xss_clean ( $this -> input -> post ( 'mode' ));
$dxcc = $this -> security -> xss_clean ( $this -> input -> post ( 'dxcc_id' ));
$cqz = $this -> security -> xss_clean ( $this -> input -> post ( 'cqz' ));
$propagation = $this -> security -> xss_clean ( $this -> input -> post ( 'prop_mode' ));
$fromdate = $this -> security -> xss_clean ( $this -> input -> post ( 'fromdate' ));
$todate = $this -> security -> xss_clean ( $this -> input -> post ( 'todate' ));
// Get QSOs with valid SOTA info
$data [ 'qsos' ] = $this -> csv_model -> get_qsos ( $station_id , $band , $mode , $dxcc , $cqz , $propagation , $fromdate , $todate );
$this -> load -> view ( 'csv/data/export' , $data );
}
}