diff --git a/config/config.php b/config/config.php index 2f4b313..a73e00c 100644 --- a/config/config.php +++ b/config/config.php @@ -10,7 +10,7 @@ class Config extends \Ilch\Config\Install { public $config = [ 'key' => 'radiohoerercharts', - 'version' => '1.5.0', + 'version' => '1.5.1', 'icon_small' => 'fa-list-ol', 'author' => 'Reilard, Dennis alias hhunderter ', 'link' => '', @@ -203,8 +203,16 @@ public function getUpdate($installedVersion) $this->db()->query('UPDATE `[prefix]_radio_hoerercharts` SET `datecreate` = "'.$datecreate.'" WHERE `datecreate` = "0000-00-00 00:00:00"'); case "1.4.4": //update zu 1.5.0 /* - Admin View Sort #2 (https://github.com/hhunderter/radiohoerercharts/issues/2) + Admin View Sort #2 ( https://github.com/hhunderter/radiohoerercharts/issues/2 ) */ + case "1.5.0": //update zu 1.5.1 + /* + Change Font Awesome icons + if voting period + additional time, there is no sorted issue #3 ( https://github.com/hhunderter/radiohoerercharts/issues/3 ) + */ + $databaseConfig = new \Ilch\Config\Database($this->db()); + $databaseConfig->set('radio_hoerercharts_Program_sec_duration', '7200'); //2h + case "1.5.1": //update zu ? } return 'Update function executed.'; } diff --git a/controllers/Index.php b/controllers/Index.php index 2ca3ecf..2d0aef2 100644 --- a/controllers/Index.php +++ b/controllers/Index.php @@ -36,7 +36,8 @@ public function indexAction() if ($this->getConfig()->get('radio_hoerercharts_End_Datetime')) $end_datetime = new \Ilch\Date($this->getConfig()->get('radio_hoerercharts_End_Datetime')); $formatdatetime = 'd.m.Y H:i'; - $hoererchartsconfig = array('allsecvote'=>$this->getConfig()->get('radio_hoerercharts_all_sec_vote'), + $hoererchartsconfig = array('program_secduration'=>$this->getConfig()->get('radio_hoerercharts_Program_sec_duration'), + 'allsecvote'=>$this->getConfig()->get('radio_hoerercharts_all_sec_vote'), 'guestallow'=>$this->getConfig()->get('radio_hoerercharts_Guest_Allow'), 'start_datetime'=>$start_datetime, 'allowsuggestion'=>$this->getConfig()->get('radio_hoerercharts_allow_suggestion'), @@ -55,10 +56,14 @@ public function indexAction() if ($hoererchartsMapper->checkDB()) { $vote_allowed = $hoererchartsMapper->vote_allowed($hoererchartsconfig['start_datetime'], $hoererchartsconfig['end_datetime']); $this->getView()->set('vote_allowed', $vote_allowed); + $show_sortedlist = $hoererchartsMapper->is_showsortedlist($hoererchartsconfig['end_datetime'], $hoererchartsconfig['program_secduration']); + $this->getView()->set('show_sortedlist', $show_sortedlist); if ($hoererchartsuservotesMapper->is_voted($this->getUser(), $hoererchartsconfig['guestallow'], $hoererchartsconfig['allsecvote']) or !$vote_allowed) { $this->getView()->set('voted', true); - $this->getView()->set('entries', $hoererchartsMapper->getEntriesBy(['setfree' => 1], ['votes' => 'DESC','id' => 'DESC'])); + + if ($show_sortedlist) $this->getView()->set('entries', $hoererchartsMapper->getEntriesBy(['setfree' => 1], ['votes' => 'DESC','id' => 'DESC'])); + else $this->getView()->set('entries', $hoererchartsMapper->getEntriesBy(['setfree' => 1], ['datecreate' => 'ASC','id' => 'DESC'])); } else { if ($this->getRequest()->getPost('saveHoererCharts')) { $validation_indb = Validation::create($this->getRequest()->getPost(), ['hoerercharts-d' => 'required|unique:radio_hoerercharts,id']); diff --git a/controllers/admin/Settings.php b/controllers/admin/Settings.php index ec6d78e..c179c28 100644 --- a/controllers/admin/Settings.php +++ b/controllers/admin/Settings.php @@ -52,20 +52,22 @@ public function indexAction() if ($hoererchartsMapper->checkDB()) { if ($this->getRequest()->isPost()) { $validation = Validation::create($this->getRequest()->getPost(), [ - 'Program_Name' => 'required', - 'allsecvote' => 'required|numeric', - 'guestallow' => 'required|numeric|min:0|max:1', - 'showstars' => 'required|numeric|min:0|max:1', - 'Star1' => 'required|numeric|min:1', - 'Star2' => 'required|numeric|min:1', - 'Star3' => 'required|numeric|min:1', - 'Star4' => 'required|numeric|min:1', - 'Star5' => 'required|numeric|min:1', + 'Program_Name' => 'required', + 'allsecvote' => 'required|numeric', + 'program_secduration' => 'required|numeric', + 'guestallow' => 'required|numeric|min:0|max:1', + 'showstars' => 'required|numeric|min:0|max:1', + 'Star1' => 'required|numeric|min:1', + 'Star2' => 'required|numeric|min:1', + 'Star3' => 'required|numeric|min:1', + 'Star4' => 'required|numeric|min:1', + 'Star5' => 'required|numeric|min:1', ]); if ($validation->isValid()) { $this->getConfig()->set('radio_hoerercharts_Program_Name', $this->getRequest()->getPost('Program_Name')) ->set('radio_hoerercharts_all_sec_vote', $this->getRequest()->getPost('allsecvote')) + ->set('radio_hoerercharts_Program_sec_duration', $this->getRequest()->getPost('program_secduration')) ->set('radio_hoerercharts_Guest_Allow', $this->getRequest()->getPost('guestallow')) ->set('radio_hoerercharts_showstars', $this->getRequest()->getPost('showstars')) ->set('radio_hoerercharts_Star1', $this->getRequest()->getPost('Star1')) @@ -88,6 +90,7 @@ public function indexAction() $this->getView()->set('Program_Name', $this->getConfig()->get('radio_hoerercharts_Program_Name')) ->set('allsecvote', $this->getConfig()->get('radio_hoerercharts_all_sec_vote')) + ->set('program_secduration', $this->getConfig()->get('radio_hoerercharts_Program_sec_duration')) ->set('guestallow', $this->getConfig()->get('radio_hoerercharts_Guest_Allow')) ->set('showstars', $this->getConfig()->get('radio_hoerercharts_showstars')) ->set('Star1', $this->getConfig()->get('radio_hoerercharts_Star1')) diff --git a/mappers/HoererCharts.php b/mappers/HoererCharts.php index 7da0e02..e756811 100644 --- a/mappers/HoererCharts.php +++ b/mappers/HoererCharts.php @@ -312,4 +312,24 @@ public function vote_allowed($start_datetime = null, $end_datetime = null) } } + /** + * Checks if Time to show the Filal list. + * + * @param null|\Ilch\Date $end_datetime + * @param null|integer $program_secduration + * @return boolean + */ + public function is_showsortedlist($end_datetime = null, $program_secduration = null) + { + $date = new \Ilch\Date(); + + $datenow = new \Ilch\Date($date->format("Y-m-d H:i:s",true)); + + if ((!$end_datetime and !$program_secduration) or $program_secduration <= 0){ + return true; + }else{ + return (($datenow->getTimestamp() >= ($end_datetime->getTimestamp()+$program_secduration)) ? true : false); + } + } + } diff --git a/translations/de.php b/translations/de.php index 36a1d64..324d881 100644 --- a/translations/de.php +++ b/translations/de.php @@ -61,6 +61,8 @@ 'setfree' => 'Anzeigen', 'Allsecvote' => 'Abstimmung Sperre', 'AllsecvoteText' => 'Gibt in Sekunden an, ab wann der Benutzer / Gast erneut abstimmen kann.
Wenn der Wert "0" ist, können Benutzer / Gäste nur einmal abstimmen.', + 'Program_secduration' => 'Zusätzliche Endzeit', + 'Program_secdurationText' => '(Sendezeit)
Gibt in Sekunden die zusätzliche Zeit nach dem Ende an, um die sortierte Liste anzuzeigen.', 'datecreate' => 'Erstell Datum', 'new' => 'neu', 'enable' => 'Freischalten', diff --git a/translations/en.php b/translations/en.php index 7c4d022..bb8683e 100644 --- a/translations/en.php +++ b/translations/en.php @@ -61,6 +61,8 @@ 'setfree' => 'Show', 'Allsecvote' => 'Vote lock', 'AllsecvoteText' => 'Specifies in seconds, from when the user / guest can vote again.
If the value is "0", users / guests can vote only once.', + 'Program_secduration' => 'Additional End Time', + 'Program_secdurationText' => '(Broadcasting time)
Specifies in seconds, the additional Time after end Time to show the Sorted List.', 'datecreate' => 'Erstell Datum', 'new' => 'neu', 'enable' => 'Freischalten', diff --git a/views/admin/index/index.php b/views/admin/index/index.php index fcb1c12..d11efeb 100644 --- a/views/admin/index/index.php +++ b/views/admin/index/index.php @@ -4,7 +4,7 @@ get('suggestion')): ?>
- get('votedatetime') ?> + get('votedatetime') ?>
@@ -67,33 +67,33 @@ getTrans('interpret') ?> - + getTrans('songtitel') ?> - + get('suggestion')): ?> getTrans('vote') ?> - + getTrans('datecreate') ?> - + getTrans('user') ?> - + @@ -108,16 +108,16 @@ get('suggestion')): ?> getSetFree() == 1): ?> - + - + - + diff --git a/views/admin/settings/index.php b/views/admin/settings/index.php index ec1ffa3..6cbe846 100644 --- a/views/admin/settings/index.php +++ b/views/admin/settings/index.php @@ -30,6 +30,21 @@ class="form-control" required />
+

