Test Failed
Branch master (fee893)
by René
03:21
created
templates/main.tmpl.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
     \OCP\Util::addStyle('polls', 'list');
28 28
     \OCP\Util::addScript('polls', 'start');
29 29
 
30
-    $userId = $_['userId'];
31
-    $userMgr = $_['userMgr'];
32
-    $urlGenerator = $_['urlGenerator'];
30
+    $userId = $_[ 'userId' ];
31
+    $userMgr = $_[ 'userMgr' ];
32
+    $urlGenerator = $_[ 'urlGenerator' ];
33 33
 ?>
34 34
     <div id="app-content">
35 35
         <div id="app-content-wrapper">
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                         <input class="stop icon-close" style="display:none" value="" type="button">
49 49
                     </div>
50 50
                 </div>
51
-    <?php if (count($_['polls']) === 0) : ?>
51
+    <?php if (count($_[ 'polls' ]) === 0) : ?>
52 52
         <div id="emptycontent" class="">
53 53
             <div class="icon-polls"></div>
54 54
             <h2><?php p($l->t('No existing polls.')); ?></h2>
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
                      </div>
82 82
                 </div>
83 83
 
84
-                <?php foreach ($_['polls'] as $poll) : ?>
84
+                <?php foreach ($_[ 'polls' ] as $poll) : ?>
85 85
                     <?php
86 86
                         if (!userHasAccess($poll, $userId)) continue;
87 87
                         // direct url to poll
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 
91 91
                         $expiry_style = '';
92 92
                         if ($poll->getType() == '0') {
93
-                            $participated = $_['participations'];
93
+                            $participated = $_[ 'participations' ];
94 94
                         } else {
95
-                            $participated = $_['participations_text'];
95
+                            $participated = $_[ 'participations_text' ];
96 96
                         }
97 97
                         $participated_class = 'partic_no';
98 98
                         $participated_title = 'You did not vote';
99 99
                         $participated_count = count($participated);
100 100
 
101
-                        $comments = $_['comments'];
101
+                        $comments = $_[ 'comments' ];
102 102
                         $commented_class = 'commented_no';
103 103
                         $commented_title = 'You did not comment';
104 104
                         $commented_count = count($comments);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                         }
122 122
 
