Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4141 | Rev 4858 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 4141 Rev 4857
Línea 20... Línea 20...
20
use LeadersLinked\Model\ChatGroupMessage;
20
use LeadersLinked\Model\ChatGroupMessage;
21
use LeadersLinked\Model\ChatGroupUserMessage;
21
use LeadersLinked\Model\ChatGroupUserMessage;
22
use LeadersLinked\Model\Connection;
22
use LeadersLinked\Model\Connection;
23
use LeadersLinked\Model\ChatGroup;
23
use LeadersLinked\Model\ChatGroup;
24
use LeadersLinked\Model\ChatUser;
24
use LeadersLinked\Model\ChatUser;
-
 
25
use LeadersLinked\Model\Network;
25
use LeadersLinked\Form\Chat\CreateGroupForm;
26
use LeadersLinked\Form\Chat\CreateGroupForm;
26
use LeadersLinked\Mapper\ChatGroupUserMapper;
27
use LeadersLinked\Mapper\ChatGroupUserMapper;
27
use LeadersLinked\Model\ChatGroupUser;
28
use LeadersLinked\Model\ChatGroupUser;
28
use LeadersLinked\Mapper\UtilMapper;
29
use LeadersLinked\Mapper\UtilMapper;
29
use LeadersLinked\Library\Zoom;
30
use LeadersLinked\Library\Zoom;
Línea 32... Línea 33...
32
use LeadersLinked\Mapper\ZoomMeetingMapper;
33
use LeadersLinked\Mapper\ZoomMeetingMapper;
33
use LeadersLinked\Model\ZoomMeetingUser;
34
use LeadersLinked\Model\ZoomMeetingUser;
34
use LeadersLinked\Model\CalendarEvent;
35
use LeadersLinked\Model\CalendarEvent;
35
use LeadersLinked\Mapper\CalendarEventMapper;
36
use LeadersLinked\Mapper\CalendarEventMapper;
36
use LeadersLinked\Mapper\ZoomMeetingUserMapper;
37
use LeadersLinked\Mapper\ZoomMeetingUserMapper;
-
 
38
use LeadersLinked\Mapper\QueryMapper;
Línea 37... Línea 39...
37
 
39
 
38
 
40
 
Línea 88... Línea 90...
88
    public function indexAction()
90
    public function indexAction()
