@@ -22,7 +22,7 @@ |
||
| 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> ' . 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> ' . 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> ' . Yii::t("FriendshipModule.base", "Friends"), $user->getUrl(), ['class' => 'btn btn-info btn-sm', 'data-ui-loader' => '']); |
| 28 | 28 | } |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | return (Group::find()->where(['show_at_directory' => 1])->count() != 0); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public function getPath(){ |
|
| 70 | + public function getPath() { |
|
| 71 | 71 | return "protected/modules/geolocation"; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | { |
| 13 | 13 | $table = Yii::$app->db->getTableSchema('user'); |
| 14 | 14 | |
| 15 | - if (isset($table->columns['longitude'])){ |
|
| 15 | + if (isset($table->columns['longitude'])) { |
|
| 16 | 16 | $this->dropColumn('user', 'longitude'); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - if (isset($table->columns['latitude'])){ |
|
| 19 | + if (isset($table->columns['latitude'])) { |
|
| 20 | 20 | $this->dropColumn('user', 'latitude'); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -18,11 +18,11 @@ |
||
| 18 | 18 | { |
| 19 | 19 | $table = Yii::$app->db->getTableSchema('user'); |
| 20 | 20 | |
| 21 | - if (!isset($table->columns['longitude'])){ |
|
| 21 | + if (!isset($table->columns['longitude'])) { |
|
| 22 | 22 | $this->addColumn('user', 'longitude', 'string'); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - if (!isset($table->columns['latitude'])){ |
|
| 25 | + if (!isset($table->columns['latitude'])) { |
|
| 26 | 26 | $this->addColumn('user', 'latitude', 'string'); |
| 27 | 27 | } |
| 28 | 28 | $this->db->createCommand('DROP FUNCTION IF EXISTS `get_distance_in_miles_between_geo_locations`')->execute(); |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | return $dataProvider; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - $newQuery = new MySQLCommand('geolocatioin',Module::getInstance()); |
|
| 62 | + $newQuery = new MySQLCommand('geolocatioin', Module::getInstance()); |
|
| 63 | 63 | |
| 64 | 64 | // grid filtering conditions |
| 65 | 65 | $query->andFilterWhere([ |
@@ -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> |
@@ -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 | |
@@ -22,7 +22,7 @@ |
||
| 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> ' . 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> ' . 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> ' . Yii::t("FriendshipModule.base", "Friends"), $user->getUrl(), ['class' => 'btn btn-info btn-sm', 'data-ui-loader' => '']); |
| 28 | 28 | } |