2011-09-30 21:27:18 +00:00
|
|
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
|
|
|
|
class Backup extends CI_Controller {
|
2019-10-05 18:35:55 +00:00
|
|
|
function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
2011-09-30 21:27:18 +00:00
|
|
|
/* User Facing Links to Backup URLs */
|
|
|
|
public function index()
|
|
|
|
{
|
2020-08-10 22:26:02 +00:00
|
|
|
$this->load->model('user_model');
|
2023-08-01 08:21:17 +00:00
|
|
|
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
2011-09-30 21:27:18 +00:00
|
|
|
|
2011-11-04 17:32:03 +00:00
|
|
|
$data['page_title'] = "Backup";
|
|
|
|
|
2019-01-14 16:29:06 +00:00
|
|
|
$this->load->view('interface_assets/header', $data);
|
2011-09-30 21:27:18 +00:00
|
|
|
$this->load->view('backup/main');
|
2019-01-14 16:29:06 +00:00
|
|
|
$this->load->view('interface_assets/footer');
|
2011-09-30 21:27:18 +00:00
|
|
|
}
|
|
|
|
|
2011-10-01 18:35:23 +00:00
|
|
|
/* Gets all QSOs and Dumps them to logbook.adi */
|
2023-05-01 19:23:30 +00:00
|
|
|
public function adif($key = null){
|
2023-05-02 06:04:21 +00:00
|
|
|
if ($key == null) {
|
|
|
|
$this->load->model('user_model');
|
2023-08-01 08:21:17 +00:00
|
|
|
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
2023-05-02 06:04:21 +00:00
|
|
|
}
|
|
|
|
|
2011-09-30 21:27:18 +00:00
|
|
|
$this->load->helper('file');
|
|
|
|
// Set memory limit to unlimited to allow heavy usage
|
|
|
|
ini_set('memory_limit', '-1');
|
|
|
|
|
|
|
|
$this->load->model('adif_data');
|
|
|
|
|
2023-05-01 13:25:30 +00:00
|
|
|
$data['qsos'] = $this->adif_data->export_all($key);
|
2011-09-30 21:27:18 +00:00
|
|
|
|
2023-05-01 15:21:20 +00:00
|
|
|
$data['filename'] = 'backup/logbook'. date('_Y_m_d_H_i_s') .'.adi';
|
|
|
|
|
|
|
|
if ( ! write_file($data['filename'], $this->load->view('backup/exportall', $data, true)))
|
2011-09-30 21:27:18 +00:00
|
|
|
{
|
2023-05-03 07:38:28 +00:00
|
|
|
$data['status'] = false;
|
2011-09-30 21:27:18 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-05-03 07:38:28 +00:00
|
|
|
$data['status'] = true;
|
2011-09-30 21:27:18 +00:00
|
|
|
}
|
|
|
|
|
2011-11-04 17:32:03 +00:00
|
|
|
$data['page_title'] = "ADIF - Backup";
|
2023-05-01 15:21:20 +00:00
|
|
|
|
2011-11-04 17:32:03 +00:00
|
|
|
|
2019-01-14 16:29:06 +00:00
|
|
|
$this->load->view('interface_assets/header', $data);
|
2011-11-04 17:32:03 +00:00
|
|
|
$this->load->view('backup/adif_view');
|
2019-01-14 16:29:06 +00:00
|
|
|
$this->load->view('interface_assets/footer');
|
2011-09-30 21:27:18 +00:00
|
|
|
|
|
|
|
}
|
2011-10-01 18:35:23 +00:00
|
|
|
|
|
|
|
/* Export the notes to XML */
|
2023-05-03 07:38:28 +00:00
|
|
|
public function notes($key = null) {
|
|
|
|
if ($key == null) {
|
|
|
|
$this->load->model('user_model');
|
2023-08-01 08:21:17 +00:00
|
|
|
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
2023-05-03 07:38:28 +00:00
|
|
|
}
|
|
|
|
|
2011-10-01 18:35:23 +00:00
|
|
|
$this->load->helper('file');
|
|
|
|
$this->load->model('note');
|
|
|
|
|
2023-05-03 07:38:28 +00:00
|
|
|
$data['list_note'] = $this->note->list_all($key);
|
|
|
|
|
|
|
|
$data['filename'] = 'backup/notes'. date('_Y_m_d_H_i_s') .'.xml';
|
2011-10-01 18:35:23 +00:00
|
|
|
|
2023-05-03 07:38:28 +00:00
|
|
|
if ( ! write_file($data['filename'], $this->load->view('backup/notes', $data, true)))
|
2011-10-01 18:35:23 +00:00
|
|
|
{
|
2023-05-03 07:38:28 +00:00
|
|
|
$data['status'] = false;
|
2011-10-01 18:35:23 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-05-03 07:38:28 +00:00
|
|
|
$data['status'] = true;
|
2011-10-01 18:35:23 +00:00
|
|
|
}
|
|
|
|
|
2011-11-04 17:32:03 +00:00
|
|
|
$data['page_title'] = "Notes - Backup";
|
|
|
|
|
2019-01-14 16:29:06 +00:00
|
|
|
$this->load->view('interface_assets/header', $data);
|
2011-11-04 17:32:03 +00:00
|
|
|
$this->load->view('backup/notes_view');
|
2019-01-14 16:29:06 +00:00
|
|
|
$this->load->view('interface_assets/footer');
|
2011-10-01 18:35:23 +00:00
|
|
|
|
|
|
|
}
|
2011-09-30 21:27:18 +00:00
|
|
|
}
|
|
|
|
|
2023-05-02 06:04:21 +00:00
|
|
|
/* End of file Backup.php */
|