89
    {
91
    {
90
        $currentUserPlugin = $this->plugin('currentUserPlugin');
92
        $currentUserPlugin = $this->plugin('currentUserPlugin');
91
        $currentUser = $currentUserPlugin->getUser();
93
        $currentUser = $currentUserPlugin->getUser();
Línea -... Línea 94...
-
 
94
        
-
 
95
        $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
-
 
96
        $currentNetwork = $currentNetworkPlugin->getNetwork();
-
 
97
        
-
 
98
        $userIds = [];
-
 
99
        if($currentNetwork->relationship_user_mode == Network::RELATIONSHIP_USER_MODE_USER_2_USER)  {
-
 
100
        
92
        
101
        
93
        $connectionMapper = ConnectionMapper:: getInstance($this->adapter);
102
            $connectionMapper = ConnectionMapper:: getInstance($this->adapter);
-
 
103
            $userIds = $connectionMapper->fetchAllConnectionsByUserReturnIds( $currentUser->id );
-
 
104
            
-
 
105
           
-
 
106
        } else {
-
 
107
            
-
 
108
            $chatUserMapper = ChatUserMapper::getInstance($this->adapter);
-
 
109
            $records = $chatUserMapper->fetchAllByUserId($currentUser->id);
-
 
110
            
-
 
111
            foreach($records as $record)
-
 
112
            {
-
 
113
                if($record->user_id1 == $currentUser->id) {
-
 
114
                    array_push($userIds, $record->user_id2);
-
 
115
                } else {
-
 
116
                    array_push($userIds, $record->user_id1);
-
 
117
                }
-
 
118
            }
-
 
119
            
-
 
120
            
Línea 94... Línea 121...
94
        $connectionIds = $connectionMapper->fetchAllConnectionsByUserReturnIds( $currentUser->id );
121
        }
95
        
122
        
Línea 96... Línea 123...
96
        $contacts = [];
123
        $contacts = [];
97
        if($connectionIds) {
124
        if($userIds) {
Línea 98... Línea 125...
98
            
125
            
99
            $utilMapper = UtilMapper::getInstance($this->adapter);
126
            //$utilMapper = UtilMapper::getInstance($this->adapter);
Línea 100... Línea 127...
100
            $now = $utilMapper->getDatebaseNow();
127
            //$now = $utilMapper->getDatebaseNow();
101
            
128
            
102
            $userMapper = UserMapper::getInstance($this->adapter);
129
            $userMapper = UserMapper::getInstance($this->adapter);
103
            $users = $userMapper->fetchAllByIds($connectionIds);
130
            $users = $userMapper->fetchAllByIds($userIds);
Línea 224... Línea 251...
224
     * ]
251
     * ]
225
     * @return \Laminas\View\Model\JsonModel
252
     * @return \Laminas\View\Model\JsonModel
226
     */
253
     */
227
    public function heartBeatAction()
254
    public function heartBeatAction()
228
    {
255
    {
-
 
256
        $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
257
        $currentUser = $currentUserPlugin->getUser();
-
 
258
        
-
 
259
        $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
-
 
260
        $currentNetwork = $currentNetworkPlugin->getNetwork();
-
 
261
        
-
 
262
        
229
        $request    = $this->getRequest();
263
        $request    = $this->getRequest();
230
        if($request->isGet()) {
264
        if($request->isGet()) {
231
            $utilMapper = UtilMapper::getInstance($this->adapter);
265
            $utilMapper = UtilMapper::getInstance($this->adapter);
232
            $now = $utilMapper->getDatebaseNow();
266
            $now = $utilMapper->getDatebaseNow();
Línea 233... Línea -...
233
 
-
 
234
            $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
-
 
267
 
Línea 235... Línea 268...
235
            $currentUser = $currentUserPlugin->getUser();
268
 
236
 
269
 
Línea 237... Línea 270...
237
            $userMapper = UserMapper::getInstance($this->adapter);
270
            $userMapper = UserMapper::getInstance($this->adapter);
Línea 333... Línea 366...
333
            }
366
            }
Línea 334... Línea 367...
334
            
367
            
335
            $chatUserMapper = ChatUserMapper::getInstance($this->adapter);
368
            $chatUserMapper = ChatUserMapper::getInstance($this->adapter);
Línea -... Línea 369...
-
 
369
            $chatMessageMapper = ChatMessageMapper::getInstance($this->adapter);
-
 
370
            
-
 
371
            
-
 
372
            $userIds = [];
336
            $chatMessageMapper = ChatMessageMapper::getInstance($this->adapter);
373
            if($currentNetwork->relationship_user_mode == Network::RELATIONSHIP_USER_MODE_USER_2_USER)  {
337
            
374
            
-
 
375
                $connectionMapper = ConnectionMapper::getInstance($this->adapter);
-
 
376
                $userIds = $connectionMapper->fetchAllConnectionsByUserReturnIds($currentUser->id);
-
 
377
                
-
 
378
            } else {
-
 
379
                
-
 
380
                $records = $chatUserMapper->fetchAllByUserId($currentUser->id);
-
 
381
                foreach($records as $record)
-
 
382
                {
-
 
383
                    if($record->user_id1 == $currentUser->id) {
-
 
384
                        array_push($userIds, $record->user_id2);
-
 
385
                    } else {
-
 
386
                        array_push($userIds, $record->user_id1);
-
 
387
                    }
-
 
388
                }
Línea 338... Línea 389...
338
            $connectionMapper = ConnectionMapper::getInstance($this->adapter);
389
                
Línea 339... Línea 390...
339
            $connectionIds = $connectionMapper->fetchAllConnectionsByUserReturnIds($currentUser->id);
390
            }
340
 
391
 
Línea 341... Línea 392...
341
            
392
            
342
 
393
 
343
            if ($connectionIds) {
394
            if ($userIds) {
344
                 
395
                 
Línea 576... Línea 627...
576
     * ]
627
     * ]
577
     * @return \Laminas\View\Model\JsonModel
628
     * @return \Laminas\View\Model\JsonModel
578
     */
629
     */
579
    public function addUserToGroupAction()
630
    public function addUserToGroupAction()
580
    {
631
    {
-
 
632
        $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
633
        $currentUser = $currentUserPlugin->getUser();
-
 
634
        
-
 
635
        $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
-
 
636
        $currentNetwork = $currentNetworkPlugin->getNetwork();
-
 
637
        
-
 
638
        
-
 
639
        
581
        $request    = $this->getRequest();
640
        $request    = $this->getRequest();
582
        if($request->isPost()) {
641
        if($request->isPost()) {
583
            $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
584
            $currentUser = $currentUserPlugin->getUser();
-
 
-
 
642
            
Línea 585... Línea 643...
585
    
643
    
586
            $group_id   = $this->params()->fromRoute('group_id');
644
            $group_id   = $this->params()->fromRoute('group_id');
Línea 587... Línea 645...
587
            $user_id    = $this->params()->fromPost('uid');
645
            $user_id    = $this->params()->fromPost('uid');
Línea 628... Línea 686...
628
                    'data' => 'ERROR_CHAT_I_CAN_NOT_ADD_HIMSELF'
686
                    'data' => 'ERROR_CHAT_I_CAN_NOT_ADD_HIMSELF'
629
                ]);
687
                ]);
630
            }
688
            }
Línea -... Línea 689...
-
 
689
                        
-
 
690
            
-
 
691
            if($currentNetwork->relationship_user_mode == Network::RELATIONSHIP_USER_MODE_USER_2_USER)  {
631
                        
692
                
632
            
693
                
633
            $connectionMapper = ConnectionMapper::getInstance($this->adapter);
694
                $connectionMapper = ConnectionMapper::getInstance($this->adapter);
-
 
695
                $connection = $connectionMapper->fetchOneByUserId1AndUserId2($currentUser->id, $user->id);
-
 
696
                if(!$connection) {
-
 
697
                    return new JsonModel([
-
 
698
                        'success' => false,
-
 
699
                        'data' => 'ERROR_THIS_USER_IS_NOT_A_CONNECTION'
-
 
700
                    ]);
-
 
701
                }
634
            $connection = $connectionMapper->fetchOneByUserId1AndUserId2($currentUser->id, $user->id);
702
            } else {
635
            if(!$connection) {
703
                if($currentUser->network_id != $user->network_id) {
636
                return new JsonModel([
704
                    return new JsonModel([
-
 
705
                        'success' => false,
637
                    'success' => false,
706
                        'data' => 'ERROR_THIS_USER_IS_NOT_A_CONNECTION'
638
                    'data' => 'ERROR_THIS_USER_IS_NOT_A_CONNECTION'
707
                    ]);
Línea 639... Línea 708...
639
                ]);
708
                }
640
            }
709
            }
641
                            
710
                            
Línea 1087... Línea 1156...
1087
     * ]
1156
     * ]
1088
     * @return \Laminas\View\Model\JsonModel
1157
     * @return \Laminas\View\Model\JsonModel
1089
     */
1158
     */
1090
    public function getAllMessagesAction()
1159
    public function getAllMessagesAction()
1091
    {
1160
    {
-
 
1161
        $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
1162
        $currentUser = $currentUserPlugin->getUser();
-
 
1163
        
-
 
1164
        $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
-
 
1165
        $currentNetwork = $currentNetworkPlugin->getNetwork();
-
 
1166
        
Línea 1092... Línea 1167...
1092
        
1167
        
1093
        $request    = $this->getRequest();
1168
        $request    = $this->getRequest();
1094
        if($request->isGet()) {
-
 
1095
            $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
-
 
1169
        if($request->isGet()) {
Línea 1096... Línea 1170...
1096
            $currentUser = $currentUserPlugin->getUser();
1170
 
1097
            
1171
            
Línea 1122... Línea 1196...
1122
                        'data' => 'ERROR_USER_NOT_FOUND'
1196
                        'data' => 'ERROR_USER_NOT_FOUND'
1123
                    ]);
1197
                    ]);
1124
                }
1198
                }
Línea 1125... Línea -...
1125
                
-
 
1126
                
-
 
1127
                
-
 
1128
                
-
 
-
 
1199
                
1129
                
1200
                
1130
 
1201
                if($currentNetwork->relationship_user_mode == Network::RELATIONSHIP_USER_MODE_USER_2_USER)  {
1131
                $connectionMapper = ConnectionMapper::getInstance($this->adapter);
1202
                    $connectionMapper = ConnectionMapper::getInstance($this->adapter);
1132
                $connection = $connectionMapper->fetchOneByUserId1AndUserId2($currentUser->id, $user->id);
1203
                    $connection = $connectionMapper->fetchOneByUserId1AndUserId2($currentUser->id, $user->id);
1133
                if(!$connection || $connection->status != Connection::STATUS_ACCEPTED) {
1204
                    if(!$connection || $connection->status != Connection::STATUS_ACCEPTED) {
1134
                    
1205
                        
1135
                    return new JsonModel([
1206
                        return new JsonModel([
-
 
1207
                            'success' => false,
-
 
1208
                            'data' => 'ERROR_THIS_USER_IS_NOT_A_CONNECTION'
1136
                        'success' => false,
1209
                        ]);
-
 
1210
                        
-
 
1211
                    }
1137
                        'data' => 'ERROR_THIS_USER_IS_NOT_A_CONNECTION'
1212
                } else {
-
 
1213
                    if($currentNetwork->network_id != $user->network_id) {
-
 
1214
                        
-
 
1215
                        return new JsonModel([
-
 
1216
                            'success' => false,
-
 
1217
                            'data' => 'ERROR_THIS_USER_IS_NOT_A_CONNECTION'
1138
                    ]);
1218
                        ]);
-
 
1219
                    }
-
 
1220
                }
1139
                    
1221
               
1140
                }
