From 88b28a1e7f6e70bc7e65abfea3d6ab6bb1eb1395 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 6 Dec 2024 08:51:54 +0100 Subject: [PATCH] [Timeline] Added year selection, and only new --- application/controllers/Timeline.php | 23 +++- application/models/Timeline_model.php | 114 ++++++++++++----- application/views/timeline/index.php | 176 +++++++++++++++++--------- 3 files changed, 220 insertions(+), 93 deletions(-) diff --git a/application/controllers/Timeline.php b/application/controllers/Timeline.php index af30bc277..34cbc6742 100644 --- a/application/controllers/Timeline.php +++ b/application/controllers/Timeline.php @@ -44,6 +44,12 @@ class Timeline extends CI_Controller { $award = 'dxcc'; } + if ($this->input->post('year') != NULL) { + $year = $this->security->xss_clean($this->input->post('year')); + } else { + $year = 'All'; + } + if ($this->input->post('qsl') != NULL) { $qsl = $this->security->xss_clean($this->input->post('qsl')); } else { @@ -68,17 +74,32 @@ class Timeline extends CI_Controller { $eqsl = '0'; } + if ($this->input->post('qrz') != NULL) { + $qrz = $this->security->xss_clean($this->input->post('qrz')); + } else { + $qrz = '0'; + } + + if ($this->input->post('onlynew') != NULL) { + $onlynew = $this->security->xss_clean($this->input->post('onlynew')); + } else { + $onlynew = '0'; + } + $this->load->model('modes'); $this->load->model('bands'); $data['modes'] = $this->modes->active(); - $data['timeline_array'] = $this->Timeline_model->get_timeline($band, $mode, $propmode, $award, $qsl, $lotw, $eqsl, $clublog); + $data['timeline_array'] = $this->Timeline_model->get_timeline($band, $mode, $propmode, $award, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew); $data['worked_bands'] = $this->bands->get_worked_bands(); $data['bandselect'] = $band; $data['modeselect'] = $mode; $data['propmode'] = $propmode; $data['user_default_band'] = $this->session->userdata('user_default_band'); + $data['years'] = $this->Timeline_model->get_years(); + $data['onlynew'] = $onlynew; + $data['selectedyear'] = $year; $footerData['scripts'] = [ 'assets/js/sections/timeline.js?' ]; $this->load->view('interface_assets/header', $data); diff --git a/application/models/Timeline_model.php b/application/models/Timeline_model.php index c26ca67fb..34819b35c 100644 --- a/application/models/Timeline_model.php +++ b/application/models/Timeline_model.php @@ -2,7 +2,7 @@ if (!defined('BASEPATH')) exit('No direct script access allowed'); class Timeline_model extends CI_Model { - function get_timeline($band, $mode, $propmode, $award, $qsl, $lotw, $eqsl, $clublog) { + function get_timeline($band, $mode, $propmode, $award, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew) { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -13,18 +13,18 @@ class Timeline_model extends CI_Model { $location_list = "'".implode("','",$logbooks_locations_array)."'"; switch ($award) { - case 'dxcc': $result = $this->get_timeline_dxcc($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog); break; - case 'was': $result = $this->get_timeline_was($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog); break; - case 'iota': $result = $this->get_timeline_iota($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog); break; - case 'waz': $result = $this->get_timeline_waz($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog); break; - case 'vucc': $result = $this->get_timeline_vucc($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog); break; - case 'waja': $result = $this->get_timeline_waja($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog); break; + case 'dxcc': $result = $this->get_timeline_dxcc($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew); break; + case 'was': $result = $this->get_timeline_was($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew); break; + case 'iota': $result = $this->get_timeline_iota($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew); break; + case 'waz': $result = $this->get_timeline_waz($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew); break; + case 'vucc': $result = $this->get_timeline_vucc($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew); break; + case 'waja': $result = $this->get_timeline_waja($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew); break; } return $result; } - public function get_timeline_dxcc($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog) { + public function get_timeline_dxcc($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew) { $binding = []; $sql = "select min(date(COL_TIME_ON)) date, prefix, col_country, end, adif from " .$this->config->item('table_name'). " thcv @@ -51,12 +51,17 @@ class Timeline_model extends CI_Model { } } + if ($year != "All" && $onlynew == 0) { + $sql .= " and year(col_time_on) = ?"; + $binding[] = $year; + } + if ($mode != 'All') { $sql .= " and col_mode = ?"; $binding[] = $mode; } - $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog); + $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog, $qrz); $sql .= " group by col_dxcc, col_country order by date desc"; @@ -66,7 +71,7 @@ class Timeline_model extends CI_Model { return $query->result(); } - public function get_timeline_waja($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog) { + public function get_timeline_waja($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew) { $binding = []; $sql = "select min(date(COL_TIME_ON)) date, col_state from " .$this->config->item('table_name'). " thcv @@ -98,9 +103,14 @@ class Timeline_model extends CI_Model { $binding[] = $mode; } + if ($year != "All" && $onlynew == 0) { + $sql .= " and year(col_time_on) = ?"; + $binding[] = $year; + } + $sql .= " and COL_DXCC = '339' and trim(coalesce(COL_STATE,'')) != '' "; - $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog); + $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog, $qrz); $sql .= " group by col_state order by date desc"; @@ -110,7 +120,7 @@ class Timeline_model extends CI_Model { return $query->result(); } - public function get_timeline_was($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog) { + public function get_timeline_was($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew) { $binding = []; $sql = "select min(date(COL_TIME_ON)) date, col_state from " .$this->config->item('table_name'). " thcv @@ -141,10 +151,15 @@ class Timeline_model extends CI_Model { $binding[] = $mode; } + if ($year != "All" && $onlynew == 0) { + $sql .= " and year(col_time_on) = ?"; + $binding[] = $year; + } + $sql .= " and COL_DXCC in ('291', '6', '110')"; $sql .= " and COL_STATE in ('AK','AL','AR','AZ','CA','CO','CT','DE','FL','GA','HI','IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VA','VT','WA','WI','WV','WY')"; - $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog); + $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog, $qrz); $sql .= " group by col_state order by date desc"; @@ -154,7 +169,7 @@ class Timeline_model extends CI_Model { return $query->result(); } - public function get_timeline_iota($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog) { + public function get_timeline_iota($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew) { $binding = []; $sql = "select min(date(COL_TIME_ON)) date, col_iota, name, prefix from " .$this->config->item('table_name'). " thcv @@ -187,7 +202,12 @@ class Timeline_model extends CI_Model { $binding[] = $mode; } - $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog); + if ($year != "All" && $onlynew == 0) { + $sql .= " and year(col_time_on) = ?"; + $binding[] = $year; + } + + $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog, $qrz); $sql .= " and col_iota <> '' group by col_iota, name, prefix order by date desc"; @@ -197,7 +217,7 @@ class Timeline_model extends CI_Model { return $query->result(); } - public function get_timeline_waz($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog) { + public function get_timeline_waz($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew) { $binding = []; $sql = "select min(date(COL_TIME_ON)) date, col_cqz from " .$this->config->item('table_name'). " thcv @@ -229,7 +249,12 @@ class Timeline_model extends CI_Model { $binding[] = $mode; } - $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog); + if ($year != "All" && $onlynew == 0) { + $sql .= " and year(col_time_on) = ?"; + $binding[] = $year; + } + + $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog, $qrz); $sql .= " and col_cqz <> '' group by col_cqz order by date desc"; @@ -241,9 +266,9 @@ class Timeline_model extends CI_Model { // Adds confirmation to query - function addQslToQuery($qsl, $lotw, $eqsl, $clublog) { + function addQslToQuery($qsl, $lotw, $eqsl, $clublog, $qrz) { $sql = ''; - if ( (($lotw ?? 0) != 0) || (($qsl ?? 0) != 0) || (($eqsl ?? 0) != 0) || (($clublog ?? 0) != 0) ) { + if ( (($lotw ?? 0) != 0) || (($qsl ?? 0) != 0) || (($eqsl ?? 0) != 0) || (($clublog ?? 0) != 0) || (($qrz ?? 0) != 0)) { $sql .= 'and ('; if ($lotw ?? 0 == 1) { @@ -261,6 +286,10 @@ class Timeline_model extends CI_Model { if ($clublog ?? 0 == 1) { $sql .= " col_clublog_qso_download_status = 'Y' or"; } + if ($qrz ?? 0 == 1) { + $sql .= " col_qrzcom_qso_download_status = 'Y' or"; + } + $sql.=' 1=0)'; } return $sql; @@ -295,7 +324,6 @@ class Timeline_model extends CI_Model { if ( $propmode == 'NoSAT' ) { // All without SAT $this->db->where('col_prop_mode !=', 'SAT'); } elseif ($propmode == 'None') { // Empty Propmode - $sql .= " and (trim(col_prop_mode)='' or col_prop_mode is null)"; $this->db->group_start(); $this->db->where('trim(col_prop_mode)', ''); $this->db->or_where('col_prop_mode is null'); @@ -314,11 +342,11 @@ class Timeline_model extends CI_Model { $this->db->where_in('station_profile.station_id', $logbooks_locations_array); switch($type) { - case 'dxcc': $this->db->where('COL_DXCC', $querystring); break; - case 'was': $this->db->where('COL_STATE', $querystring); $this->db->where("COL_DXCC in ('291', '6', '110')"); break; - case 'iota': $this->db->where('COL_IOTA', $querystring); break; - case 'waz': $this->db->where('COL_CQZ', $querystring); break; - case 'vucc': $this->db->group_start(); $this->db->like('COL_GRIDSQUARE', $querystring); $this->db->or_like('COL_VUCC_GRIDS',$querystring); $this->db->group_end();break; + case 'dxcc': $this->db->where('COL_DXCC', $querystring); break; + case 'was': $this->db->where('COL_STATE', $querystring); $this->db->where("COL_DXCC in ('291', '6', '110')"); break; + case 'iota': $this->db->where('COL_IOTA', $querystring); break; + case 'waz': $this->db->where('COL_CQZ', $querystring); break; + case 'vucc': $this->db->group_start(); $this->db->like('COL_GRIDSQUARE', $querystring); $this->db->or_like('COL_VUCC_GRIDS',$querystring); $this->db->group_end();break; case 'waja': $this->db->where('COL_STATE', $querystring); $this->db->where('COL_DXCC','339'); break; } $this->db->order_by('COL_TIME_ON', 'DESC'); @@ -326,10 +354,10 @@ class Timeline_model extends CI_Model { return $this->db->get($this->config->item('table_name')); } - public function get_timeline_vucc($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog) { + public function get_timeline_vucc($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew) { $timeline = array(); - $col_gridsquare = $this->get_gridsquare($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog); + $col_gridsquare = $this->get_gridsquare($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew); foreach ($col_gridsquare as $grid) { $timeline[] = array( @@ -337,7 +365,7 @@ class Timeline_model extends CI_Model { 'date' => $grid->date); } - $col_vucc_grids = $this->get_vucc_grids($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog); + $col_vucc_grids = $this->get_vucc_grids($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew); foreach ($col_vucc_grids as $gridSplit) { $grids = explode(",", $gridSplit->gridsquare); @@ -357,7 +385,7 @@ class Timeline_model extends CI_Model { return $timeline; } - public function get_gridsquare($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog) { + public function get_gridsquare($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew) { $binding = []; $sql = "select min(COL_TIME_ON) date, upper(substring(col_gridsquare, 1, 4)) gridsquare from " .$this->config->item('table_name'). " thcv @@ -388,7 +416,12 @@ class Timeline_model extends CI_Model { $binding[] = $mode; } - $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog); + if ($year != "All" && $onlynew == 0) { + $sql .= " and year(col_time_on) = ?"; + $binding[] = $year; + } + + $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog, $qrz); $sql .= " and col_gridsquare <> '' group by upper(substring(col_gridsquare, 1, 4)) order by date desc"; @@ -398,7 +431,7 @@ class Timeline_model extends CI_Model { return $query->result(); } - public function get_vucc_grids($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog) { + public function get_vucc_grids($band, $mode, $propmode, $location_list, $qsl, $lotw, $eqsl, $clublog, $year, $qrz, $onlynew) { $binding = []; $sql = "select COL_TIME_ON as date, upper(col_vucc_grids) gridsquare from " .$this->config->item('table_name'). " thcv @@ -429,7 +462,12 @@ class Timeline_model extends CI_Model { $binding[] = $mode; } - $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog); + if ($year != "All" && $onlynew == 0) { + $sql .= " and year(col_time_on) = ?"; + $binding[] = $year; + } + + $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $clublog, $qrz); $sql .= " and col_vucc_grids <> ''"; @@ -438,4 +476,16 @@ class Timeline_model extends CI_Model { return $query->result(); } + function get_years() { + $this->load->model('logbook_model'); + $totals_year = $this->logbook_model->totals_year(); + $years=[]; + if ($totals_year) { + foreach($totals_year->result() as $years_obj) { + $years[] = $years_obj->year; + } + } + return $years; + } + } diff --git a/application/views/timeline/index.php b/application/views/timeline/index.php index 2ada8efb3..0b385f59c 100644 --- a/application/views/timeline/index.php +++ b/application/views/timeline/index.php @@ -63,41 +63,64 @@ input->post('eqsl')) echo ' checked="checked"'; ?> > -
+
input->post('clublog')) echo ' checked="checked"'; ?> > +
+
+ input->post('qrz')) echo ' checked="checked"'; ?> > +
-
- -
- -
-
+
+ + +
+ +
+ + + +
+
+ +
+
+ input->post('onlynew') ? 'checked' : '' ?>> + +
+
+
+
@@ -108,7 +131,7 @@ - session->userdata('user_date_format')) { // If Logged in and session exists @@ -123,12 +146,12 @@ if ($timeline_array) { switch ($this->input->post('award')) { - case 'dxcc': $result = write_dxcc_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award')); break; - case 'was': $result = write_was_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award')); break; - case 'iota': $result = write_iota_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award')); break; - case 'waz': $result = write_waz_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award')); break; - case 'vucc': $result = write_vucc_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award')); break; - case 'waja': $result = write_waja_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award')); break; + case 'dxcc': $result = write_dxcc_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award'), $selectedyear, $onlynew); break; + case 'was': $result = write_was_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award'), $selectedyear, $onlynew); break; + case 'iota': $result = write_iota_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award'), $selectedyear, $onlynew); break; + case 'waz': $result = write_waz_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award'), $selectedyear, $onlynew); break; + case 'vucc': $result = write_vucc_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award'), $selectedyear, $onlynew); break; + case 'waja': $result = write_waja_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award'), $selectedyear, $onlynew); break; } } else { @@ -140,8 +163,9 @@ @@ -158,8 +182,12 @@ function write_dxcc_timeline($timeline_array, $custom_date_format, $bandselect, foreach ($timeline_array as $line) { $date_as_timestamp = strtotime($line->date ?? '1970-01-01 00:00:00'); + $entry_year = date('Y', $date_as_timestamp); + if ($onlynew == "1" && $entry_year != $selectedyear) { + continue; + } echo ' - ' . $i-- . ' + ' . (($onlynew == "1") ? $j++ : $i--) . ' ' . date($custom_date_format, $date_as_timestamp) . ' ' . $line->prefix . ' ' . $line->col_country . ' @@ -173,10 +201,11 @@ function write_dxcc_timeline($timeline_array, $custom_date_format, $bandselect, echo '
'; } -function write_waja_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $award) { +function write_waja_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $award, $selectedyear, $onlynew) { $CI = &get_instance(); $CI->load->model("Waja"); - $i = count($timeline_array); + $i = count($timeline_array); // General counter for all entries + $j = 1; // Separate counter for filtered rows (new stuff) echo ' @@ -190,8 +219,12 @@ function write_waja_timeline($timeline_array, $custom_date_format, $bandselect, foreach ($timeline_array as $line) { $date_as_timestamp = strtotime($line->date); + $entry_year = date('Y', $date_as_timestamp); + if ($onlynew == "1" && $entry_year != $selectedyear) { + continue; + } echo ' - + @@ -200,33 +233,42 @@ function write_waja_timeline($timeline_array, $custom_date_format, $bandselect, echo '
' . $i-- . '' . (($onlynew == "1") ? $j++ : $i--) . ' ' . date($custom_date_format, $date_as_timestamp) . ' ' . $CI->Waja->jaPrefectures[$line->col_state] . ' ('.$line->col_state.') col_state . '","'. $bandselect . '","'. $modeselect. '","' . $propmode . '","' . $award .'")>'.__("Show").'
'; } -function write_was_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $award) { - $i = count($timeline_array); +function write_was_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $award, $selectedyear, $onlynew) { + $i = count($timeline_array); // General counter for all entries + $j = 1; // Separate counter for filtered rows (new stuff) echo ' - - - + + + '; foreach ($timeline_array as $line) { $date_as_timestamp = strtotime($line->date); + $entry_year = date('Y', $date_as_timestamp); + if ($onlynew == "1" && $entry_year != $selectedyear) { + continue; + } + echo ' - + - - '; + + '; } - echo '
#'.__("Date").''.__("State").''.__("Show QSO's").'' . __("Date") . '' . __("State") . '' . __("Show QSO's") . '
' . $i-- . '' . (($onlynew == "1") ? $j++ : $i--) . ' ' . date($custom_date_format, $date_as_timestamp) . ' ' . $line->col_state . 'col_state . '","'. $bandselect . '","'. $modeselect. '","' . $propmode . '","' . $award .'")>'.__("Show").'
col_state . '","' . $bandselect . '","' . $modeselect . '","' . $propmode . '","' . $award .'")>' . __("Show") . '
'; + echo ''; } -function write_iota_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $award) { - $i = count($timeline_array); + + +function write_iota_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $award, $selectedyear, $onlynew) { + $i = count($timeline_array); // General counter for all entries + $j = 1; // Separate counter for filtered rows (new stuff) echo ' @@ -242,8 +284,12 @@ function write_iota_timeline($timeline_array, $custom_date_format, $bandselect, foreach ($timeline_array as $line) { $date_as_timestamp = strtotime($line->date); + $entry_year = date('Y', $date_as_timestamp); + if ($onlynew == "1" && $entry_year != $selectedyear) { + continue; + } echo ' - + @@ -254,8 +300,9 @@ function write_iota_timeline($timeline_array, $custom_date_format, $bandselect, echo '
' . $i-- . '' . (($onlynew == "1") ? $j++ : $i--) . ' ' . date($custom_date_format, $date_as_timestamp) . ' ' . $line->col_iota . ' ' . $line->name . '
'; } -function write_waz_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $award) { - $i = count($timeline_array); +function write_waz_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $award, $selectedyear, $onlynew) { + $i = count($timeline_array); // General counter for all entries + $j = 1; // Separate counter for filtered rows (new stuff) echo ' @@ -269,8 +316,12 @@ function write_waz_timeline($timeline_array, $custom_date_format, $bandselect, $ foreach ($timeline_array as $line) { $date_as_timestamp = strtotime($line->date); + $entry_year = date('Y', $date_as_timestamp); + if ($onlynew == "1" && $entry_year != $selectedyear) { + continue; + } echo ' - + @@ -279,8 +330,9 @@ function write_waz_timeline($timeline_array, $custom_date_format, $bandselect, $ echo '
' . $i-- . '' . (($onlynew == "1") ? $j++ : $i--) . ' ' . date($custom_date_format, $date_as_timestamp) . ' ' . $line->col_cqz . ' col_cqz . '","'. $bandselect . '","'. $modeselect. '","' . $propmode . '","' . $award .'")>'.__("Show").'
'; } -function write_vucc_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode,$award) { - $i = count($timeline_array); +function write_vucc_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode,$award, $selectedyear, $onlynew) { + $i = count($timeline_array); // General counter for all entries + $j = 1; // Separate counter for filtered rows (new stuff) echo ' @@ -295,8 +347,12 @@ function write_vucc_timeline($timeline_array, $custom_date_format, $bandselect, foreach ($timeline_array as $line) { $date_as_timestamp = strtotime($line['date']); + $entry_year = date('Y', $date_as_timestamp); + if ($onlynew == "1" && $entry_year != $selectedyear) { + continue; + } echo ' - +
' . $i-- . '' . (($onlynew == "1") ? $j++ : $i--) . ' ' . date($custom_date_format, $date_as_timestamp) . ' ' . date('H:i', $date_as_timestamp) . ' ' . $line['gridsquare'] . '