getTrans('Program_secduration') ?>

+
+ +
+ +
+

getTrans('guestallow') ?>

@@ -30,7 +30,7 @@ class="form-control" name="end_datetime" value="get('end_datetime') ?>" /> - + diff --git a/views/index/index.php b/views/index/index.php index b893c53..8e99013 100644 --- a/views/index/index.php +++ b/views/index/index.php @@ -29,7 +29,7 @@ ?> - + get('show_sortedlist')): ?>@@ -37,7 +37,7 @@ - + get('show_sortedlist')): ?> @@ -47,12 +47,12 @@ get('entries') as $entry): ?> - + get('show_sortedlist')): ?>getUserById($entry->getUser_Id()); ?> - + escape($entry->getInterpret()) ?>getUserById($entry->getUser_Id()); ?> - + diff --git a/views/index/treat.php b/views/index/treat.php index a66222e..3605fb6 100644 --- a/views/index/treat.php +++ b/views/index/treat.php @@ -25,7 +25,6 @@ value="getRequest()->getPost('songtitel') != '') { echo $this->escape($this->getRequest()->getPost('songtitel')); } ?>" /> - get('captchaNeeded')) : ?>
getTrans('place') ?>getTrans('place') ?> getTrans('interpret') ?> getTrans('songtitel') ?> getTrans('vote') ?>
escape($entry->getInterpret()) ?> escape($entry->getSongTitel()) ?> get('hoererchartsMapper')->getStars($entry->getVotes(), $hoererchartsconfig) ?>
escape($entry->getSongTitel()) ?>