@@ -78,10 +78,10 @@ |
||
| 78 | 78 | <div class="media-body"> |
| 79 | 79 | <h4 class="media-heading"> |
| 80 | 80 | <?= Html::containerLink($user); ?> |
| 81 | - <div id="distance"><?php if (is_numeric($user->distance)){ |
|
| 81 | + <div id="distance"><?php if (is_numeric($user->distance)) { |
|
| 82 | 82 | echo round($user->distance) . " miles.</div>"; |
| 83 | - }else { |
|
| 84 | - echo $user->distance ."</div>"; |
|
| 83 | + } else { |
|
| 84 | + echo $user->distance . "</div>"; |
|
| 85 | 85 | } ?> |
| 86 | 86 | <?= UserGroupList::widget(['user' => $user]); ?> |
| 87 | 87 | </h4> |
@@ -21,8 +21,11 @@ discard block |
||
| 21 | 21 | <div class="panel-heading"> |
| 22 | 22 | <?php if ($group === null) : ?> |
| 23 | 23 | <?= Yii::t('DirectoryModule.base', '<strong>Member</strong> directory'); ?> |
| 24 | - <?php else: ?> |
|
| 25 | - <?= Yii::t('DirectoryModule.base', '<strong>Group</strong> members - {group}', ['{group}' => Html::encode($group->name)]); ?> |
|
| 24 | + <?php else { |
|
| 25 | + : ?> |
|
| 26 | + <?= Yii::t('DirectoryModule.base', '<strong>Group</strong> members - {group}', ['{group}' => Html::encode($group->name)]); |
|
| 27 | +} |
|
| 28 | +?> |
|
| 26 | 29 | <?php endif; ?> |
| 27 | 30 | </div> |
| 28 | 31 | |
@@ -80,7 +83,7 @@ discard block |
||
| 80 | 83 | <?= Html::containerLink($user); ?> |
| 81 | 84 | <div id="distance"><?php if (is_numeric($user->distance)){ |
| 82 | 85 | echo round($user->distance) . " miles.</div>"; |
| 83 | - }else { |
|
| 86 | + } else { |
|
| 84 | 87 | echo $user->distance ."</div>"; |
| 85 | 88 | } ?> |
| 86 | 89 | <?= UserGroupList::widget(['user' => $user]); ?> |
@@ -10,9 +10,7 @@ |
||
| 10 | 10 | echo StreamViewer::widget([ |
| 11 | 11 | 'streamAction' => '//directory/directory/stream', |
| 12 | 12 | 'messageStreamEmpty' => (!Yii::$app->user->isGuest) ? |
| 13 | - Yii::t('DirectoryModule.base', '<b>Nobody wrote something yet.</b><br>Make the beginning and post something...') : |
|
| 14 | - Yii::t('DirectoryModule.base', '<b>There are no profile posts yet!</b>'), |
|
| 13 | + Yii::t('DirectoryModule.base', '<b>Nobody wrote something yet.</b><br>Make the beginning and post something...') : Yii::t('DirectoryModule.base', '<b>There are no profile posts yet!</b>'), |
|
| 15 | 14 | 'messageStreamEmptyCss' => (!Yii::$app->user->isGuest) ? |
| 16 | - 'placeholder-empty-stream' : |
|
| 17 | - '', |
|
| 15 | + 'placeholder-empty-stream' : '', |
|
| 18 | 16 | ]); |
@@ -74,7 +74,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -106,7 +106,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -1,8 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | - 'Geolocation' => '', |
|
| 5 | - 'Directory' => '', |
|
| 6 | - '<strong>Geolocation</strong> configuration' => '', |
|
| 7 | - 'Welcome to the admin only area.' => '', |
|
| 4 | + 'Geolocation' => '', |
|
| 5 | + 'Directory' => '', |
|
| 6 | + '<strong>Geolocation</strong> configuration' => '', |
|
| 7 | + 'Welcome to the admin only area.' => '', |
|
| 8 | 8 | ]; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class Events |
| 11 | 11 | { |
| 12 | - public static function directoryAfterInit(){ |
|
| 12 | + public static function directoryAfterInit() { |
|
| 13 | 13 | $x = 3; |
| 14 | 14 | } |
| 15 | 15 | /** |
@@ -22,14 +22,14 @@ discard block |
||
| 22 | 22 | $arrayNumber = null; |
| 23 | 23 | $it = 0; |
| 24 | 24 | /* @var $sender TopMenu */ |
| 25 | - foreach ($event->sender->items as $item){ |
|
| 26 | - if ($item['label'] == Yii::t('GeolocationModule.base', 'Directory')){ |
|
| 25 | + foreach ($event->sender->items as $item) { |
|
| 26 | + if ($item['label'] == Yii::t('GeolocationModule.base', 'Directory')) { |
|
| 27 | 27 | $arrayNumber = $it; |
| 28 | 28 | } |
| 29 | 29 | $it++; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - $event->sender->items[$arrayNumber]['url'] = Url::to([ "/geolocation/index"]); |
|
| 32 | + $event->sender->items[$arrayNumber]['url'] = Url::to(["/geolocation/index"]); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |