8
8
use \BNETDocs \Libraries \Exceptions \UserProfileNotFoundException ;
9
9
use \BNETDocs \Libraries \NewsPost ;
10
10
use \BNETDocs \Libraries \Packet ;
11
+ use \BNETDocs \Libraries \Server ;
11
12
use \BNETDocs \Libraries \User as UserLib ;
12
13
use \BNETDocs \Libraries \UserProfile ;
13
14
use \BNETDocs \Models \User \View as UserViewModel ;
@@ -133,7 +134,9 @@ protected function getUserInfo(UserViewModel &$model) {
133
134
$ model ->packets = ($ model ->sum_packets ?
134
135
Packet::getPacketsByUserId ($ model ->user_id ) : null
135
136
);
136
- $ model ->servers = ($ model ->sum_servers ? true : null );
137
+ $ model ->servers = ($ model ->sum_servers ?
138
+ Server::getServersByUserId ($ model ->user_id ) : null
139
+ );
137
140
138
141
// Process documents
139
142
if ($ model ->documents ) {
@@ -158,15 +161,15 @@ protected function getUserInfo(UserViewModel &$model) {
158
161
159
162
// Process news posts
160
163
if ($ model ->news_posts ) {
161
- // Alphabetically sort the documents
164
+ // Alphabetically sort the news posts
162
165
usort ($ model ->news_posts , function ($ a , $ b ){
163
166
$ a1 = $ a ->getTitle ();
164
167
$ b1 = $ b ->getTitle ();
165
168
if ($ a1 == $ b1 ) return 0 ;
166
169
return ($ a1 < $ b1 ? -1 : 1 );
167
170
});
168
171
169
- // Remove documents that are not published
172
+ // Remove news posts that are not published
170
173
$ i = count ($ model ->news_posts ) - 1 ;
171
174
while ($ i >= 0 ) {
172
175
if (!($ model ->news_posts [$ i ]->getOptionsBitmask ()
@@ -179,15 +182,15 @@ protected function getUserInfo(UserViewModel &$model) {
179
182
180
183
// Process packets
181
184
if ($ model ->packets ) {
182
- // Alphabetically sort the documents
185
+ // Alphabetically sort the packets
183
186
usort ($ model ->packets , function ($ a , $ b ){
184
187
$ a1 = $ a ->getPacketName ();
185
188
$ b1 = $ b ->getPacketName ();
186
189
if ($ a1 == $ b1 ) return 0 ;
187
190
return ($ a1 < $ b1 ? -1 : 1 );
188
191
});
189
192
190
- // Remove documents that are not published
193
+ // Remove packets that are not published
191
194
$ i = count ($ model ->packets ) - 1 ;
192
195
while ($ i >= 0 ) {
193
196
if (!($ model ->packets [$ i ]->getOptionsBitmask ()
@@ -198,6 +201,17 @@ protected function getUserInfo(UserViewModel &$model) {
198
201
}
199
202
}
200
203
204
+ // Process servers
205
+ if ($ model ->servers ) {
206
+ // Alphabetically sort the servers
207
+ usort ($ model ->servers , function ($ a , $ b ){
208
+ $ a1 = $ a ->getName ();
209
+ $ b1 = $ b ->getName ();
210
+ if ($ a1 == $ b1 ) return 0 ;
211
+ return ($ a1 < $ b1 ? -1 : 1 );
212
+ });
213
+ }
214
+
201
215
}
202
216
203
217
}
0 commit comments