| @@ -134,12 +134,12 @@ | ||
| 134 | 134 | $polls = $this->eventMapper->findAllForUserWithInfo($this->userId); | 
| 135 | 135 | $comments = $this->commentMapper->findDistinctByUser($this->userId); | 
| 136 | 136 | $partic = $this->participationMapper->findDistinctByUser($this->userId); | 
| 137 | - $particText = $this->participationTextMapper->findDistinctByUser($this->userId); | |
| 137 | + $particText = $this->participationTextMapper->findDistinctByUser($this->userId); | |
| 138 | 138 |          $response = new TemplateResponse('polls', 'main.tmpl', [ | 
| 139 | 139 | 'polls' => $polls, | 
| 140 | 140 | 'comments' => $comments, | 
| 141 | 141 | 'participations' => $partic, | 
| 142 | - 'participations_text' => $particText, | |
| 142 | + 'participations_text' => $particText, | |
| 143 | 143 | 'userId' => $this->userId, | 
| 144 | 144 | 'userMgr' => $this->manager, | 
| 145 | 145 | 'urlGenerator' => $this->urlGenerator | 
| @@ -246,7 +246,7 @@ discard block | ||
| 246 | 246 | ]); | 
| 247 | 247 |          } else { | 
| 248 | 248 | User::checkLoggedIn(); | 
| 249 | -            return new TemplateResponse('polls', 'no.acc.tmpl', []); | |
| 249 | +            return new TemplateResponse('polls', 'no.acc.tmpl', [ ]); | |
| 250 | 250 | } | 
| 251 | 251 | } | 
| 252 | 252 | |
| @@ -387,7 +387,7 @@ discard block | ||
| 387 | 387 | */ | 
| 388 | 388 |      public function createPoll() { | 
| 389 | 389 |          return new TemplateResponse('polls', 'create.tmpl', | 
| 390 | - ['userId' => $this->userId, 'userMgr' => $this->manager, 'urlGenerator' => $this->urlGenerator]); | |
| 390 | + [ 'userId' => $this->userId, 'userMgr' => $this->manager, 'urlGenerator' => $this->urlGenerator ]); | |
| 391 | 391 | } | 
| 392 | 392 | |
| 393 | 393 | /** | 
| @@ -538,15 +538,15 @@ discard block | ||
| 538 | 538 | $part = new Participation(); | 
| 539 | 539 | $part->setPollId($pollId); | 
| 540 | 540 | $part->setUserId($userId); | 
| 541 | -                    $part->setDt(date('Y-m-d H:i:s', $dates[$i])); | |
| 542 | - $part->setType($types[$i]); | |
| 541 | +                    $part->setDt(date('Y-m-d H:i:s', $dates[ $i ])); | |
| 542 | + $part->setType($types[ $i ]); | |
| 543 | 543 | $this->participationMapper->insert($part); | 
| 544 | 544 |                  } else { | 
| 545 | 545 | $part = new ParticipationText(); | 
| 546 | 546 | $part->setPollId($pollId); | 
| 547 | 547 | $part->setUserId($userId); | 
| 548 | - $part->setText($dates[$i]); | |
| 549 | - $part->setType($types[$i]); | |
| 548 | + $part->setText($dates[ $i ]); | |
| 549 | + $part->setType($types[ $i ]); | |
| 550 | 550 | $this->participationTextMapper->insert($part); | 
| 551 | 551 | } | 
| 552 | 552 | |
| @@ -554,7 +554,7 @@ discard block | ||
| 554 | 554 | $this->sendNotifications($pollId, $userId); | 
| 555 | 555 | } | 
| 556 | 556 | $hash = $poll->getHash(); | 
| 557 | -        $url = $this->urlGenerator->linkToRoute('polls.page.goto_poll', ['hash' => $hash]); | |
| 557 | +        $url = $this->urlGenerator->linkToRoute('polls.page.goto_poll', [ 'hash' => $hash ]); | |
| 558 | 558 | return new RedirectResponse($url); | 
| 559 | 559 | } | 
| 560 | 560 | |
| @@ -612,15 +612,15 @@ discard block | ||
| 612 | 612 | $gids = array(); | 
| 613 | 613 | $sgids = array(); | 
| 614 | 614 |          foreach ($selectedGroups as $sg) { | 
| 615 | -            $sgids[] = str_replace('group_', '', $sg); | |
| 615 | +            $sgids[ ] = str_replace('group_', '', $sg); | |
| 616 | 616 | } | 
| 617 | 617 |          foreach ($groups as $g) { | 
| 618 | - $gids[] = $g->getGID(); | |
| 618 | + $gids[ ] = $g->getGID(); | |
| 619 | 619 | } | 
| 620 | 620 | $diffGids = array_diff($gids, $sgids); | 
| 621 | 621 | $gids = array(); | 
| 622 | 622 |          foreach ($diffGids as $g) { | 
| 623 | - $gids[] = ['gid' => $g, 'isGroup' => true]; | |
| 623 | + $gids[ ] = [ 'gid' => $g, 'isGroup' => true ]; | |
| 624 | 624 | } | 
| 625 | 625 | return $gids; | 
| 626 | 626 | } | 
| @@ -639,7 +639,7 @@ discard block | ||
| 639 | 639 | $users = array(); | 
| 640 | 640 | $sUsers = array(); | 
| 641 | 641 |          foreach ($selectedUsers as $su) { | 
| 642 | -            $sUsers[] = str_replace('user_', '', $su); | |
| 642 | +            $sUsers[ ] = str_replace('user_', '', $su); | |
| 643 | 643 | } | 
| 644 | 644 |          foreach ($userNames as $u) { | 
| 645 | 645 | $alreadyAdded = false; | 
| @@ -651,7 +651,7 @@ discard block | ||
| 651 | 651 | } | 
| 652 | 652 | } | 
| 653 | 653 |              if (!$alreadyAdded) { | 
| 654 | -                $users[] = array('uid' => $u->getUID(), 'displayName' => $u->getDisplayName(), 'isGroup' => false); | |
| 654 | +                $users[ ] = array('uid' => $u->getUID(), 'displayName' => $u->getDisplayName(), 'isGroup' => false); | |
| 655 | 655 |              } else { | 
| 656 | 656 | continue; | 
| 657 | 657 | } | 
| @@ -699,7 +699,7 @@ discard block | ||
| 699 | 699 | } | 
| 700 | 700 | // Nextcloud >= 12 | 
| 701 | 701 | $groups = \OC::$server->getGroupManager()->getUserGroups(\OC::$server->getUserSession()->getUser()); | 
| 702 | -        return array_map(function ($group) { | |
| 702 | +        return array_map(function($group) { | |
| 703 | 703 | return $group->getGID(); | 
| 704 | 704 | }, $groups); | 
| 705 | 705 | } | 
| @@ -49,7 +49,7 @@ discard block | ||
| 49 | 49 | /** | 
| 50 | 50 | * Controllers | 
| 51 | 51 | */ | 
| 52 | -        $container->registerService('PageController', function ($c) use ($server) { | |
| 52 | +        $container->registerService('PageController', function($c) use ($server) { | |
| 53 | 53 | /** @var SimpleContainer $c */ | 
| 54 | 54 | return new PageController( | 
| 55 | 55 |                  $c->query('AppName'), | 
| @@ -71,73 +71,73 @@ discard block | ||
| 71 | 71 | ); | 
| 72 | 72 | }); | 
| 73 | 73 | |
| 74 | -        $container->registerService('UserManager', function ($c) { | |
| 74 | +        $container->registerService('UserManager', function($c) { | |
| 75 | 75 | /** @var SimpleContainer $c */ | 
| 76 | 76 |              return $c->query('ServerContainer')->getUserManager(); | 
| 77 | 77 | }); | 
| 78 | 78 | |
| 79 | -        $container->registerService('GroupManager', function ($c) { | |
| 79 | +        $container->registerService('GroupManager', function($c) { | |
| 80 | 80 | /** @var SimpleContainer $c */ | 
| 81 | 81 |              return $c->query('ServerContainer')->getGroupManager(); | 
| 82 | 82 | }); | 
| 83 | 83 | |
| 84 | -        $container->registerService('AvatarManager', function ($c) { | |
| 84 | +        $container->registerService('AvatarManager', function($c) { | |
| 85 | 85 | /** @var SimpleContainer $c */ | 
| 86 | 86 |              return $c->query('ServerContainer')->getAvatarManager(); | 
| 87 | 87 | }); | 
| 88 | 88 | |
| 89 | -        $container->registerService('Logger', function ($c) { | |
| 89 | +        $container->registerService('Logger', function($c) { | |
| 90 | 90 | /** @var SimpleContainer $c */ | 
| 91 | 91 |              return $c->query('ServerContainer')->getLogger(); | 
| 92 | 92 | }); | 
| 93 | 93 | |
| 94 | -        $container->registerService('L10N', function ($c) { | |
| 94 | +        $container->registerService('L10N', function($c) { | |
| 95 | 95 |              return $c->query('ServerContainer')->getL10N($c->query('AppName')); | 
| 96 | 96 | }); | 
| 97 | 97 | |
| 98 | -        $container->registerService('CommentMapper', function ($c) use ($server) { | |
| 98 | +        $container->registerService('CommentMapper', function($c) use ($server) { | |
| 99 | 99 | /** @var SimpleContainer $c */ | 
| 100 | 100 | return new CommentMapper( | 
| 101 | 101 | $server->getDatabaseConnection() | 
| 102 | 102 | ); | 
| 103 | 103 | }); | 
| 104 | 104 | |
| 105 | -        $container->registerService('DateMapper', function ($c) use ($server) { | |
| 105 | +        $container->registerService('DateMapper', function($c) use ($server) { | |
| 106 | 106 | /** @var SimpleContainer $c */ | 
| 107 | 107 | return new DateMapper( | 
| 108 | 108 | $server->getDatabaseConnection() | 
| 109 | 109 | ); | 
| 110 | 110 | }); | 
| 111 | 111 | |
| 112 | -        $container->registerService('EventMapper', function ($c) use ($server) { | |
| 112 | +        $container->registerService('EventMapper', function($c) use ($server) { | |
| 113 | 113 | /** @var SimpleContainer $c */ | 
| 114 | 114 | return new EventMapper( | 
| 115 | 115 | $server->getDatabaseConnection() | 
| 116 | 116 | ); | 
| 117 | 117 | }); | 
| 118 | 118 | |
| 119 | -        $container->registerService('NotificationMapper', function ($c) use ($server) { | |
| 119 | +        $container->registerService('NotificationMapper', function($c) use ($server) { | |
| 120 | 120 | /** @var SimpleContainer $c */ | 
| 121 | 121 | return new NotificationMapper( | 
| 122 | 122 | $server->getDatabaseConnection() | 
| 123 | 123 | ); | 
| 124 | 124 | }); | 
| 125 | 125 | |
| 126 | -        $container->registerService('ParticipationMapper', function ($c) use ($server) { | |
| 126 | +        $container->registerService('ParticipationMapper', function($c) use ($server) { | |
| 127 | 127 | /** @var SimpleContainer $c */ | 
| 128 | 128 | return new ParticipationMapper( | 
| 129 | 129 | $server->getDatabaseConnection() | 
| 130 | 130 | ); | 
| 131 | 131 | }); | 
| 132 | 132 | |
| 133 | -        $container->registerService('ParticipationTextMapper', function ($c) use ($server) { | |
| 133 | +        $container->registerService('ParticipationTextMapper', function($c) use ($server) { | |
| 134 | 134 | /** @var SimpleContainer $c */ | 
| 135 | 135 | return new ParticipationTextMapper( | 
| 136 | 136 | $server->getDatabaseConnection() | 
| 137 | 137 | ); | 
| 138 | 138 | }); | 
| 139 | 139 | |
| 140 | -        $container->registerService('TextMapper', function ($c) use ($server) { | |
| 140 | +        $container->registerService('TextMapper', function($c) use ($server) { | |
| 141 | 141 | /** @var SimpleContainer $c */ | 
| 142 | 142 | return new TextMapper( | 
| 143 | 143 | $server->getDatabaseConnection() | 
| @@ -150,7 +150,7 @@ discard block | ||
| 150 | 150 | */ | 
| 151 | 151 |      public function registerNavigationEntry() { | 
| 152 | 152 | $container = $this->getContainer(); | 
| 153 | -        $container->query('OCP\INavigationManager')->add(function () use ($container) { | |
| 153 | +        $container->query('OCP\INavigationManager')->add(function() use ($container) { | |
| 154 | 154 |              $urlGenerator = $container->query('OCP\IURLGenerator'); | 
| 155 | 155 |              $l10n = $container->query('OCP\IL10N'); | 
| 156 | 156 | return [ | 
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 | */ | 
| 45 | 45 |      public function findByPoll($pollId, $limit = null, $offset = null) { | 
| 46 | 46 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; | 
| 47 | - return $this->findEntities($sql, [$pollId], $limit, $offset); | |
| 47 | + return $this->findEntities($sql, [ $pollId ], $limit, $offset); | |
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | 50 | /** | 
| @@ -52,6 +52,6 @@ discard block | ||
| 52 | 52 | */ | 
| 53 | 53 |      public function deleteByPoll($pollId) { | 
| 54 | 54 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; | 
| 55 | - $this->execute($sql, [$pollId]); | |
| 55 | + $this->execute($sql, [ $pollId ]); | |
| 56 | 56 | } | 
| 57 | 57 | } | 
| @@ -40,7 +40,7 @@ discard block | ||
| 40 | 40 | */ | 
| 41 | 41 |      public function find($id) { | 
| 42 | 42 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE id = ?'; | 
| 43 | - return $this->findEntity($sql, [$id]); | |
| 43 | + return $this->findEntity($sql, [ $id ]); | |
| 44 | 44 | } | 
| 45 | 45 | |
| 46 | 46 | /** | 
| @@ -53,7 +53,7 @@ discard block | ||
| 53 | 53 | */ | 
| 54 | 54 |      public function findBetween($userId, $from, $until, $limit = null, $offset = null) { | 
| 55 | 55 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE userId = ? AND timestamp BETWEEN ? AND ?'; | 
| 56 | - return $this->findEntities($sql, [$userId, $from, $until], $limit, $offset); | |
| 56 | + return $this->findEntities($sql, [ $userId, $from, $until ], $limit, $offset); | |
| 57 | 57 | } | 
| 58 | 58 | |
| 59 | 59 | /** | 
| @@ -63,7 +63,7 @@ discard block | ||
| 63 | 63 | */ | 
| 64 | 64 |      public function findAll($limit = null, $offset = null) { | 
| 65 | 65 | $sql = 'SELECT * FROM ' . $this->getTableName(); | 
| 66 | - return $this->findEntities($sql, [], $limit, $offset); | |
| 66 | + return $this->findEntities($sql, [ ], $limit, $offset); | |
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | 69 | /** | 
| @@ -74,7 +74,7 @@ discard block | ||
| 74 | 74 | */ | 
| 75 | 75 |      public function findAllByPoll($pollId, $limit = null, $offset = null) { | 
| 76 | 76 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; | 
| 77 | - return $this->findEntities($sql, [$pollId], $limit, $offset); | |
| 77 | + return $this->findEntities($sql, [ $pollId ], $limit, $offset); | |
| 78 | 78 | } | 
| 79 | 79 | |
| 80 | 80 | /** | 
| @@ -84,6 +84,6 @@ discard block | ||
| 84 | 84 | */ | 
| 85 | 85 |      public function findByUserAndPoll($pollId, $userId) { | 
| 86 | 86 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ? AND user_id = ?'; | 
| 87 | - return $this->findEntity($sql, [$pollId, $userId]); | |
| 87 | + return $this->findEntity($sql, [ $pollId, $userId ]); | |
| 88 | 88 | } | 
| 89 | 89 | } | 
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 | */ | 
| 45 | 45 |      public function findDistinctByUser($userId, $limit = null, $offset = null) { | 
| 46 | 46 | $sql = 'SELECT DISTINCT * FROM ' . $this->getTableName() . ' WHERE user_id = ?'; | 
| 47 | - return $this->findEntities($sql, [$userId], $limit, $offset); | |
| 47 | + return $this->findEntities($sql, [ $userId ], $limit, $offset); | |
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | 50 | /** | 
| @@ -55,7 +55,7 @@ discard block | ||
| 55 | 55 | */ | 
| 56 | 56 |      public function findByPoll($pollId, $limit = null, $offset = null) { | 
| 57 | 57 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ? ORDER BY Dt DESC'; | 
| 58 | - return $this->findEntities($sql, [$pollId], $limit, $offset); | |
| 58 | + return $this->findEntities($sql, [ $pollId ], $limit, $offset); | |
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | 61 | /** | 
| @@ -63,6 +63,6 @@ discard block | ||
| 63 | 63 | */ | 
| 64 | 64 |      public function deleteByPoll($pollId) { | 
| 65 | 65 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; | 
| 66 | - $this->execute($sql, [$pollId]); | |
| 66 | + $this->execute($sql, [ $pollId ]); | |
| 67 | 67 | } | 
| 68 | 68 | } | 
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 | */ | 
| 45 | 45 |      public function find($id) { | 
| 46 | 46 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE id = ?'; | 
| 47 | - return $this->findEntity($sql, [$id]); | |
| 47 | + return $this->findEntity($sql, [ $id ]); | |
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | 50 | /** | 
| @@ -55,7 +55,7 @@ discard block | ||
| 55 | 55 | */ | 
| 56 | 56 |      public function findByHash($hash, $limit = null, $offset = null) { | 
| 57 | 57 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE hash = ?'; | 
| 58 | - return $this->findEntity($sql, [$hash], $limit, $offset); | |
| 58 | + return $this->findEntity($sql, [ $hash ], $limit, $offset); | |
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | 61 | /** | 
| @@ -66,7 +66,7 @@ discard block | ||
| 66 | 66 | */ | 
| 67 | 67 |      public function findAllForUser($userId, $limit = null, $offset = null) { | 
| 68 | 68 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE owner = ?'; | 
| 69 | - return $this->findEntities($sql, [$userId], $limit, $offset); | |
| 69 | + return $this->findEntities($sql, [ $userId ], $limit, $offset); | |
| 70 | 70 | } | 
| 71 | 71 | |
| 72 | 72 | /** | 
| @@ -101,6 +101,6 @@ discard block | ||
| 101 | 101 | OR | 
| 102 | 102 | *PREFIX*polls_comments.user_id = ? | 
| 103 | 103 | ORDER BY created'; | 
| 104 | - return $this->findEntities($sql, ['hidden', $userId, 'hidden', $userId, $userId], $limit, $offset); | |
| 104 | + return $this->findEntities($sql, [ 'hidden', $userId, 'hidden', $userId, $userId ], $limit, $offset); | |
| 105 | 105 | } | 
| 106 | 106 | } | 
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 | */ | 
| 45 | 45 |      public function findDistinctByUser($userId, $limit = null, $offset = null) { | 
| 46 | 46 | $sql = 'SELECT DISTINCT * FROM ' . $this->getTableName() . ' WHERE user_id = ?'; | 
| 47 | - return $this->findEntities($sql, [$userId], $limit, $offset); | |
| 47 | + return $this->findEntities($sql, [ $userId ], $limit, $offset); | |
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | 50 | /** | 
| @@ -55,7 +55,7 @@ discard block | ||
| 55 | 55 | */ | 
| 56 | 56 |      public function findByPoll($pollId, $limit = null, $offset = null) { | 
| 57 | 57 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; | 
| 58 | - return $this->findEntities($sql, [$pollId], $limit, $offset); | |
| 58 | + return $this->findEntities($sql, [ $pollId ], $limit, $offset); | |
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | 61 | /** | 
| @@ -63,7 +63,7 @@ discard block | ||
| 63 | 63 | */ | 
| 64 | 64 |      public function deleteByPoll($pollId) { | 
| 65 | 65 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; | 
| 66 | - $this->execute($sql, [$pollId]); | |
| 66 | + $this->execute($sql, [ $pollId ]); | |
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | 69 | /** | 
| @@ -72,6 +72,6 @@ discard block | ||
| 72 | 72 | */ | 
| 73 | 73 |      public function deleteByPollAndUser($pollId, $userId) { | 
| 74 | 74 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ? AND user_id = ?'; | 
| 75 | - $this->execute($sql, [$pollId, $userId]); | |
| 75 | + $this->execute($sql, [ $pollId, $userId ]); | |
| 76 | 76 | } | 
| 77 | 77 | } | 
| @@ -47,16 +47,16 @@ | ||
| 47 | 47 | return $this->findEntities($sql, [$pollId], $limit, $offset); | 
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | - /** | |
| 51 | - * @param string $userId | |
| 52 | - * @param int $limit | |
| 53 | - * @param int $offset | |
| 54 | - * @return ParticipationText[] | |
| 55 | - */ | |
| 56 | -	public function findDistinctByUser($userId, $limit = null, $offset = null) { | |
| 57 | - $sql = 'SELECT DISTINCT * FROM ' . $this->getTableName() . ' WHERE user_id = ?'; | |
| 58 | - return $this->findEntities($sql, [$userId], $limit, $offset); | |
| 59 | - } | |
| 50 | + /** | |
| 51 | + * @param string $userId | |
| 52 | + * @param int $limit | |
| 53 | + * @param int $offset | |
| 54 | + * @return ParticipationText[] | |
| 55 | + */ | |
| 56 | +    public function findDistinctByUser($userId, $limit = null, $offset = null) { | |
| 57 | + $sql = 'SELECT DISTINCT * FROM ' . $this->getTableName() . ' WHERE user_id = ?'; | |
| 58 | + return $this->findEntities($sql, [$userId], $limit, $offset); | |
| 59 | + } | |
| 60 | 60 | |
| 61 | 61 | /** | 
| 62 | 62 | * @param string $pollId | 
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 | */ | 
| 45 | 45 |      public function findByPoll($pollId, $limit = null, $offset = null) { | 
| 46 | 46 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; | 
| 47 | - return $this->findEntities($sql, [$pollId], $limit, $offset); | |
| 47 | + return $this->findEntities($sql, [ $pollId ], $limit, $offset); | |
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | 50 | /** | 
| @@ -55,7 +55,7 @@ discard block | ||
| 55 | 55 | */ | 
| 56 | 56 |  	public function findDistinctByUser($userId, $limit = null, $offset = null) { | 
| 57 | 57 | $sql = 'SELECT DISTINCT * FROM ' . $this->getTableName() . ' WHERE user_id = ?'; | 
| 58 | - return $this->findEntities($sql, [$userId], $limit, $offset); | |
| 58 | + return $this->findEntities($sql, [ $userId ], $limit, $offset); | |
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | 61 | /** | 
| @@ -63,7 +63,7 @@ discard block | ||
| 63 | 63 | */ | 
| 64 | 64 |      public function deleteByPoll($pollId) { | 
| 65 | 65 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; | 
| 66 | - $this->execute($sql, [$pollId]); | |
| 66 | + $this->execute($sql, [ $pollId ]); | |
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | 69 | /** | 
| @@ -72,6 +72,6 @@ discard block | ||
| 72 | 72 | */ | 
| 73 | 73 |      public function deleteByPollAndUser($pollId, $userId) { | 
| 74 | 74 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ? AND user_id = ?'; | 
| 75 | - $this->execute($sql, [$pollId, $userId]); | |
| 75 | + $this->execute($sql, [ $pollId, $userId ]); | |
| 76 | 76 | } | 
| 77 | 77 | } | 
| @@ -27,18 +27,18 @@ discard block | ||
| 27 | 27 |      \OCP\Util::addScript('polls', 'create_edit'); | 
| 28 | 28 |      \OCP\Util::addScript('polls', 'jquery.datetimepicker.full.min'); | 
| 29 | 29 | |
| 30 | - $userId = $_['userId']; | |
| 31 | - $userMgr = $_['userMgr']; | |
| 32 | - $urlGenerator = $_['urlGenerator']; | |
| 33 | - $isUpdate = isset($_['poll']) && $_['poll'] !== null; | |
| 30 | + $userId = $_[ 'userId' ]; | |
| 31 | + $userMgr = $_[ 'userMgr' ]; | |
| 32 | + $urlGenerator = $_[ 'urlGenerator' ]; | |
| 33 | + $isUpdate = isset($_[ 'poll' ]) && $_[ 'poll' ] !== null; | |
| 34 | 34 | $isAnonymous = false; | 
| 35 | 35 | $hideNames = false; | 
| 36 | 36 | |
| 37 | 37 |      if ($isUpdate) { | 
| 38 | - $poll = $_['poll']; | |
| 38 | + $poll = $_[ 'poll' ]; | |
| 39 | 39 | $isAnonymous = $poll->getIsAnonymous(); | 
| 40 | 40 | $hideNames = $isAnonymous && $poll->getFullAnonymous(); | 
| 41 | - $dates = $_['dates']; | |
| 41 | + $dates = $_[ 'dates' ]; | |
| 42 | 42 | $chosen = '['; | 
| 43 | 43 |          foreach ($dates as $d) { | 
| 44 | 44 |              if ($poll->getType() == '0') { | 
| @@ -53,7 +53,7 @@ discard block | ||
| 53 | 53 | $title = $poll->getTitle(); | 
| 54 | 54 | $desc = $poll->getDescription(); | 
| 55 | 55 |          if ($poll->getExpire() !== null) { | 
| 56 | - $expireTs = strtotime($poll->getExpire()) - 60*60*24; //remove one day, which has been added to expire at the end of a day | |
| 56 | + $expireTs = strtotime($poll->getExpire()) - 60 * 60 * 24; //remove one day, which has been added to expire at the end of a day | |
| 57 | 57 |              $expireStr = date('d.m.Y', $expireTs); | 
| 58 | 58 | } | 
| 59 | 59 | $access = $poll->getAccess(); | 
| @@ -164,7 +164,7 @@ discard block | ||
| 164 | 164 | <table id="selected-dates-table" class="choices"> | 
| 165 | 165 | </table> | 
| 166 | 166 | </div> | 
| 167 | -            <div id="text-select-container" <?php if(!$isUpdate || $poll->getType() == '0') print_unescaped('style="display:none;"'); ?> > | |
| 167 | +            <div id="text-select-container" <?php if (!$isUpdate || $poll->getType() == '0') print_unescaped('style="display:none;"'); ?> > | |
| 168 | 168 |                  <label for="text-title" class="input_title"><?php p($l->t('Text item')); ?></label> | 
| 169 | 169 | <div class="input-group"> | 
| 170 | 170 |                      <input type="text" id="text-title" placeholder="<?php print_unescaped('Insert text...'); ?>" /> | 
| @@ -78,8 +78,11 @@ discard block | ||
| 78 | 78 | <span> | 
| 79 | 79 | <?php if ($isUpdate): ?> | 
| 80 | 80 |                              <?php p($l->t('Edit poll') . ' ' . $poll->getTitle()); ?> | 
| 81 | - <?php else: ?> | |
| 82 | -                          <?php p($l->t('Create new poll')); ?> | |
| 81 | +                        <?php else { | |
| 82 | + : ?> | |
| 83 | +                          <?php p($l->t('Create new poll')); | |
| 84 | +} | |
| 85 | +?> | |
| 83 | 86 | <?php endif; ?> | 
| 84 | 87 | </span> | 
| 85 | 88 | </div> | 
| @@ -89,11 +92,20 @@ discard block | ||
| 89 | 92 | <?php if ($isUpdate): ?> | 
| 90 | 93 |  <form name="finish_poll" action="<?php p($urlGenerator->linkToRoute('polls.page.update_poll')); ?>" method="POST"> | 
| 91 | 94 | <input type="hidden" name="pollId" value="<?php p($poll->getId()); ?>" /> | 
| 92 | -<?php else: ?> | |
| 93 | -<form name="finish_poll" action="<?php p($urlGenerator->linkToRoute('polls.page.insert_poll')); ?>" method="POST"> | |
| 95 | +<?php else { | |
| 96 | + : ?> | |
| 97 | +<form name="finish_poll" action="<?php p($urlGenerator->linkToRoute('polls.page.insert_poll')); | |
| 98 | +} | |
| 99 | +?>" method="POST"> | |
| 94 | 100 | <?php endif; ?> | 
| 95 | - <input type="hidden" name="chosenDates" id="chosenDates" value="<?php if (isset($chosen)) p($chosen); ?>" /> | |
| 96 | - <input type="hidden" name="expireTs" id="expireTs" value="<?php if (isset($expireTs)) p($expireTs); ?>" /> | |
| 101 | +    <input type="hidden" name="chosenDates" id="chosenDates" value="<?php if (isset($chosen)) { | |
| 102 | + p($chosen); | |
| 103 | +} | |
| 104 | +?>" /> | |
| 105 | +    <input type="hidden" name="expireTs" id="expireTs" value="<?php if (isset($expireTs)) { | |
| 106 | + p($expireTs); | |
| 107 | +} | |
| 108 | +?>" /> | |
| 97 | 109 | <input type="hidden" name="userId" id="userId" value="<?php p($userId); ?>" /> | 
| 98 | 110 | |
| 99 | 111 | <header class="row"> | 
| @@ -102,22 +114,40 @@ discard block | ||
| 102 | 114 | <div class="new_poll row"> | 
| 103 | 115 | <div class="col-50"> | 
| 104 | 116 |              <label for="pollTitle" class="input_title"><?php p($l->t('Title')); ?></label> | 
| 105 | - <input type="text" class="input_field" id="pollTitle" name="pollTitle" value="<?php if (isset($title)) p($title); ?>" /> | |
| 117 | +            <input type="text" class="input_field" id="pollTitle" name="pollTitle" value="<?php if (isset($title)) { | |
| 118 | + p($title); | |
| 119 | +} | |
| 120 | +?>" /> | |
| 106 | 121 |              <label for="pollDesc" class="input_title"><?php p($l->t('Description')); ?></label> | 
| 107 | - <textarea class="input_field" id="pollDesc" name="pollDesc"><?php if (isset($desc)) p($desc); ?></textarea> | |
| 122 | +            <textarea class="input_field" id="pollDesc" name="pollDesc"><?php if (isset($desc)) { | |
| 123 | + p($desc); | |
| 124 | +} | |
| 125 | +?></textarea> | |
| 108 | 126 | |
| 109 | 127 |              <label class="input_title"><?php p($l->t('Access')); ?></label> | 
| 110 | 128 | |
| 111 | -            <input type="radio" name="accessType" id="private" value="registered" class="radio" <?php if (!$isUpdate || $access === 'registered') print_unescaped('checked'); ?> /> | |
| 129 | +            <input type="radio" name="accessType" id="private" value="registered" class="radio" <?php if (!$isUpdate || $access === 'registered') { | |
| 130 | +    print_unescaped('checked'); | |
| 131 | +} | |
| 132 | +?> /> | |
| 112 | 133 |              <label for="private"><?php p($l->t('Registered users only')); ?></label> | 
| 113 | 134 | |
| 114 | -            <input type="radio" name="accessType" id="hidden" value="hidden" class="radio" <?php if ($isUpdate && $access === 'hidden') print_unescaped('checked'); ?> /> | |
| 135 | +            <input type="radio" name="accessType" id="hidden" value="hidden" class="radio" <?php if ($isUpdate && $access === 'hidden') { | |
| 136 | +    print_unescaped('checked'); | |
| 137 | +} | |
| 138 | +?> /> | |
| 115 | 139 |              <label for="hidden"><?php p($l->t('hidden')); ?></label> | 
| 116 | 140 | |
| 117 | -            <input type="radio" name="accessType" id="public" value="public" class="radio" <?php if ($isUpdate && $access === 'public') print_unescaped('checked'); ?> /> | |
| 141 | +            <input type="radio" name="accessType" id="public" value="public" class="radio" <?php if ($isUpdate && $access === 'public') { | |
| 142 | +    print_unescaped('checked'); | |
| 143 | +} | |
| 144 | +?> /> | |
| 118 | 145 |              <label for="public"><?php p($l->t('Public access')); ?></label> | 
| 119 | 146 | |
| 120 | -            <input type="radio" name="accessType" id="select" value="select" class="radio" <?php if ($isUpdate && $access === 'select') print_unescaped('checked'); ?>> | |
| 147 | +            <input type="radio" name="accessType" id="select" value="select" class="radio" <?php if ($isUpdate && $access === 'select') { | |
| 148 | +    print_unescaped('checked'); | |
| 149 | +} | |
| 150 | +?>> | |
| 121 | 151 |              <label for="select"><?php p($l->t('Select')); ?></label> | 
| 122 | 152 | <span id="id_label_select">...</span> | 
| 123 | 153 | |
| @@ -133,9 +163,12 @@ discard block | ||
| 133 | 163 | </div> | 
| 134 | 164 | </div> | 
| 135 | 165 | |
| 136 | - <input type="hidden" name="accessValues" id="accessValues" value="<?php if ($isUpdate && $access === 'select') p($accessTypes) ?>" /> | |
| 166 | +            <input type="hidden" name="accessValues" id="accessValues" value="<?php if ($isUpdate && $access === 'select') { | |
| 167 | + p($accessTypes) ?>" /> | |
| 137 | 168 | |
| 138 | -            <input id="isAnonymous" name="isAnonymous" type="checkbox" class="checkbox" <?php $isAnonymous ? print_unescaped('value="true" checked') : print_unescaped('value="false"'); ?> /> | |
| 169 | +            <input id="isAnonymous" name="isAnonymous" type="checkbox" class="checkbox" <?php $isAnonymous ? print_unescaped('value="true" checked') : print_unescaped('value="false"'); | |
| 170 | +} | |
| 171 | +?> /> | |
| 139 | 172 |              <label for="isAnonymous" class="input_title"><?php p($l->t('Anonymous')) ?></label> | 
| 140 | 173 | |
| 141 | 174 | <div id="anonOptions" style="display:none;"> | 
| @@ -151,20 +184,32 @@ discard block | ||
| 151 | 184 | </div> | 
| 152 | 185 | <div class="col-50"> | 
| 153 | 186 | |
| 154 | -            <input type="radio" name="pollType" id="event" value="event" class="radio" <?php if (!$isUpdate || $poll->getType() == '0') print_unescaped('checked'); ?> /> | |
| 187 | +            <input type="radio" name="pollType" id="event" value="event" class="radio" <?php if (!$isUpdate || $poll->getType() == '0') { | |
| 188 | +    print_unescaped('checked'); | |
| 189 | +} | |
| 190 | +?> /> | |
| 155 | 191 |              <label for="event"><?php p($l->t('Event schedule')); ?></label> | 
| 156 | 192 | |
| 157 | 193 | <!-- TODO texts to db --> | 
| 158 | -            <input type="radio" name="pollType" id="text" value="text" class="radio" <?php if ($isUpdate && $poll->getType() == '1') print_unescaped('checked'); ?>> | |
| 194 | +            <input type="radio" name="pollType" id="text" value="text" class="radio" <?php if ($isUpdate && $poll->getType() == '1') { | |
| 195 | +    print_unescaped('checked'); | |
| 196 | +} | |
| 197 | +?>> | |
| 159 | 198 |              <label for="text"><?php p($l->t('Text based')); ?></label> | 
| 160 | 199 | |
| 161 | -            <div id="date-select-container" <?php if ($isUpdate && $poll->getType() == '1') print_unescaped('style="display:none;"'); ?> > | |
| 200 | +            <div id="date-select-container" <?php if ($isUpdate && $poll->getType() == '1') { | |
| 201 | +    print_unescaped('style="display:none;"'); | |
| 202 | +} | |
| 203 | +?> > | |
| 162 | 204 |                  <label for="datetimepicker" class="input_title"><?php p($l->t('Dates')); ?></label> | 
| 163 | 205 | <input id="datetimepicker" type="text" /> | 
| 164 | 206 | <table id="selected-dates-table" class="choices"> | 
| 165 | 207 | </table> | 
| 166 | 208 | </div> | 
| 167 | -            <div id="text-select-container" <?php if(!$isUpdate || $poll->getType() == '0') print_unescaped('style="display:none;"'); ?> > | |
| 209 | +            <div id="text-select-container" <?php if(!$isUpdate || $poll->getType() == '0') { | |
| 210 | +    print_unescaped('style="display:none;"'); | |
| 211 | +} | |
| 212 | +?> > | |
| 168 | 213 |                  <label for="text-title" class="input_title"><?php p($l->t('Text item')); ?></label> | 
| 169 | 214 | <div class="input-group"> | 
| 170 | 215 |                      <input type="text" id="text-title" placeholder="<?php print_unescaped('Insert text...'); ?>" /> | 
| @@ -180,8 +225,11 @@ discard block | ||
| 180 | 225 | <div class="form-actions"> | 
| 181 | 226 | <?php if ($isUpdate): ?> | 
| 182 | 227 |              <input type="submit" id="submit_finish_poll" class="button btn primary" value="<?php p($l->t('Update poll')); ?>" /> | 
| 183 | - <?php else: ?> | |
| 184 | -            <input type="submit" id="submit_finish_poll" class="button btn primary" value="<?php p($l->t('Create poll')); ?>" /> | |
| 228 | +        <?php else { | |
| 229 | + : ?> | |
| 230 | +            <input type="submit" id="submit_finish_poll" class="button btn primary" value="<?php p($l->t('Create poll')); | |
| 231 | +} | |
| 232 | +?>" /> | |
| 185 | 233 | <?php endif; ?> | 
| 186 | 234 |          <a href="<?php p($urlGenerator->linkToRoute('polls.page.index')); ?>" id="submit_cancel_poll" class="button"><?php p($l->t('Cancel')); ?></a> | 
| 187 | 235 | </div> |