Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 278 Rev 281
Línea 67... Línea 67...
67
use LeadersLinked\Model\UserBlocked;
67
use LeadersLinked\Model\UserBlocked;
68
use LeadersLinked\Library\Storage;
68
use LeadersLinked\Library\Storage;
Línea 69... Línea 69...
69
 
69
 
70
class HelperController extends AbstractActionController
70
class HelperController extends AbstractActionController
-
 
71
{
-
 
72
    const _USE_S3 = false;
71
{
73
    
72
    /**
74
    /**
73
     *
75
     *
74
     * @var \Laminas\Db\Adapter\AdapterInterface
76
     * @var \Laminas\Db\Adapter\AdapterInterface
75
     */
77
     */
Línea 270... Línea 272...
270
            $select->where->in('u.usertype_id', [UserType::ADMIN, UserType::USER]);
272
            $select->where->in('u.usertype_id', [UserType::ADMIN, UserType::USER]);
271
            $select->order(['first_name', 'last_name']);
273
            $select->order(['first_name', 'last_name']);
Línea 272... Línea 274...
272
 
274
 
Línea -... Línea 275...
-
 
275
            //echo $select->getSqlString($this->adapter->platform); exit;
273
            //echo $select->getSqlString($this->adapter->platform); exit;
276
 
-
 
277
            if(self::_USE_S3) {
-
 
278
                $storage = Storage::getInstance($this->config);
-
 
279
            } else {
Línea 274... Línea 280...
274
 
280
                $storage = null;
275
            $storage = Storage::getInstance($this->config);
281
            }
Línea 276... Línea 282...
276
            
282
            
Línea 295... Línea 301...
295
                $connection = $connectionMapper->fetchOneByUserId1AndUserId2($currentUser->id, $record['id']);
301
                $connection = $connectionMapper->fetchOneByUserId1AndUserId2($currentUser->id, $record['id']);
Línea 296... Línea 302...
296
 
302
 
297
                $item = [
303
                $item = [
298
                    'id'    => $record['uuid'],
304
                    'id'    => $record['uuid'],
-
 
305
                    'name'  => trim($record['first_name'] . ' ' . $record['last_name']),
299
                    'name'  => trim($record['first_name'] . ' ' . $record['last_name']),
306
                    'image' => $storage 
-
 
307
                        ? $storage->getUserImageForCodeAndFilename($record['uuid'], $record['image']) 
300
                    'image' => $storage->getUserImageForCodeAndFilename($record['uuid'], $record['image']),
308
                        : $this->url()->fromRoute('storage', ['code' => $record['uuid'], 'type' => 'user', 'filename' => $record['image'] ]), 
301
                    'profile'   => $this->url()->fromRoute('profile/view', ['id' => $record['uuid']]),
309
                    'profile'   => $this->url()->fromRoute('profile/view', ['id' => $record['uuid']]),
302
                    'relation' => $relation,
310
                    'relation' => $relation,
303
                    'link_cancel'   => '',
311
                    'link_cancel'   => '',
304
                    'link_request'  => '',
312
                    'link_request'  => '',
Línea 391... Línea 399...
391
                $select->where->in('id', $user_ids);
399
                $select->where->in('id', $user_ids);
392
                $select->where->equalTo('network_id', $currentUser->network_id);
400
                $select->where->equalTo('network_id', $currentUser->network_id);
393
                $select->where->equalTo('status', User::STATUS_ACTIVE);
401
                $select->where->equalTo('status', User::STATUS_ACTIVE);
394
                $select->order(['last_name ASC', 'first_name ASC']);
402
                $select->order(['last_name ASC', 'first_name ASC']);
Línea -... Línea 403...
-
 
403
 
395
 
404
                if(self::_USE_S3) {
-
 
405
                    $storage = Storage::getInstance($this->config);
-
 
406
                } else {
-
 
407
                    $storage = null;
Línea 396... Línea 408...
396
                $storage = Storage::getInstance($this->config);
408
                }
397
                
409
                
398
                $records = $mapper->fetchAll($select);
410
                $records = $mapper->fetchAll($select);
399
                foreach ($records as $record) {
411
                foreach ($records as $record) {
400
                    array_push($items, [
412
                    array_push($items, [
-
 
413
                        'id'        => $record['uuid'],
401
                        'id'        => $record['uuid'],
414
                        'name'      => trim($record['first_name'] . ' ' . $record['last_name']),
-
 
415
                        'image' => $storage
-
 
416
                            ? $storage->getUserImageForCodeAndFilename($record['uuid'], $record['image'])
402
                        'name'      => trim($record['first_name'] . ' ' . $record['last_name']),
417
                            : $this->url()->fromRoute('storage', ['code' => $record['uuid'], 'type' => 'user', 'filename' => $record['image'] ]),
403
                        'image'     => $storage->getUserImageForCodeAndFilename($record['uuid'], $record['image']),
418
                        'profile'   => $this->url()->fromRoute('profile/view', ['id' => $record['uuid']]),
404
                        'profile'   => $this->url()->fromRoute('profile/view', ['id' => $record['uuid']]),
419
                        'profile'   => $this->url()->fromRoute('profile/view', ['id' => $record['uuid']]),
405
                    ]);
420
                    ]);
Línea 479... Línea 494...
479
                    $select->order(['last_name', 'first_name']);
494
                    $select->order(['last_name', 'first_name']);
Línea 480... Línea 495...
480
 
495
 
Línea -... Línea 496...
-
 
496
                    //echo $select->getSqlString($this->adapter->platform); exit;
481
                    //echo $select->getSqlString($this->adapter->platform); exit;
497
 
-
 
498
 
-
 
499
                    if(self::_USE_S3) {
-
 
500
                        $storage = Storage::getInstance($this->config);
Línea 482... Línea 501...
482
 
501
                    } else {
483
 
502
                        $storage = null;
Línea 484... Línea 503...
484
                    $storage = Storage::getInstance($this->config);
503
                    }
485
 
504
 
486
                    $records = $mapper->fetchAll($select);
505
                    $records = $mapper->fetchAll($select);
-
 
506
                    foreach ($records as $record) {
487
                    foreach ($records as $record) {
507
 
-
 
508
 
488
 
509
                        array_push($items, [
489
 
510
                            'id'        => $record['uuid'],
490
                        array_push($items, [
511
                            'name'      => trim($record['first_name'] . ' ' . $record['last_name']),
491
                            'id'        => $record['uuid'],
512
                            'image' => $storage
492
                            'name'      => trim($record['first_name'] . ' ' . $record['last_name']),
513
                                ? $storage->getUserImageForCodeAndFilename($record['uuid'], $record['image'])
Línea 536... Línea 557...
536
                $select->order(['name']);
557
                $select->order(['name']);
Línea 537... Línea 558...
537
 
558
 
Línea -... Línea 559...
-
 
559
 
538
 
560
                //echo $select->getSqlString($this->adapter->platform); exit;
-
 
561
 
-
 
562
                if(self::_USE_S3) {
-
 
563
                    $storage = Storage::getInstance($this->config);
Línea 539... Línea 564...
539
                //echo $select->getSqlString($this->adapter->platform); exit;
564
                } else {
540
 
565
                    $storage = null;
541
                $storage = Storage::getInstance($this->config);
566
                }
542
                
567
                
543
                $records = $mapper->fetchAll($select);
568
                $records = $mapper->fetchAll($select);
-
 
569
                foreach ($records as $record) {
544
                foreach ($records as $record) {
570
                    array_push($items, [
-
 
571
                        'id'        => $record['uuid'],
545
                    array_push($items, [
572
                        'name'      => trim($record['name']),
546
                        'id'        => $record['uuid'],
573
                        'image'     => $storage
547
                        'name'      => trim($record['name']),
574
                            ? $storage->getCompanyImageForCodeAndFilename($record['uuid'], $record['image']) 
548
                        'image'     => $storage->getCompanyImageForCodeAndFilename($record['uuid'], $record['image']),
575
                            : $this->url()->fromRoute('storage', ['code' => $record['uuid'], 'type' => 'company', 'filename' => $record['image'] ]),
Línea 626... Línea 653...
626
                $select->order(['last_name', 'first_name']);
653
                $select->order(['last_name', 'first_name']);
Línea 627... Línea 654...
627
 
654
 
Línea -... Línea 655...
-
 
655
                //echo $select->getSqlString($this->adapter->platform);
628
                //echo $select->getSqlString($this->adapter->platform);
656
 
-
 
657
 
-
 
658
                if(self::_USE_S3) {
-
 
659
                    $storage = Storage::getInstance($this->config);
Línea 629... Línea 660...
629
 
660
                } else {
630
 
661
                    $storage = null;
Línea 656... Línea 687...
656
                    }
687
                    }
Línea 657... Línea 688...
657
 
688
 
658
                    array_push($items, [
689
                    array_push($items, [
659
                        'id'        => $record['uuid'],
690
                        'id'        => $record['uuid'],
-
 
691
                        'name'      => trim($record['first_name'] . ' ' . $record['last_name']),
-
 
692
                        
660
                        'name'      => trim($record['first_name'] . ' ' . $record['last_name']),
693
                        'image'     => $storage
-
 
694
                        ? $storage->getGroupImageForCodeAndFilename($record['uuid'], $record['image'])
-
 
695
                        : $this->url()->fromRoute('storage', ['code' => $record['uuid'], 'type' => 'group', 'filename' => $record['image'] ]),
661
                        'image'     => $storage->getUserImageForCodeAndFilename($record['uuid'], $record['image']),
696
                        
662
                        'profile'   => $this->url()->fromRoute('profile/view', ['id' => $record['uuid']]),
697
                        'profile'   => $this->url()->fromRoute('profile/view', ['id' => $record['uuid']]),
Línea 663... Línea 698...
663
                        'actions'   => $actions,
698
                        'actions'   => $actions,
664
 
699
 
Línea 1349... Línea 1384...
1349
            });
1384
            });
Línea 1350... Línea 1385...
1350
 
1385
 
Línea -... Línea 1386...
-
 
1386
 
1351
 
1387
            $items = [];
-
 
1388
            
-
 
1389
            if(self::_USE_S3) {
-
 
1390
                $storage = Storage::getInstance($this->config);
Línea 1352... Línea 1391...
1352
            $items = [];
1391
            } else {
Línea 1353... Línea 1392...
1353
            
1392
                $storage = null;
1354
            $storage = Storage::getInstance($this->config);
1393
            }
1355
 
1394
 
-
 
1395
            foreach ($records as $record) {
1356
            foreach ($records as $record) {
1396
 
-
 
1397
                array_push($items, [
-
 
1398
                    'id'        => $record['uuid'],
1357
 
1399
                    'name'      => trim($record['name']),
1358
                array_push($items, [
1400
                    'image'     => $storage
Línea 1359... Línea 1401...
1359
                    'id'        => $record['uuid'],
1401
                    ? $storage->getGroupImageForCodeAndFilename($record['uuid'], $record['image'])
1360
                    'name'      => trim($record['name']),
1402
                    : $this->url()->fromRoute('storage', ['code' => $record['uuid'], 'type' => 'group', 'filename' => $record['image'] ]),
Línea 1387... Línea 1429...
1387
            $items = [];
1429
            $items = [];
1388
            $postMapper = PostMapper::getInstance($this->adapter);
1430
            $postMapper = PostMapper::getInstance($this->adapter);
1389
            $posts = $postMapper->fetchAllActiveByNetworkId($currentUser->network_id);
1431
            $posts = $postMapper->fetchAllActiveByNetworkId($currentUser->network_id);
Línea -... Línea 1432...
-
 
1432
 
1390
 
1433
 
1391
 
1434
            if(self::_USE_S3) {
-
 
1435
                $storage = Storage::getInstance($this->config);
-
 
1436
                $path = $storage->getPathPost();
-
 
1437
            } else {
-
 
1438
                $storage = null;
Línea 1392... Línea 1439...
1392
            $storage = Storage::getInstance($this->config);
1439
            }
1393
            $path = $storage->getPathPost();
1440
           
1394
 
1441
 
-
 
1442
            foreach ($posts as $post) {
1395
            foreach ($posts as $post) {
1443
                $dt = \DateTime::createFromFormat('Y-m-d', $post->date);
-
 
1444
                array_push($items, [
1396
                $dt = \DateTime::createFromFormat('Y-m-d', $post->date);
1445
                    'image' => $storage 
1397
                array_push($items, [
1446
                    ? $storage->getGenericImage($path, $post->uuid, $post->image)
1398
                    'image' => $storage->getGenericImage($path, $post->uuid, $post->image),
1447
                    : $this->url()->fromRoute('storage', ['code' => $post->uuid, 'type' => 'post', 'filename' => $post->image ]),
1399
                    'date' => $dt->format('d/m/Y'),
1448
                    'date' => $dt->format('d/m/Y'),
1400
                    'title' => $post->title,
1449
                    'title' => $post->title,
Línea 1570... Línea 1619...
1570
            $select->where->equalTo('g.user_id', $currentUser->id);
1619
            $select->where->equalTo('g.user_id', $currentUser->id);
1571
            $select->order('name ASC');
1620
            $select->order('name ASC');
Línea 1572... Línea 1621...
1572
 
1621
 
-
 
1622
 
1573
 
1623
            $items = [];
-
 
1624
            if(self::_USE_S3) {
-
 
1625
                $storage = Storage::getInstance($this->config);
-
 
1626
            } else {
-
 
1627
                $storage = null;
Línea 1574... Línea 1628...
1574
            $items = [];
1628
            }
1575
            $storage = Storage::getInstance($this->config);
1629
            
Línea 1576... Línea 1630...
1576
 
1630
 
1577
            $records = $queryMapper->fetchAll($select);
1631
            $records = $queryMapper->fetchAll($select);
1578
            foreach ($records as $record) {
1632
            foreach ($records as $record) {
-
 
1633
 
1579
 
1634
                array_push($items, [
-
 
1635
                    'id'        => $record['uuid'],
-
 
1636
                    'name'      => trim($record['name']),
1580
                array_push($items, [
1637
                    'image'     => $storage
1581
                    'id'        => $record['uuid'],
1638
                    ? $storage->getGroupImageForCodeAndFilename($record['uuid'], $record['image'])
Línea 1582... Línea 1639...
1582
                    'name'      => trim($record['name']),
1639
                    : $this->url()->fromRoute('storage', ['code' => $record['uuid'], 'type' => 'group', 'filename' => $record['image'] ]),
1583
                    'image'     => $storage->getGroupImageForCodeAndFilename($record['uuid'], $record['image']),
1640
                    
Línea 2173... Línea 2230...
2173
                    
2230
                    
2174
                    array_push($menu, $option);
2231
                    array_push($menu, $option);
Línea 2175... Línea -...
2175
                }
-
 
-
 
2232
                }
2176
                
2233
                
2177
           
-
 
-
 
2234
           
-
 
2235
                if(self::_USE_S3) {
-
 
2236
                    $storage = Storage::getInstance($this->config);
Línea 2178... Línea 2237...
2178
                
2237
                } else {
2179
                $storage = Storage::getInstance($this->config);
2238
                    $storage = null;
2180
                
2239
                }
2181
                
2240
                
Línea 2182... Línea -...
2182
                $image = $storage->getUserImage($currentUser);
-
 
2183
                $isChatPage = $this->getEvent()->getViewModel()->getVariable('is_chat');
-
 
Línea 2184... Línea 2241...
2184
                $routeCheckSession = $this->url()->fromRoute('check-session');
2241
                $image = $storage->getUserImage($currentUser);
-
 
2242
                $isChatPage = $this->getEvent()->getViewModel()->getVariable('is_chat');
-
 
2243
                $routeCheckSession = $this->url()->fromRoute('check-session');
-
 
2244
                $routeAbuseReport = $this->url()->fromRoute('abuse-report');
-
 
2245
 
-
 
2246
                
-
 
2247
                if($network->navbar) {
-
 
2248
                    
-
 
2249
                    
-
 
2250
                    
2185
                $routeAbuseReport = $this->url()->fromRoute('abuse-report');
2251
                    
-
 
2252
                    if(self::_USE_S3) {
-
 
2253
                        
-
 
2254
                        $storage = Storage::getInstance($this->config);
-
 
2255
                        $path = $storage->getPathNetwork();
-
 
2256
                        
-
 
2257
                        $navbar = $storage->getGenericImage($path, $network->uuid, $network->navbar);
-
 
2258
                        
-
 
2259
                    } else {
-
 
2260
                        $storage = null;
-
 
2261
                    }
-
 
2262
                    
-
 
2263
                    $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
-
 
2264
                    $currentNetwork = $currentNetworkPlugin->getNetwork();
-
 
2265
                    
-
 
2266
                    $parts = explode('.', $currentNetwork->main_hostname);
-
 
2267
                    if($parts[1] === 'com') {
-
 
2268
                        $replace_main = false;
-
 
2269
                    } else {
-
 
2270
                        $replace_main = true;
-
 
2271
                    }
-
 
2272
                    
-
 
2273
                    if($currentNetwork->navbar) {
-
 
2274
                        $navbar_url = $storage->getGenericImage($path, $currentNetwork->uuid, $currentNetwork->navbar);
-
 
2275
                    } else {
-
 
2276
                        $navbar_url = '';
-
 
2277
                    }
-
 
2278
                    
-
 
2279
                    if($replace_main) {
-
 
2280
                        $navbar_url = str_replace($currentNetwork->main_hostname, $currentNetwork->service_hostname, $navbar_url);
-
 
2281
                    }
-
 
2282
                    
-
 
2283
                    if($currentNetwork->alternative_hostname) {
-
 
2284
                        $navbar_url = str_replace($currentNetwork->alternative_hostname, $currentNetwork->service_hostname, $navbar_url);
-
 
2285
                        
-
 
2286
                    }
2186
 
2287
                }
2187
                $storage = Storage::getInstance($this->config);
2288
                
2188
                $path = $storage->getPathNetwork();
2289
   
Línea 2189... Línea 2290...
2189
                
2290