diff --git a/application/config/migration.php b/application/config/migration.php index 2522a204..73ae30f1 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 49; +$config['migration_version'] = 50; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/User.php b/application/controllers/User.php index 129b6904..00c9d59b 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -235,6 +235,12 @@ class User extends CI_Controller { $data['user_measurement_base'] = $q->user_measurement_base; } + + if($this->input->post('user_date_format')) { + $data['user_date_format'] = $this->input->post('user_date_format', true); + } else { + $data['user_date_format'] = $q->user_date_format; + } $this->load->view('user/edit', $data); $this->load->view('interface_assets/footer'); diff --git a/application/migrations/050_add_dateformat_to_users.php b/application/migrations/050_add_dateformat_to_users.php new file mode 100644 index 00000000..764be2aa --- /dev/null +++ b/application/migrations/050_add_dateformat_to_users.php @@ -0,0 +1,20 @@ +dbforge->add_column('users', $fields); + } + + public function down() + { + $this->dbforge->drop_column('users', 'user_date_format'); + } +} \ No newline at end of file diff --git a/application/models/User_model.php b/application/models/User_model.php index 30c4ffee..e751f308 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -148,6 +148,7 @@ class User_Model extends CI_Model { 'user_eqsl_name' => xss_clean($fields['user_eqsl_name']), 'user_clublog_name' => xss_clean($fields['user_clublog_name']), 'user_measurement_base' => xss_clean($fields['user_measurement_base']), + 'user_date_format' => xss_clean($fields['user_date_format']), ); // Check to see if the user is allowed to change user levels @@ -253,6 +254,7 @@ class User_Model extends CI_Model { 'radio' => isset($_COOKIE["radio"])?$_COOKIE["radio"]:"", 'station_profile_id' => isset($_COOKIE["station_profile_id"])?$_COOKIE["station_profile_id"]:"", 'user_measurement_base' => $u->row()->user_measurement_base, + 'user_date_format' => $u->row()->user_date_format, ); $this->session->set_userdata($userdata); diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php index bc4e7f05..2cb62260 100644 --- a/application/views/dashboard/index.php +++ b/application/views/dashboard/index.php @@ -51,7 +51,21 @@ $i = 0; foreach ($last_five_qsos->result() as $row) { ?> '; ?> -
A maximum of the 10 longest streaks are shown!
+ + session->userdata('user_date_format')) { + // If Logged in and session exists + $custom_date_format = $this->session->userdata('user_date_format'); + } else { + // Get Default date format from /config/cloudlog.php + $custom_date_format = $this->config->item('qso_date_format'); + } + ?> +| ' . $streak['highstreak'] . ' | '; - echo '' . $streak['beginstreak'] . ' | '; - echo '' . $streak['endstreak'] . ' | '; + $beginstreak_newdate = strtotime($streak['beginstreak']); + echo '' . date($custom_date_format, $beginstreak_newdate) . ' | '; + $endstreak_newdate = strtotime($streak['endstreak']); + echo '' . date($custom_date_format, $endstreak_newdate) . ' | '; echo '|
| ' . $i-- . ' | -' . $line->date . ' | +' . date($custom_date_format, $date_as_timestamp) . ' | ' . $line->prefix . ' | ' . $line->col_country . ' | ';
diff --git a/application/views/user/edit.php b/application/views/user/edit.php
index 21f6d013..80f40b5e 100644
--- a/application/views/user/edit.php
+++ b/application/views/user/edit.php
@@ -133,9 +133,20 @@
+
+
+
+ Select how you would like dates shown when logged into your account.
+
+
- | COL_TIME_ON); echo date($this->config->item('qso_date_format'), $timestamp); ?> | +COL_TIME_ON); echo date($custom_date_format, $timestamp); ?> | config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time'))) { ?>COL_TIME_ON); echo date('H:i', $timestamp); ?> | diff --git a/application/views/view_log/partial/log_ajax.php b/application/views/view_log/partial/log_ajax.php index 0c41b062..b1830c77 100644 --- a/application/views/view_log/partial/log_ajax.php +++ b/application/views/view_log/partial/log_ajax.php @@ -25,9 +25,18 @@ result() as $row) { ?> - + session->userdata('user_date_format')) { + // If Logged in and session exists + $custom_date_format = $this->session->userdata('user_date_format'); + } else { + // Get Default date format from /config/cloudlog.php + $custom_date_format = $this->config->item('qso_date_format'); + } + ?> COL_PRIMARY_KEY .'">'; ?> -COL_TIME_ON); echo date($this->config->item('qso_date_format'), $timestamp); ?> | +COL_TIME_ON); echo date($custom_date_format, $timestamp); ?> | config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time'))) { ?>COL_TIME_ON); echo date('H:i', $timestamp); ?> | diff --git a/application/views/view_log/qso.php b/application/views/view_log/qso.php index 2d8a554c..f35d47b9 100644 --- a/application/views/view_log/qso.php +++ b/application/views/view_log/qso.php @@ -12,11 +12,24 @@
| Date/Time: | config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time'))) { ?> -COL_TIME_ON); echo date($this->config->item('qso_date_format'), $timestamp); $timestamp = strtotime($row->COL_TIME_ON); echo " at ".date('H:i', $timestamp); ?> | +COL_TIME_ON); echo date($custom_date_format, $timestamp); $timestamp = strtotime($row->COL_TIME_ON); echo " at ".date('H:i', $timestamp); ?> | -COL_TIME_ON); echo date($this->config->item('qso_date_format'), $timestamp); ?> | +COL_TIME_ON); echo date($custom_date_format, $timestamp); ?> |