@@ -1,74 +1,74 @@ |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <[email protected]> |
|
| 4 | - * |
|
| 5 | - * @author Vinzenz Rosenkranz <[email protected]> |
|
| 6 | - * |
|
| 7 | - * @license GNU AGPL version 3 or any later version |
|
| 8 | - * |
|
| 9 | - * This program is free software: you can redistribute it and/or modify |
|
| 10 | - * it under the terms of the GNU Affero General Public License as |
|
| 11 | - * published by the Free Software Foundation, either version 3 of the |
|
| 12 | - * License, or (at your option) any later version. |
|
| 13 | - * |
|
| 14 | - * This program is distributed in the hope that it will be useful, |
|
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 17 | - * GNU Affero General Public License for more details. |
|
| 18 | - * |
|
| 19 | - * You should have received a copy of the GNU Affero General Public License |
|
| 20 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 21 | - * |
|
| 22 | - */ |
|
| 23 | - |
|
| 24 | - \OCP\Util::addStyle('polls', 'main'); |
|
| 25 | - \OCP\Util::addStyle('polls', 'createpoll'); |
|
| 26 | - \OCP\Util::addStyle('polls', 'vendor/jquery.datetimepicker.min'); |
|
| 27 | - \OCP\Util::addScript('polls', 'create_edit'); |
|
| 28 | - \OCP\Util::addScript('polls', 'vendor/jquery.datetimepicker.full.min'); |
|
| 29 | - |
|
| 30 | - $userId = $_['userId']; |
|
| 31 | - /** @var \OCP\IUserManager $userMgr */ |
|
| 32 | - $userMgr = $_['userMgr']; |
|
| 33 | - /** @var \OCP\IURLGenerator $urlGenerator */ |
|
| 34 | - $urlGenerator = $_['urlGenerator']; |
|
| 35 | - $isUpdate = isset($_['poll']) && $_['poll'] !== null; |
|
| 36 | - $isAnonymous = false; |
|
| 37 | - $hideNames = false; |
|
| 38 | - |
|
| 39 | - if ($isUpdate) { |
|
| 40 | - /** @var OCA\Polls\Db\Event $poll */ |
|
| 41 | - $poll = $_['poll']; |
|
| 42 | - $isAnonymous = $poll->getIsAnonymous(); |
|
| 43 | - $hideNames = $isAnonymous && $poll->getFullAnonymous(); |
|
| 44 | - /** @var OCA\Polls\Db\Date[]|OCA\Polls\Db\Text[] $dates */ |
|
| 45 | - $dates = $_['dates']; |
|
| 46 | - $chosen = '['; |
|
| 47 | - foreach ($dates as $d) { |
|
| 48 | - if ($poll->getType() === 0) { |
|
| 49 | - $chosen .= strtotime($d->getDt()); |
|
| 50 | - } else { |
|
| 51 | - $chosen .= '"' . $d->getText() . '"'; |
|
| 52 | - } |
|
| 53 | - $chosen .= ','; |
|
| 54 | - } |
|
| 55 | - $chosen = trim($chosen, ','); |
|
| 56 | - $chosen .= ']'; |
|
| 57 | - $title = $poll->getTitle(); |
|
| 58 | - $desc = $poll->getDescription(); |
|
| 59 | - if ($poll->getExpire() !== null) { |
|
| 60 | - $expireTs = strtotime($poll->getExpire()); |
|
| 61 | - $expireStr = date('d.m.Y', $expireTs); |
|
| 62 | - } |
|
| 63 | - $access = $poll->getAccess(); |
|
| 64 | - $accessTypes = $access; |
|
| 65 | - if ( |
|
| 66 | - $access !== 'registered' |
|
| 67 | - && $access !== 'hidden' && $access !== 'public' |
|
| 68 | - ) { |
|
| 69 | - $access = 'select'; |
|
| 70 | - } |
|
| 71 | - } |
|
| 2 | + /** |
|
| 3 | + * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <[email protected]> |
|
| 4 | + * |
|
| 5 | + * @author Vinzenz Rosenkranz <[email protected]> |
|
| 6 | + * |
|
| 7 | + * @license GNU AGPL version 3 or any later version |
|
| 8 | + * |
|
| 9 | + * This program is free software: you can redistribute it and/or modify |
|
| 10 | + * it under the terms of the GNU Affero General Public License as |
|
| 11 | + * published by the Free Software Foundation, either version 3 of the |
|
| 12 | + * License, or (at your option) any later version. |
|
| 13 | + * |
|
| 14 | + * This program is distributed in the hope that it will be useful, |
|
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 17 | + * GNU Affero General Public License for more details. |
|
| 18 | + * |
|
| 19 | + * You should have received a copy of the GNU Affero General Public License |
|
| 20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 21 | + * |
|
| 22 | + */ |
|
| 23 | + |
|
| 24 | + \OCP\Util::addStyle('polls', 'main'); |
|
| 25 | + \OCP\Util::addStyle('polls', 'createpoll'); |
|
| 26 | + \OCP\Util::addStyle('polls', 'vendor/jquery.datetimepicker.min'); |
|
| 27 | + \OCP\Util::addScript('polls', 'create_edit'); |
|
| 28 | + \OCP\Util::addScript('polls', 'vendor/jquery.datetimepicker.full.min'); |
|
| 29 | + |
|
| 30 | + $userId = $_['userId']; |
|
| 31 | + /** @var \OCP\IUserManager $userMgr */ |
|
| 32 | + $userMgr = $_['userMgr']; |
|
| 33 | + /** @var \OCP\IURLGenerator $urlGenerator */ |
|
| 34 | + $urlGenerator = $_['urlGenerator']; |
|
| 35 | + $isUpdate = isset($_['poll']) && $_['poll'] !== null; |
|
| 36 | + $isAnonymous = false; |
|
| 37 | + $hideNames = false; |
|
| 38 | + |
|
| 39 | + if ($isUpdate) { |
|
| 40 | + /** @var OCA\Polls\Db\Event $poll */ |
|
| 41 | + $poll = $_['poll']; |
|
| 42 | + $isAnonymous = $poll->getIsAnonymous(); |
|
| 43 | + $hideNames = $isAnonymous && $poll->getFullAnonymous(); |
|
| 44 | + /** @var OCA\Polls\Db\Date[]|OCA\Polls\Db\Text[] $dates */ |
|
| 45 | + $dates = $_['dates']; |
|
| 46 | + $chosen = '['; |
|
| 47 | + foreach ($dates as $d) { |
|
| 48 | + if ($poll->getType() === 0) { |
|
| 49 | + $chosen .= strtotime($d->getDt()); |
|
| 50 | + } else { |
|
| 51 | + $chosen .= '"' . $d->getText() . '"'; |
|
| 52 | + } |
|
| 53 | + $chosen .= ','; |
|
| 54 | + } |
|
| 55 | + $chosen = trim($chosen, ','); |
|
| 56 | + $chosen .= ']'; |
|
| 57 | + $title = $poll->getTitle(); |
|
| 58 | + $desc = $poll->getDescription(); |
|
| 59 | + if ($poll->getExpire() !== null) { |
|
| 60 | + $expireTs = strtotime($poll->getExpire()); |
|
| 61 | + $expireStr = date('d.m.Y', $expireTs); |
|
| 62 | + } |
|
| 63 | + $access = $poll->getAccess(); |
|
| 64 | + $accessTypes = $access; |
|
| 65 | + if ( |
|
| 66 | + $access !== 'registered' |
|
| 67 | + && $access !== 'hidden' && $access !== 'public' |
|
| 68 | + ) { |
|
| 69 | + $access = 'select'; |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | 72 | ?> |
| 73 | 73 | |
| 74 | 74 | <div id="app"> |