123 123
                         for ($i = 0; $i < count($participated); $i++) {
124
-                            if ($poll->getId() == intval($participated[$i]->getPollId())) {
124
+                            if ($poll->getId() == intval($participated[ $i ]->getPollId())) {
125 125
                                 $participated_class = 'partic_yes';
126 126
                                 $participated_title = 'You voted';
127 127
                                 array_splice($participated, $i, 1);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
                         }
131 131
 
132 132
                         for ($i = 0; $i < count($comments); $i++) {
133
-                            if ($poll->getId() === intval($comments[$i]->getPollId())) {
133
+                            if ($poll->getId() === intval($comments[ $i ]->getPollId())) {
134 134
                                 $commented_class = 'commented_yes';
135 135
                                 $commented_title = 'You commented';
136 136
                                 array_splice($comments, $i, 1);
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                     <div class="row table-body">
144 144
                         <div class="wrapper group-master">
145 145
                             <div class="wrapper group-1">
146
-                                <div class="thumbnail <?php p($expiry_style . " " . $commented_class. " " . $participated_class); ?>"></div>  <!-- Image to display status or type of poll */ -->
146
+                                <div class="thumbnail <?php p($expiry_style . " " . $commented_class . " " . $participated_class); ?>"></div>  <!-- Image to display status or type of poll */ -->
147 147
                                 <a href="<?php p($pollUrl); ?>" class="wrapper group-1-1">
148 148
                                     <div class="column name">                          <?php p($poll->getTitle()); ?></div>
149 149
                                     <div class="column description">                   <?php p($poll->getDescription()); ?></div>
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                                                 </button>
167 167
                                             </li>
168 168
                                             <li>
169
-                                                <a href="<?php p($urlGenerator->linkToRoute('polls.page.edit_poll', ['hash' => $poll->getHash()])); ?>" class="menuitem action permanent" id="id_edit_<?php p($poll->getId()); ?>">
169
+                                                <a href="<?php p($urlGenerator->linkToRoute('polls.page.edit_poll', [ 'hash' => $poll->getHash() ])); ?>" class="menuitem action permanent" id="id_edit_<?php p($poll->getId()); ?>">
170 170
                                                     <span class="icon-rename"></span>
171 171
                                                     <span>Edit Poll</span>
172 172
                                                 </a>
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     }
217 217
     // Nextcloud >= 12
218 218
     $groups = \OC::$server->getGroupManager()->getUserGroups(\OC::$server->getUserSession()->getUser());
219
-    return array_map(function ($group) {
219
+    return array_map(function($group) {
220 220
         return $group->getGID();
221 221
     }, $groups);
222 222
 }
Please login to merge, or discard this patch.
templates/goto.tmpl.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -27,18 +27,18 @@  discard block
 block discarded – undo
27 27
     \OCP\Util::addStyle('polls', 'vote');
28 28
     \OCP\Util::addScript('polls', 'vote');
29 29
     
30
-    $userId = $_['userId'];
31
-    $userMgr = $_['userMgr'];
32
-    $urlGenerator = $_['urlGenerator'];
33
-    $avaMgr = $_['avatarManager'];
30
+    $userId = $_[ 'userId' ];
31
+    $userMgr = $_[ 'userMgr' ];
32
+    $urlGenerator = $_[ 'urlGenerator' ];
33
+    $avaMgr = $_[ 'avatarManager' ];
34 34
 
35
-    $poll = $_['poll'];
36
-    $dates = $_['dates'];
37
-    $votes = $_['votes'];
38
-    $comments = $_['comments'];
35
+    $poll = $_[ 'poll' ];
36
+    $dates = $_[ 'dates' ];
37
+    $votes = $_[ 'votes' ];
38
+    $comments = $_[ 'comments' ];
39 39
     $isAnonymous = $poll->getIsAnonymous() && $userId != $poll->getOwner();
40 40
     $hideNames = $poll->getIsAnonymous() && $poll->getFullAnonymous();
41
-    $notification = $_['notification'];
41
+    $notification = $_[ 'notification' ];
42 42
 
43 43
     if ($poll->getExpire() === null) {
44 44
         $expired = false;
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
     }
48 48
 ?>
49 49
 
50
-<?php if($poll->getType() == '0') : ?>
51
-    <?php foreach($dates as $d) : ?>
50
+<?php if ($poll->getType() == '0') : ?>
51
+    <?php foreach ($dates as $d) : ?>
52 52
         <input class="hidden-dates" type="hidden" value="<?php print_unescaped($d->getDt()); ?>" />
53 53
     <?php endforeach ?>
54 54
 <?php endif ?>
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 // init array for counting 'yes'-votes for each date
64 64
 $total_y = array();
65 65
 $total_n = array();
66
-for ($i = 0 ; $i < count($dates) ; $i++) {
67
-    $total_y[$i] = 0;
68
-    $total_n[$i] = 0;
66
+for ($i = 0; $i < count($dates); $i++) {
67
+    $total_y[ $i ] = 0;
68
+    $total_n[ $i ] = 0;
69 69
 }
70 70
 $user_voted = array();
71 71
 
72
-$pollUrl = $urlGenerator->linkToRouteAbsolute('polls.page.goto_poll', ['hash' => $poll->getHash()]);
72
+$pollUrl = $urlGenerator->linkToRouteAbsolute('polls.page.goto_poll', [ 'hash' => $poll->getHash() ]);
73 73
 ?>
74 74
 
75 75
 <div id="app">
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
                                     //group by user
122 122
                                     $others = array();
123 123
                                     foreach ($votes as $vote) {
124
-                                        if (!isset($others[$vote->getUserId()])) {
125
-                                            $others[$vote->getUserId()] = array();
124
+                                        if (!isset($others[ $vote->getUserId() ])) {
125
+                                            $others[ $vote->getUserId() ] = array();
126 126
                                         }
127
-                                        array_push($others[$vote->getUserId()], $vote);
127
+                                        array_push($others[ $vote->getUserId() ], $vote);
128 128
                                     }
129 129
                                     $userCnt = 0;
130 130
                                     foreach (array_keys($others) as $usr) {
@@ -133,24 +133,24 @@  discard block
 block discarded – undo
133 133
                                             // if poll expired, just put current user among the others;
134 134
                                             // otherwise skip here to add current user as last row (to vote)
135 135
                                             if (!$expired) {
136
-                                                $user_voted = $others[$usr];
136
+                                                $user_voted = $others[ $usr ];
137 137
                                                 continue;
138 138
                                             }
139 139
                                         }
140 140
                                         print_unescaped('<tr>');
141 141
                                         print_unescaped('<td class="avatar-cell">');
142 142
                                         if ($userMgr->get($usr) != null && !$isAnonymous && !$hideNames) {
143
-                                            print_unescaped('<div class="poll avatardiv" title="'.($usr).'"></div>');
143
+                                            print_unescaped('<div class="poll avatardiv" title="' . ($usr) . '"></div>');
144 144
                                             print_unescaped('</td>');
145 145
                                             print_unescaped('<td colspan="2" class="name">');
146 146
                                             p($userMgr->get($usr)->getDisplayName());
147 147
                                         } else {
148 148
                                             if ($isAnonymous || $hideNames) {
149
-                                            print_unescaped('<div class="poll avatardiv" title="'.($userCnt).'"></div>');
149
+                                            print_unescaped('<div class="poll avatardiv" title="' . ($userCnt) . '"></div>');
150 150
                                             print_unescaped('</td>');
151 151
                                             print_unescaped('<td colspan="2" class="name">');
152 152
                                             } else {
153
-                                                print_unescaped('<div class="poll avatardiv" title="'.($usr).'"></div>');
153
+                                                print_unescaped('<div class="poll avatardiv" title="' . ($usr) . '"></div>');
154 154
                                                 print_unescaped('</td>');
155 155
                                                 print_unescaped('<td colspan="2" class="name">');
156 156
                                                 p($usr);
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
                                             }
171 171
                                             // look what user voted for this dts
172 172
                                             $found = false;
173
-                                            foreach ($others[$usr] as $vote) {
173
+                                            foreach ($others[ $usr ] as $vote) {
174 174
                                                 $voteVal = null;
175 175
                                                 if ($poll->getType() == '0') {
176 176
                                                     $voteVal = strtotime($vote->getDt());
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
                                                 if ($date_id === $voteVal) {
181 181
                                                     if ($vote->getType() == '1') {
182 182
                                                         $cl = 'poll-cell yes';
183
-                                                        $total_y[$i_tot]++;
183
+                                                        $total_y[ $i_tot ]++;
184 184
                                                     } else if ($vote->getType() == '0') {
185 185
                                                         $cl = 'poll-cell no';
186
-                                                        $total_n[$i_tot]++;
186
+                                                        $total_n[ $i_tot ]++;
187 187
                                                     } else if ($vote->getType() == '2') {
188 188
                                                         $cl = 'poll-cell maybe';
189 189
                                                     } else {
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                                     print_unescaped('<tr class="current-user">');
212 212
                                     print_unescaped('<td class="avatar-cell">');
213 213
                                     if (User::isLoggedIn()) {
214
-                                        print_unescaped('<div class="poll avatardiv" title="'.($userId).'"></div>');
214
+                                        print_unescaped('<div class="poll avatardiv" title="' . ($userId) . '"></div>');
215 215
                                         print_unescaped('</td>');
216 216
                                         print_unescaped('<td class="name">');
217 217
                                         p($userMgr->get($userId)->getDisplayName());
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
                                         if (isset($user_voted)) {
237 237
                                             foreach ($user_voted as $obj) {
238 238
                                                 $voteVal = null;
239
-                                                if($poll->getType() == '0') {
239
+                                                if ($poll->getType() == '0') {
240 240
                                                     $voteVal = strtotime($obj->getDt());
241 241
                                                 } else {
242 242
                                                     $voteVal = $obj->getText();
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
                                                 if ($voteVal === $date_id) {
245 245
                                                     if ($obj->getType() == '1') {
246 246
                                                         $cl = 'poll-cell active yes';
247
-                                                        $total_y[$i_tot]++;
247
+                                                        $total_y[ $i_tot ]++;
248 248
                                                     } else if ($obj->getType() == '0') {
249 249
                                                         $cl = 'poll-cell active no';
250
-                                                        $total_n[$i_tot]++;
251
-                                                    } else if($obj->getType() == '2') {
250
+                                                        $total_n[ $i_tot ]++;
251
+                                                    } else if ($obj->getType() == '2') {
252 252
                                                         $cl = 'poll-cell active maybe';
253 253
                                                     }
254 254
                                                     break;
@@ -268,28 +268,28 @@  discard block
 block discarded – undo
268 268
                             <tbody class="summary">
269 269
                                 <?php
270 270
                                     $diff_array = $total_y;
271
-                                    for($i = 0 ; $i < count($diff_array) ; $i++) {
272
-                                        $diff_array[$i] = ($total_y[$i] - $total_n[$i]);
271
+                                    for ($i = 0; $i < count($diff_array); $i++) {
272
+                                        $diff_array[ $i ] = ($total_y[ $i ] - $total_n[ $i ]);
273 273
                                     }
274 274
                                     $max_votes = max($diff_array);
275 275
                                 ?>
276 276
                                 <tr class="total">
277 277
                                     <th colspan="3"><?php p($l->t('Total')); ?></th>
278
-                                    <?php for ($i = 0 ; $i < count($dates) ; $i++) : ?>
278
+                                    <?php for ($i = 0; $i < count($dates); $i++) : ?>
279 279
                                         <td class="total">
280 280
                                             <?php
281
-                                            $classSuffix = "pollid_" . $dates[$i]->getId();
282
-                                            if (isset($total_y[$i])) {
283
-                                                $val = $total_y[$i];
281
+                                            $classSuffix = "pollid_" . $dates[ $i ]->getId();
282
+                                            if (isset($total_y[ $i ])) {
283
+                                                $val = $total_y[ $i ];
284 284
                                             } else {
285 285
                                                 $val = 0;
286 286
                                             }
287 287
                                             ?>
288
-                                            <div id="id_y_<?php p($classSuffix); ?>" class="result-cell yes" data-value=<?php p(isset($total_y_others[$i]) ? $total_y_others[$i] : '0'); ?>>
288
+                                            <div id="id_y_<?php p($classSuffix); ?>" class="result-cell yes" data-value=<?php p(isset($total_y_others[ $i ]) ? $total_y_others[ $i ] : '0'); ?>>
289 289
                                                 <?php p($val); ?>
290 290
                                             </div>
291
-                                            <div id="id_n_<?php p($classSuffix); ?>" class="result-cell no" data-value=<?php p(isset($total_n_others[$i]) ? $total_n_others[$i] : '0'); ?>>
292
-                                                <?php p(isset($total_n[$i]) ? $total_n[$i] : '0'); ?>
291
+                                            <div id="id_n_<?php p($classSuffix); ?>" class="result-cell no" data-value=<?php p(isset($total_n_others[ $i ]) ? $total_n_others[ $i ] : '0'); ?>>
292
+                                                <?php p(isset($total_n[ $i ]) ? $total_n[ $i ] : '0'); ?>
293 293
                                             </div>
294 294
                                         </td>
295 295
                                     <?php endfor; ?>
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
                                     <?php
300 300
                                     for ($i = 0; $i < count($dates); $i++) {
301 301
                                         $check = '';
302
-                                        if ($total_y[$i] - $total_n[$i] === $max_votes) {
302
+                                        if ($total_y[ $i ] - $total_n[ $i ] === $max_votes) {
303 303
                                             $check = 'icon-checkmark';
304 304
                                         }
305 305
                                         print_unescaped('<td class="win_row ' . $check . '" id="id_total_' . $i . '"></td>');
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
                         <div class="input-group-addon">
331 331
                             <span class="icon-share"></span><?php p($l->t('Link')); ?>
332 332
                         </div>
333
-                        <input type="text" value="<?php p($pollUrl);?>" readonly="readonly">
333
+                        <input type="text" value="<?php p($pollUrl); ?>" readonly="readonly">
334 334
                     </div>
335 335
                     <?php if ($expired) : ?>
336 336
                         <div id="expired_info">
Please login to merge, or discard this patch.