1222
                
1141
                $chatUserMapper = ChatUserMapper::getInstance($this->adapter);
1223
                $chatUserMapper = ChatUserMapper::getInstance($this->adapter);
1142
                $chatUser = $chatUserMapper->fetchOneByUserId1AndUserId2($currentUser->id, $user->id);
1224
                $chatUser = $chatUserMapper->fetchOneByUserId1AndUserId2($currentUser->id, $user->id);
1143
                if(!$chatUser) {
1225
                if(!$chatUser) {
Línea 1208... Línea 1290...
1208
     * ]
1290
     * ]
1209
     * @return \Laminas\View\Model\JsonModel
1291
     * @return \Laminas\View\Model\JsonModel
1210
     */
1292
     */
1211
    public function sendAction()
1293
    public function sendAction()
1212
    {
1294
    {
-
 
1295
        $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
1296
        $currentUser = $currentUserPlugin->getUser();
-
 
1297
        
-
 
1298
        $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
-
 
1299
        $currentNetwork = $currentNetworkPlugin->getNetwork();
-
 
1300
        
Línea 1213... Línea 1301...
1213
        
1301
        
1214
        $request    = $this->getRequest();
1302
        $request    = $this->getRequest();
1215
        if($request->isPost()) {
1303
        if($request->isPost()) {
1216
            $id         = $this->params()->fromRoute('id');
1304
            $id         = $this->params()->fromRoute('id');
Línea 1221... Línea 1309...
1221
                    'success' => false,
1309
                    'success' => false,
1222
                    'data' => 'ERROR_PARAMETERS_ARE_INVALID'
1310
                    'data' => 'ERROR_PARAMETERS_ARE_INVALID'
1223
                ]);
1311
                ]);
1224
            } 
1312
            } 
Línea 1225... Línea -...
1225
            
-
 
1226
            $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
-
 
1313
            
Línea 1227... Línea 1314...
1227
            $currentUser = $currentUserPlugin->getUser();
1314
 
1228
            
1315
            
1229
            $userMapper = UserMapper::getInstance($this->adapter);
1316
            $userMapper = UserMapper::getInstance($this->adapter);
1230
            $sender_result = $userMapper->fetchOne($currentUser->id);
1317
            $sender_result = $userMapper->fetchOne($currentUser->id);
Línea 1332... Línea 1419...
1332
                        'success' => false,
1419
                        'success' => false,
1333
                        'data' => 'ERROR_USER_NOT_FOUND'
1420
                        'data' => 'ERROR_USER_NOT_FOUND'
1334
                    ]);
1421
                    ]);
1335
                }
1422
                }
Línea -... Línea 1423...
-
 
1423
                
Línea -... Línea 1424...
-
 
1424
                if($currentNetwork->relationship_user_mode == Network::RELATIONSHIP_USER_MODE_USER_2_USER)  {
1336
                
1425
                
1337
                
1426
                
1338
                $connectionMapper = ConnectionMapper::getInstance($this->adapter);
1427
                    $connectionMapper = ConnectionMapper::getInstance($this->adapter);
1339
                $connection = $connectionMapper->fetchOneByUserId1AndUserId2($currentUser->id, $user->id);
1428
                    $connection = $connectionMapper->fetchOneByUserId1AndUserId2($currentUser->id, $user->id);
1340
                if(!$connection || $connection->status != Connection::STATUS_ACCEPTED) {
1429
                    if(!$connection || $connection->status != Connection::STATUS_ACCEPTED) {
1341
                    
1430
                        
1342
                    return new JsonModel([
1431
                        return new JsonModel([
1343
                        'success' => false,
1432
                            'success' => false,
1344
                        'data' => 'ERROR_THIS_USER_IS_NOT_A_CONNECTION'
1433
                            'data' => 'ERROR_THIS_USER_IS_NOT_A_CONNECTION'
-
 
1434
                        ]);
-
 
1435
                        
-
 
1436
                    }
-
 
1437
                } else {
-
 
1438
                    if($currentUser->network_id != $user->network_id) {
-
 
1439
                        return new JsonModel([
-
 
1440
                            'success' => false,
-
 
1441
                            'data' => 'ERROR_THIS_USER_IS_NOT_A_CONNECTION'
1345
                    ]);
1442
                        ]);
1346
                    
1443
                    }
1347
                }
1444
                }
