diff options
author | Vinzenz <vinzenz.rosenkranz@gmail.com> | 2016-04-25 17:49:41 +0300 |
---|---|---|
committer | Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com> | 2016-04-27 01:19:38 +0300 |
commit | 6fb57600e42af9545afccfd269ff3237e20a6e73 (patch) | |
tree | 5424818ed82efaa9950dbd6285935f07370437de /controller | |
parent | e05579897a969950fc3af6853a6dd5acca645201 (diff) |
set user's timezone for new polls
Diffstat (limited to 'controller')
-rw-r--r-- | controller/pagecontroller.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php index 19129abd..1105b086 100644 --- a/controller/pagecontroller.php +++ b/controller/pagecontroller.php @@ -333,10 +333,15 @@ class PageController extends Controller { $ins = $this->eventMapper->insert($event); $poll_id = $ins->getId(); sort($chosenDates); + $tz = \OC::$server->getConfig()->getUserValue($this->userId, 'core', 'timezone', 'UTC'); + $timezone = new \DateTimeZone($tz); foreach ($chosenDates as $el) { $date = new Date(); $date->setPollId($poll_id); - $date->setDt(date('Y-m-d H:i:s', $el)); + $dateTime = new \DateTime(date(\DateTime::ATOM, $el), $timezone); + $offset = $timezone->getOffset($dateTime); + $dateTime->setTimestamp($dateTime->getTimestamp() + $timezone->getOffset($dateTime)); + $date->setDt($dateTime->format('Y-m-d H:i:s')); $this->dateMapper->insert($date); } } else { @@ -406,7 +411,7 @@ class PageController extends Controller { $part->setType($types[$i]); $this->participationTextMapper->insert($part); } - + } $this->sendNotifications($pollId, $userId); } |