Completed
Push — master ( 0d47e3...0ec35d )
by Sarah
02:07 queued 37s
created
controllers/IndexController.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
         $group = null;
76 76
         $pagination = new Pagination([]);
77
-        if ($model->load(Yii::$app->request->post())){
77
+        if ($model->load(Yii::$app->request->post())) {
78 78
 
79 79
 
80 80
             if ($model->groupID) {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
         }
100 100
 
101
-        if ($model->keyword != ''){
101
+        if ($model->keyword != '') {
102 102
             $searchResultSet = Yii::$app->search->find($model->keyword, $searchOptions);
103 103
 
104 104
             $pagination = new Pagination([
@@ -106,15 +106,15 @@  discard block
 block discarded – undo
106 106
                 'pageSize' => $searchResultSet->pageSize
107 107
             ]);
108 108
 
109
-        }else {
109
+        } else {
110 110
 
111 111
             $limit = $this->module->pageSize;
112 112
 
113
-            if ($model->page > 1){
113
+            if ($model->page > 1) {
114 114
                 $limit = ($model->page * $this->module->pageSize) . ', ' . $this->module->pageSize;
115 115
             }
116 116
 
117
-            if ($model->latitude == null || $model->longitude == null){
117
+            if ($model->latitude == null || $model->longitude == null) {
118 118
                 $user = User::find()->where(['id' => Yii::$app->user->id])->one();
119 119
                 /* @var $user User */
120 120
                 $model->latitude = $user->latitude;
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
             }
123 123
 
124 124
             /* @var $searchResultSet User[] */
125
-            if ($model->latitude != null && $model->longitude != null){
125
+            if ($model->latitude != null && $model->longitude != null) {
126 126
 
127
-                if ($model->distance == null){
127
+                if ($model->distance == null) {
128 128
                     $model->distance = 25;
129 129
                 }
130 130
 
131 131
                 $commandString = 'SELECT *, get_distance_in_miles_between_geo_locations( ' . $model->latitude . ', ' . $model->longitude . ', latitude, longitude) as distance
132
-                    from user WHERE longitude BETWEEN ' . $model->longitude . ' - ' . $model->distance . ' /abs(cos(radians(' . $model->latitude . '))*69) and '. $model->longitude .' + ' . $model->distance . ' /abs(cos(radians(' . $model->latitude . '))*69)
133
-                    and latitude BETWEEN ' . $model->latitude . ' - (' . $model->distance . '/69) and '. $model->latitude . '+(' . $model->distance . '/69) and id != ' . Yii::$app->user->id;
132
+                    from user WHERE longitude BETWEEN ' . $model->longitude . ' - ' . $model->distance . ' /abs(cos(radians(' . $model->latitude . '))*69) and ' . $model->longitude . ' + ' . $model->distance . ' /abs(cos(radians(' . $model->latitude . '))*69)
133
+                    and latitude BETWEEN ' . $model->latitude . ' - (' . $model->distance . '/69) and ' . $model->latitude . '+(' . $model->distance . '/69) and id != ' . Yii::$app->user->id;
134 134
 
135
-                if ($model->page > 1){
135
+                if ($model->page > 1) {
136 136
                     $limit = ($model->page * $this->module->pageSize) . ', ' . $this->module->pageSize;
137
-                }else {
137
+                } else {
138 138
                     $limit = $this->module->pageSize;
139 139
                 }
140 140
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 $searchResultSet = Yii::$app->db->createCommand($commandString)->queryAll();
144 144
 
145 145
                 $instances = [];
146
-                foreach ($searchResultSet as $result){
146
+                foreach ($searchResultSet as $result) {
147 147
                     $modelClass = User::class;
148 148
                     $instance = $modelClass::findOne(['id' => $result['id']]);
149 149
                     $instance->distance = $result['distance'];
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
                 }
152 152
                 $searchResultSet = $instances;
153 153
 
154
-                if (count($searchResultSet) < $this->module->pageSize){
154
+                if (count($searchResultSet) < $this->module->pageSize) {
155 155
 
156 156
                     $users = User::find()->where(['latitude' => null])->limit($this->module->pageSize - count($searchResultSet))->all();
157 157
                     $instances = [];
158
-                    foreach ($users as $user){
158
+                    foreach ($users as $user) {
159 159
                         $modelClass = User::class;
160 160
                         $instance = $modelClass::findOne(['id' => $user->id]);
161 161
                         $instance->distance = "Unknown Distance";
@@ -169,39 +169,39 @@  discard block
 block discarded – undo
169 169
                     'totalCount' => count($searchResultSet),
170 170
                     'pageSize' => $this->module->pageSize
171 171
                 ]);
172
-            }else {
172
+            } else {
173 173
                 $pagination = new Pagination([]);
174 174
             }
175 175
 
176 176
         }
177 177
 
178
-        Event::on(Sidebar::class, Sidebar::EVENT_INIT, function ($event) {
178
+        Event::on(Sidebar::class, Sidebar::EVENT_INIT, function($event) {
179 179
             $event->sender->addWidget(NewMembers::class, [], ['sortOrder' => 10]);
180 180
             $event->sender->addWidget(MemberStatistics::class, [], ['sortOrder' => 20]);
181 181
         });
182 182
 
183 183
         $users = null;
184
-        if ($model->keyword == null){
185
-            if ($model->latitude != null && $model->longitude != null){
184
+        if ($model->keyword == null) {
185
+            if ($model->latitude != null && $model->longitude != null) {
186 186
 
187 187
                 $users = $searchResultSet;
188
-            }else {
188
+            } else {
189 189
                 $users = new SearchResultSet();
190 190
                 $users = $users->getResultInstances();
191 191
             }
192 192
 
193
-        }else {
193
+        } else {
194 194
             $users = $searchResultSet->getResultInstances();
195 195
         }
196 196
 
197
-        if (yii::$app->request->isAjax){
197
+        if (yii::$app->request->isAjax) {
198 198
             return $this->render('members', [
199 199
                 'model' => $model,
200 200
                 'group' => $group,
201 201
                 'users' => $users,
202 202
                 'pagination' => $pagination
203 203
             ]);
204
-        }else {
204
+        } else {
205 205
             return $this->render('members', [
206 206
                 'model' => $model,
207 207
                 'group' => $group,
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
 
213 213
     }
214 214
 
215
-    public function actionUpdatelocation( $lat,  $long){
215
+    public function actionUpdatelocation($lat, $long) {
216 216
 
217 217
         $record = User::find()->where(['id' => Yii::$app->user->id])->one();
218 218
         $record->latitude = $lat;
219 219
         $record->longitude = $long;
220
-        if ($record->save()){
220
+        if ($record->save()) {
221 221
             return true;
222
-        }else {
222
+        } else {
223 223
             return false;
224 224
         }
225 225
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
             'pageSize' => $searchResultSet->pageSize
250 250
         ]);
251 251
 
252
-        Event::on(Sidebar::class, Sidebar::EVENT_INIT, function ($event) {
252
+        Event::on(Sidebar::class, Sidebar::EVENT_INIT, function($event) {
253 253
             $event->sender->addWidget(NewSpaces::class, [], ['sortOrder' => 10]);
254 254
             $event->sender->addWidget(SpaceStatistics::class, [], ['sortOrder' => 20]);
255 255
         });
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 
275 275
         $groups = Group::getDirectoryGroups();
276 276
 
277
-        Event::on(Sidebar::class, Sidebar::EVENT_INIT, function ($event) {
277
+        Event::on(Sidebar::class, Sidebar::EVENT_INIT, function($event) {
278 278
             $event->sender->addWidget(GroupStatistics::class, [], ['sortOrder' => 10]);
279 279
         });
280 280
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                 'pageSize' => $searchResultSet->pageSize
107 107
             ]);
108 108
 
109
-        }else {
109
+        } else {
110 110
 
111 111
             $limit = $this->module->pageSize;
112 112
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
                 if ($model->page > 1){
136 136
                     $limit = ($model->page * $this->module->pageSize) . ', ' . $this->module->pageSize;
137
-                }else {
137
+                } else {
138 138
                     $limit = $this->module->pageSize;
139 139
                 }
140 140
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                     'totalCount' => count($searchResultSet),
170 170
                     'pageSize' => $this->module->pageSize
171 171
                 ]);
172
-            }else {
172
+            } else {
173 173
                 $pagination = new Pagination([]);
174 174
             }
175 175
 
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
             if ($model->latitude != null && $model->longitude != null){
186 186
 
187 187
                 $users = $searchResultSet;
188
-            }else {
188
+            } else {
189 189
                 $users = new SearchResultSet();
190 190
                 $users = $users->getResultInstances();
191 191
             }
192 192
 
193
-        }else {
193
+        } else {
194 194
             $users = $searchResultSet->getResultInstances();
195 195
         }
196 196
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                 'users' => $users,
202 202
                 'pagination' => $pagination
203 203
             ]);
204
-        }else {
204
+        } else {
205 205
             return $this->render('members', [
206 206
                 'model' => $model,
207 207
                 'group' => $group,
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         $record->longitude = $long;
220 220
         if ($record->save()){
221 221
             return true;
222
-        }else {
222
+        } else {
223 223
             return false;
224 224
         }
225 225
 
Please login to merge, or discard this patch.
widgets/Menu.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,6 @@
 block discarded – undo
10 10
 
11 11
 use Yii;
12 12
 use yii\helpers\Url;
13
-
14 13
 use humhub\modules\directory\models\User;
15 14
 
16 15
 /**
Please login to merge, or discard this patch.
views/widgets/views/memberActionsButton.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 if (!Yii::$app->user->isGuest && !$user->isCurrentUser() && Yii::$app->getModule('friendship')->getIsEnabled()) {
23 23
     $friendShipState = Friendship::getStateForUser(Yii::$app->user->getIdentity(), $user);
24 24
     if ($friendShipState === Friendship::STATE_NONE) {
25
-        echo Html::a('<span class="glyphicon glyphicon-plus"></span>&nbsp;&nbsp;' . Yii::t("FriendshipModule.base", "Add Friend"), Url::to(['/friendship/request/add', 'userId' => $user->id]), ['class' => 'btn btn-primary btn-sm','data-ui-loader' => '', 'data-method' => 'POST']);
25
+        echo Html::a('<span class="glyphicon glyphicon-plus"></span>&nbsp;&nbsp;' . Yii::t("FriendshipModule.base", "Add Friend"), Url::to(['/friendship/request/add', 'userId' => $user->id]), ['class' => 'btn btn-primary btn-sm', 'data-ui-loader' => '', 'data-method' => 'POST']);
26 26
     } elseif ($friendShipState === Friendship::STATE_FRIENDS) {
27 27
         echo Html::a('<span class="glyphicon glyphicon-ok"></span>&nbsp;&nbsp;' . Yii::t("FriendshipModule.base", "Friends"), $user->getUrl(), ['class' => 'btn btn-info btn-sm', 'data-ui-loader' => '']);
28 28
     }
Please login to merge, or discard this patch.
Events.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 class Events extends \yii\base\BaseObject
11 11
 {
12
-    public static function directoryAfterInit(){
12
+    public static function directoryAfterInit() {
13 13
         $x = 3;
14 14
     }
15 15
 
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
         $arrayNumber = null;
25 25
         $it = 0;
26 26
         /* @var $sender TopMenu */
27
-        foreach ($event->sender->items as $item){
27
+        foreach ($event->sender->items as $item) {
28 28
             if ($item['label'] == Yii::t('DirectoryModule.base', 'Directory'))
29 29
             {
30 30
                 $arrayNumber = $it;
31 31
             }
32 32
             $it++;
33 33
         }
34
-        $event->sender->items[$arrayNumber]['url'] = Url::to([ "/geolocation/index"]);
34
+        $event->sender->items[$arrayNumber]['url'] = Url::to(["/geolocation/index"]);
35 35
     }
36 36
 
37 37
 
Please login to merge, or discard this patch.
messages/en-US/base.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-  'Geolocation' => '',
5
-  '<strong>Geolocation</strong> configuration' => '',
6
-  'Welcome to the admin only area.' => '',
4
+    'Geolocation' => '',
5
+    '<strong>Geolocation</strong> configuration' => '',
6
+    'Welcome to the admin only area.' => '',
7 7
 ];
Please login to merge, or discard this patch.