1348
                $chatUserMapper = ChatUserMapper::getInstance($this->adapter);
1445
                $chatUserMapper = ChatUserMapper::getInstance($this->adapter);
1349
                $chatUser = $chatUserMapper->fetchOneByUserId1AndUserId2($currentUser->id, $user->id);
1446
                $chatUser = $chatUserMapper->fetchOneByUserId1AndUserId2($currentUser->id, $user->id);
Línea 1453... Línea 1550...
1453
     * ]
1550
     * ]
1454
     * @return \Laminas\View\Model\JsonModel
1551
     * @return \Laminas\View\Model\JsonModel
1455
     */
1552
     */
1456
    public function contactAvailableGroupListAction()
1553
    public function contactAvailableGroupListAction()
1457
    {
1554
    {
-
 
1555
        $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
1556
        $currentUser = $currentUserPlugin->getUser();
-
 
1557
        
-
 
1558
        $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
-
 
1559
        $currentNetwork = $currentNetworkPlugin->getNetwork();
-
 
1560
        
-
 
1561
        
1458
        $request    = $this->getRequest();
1562
        $request    = $this->getRequest();
1459
        if($request->isGet()) {
1563
        if($request->isGet()) {
1460
            $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
1461
            $currentUser = $currentUserPlugin->getUser();
-
 
-
 
1564
 
Línea 1462... Línea 1565...
1462
            
1565
            
1463
            $id = $this->params()->fromRoute('group_id');
1566
            $id = $this->params()->fromRoute('group_id');
1464
            if(!$id) {
1567
            if(!$id) {
1465
                return new JsonModel([
1568
                return new JsonModel([
Línea 1495... Línea 1598...
1495
            $contacts = $chatGroupUserMapper->fetchAllByGroupId($chatGroup->id);
1598
            $contacts = $chatGroupUserMapper->fetchAllByGroupId($chatGroup->id);
1496
            foreach($contacts as $contact) 
1599
            foreach($contacts as $contact) 
1497
            {
1600
            {
1498
                array_push($contact_ids, $contact->user_id);
1601
                array_push($contact_ids, $contact->user_id);
1499
            }
1602
            }
-
 
1603
            
-
 
1604
            $user_ids = [];
-
 
1605
            if($currentNetwork->relationship_user_mode == Network::RELATIONSHIP_USER_MODE_USER_2_USER)  {
Línea -... Línea 1606...
-
 
1606
                
-
 
1607
            
1500
                
1608
            
1501
            $connectionMapper = ConnectionMapper::getInstance($this->adapter);
1609
                $connectionMapper = ConnectionMapper::getInstance($this->adapter);
-
 
1610
                $user_ids = $connectionMapper->fetchAllConnectionsByUserReturnIds($currentUser->id);
-
 
1611
   
-
 
1612
            } else {
-
 
1613
                if($currentNetwork->default == Network::DEFAULT_YES) {
-
 
1614
                    $user_ids = $userMapper->fetchAllIdsByDefaultNetworkId($currentNetwork->id, $currentUser->id);
-
 
1615
                } else {
-
 
1616
                    $user_ids = $userMapper->fetchAllIdsByNonDefaultNetworkId($currentNetwork->id, $currentUser->id);
-
 
1617
                }
-
 
1618
            }
1502
            $connection_ids = $connectionMapper->fetchAllConnectionsByUserReturnIds($currentUser->id);
1619
            
1503
            $connection_ids = array_filter($connection_ids, function($var) use ( $contact_ids) {
1620
            $user_ids = array_filter($user_ids, function($var) use ( $contact_ids) {
1504
                return !in_array($var, $contact_ids); 
1621
                return !in_array($var, $contact_ids);
Línea 1505... Línea 1622...
1505
            });
1622
            });
1506
                
1623
                
1507
                
1624
                
1508
            $items = [];
1625
            $items = [];
1509
            foreach ($connection_ids as $connection_id)
1626
            foreach ($user_ids as $user_id)
1510
            {
1627
            {
1511
                $user = $userMapper->fetchOne($connection_id);
1628
                $user = $userMapper->fetchOne($user_id);
Línea 1512... Línea 1629...
1512
                if (! $user) {
1629
                if (! $user) {
Línea 1527... Línea 1644...
1527
                    'image'     => $image,
1644
                    'image'     => $image,
1528
                    'online'    => $user->online ? 1 : 0,
1645
                    'online'    => $user->online ? 1 : 0,
1529
                ]);
1646
                ]);
1530
            } 
1647
            } 
Línea -... Línea 1648...
-
 
1648
            
-
 
1649
            usort($items, function($a, $b) {
-
 
1650
                return $a['name'] <=> $b['name'];
-
 
1651
            }); 
Línea 1531... Línea 1652...
1531
            
1652
            
Línea 1532... Línea 1653...
1532
            
1653
            
Línea 2482... Línea 2603...
2482
        }
2603
        }
Línea 2483... Línea 2604...
2483
        
2604
        
2484
        return new JsonModel($response);
2605
        return new JsonModel($response);
Línea -... Línea 2606...
-
 
2606
    }
-
 
2607
    
-
 
2608
    public function usersAction()
-
 
2609
    {
-
 
2610
        $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
2611
        $currentUser = $currentUserPlugin->getUser();
-
 
2612
        
-
 
2613
        $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
-
 
2614
        $currentNetwork = $currentNetworkPlugin->getNetwork();
-
 
2615
        
-
 
2616
        $request = $this->getRequest();
-
 
2617
        if($request->isGet()) {
-
 
2618
            
-
 
2619
            $items = [];
-
 
2620
            
-
 
2621
            
-
 
2622
            $search = trim(filter_var($this->params()->fromQuery('search', ''), FILTER_SANITIZE_STRING));
-
 
2623
            if(strlen($search) >= 3) {
-
 
2624
                $user_ids = [];
-
 
2625
                
-
 
2626
                $userMapper = UserMapper::getInstance($this->adapter);
-
 
2627
                
-
 
2628
                
-
 
2629
                if($currentNetwork->relationship_user_mode == Network::RELATIONSHIP_USER_MODE_USER_2_USER)  {
-
 
2630
                    
-
 
2631
                    $connectionMapper = ConnectionMapper::getInstance($this->adapter);
-
 
2632
                    $user_ids = $connectionMapper->fetchAllConnectionsByUserReturnIds($currentUser->id);   
-
 
2633
                    
-
 
2634
                    
-
 
2635
                    
-
 
2636
                    
-
 
2637
                } else {
-
 
2638
                    if($currentNetwork->default == Network::DEFAULT_YES) {
-
 
2639
                        $user_ids = $userMapper->fetchAllIdsByDefaultNetworkId($currentNetwork->id, $currentUser->id);
-
 
2640
                    } else {
-
 
2641
                        $user_ids = $userMapper->fetchAllIdsByNonDefaultNetworkId($currentNetwork->id, $currentUser->id);
-
 
2642
                    }
-
 
2643
                    
-
 
2644
                }
-
 
2645
                
-
 
2646
                
-
 
2647
                $items = [];
-
 
2648
                $records = $userMapper->fetchAllByIdsAndSearch($user_ids, $search, $currentUser->id);
-
 
2649
                
-
 
2650
                foreach($records as $record)
-
 
2651
                {
-
 
2652
                    $items[ $this->url()->fromRoute('chat/send', ['id' => $record->uuid]) ] = trim($record->first_name .  '  ' . $record->last_name) . ' (' . $record->email . ')';
-
 
2653
                }
-
 
2654
   
-
 
2655
    
-
 
2656
                
-
 
2657
            }
-
 
2658
            
-
 
2659
            $response = [
-
 
2660
                'success' => true,
-
 
2661
                'data' => $items
-
 
2662
            ];
-
 
2663
            
-
 
2664
            
-
 
2665
        } else {
-
 
2666
            $response = [
-
 
2667
                'success' => false,
-
 
2668
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
-
 
2669
            ];
-
 
2670
        }
-
 
2671
        
-
 
2672
        return new JsonModel($response);
-
 
2673
    }
2485
    }
2674
    
2486
    
2675
    
2487
    public function zoomAction()
2676
    public function zoomAction()
2488
    {
2677
    {
2489
        $request = $this->getRequest();
2678
        $request = $this->getRequest();