From ae6b330710d58a525d8745c3eeab96ac277d1f45 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sat, 1 Oct 2011 19:35:23 +0100 Subject: [PATCH] Backup: Added XML Export of Notes --- application/controllers/backup.php | 25 +++- application/views/backup/adif_view.php | 4 +- application/views/backup/notes.php | 10 ++ application/views/backup/notes_view.php | 16 +++ application/views/layout/header.php | 3 +- cloudlog.sublime-workspace | 179 ++++++++---------------- 6 files changed, 111 insertions(+), 126 deletions(-) create mode 100644 application/views/backup/notes.php create mode 100644 application/views/backup/notes_view.php diff --git a/application/controllers/backup.php b/application/controllers/backup.php index 8e06e210..98e41a5e 100644 --- a/application/controllers/backup.php +++ b/application/controllers/backup.php @@ -9,10 +9,9 @@ class Backup extends CI_Controller { $this->load->view('layout/header'); $this->load->view('backup/main'); $this->load->view('layout/footer'); - - } + /* Gets all QSOs and Dumps them to logbook.adi */ public function adif(){ $this->load->helper('file'); // Set memory limit to unlimited to allow heavy usage @@ -36,6 +35,28 @@ class Backup extends CI_Controller { $this->load->view('layout/footer'); } + + /* Export the notes to XML */ + public function notes() { + $this->load->helper('file'); + $this->load->model('note'); + + $data['list_note'] = $this->note->list_all(); + + if ( ! write_file('backup/notes.xml', $this->load->view('backup/notes', $data, true))) + { + $data['status'] = false; + } + else + { + $data['status'] = true; + } + + $this->load->view('layout/header'); + $this->load->view('backup/notes_view', $data); + $this->load->view('layout/footer'); + + } } /* End of file Backup.php */ \ No newline at end of file diff --git a/application/views/backup/adif_view.php b/application/views/backup/adif_view.php index 37bda8dd..f1a7a6c5 100644 --- a/application/views/backup/adif_view.php +++ b/application/views/backup/adif_view.php @@ -1,9 +1,9 @@ -

Backup ADIF

+

Backup - ADIF

-

Backing up your log has been completed successfully and can be found at /logbook.adi

+

Backing up your log has been completed successfully and can be found at backup/logbook.adi

You could automate this process by making it a cronjob.

diff --git a/application/views/backup/notes.php b/application/views/backup/notes.php new file mode 100644 index 00000000..097ce788 --- /dev/null +++ b/application/views/backup/notes.php @@ -0,0 +1,10 @@ + +result() as $row) { //print_r($row);?> + + id; ?> + cat; ?> + <?php echo $row->title; ?> + note; ?>]]> + + + \ No newline at end of file diff --git a/application/views/backup/notes_view.php b/application/views/backup/notes_view.php new file mode 100644 index 00000000..65ba68ca --- /dev/null +++ b/application/views/backup/notes_view.php @@ -0,0 +1,16 @@ +

Backup - Notes XML

+
+ + + +

Backing up your notes have been completed successfully and can be found at backup/notes.xml

+ +

You could automate this process by making it a cronjob.

+ + + +

Something went wrong backing up check that the backup folder exists and has write permissions.

+ + + +
\ No newline at end of file diff --git a/application/views/layout/header.php b/application/views/layout/header.php index b55e8f60..0a388353 100644 --- a/application/views/layout/header.php +++ b/application/views/layout/header.php @@ -215,7 +215,8 @@ uri->segment(1) == "backup") { ?> diff --git a/cloudlog.sublime-workspace b/cloudlog.sublime-workspace index 695a5635..c66494e1 100644 --- a/cloudlog.sublime-workspace +++ b/cloudlog.sublime-workspace @@ -12,47 +12,28 @@ "buffers": [ { - "file": "application/controllers/social.php", + "file": "application/controllers/backup.php", "settings": { - "buffer_size": 1757, + "buffer_size": 879, "line_ending": "Unix" } }, { - "file": "application/controllers/dashboard.php", + "file": "application/views/backup/main.php", "settings": { - "buffer_size": 6056, + "buffer_size": 79, "line_ending": "Windows" } }, { - "file": "application/models/logbook_model.php", + "file": "application/views/layout/header.php", "settings": { - "buffer_size": 13676, + "buffer_size": 10575, "line_ending": "Windows" } - }, - { - "contents": " \n\n \n\n /fancybox/jquery.fancybox-1.3.4.css\" media=\"screen\" />\n\n \n\n\n \n \n\n

Social Media Map -

\n
\n\n
\n\n\n
\n \n
\n \n
\n \n \n \n \n \n \n \n \n \n\n result() as $row) { ?>\n '; ?>\n \n \n \n \n \n \n COL_SAT_NAME != null) { ?>\n \n \n \n \n \n \n\n
TimeCallModeSentRecvBand
COL_TIME_ON); echo date('d/m/y', $timestamp); ?>COL_TIME_ON); echo date('H:i', $timestamp); ?>COL_PRIMARY_KEY; ?>\">COL_CALL); ?>COL_MODE; ?>COL_RST_SENT; ?>COL_RST_RCVD; ?>SATCOL_BAND; ?>
\n\n
\n \n
\n
\n \n \n \n
\n\n
\n
", - "file": "application/views/social/map.php", - "file_size": 3479, - "file_write_time": 129618638065790029, - "settings": - { - "buffer_size": 3336, - "line_ending": "Windows" - } - }, - { - "file": "application/config/routes.php", - "settings": - { - "buffer_size": 1545, - "line_ending": "Unix" - } } ], "build_system": "", @@ -87,12 +68,24 @@ }, "file_history": [ - "/C/Users/Peter/AppData/Roaming/Sublime Text 2/Packages/User/Default (Windows).sublime-keymap", + "/C/Users/Peter/git/HRD-Web-Frontend/application/views/backup/adif_view.php", + "/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/user.php", + "/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/welcome.php", + "/C/Users/Peter/git/HRD-Web-Frontend/application/views/backup/exportall.php", + "/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/adif.php", + "/C/Users/Peter/git/HRD-Web-Frontend/application/config/config.php", + "/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/kml.php", + "/C/Users/Peter/Desktop/log.kml", + "/C/Users/Peter/git/HRD-Web-Frontend/application/models/logbook_model.php", "/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/dashboard.php", + "/C/Users/Peter/git/HRD-Web-Frontend/application/views/view_log/qso.php", + "/C/Users/Peter/git/HRD-Web-Frontend/application/config/routes.php", + "/C/Users/Peter/git/HRD-Web-Frontend/application/views/social/map.php", + "/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/social.php", + "/C/Users/Peter/AppData/Roaming/Sublime Text 2/Packages/User/Default (Windows).sublime-keymap", "/C/Users/Peter/git/HRD-Web-Frontend/application/views/dashboard/index.php", "/C/wamp/www/m3php/data.html", "/C/Users/Peter/git/HRD-Web-Frontend/application/views/layout/header.php", - "/C/Users/Peter/git/HRD-Web-Frontend/application/config/config.php", "/C/Users/Peter/git/HRD-Web-Frontend/index.php", "/C/Users/Peter/AppData/Roaming/Sublime Text 2/Packages/Default/Base File.sublime-settings", "/C/Users/Peter/AppData/Roaming/Sublime Text 2/Packages/User/Base File.sublime-settings" @@ -135,29 +128,28 @@ "groups": [ { - "selected": 3, + "selected": 0, "sheets": [ { "buffer": 0, - "file": "application/controllers/social.php", + "file": "application/controllers/backup.php", "settings": { - "buffer_size": 1757, + "buffer_size": 879, "regions": { }, "selection": [ [ - 392, - 405 + 719, + 719 ] ], "settings": { - "syntax": "Packages/PHP/PHP.tmLanguage", - "translate_tabs_to_spaces": false + "syntax": "Packages/PHP/PHP.tmLanguage" }, "translation.x": 0.0, "translation.y": 0.0, @@ -167,100 +159,18 @@ }, { "buffer": 1, - "file": "application/controllers/dashboard.php", + "file": "application/views/backup/main.php", "settings": { - "buffer_size": 6056, + "buffer_size": 79, "regions": { }, "selection": [ [ - 307, - 271 - ] - ], - "settings": - { - "syntax": "Packages/PHP/PHP.tmLanguage", - "translate_tabs_to_spaces": false - }, - "translation.x": 0.0, - "translation.y": 72.0, - "zoom_level": 1.0 - }, - "type": "text" - }, - { - "buffer": 2, - "file": "application/models/logbook_model.php", - "settings": - { - "buffer_size": 13676, - "regions": - { - }, - "selection": - [ - [ - 6092, - 6105 - ] - ], - "settings": - { - "syntax": "Packages/PHP/PHP.tmLanguage", - "tab_size": 4.0, - "translate_tabs_to_spaces": true - }, - "translation.x": 0.0, - "translation.y": 2712.0, - "zoom_level": 1.0 - }, - "type": "text" - }, - { - "buffer": 3, - "file": "application/views/social/map.php", - "settings": - { - "buffer_size": 3336, - "regions": - { - }, - "selection": - [ - [ - 2964, - 2964 - ] - ], - "settings": - { - "syntax": "Packages/PHP/PHP.tmLanguage", - "translate_tabs_to_spaces": false - }, - "translation.x": 0.0, - "translation.y": 1464.0, - "zoom_level": 1.0 - }, - "type": "text" - }, - { - "buffer": 4, - "file": "application/config/routes.php", - "settings": - { - "buffer_size": 1545, - "regions": - { - }, - "selection": - [ - [ - 1392, - 1392 + 71, + 71 ] ], "settings": @@ -268,7 +178,34 @@ "syntax": "Packages/PHP/PHP.tmLanguage" }, "translation.x": 0.0, - "translation.y": 270.0, + "translation.y": 0.0, + "zoom_level": 1.0 + }, + "type": "text" + }, + { + "buffer": 2, + "file": "application/views/layout/header.php", + "settings": + { + "buffer_size": 10575, + "regions": + { + }, + "selection": + [ + [ + 9245, + 9245 + ] + ], + "settings": + { + "syntax": "Packages/PHP/PHP.tmLanguage", + "translate_tabs_to_spaces": false + }, + "translation.x": 0.0, + "translation.y": 3540.0, "zoom_level": 1.0 }, "type": "text"