Skip to content

Commit 38b4aea

Browse files
committed
Show vote closure time
1 parent dab1c87 commit 38b4aea

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

dokuwiki/lib/plugins/doodle/lang/en/lang.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
// info messages
1111
$lang['poll_closed'] = 'This poll has been closed.';
12+
$lang['poll_close_time'] = 'This poll will close on %s.';
1213
$lang['vote_saved'] = 'Vote has been saved.';
1314
$lang['vote_deleted'] = 'Vote has been deleted.';
1415

dokuwiki/lib/plugins/doodle/syntax.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,14 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
137137
$params['voteType'] = $value;
138138
}
139139
} else
140-
if ((strcmp($name, "CLOSEON") == 0) &&
141-
(($timestamp = strtotime($value)) !== false) &&
142-
(time() > $timestamp) )
143-
{
144-
$params['closed'] = 1;
140+
if (strcmp($name, "CLOSEON") == 0) {
141+
if (($timestamp = strtotime($value)) !== false) {
142+
$params['close_on_ts'] = $timestamp;
143+
144+
if (time() > $timestamp) {
145+
$params['closed'] = 1;
146+
}
147+
}
145148
} else
146149
if (strcmp($name, "CLOSED") == 0) {
147150
$params['closed'] = strcasecmp($value, "TRUE") == 0;
@@ -284,6 +287,8 @@ function render($mode, Doku_Renderer $renderer, $data) {
284287
$this->template['formId'] = $formId;
285288
if ($this->params['closed']) {
286289
$this->template['msg'] = $this->getLang('poll_closed');
290+
} else if ($this->params['close_on_ts']) {
291+
$this->template['msg'] = sprintf($this->getLang('poll_close_time'), date('Y-m-d H:i:s e', $this->params['close_on_ts']));
287292
}
288293

289294
for($col = 0; $col < count($this->choices); $col++) {

0 commit comments

Comments
 (0)