Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 283 Rev 289
Línea 83... Línea 83...
83
     *
83
     *
84
     * @var \Laminas\Mvc\I18n\Translator
84
     * @var \Laminas\Mvc\I18n\Translator
85
     */
85
     */
86
    private $translator;
86
    private $translator;
Línea -... Línea 87...
-
 
87
    
-
 
88
    /**
-
 
89
     * 
-
 
90
     * @var \LeadersLinked\Library\Storage
-
 
91
     */
-
 
92
    private  $storage;
Línea 87... Línea 93...
87
    
93
    
88
    
94
    
89
    /**
95
    /**
90
     *
96
     *
Línea 99... Línea 105...
99
        $this->adapter      = $adapter;
105
        $this->adapter      = $adapter;
100
        $this->cache        = $cache;
106
        $this->cache        = $cache;
101
        $this->logger       = $logger;
107
        $this->logger       = $logger;
102
        $this->config       = $config;
108
        $this->config       = $config;
103
        $this->translator   = $translator;
109
        $this->translator   = $translator;
-
 
110
        
-
 
111
        $this->storage = Storage::getInstance($this->config);
104
    }
112
    }
Línea 105... Línea 113...
105
 
113
 
106
    /**
114
    /**
107
     * 
115
     * 
Línea 274... Línea 282...
274
            
282
            
Línea 275... Línea 283...
275
            $items = [];
283
            $items = [];
276
            
284
            
277
            $contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
-
 
-
 
285
            $contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
Línea 278... Línea 286...
278
            $records = $contentReactionMapper->fetchAllByFeedId($feed->id);
286
            $records = $contentReactionMapper->fetchAllByFeedId($feed->id);
279
            $storage = Storage::getInstance($this->config);
287
           
280
            
288
            
281
            foreach($records as $record)
289
            foreach($records as $record)
Línea 286... Línea 294...
286
                    
294
                    
287
                    array_push($items, [
295
                    array_push($items, [
288
                        'first_name' => $user->first_name,
296
                        'first_name' => $user->first_name,
289
                        'last_name' => $user->last_name,
297
                        'last_name' => $user->last_name,
290
                        'email' => $user->email,
298
                        'email' => $user->email,
291
                        'image' => $storage->getUserImage($user),
299
                        'image' => $this->storage->getUserImage($user),
292
                        'reaction' => $record->reaction,
300
                        'reaction' => $record->reaction,
293
                    ]);
301
                    ]);
294
                }
302
                }
Línea 727... Línea 735...
727
 
735
 
Línea 728... Línea 736...
728
 
736
 
729
                $feed = $feedMapper->fetchOne($feed->id);
-
 
730
 
737
                $feed = $feedMapper->fetchOne($feed->id);
Línea 731... Línea 738...
731
                if ($file_type == Feed::FILE_TYPE_DOCUMENT) {
738
 
732
                    $storage = Storage::getInstance($this->config);
739
                if ($file_type == Feed::FILE_TYPE_DOCUMENT) {
733
                    $target_path = $storage->getPathFeed();
740
                    $target_path = $this->storage->getPathFeed();
734
                    
741
                    
735
                    if ($storage->putFile($target_path, $feed->uuid, $feed_filename)) {
742
                    if ($this->storage->putFile($target_path, $feed->uuid, $feed_filename)) {
Línea 795... Línea 802...
795
                        //$cmd = "/usr/bin/ffmpeg -y -i $full_filename  -pix_fmt yuvj422p -deinterlace -an -ss $second_extract -f mjpeg -t 1 -r 1 -y -s $imageSize $generateFile";
802
                        //$cmd = "/usr/bin/ffmpeg -y -i $full_filename  -pix_fmt yuvj422p -deinterlace -an -ss $second_extract -f mjpeg -t 1 -r 1 -y -s $imageSize $generateFile";
796
                        // $cmd = "/usr/bin/ffmpeg -y -i $full_filename  -pix_fmt yuvj422p -an -ss $second_extract -f mjpeg -t 1 -r 1 -y -s $imageSize $generateFile";
803
                        // $cmd = "/usr/bin/ffmpeg -y -i $full_filename  -pix_fmt yuvj422p -an -ss $second_extract -f mjpeg -t 1 -r 1 -y -s $imageSize $generateFile";
797
                        $cmd = "/usr/bin/ffmpeg -y -i $full_filename  -pix_fmt yuvj422p -an -ss $second_extract -f mjpeg -t 1 -r 1 -y  $generate_full_filename";
804
                        $cmd = "/usr/bin/ffmpeg -y -i $full_filename  -pix_fmt yuvj422p -an -ss $second_extract -f mjpeg -t 1 -r 1 -y  $generate_full_filename";
798
                        exec($cmd);
805
                        exec($cmd);
Línea 799... Línea -...
799
                        
-
 
800
                        $storage = Storage::getInstance($this->config);
806
                        
Línea 801... Línea 807...
801
                        $target_path = $storage->getPathFeed();
807
                        $target_path = $this->storage->getPathFeed();
Línea 802... Línea 808...
802
                        
808
                        
803
                        if($storage->putFile($target_path, $feed->uuid, $generate_full_filename) || $storage->putFile($target_path, $feed->uuid, $full_filename)) {
809
                        if($this->storage->putFile($target_path, $feed->uuid, $generate_full_filename) || $this->storage->putFile($target_path, $feed->uuid, $full_filename)) {
804
 
810
 
Línea 1663... Línea 1669...
1663
        }
1669
        }
Línea 1664... Línea 1670...
1664
        
1670
        
Línea 1665... Línea -...
1665
 
-
 
1666
        if ($feed->posted_or_shared == Feed::POSTED) {
1671
 
Línea 1667... Línea 1672...
1667
 
1672
        if ($feed->posted_or_shared == Feed::POSTED) {
1668
            $storage = Storage::getInstance($this->config);
1673
 
Línea 1669... Línea 1674...
1669
            if ($feed->type == Feed::TYPE_COMPANY) {
1674
            if ($feed->type == Feed::TYPE_COMPANY) {
1670
                
1675
                
1671
                
1676
                
Línea 1672... Línea 1677...
1672
                $companyMapper = CompanyMapper::getInstance($this->adapter);
1677
                $companyMapper = CompanyMapper::getInstance($this->adapter);
1673
                $company = $companyMapper->fetchOne($feed->company_id);
1678
                $company = $companyMapper->fetchOne($feed->company_id);
1674
                
1679
                
Línea 1675... Línea 1680...
1675
                $item['owner_url'] = $this->url()->fromRoute('company/view', ['id' => $company->uuid],  ['force_canonical' => true]);
1680
                $item['owner_url'] = $this->url()->fromRoute('company/view', ['id' => $company->uuid],  ['force_canonical' => true]);
1676
                $item['owner_image'] = $storage->getCompanyImage($company);
1681
                $item['owner_image'] = $this->storage->getCompanyImage($company);
1677
                $item['owner_name'] = $company->name;
1682
                $item['owner_name'] = $company->name;
Línea 1678... Línea 1683...
1678
        
1683
        
1679
            } else if ($feed->type == Feed::TYPE_GROUP) {
1684
            } else if ($feed->type == Feed::TYPE_GROUP) {
1680
                $groupMapper = GroupMapper::getInstance($this->adapter);
1685
                $groupMapper = GroupMapper::getInstance($this->adapter);
Línea 1692... Línea 1697...
1692
                $userMapper = UserMapper::getInstance($this->adapter);
1697
                $userMapper = UserMapper::getInstance($this->adapter);
1693
                $user = $userMapper->fetchOne($feed->user_id);
1698
                $user = $userMapper->fetchOne($feed->user_id);
Línea 1694... Línea 1699...
1694
                
1699
                
1695
                
1700
                
1696
                $item['owner_url'] = $this->url()->fromRoute('profile/view', ['id' => $user->uuid]);
1701
                $item['owner_url'] = $this->url()->fromRoute('profile/view', ['id' => $user->uuid]);
Línea 1697... Línea 1702...
1697
                $item['owner_image'] = $storage->getUserImage($user); 
1702
                $item['owner_image'] = $this->storage->getUserImage($user); 
1698
                $item['owner_name'] = $user->first_name . ' ' . $user->last_name;
1703
                $item['owner_name'] = $user->first_name . ' ' . $user->last_name;
1699
 
1704
 
Línea 1713... Línea 1718...
1713
       
1718
       
Línea 1714... Línea 1719...
1714
 
1719
 
1715
        if ($feed->posted_or_shared == Feed::SHARED) {
1720
        if ($feed->posted_or_shared == Feed::SHARED) {
1716
           
1721
           
1717
            $item['owner_url'] = $this->url()->fromRoute('profile/view', ['id' => $user->uuid],['force_canonical' => true]);
1722
            $item['owner_url'] = $this->url()->fromRoute('profile/view', ['id' => $user->uuid],['force_canonical' => true]);
Línea 1718... Línea 1723...
1718
            $item['owner_image'] = $storage->getUserImage($user);
1723
            $item['owner_image'] = $this->storage->getUserImage($user);
1719
            $item['owner_name'] = $user->first_name . ' ' . $user->last_name;
1724
            $item['owner_name'] = $user->first_name . ' ' . $user->last_name;
Línea 1769... Línea 1774...
1769
 
1774
 
Línea 1770... Línea 1775...
1770
        $item['owner_time_elapse'] = Functions::timeAgo($feed->added_on, $now);
1775
        $item['owner_time_elapse'] = Functions::timeAgo($feed->added_on, $now);
Línea 1771... Línea 1776...
1771
 
1776
 
1772
        if ($feed->file_type == Feed::FILE_TYPE_IMAGE) {
1777
        if ($feed->file_type == Feed::FILE_TYPE_IMAGE) {
1773
            
1778
            
1774
            $path = $storage->getPathFeed();
1779
            $path = $this->storage->getPathFeed();
Línea 1775... Línea 1780...
1775
            $item['owner_file_image'] = $storage->getGenericImage($path,  $feed->uuid, $feed->file_name); 
1780
            $item['owner_file_image'] = $this->storage->getGenericImage($path,  $feed->uuid, $feed->file_name); 
1776
        }
1781
        }
1777
        if ($feed->file_type == Feed::FILE_TYPE_DOCUMENT) {
1782
        if ($feed->file_type == Feed::FILE_TYPE_DOCUMENT) {
1778
            
1783
            
1779
            $path = $storage->getPathFeed();
1784
            $path = $this->storage->getPathFeed();
1780
            $item['owner_file_document'] = $storage->getGenericFile($path,  $feed->uuid, $feed->file_name); 
1785
            $item['owner_file_document'] = $this->storage->getGenericFile($path,  $feed->uuid, $feed->file_name); 
1781
        }
1786
        }
1782
        if ($feed->file_type == Feed::FILE_TYPE_VIDEO) {
1787
        if ($feed->file_type == Feed::FILE_TYPE_VIDEO) {
Línea 1783... Línea 1788...
1783
            $path = $storage->getPathFeed();
1788
            $path = $this->storage->getPathFeed();
1784
            $item['owner_file_image_preview'] = $item['owner_file_image'] = $storage->getGenericImage($path,  $feed->uuid, $feed->file_image_preview); 
1789
            $item['owner_file_image_preview'] = $item['owner_file_image'] = $this->storage->getGenericImage($path,  $feed->uuid, $feed->file_image_preview); 
Línea 1785... Línea 1790...
1785
            $item['owner_file_video']  = $storage->getGenericFile($path,  $feed->uuid, $feed->file_name); 
1790
            $item['owner_file_video']  = $this->storage->getGenericFile($path,  $feed->uuid, $feed->file_name); 
1786
        }
1791
        }
Línea 1787... Línea 1792...
1787
 
1792
 
1788
        if ($feed->posted_or_shared == Feed::SHARED) {
1793
        if ($feed->posted_or_shared == Feed::SHARED) {
1789
            $sharedFeed = $feedMapper->fetchOneAnyStatus($feed->shared_feed_id);
1794
            $sharedFeed = $feedMapper->fetchOneAnyStatus($feed->shared_feed_id);
1790
 
1795
 
1791
            $item['shared_description'] = $sharedFeed->description;
1796
            $item['shared_description'] = $sharedFeed->description;
1792
            $item['shared_time_elapse'] = Functions::timeAgo($sharedFeed->added_on, $now);
1797
            $item['shared_time_elapse'] = Functions::timeAgo($sharedFeed->added_on, $now);
1793
 
1798
 
1794
            if ($sharedFeed->file_type == Feed::FILE_TYPE_IMAGE) {
1799
            if ($sharedFeed->file_type == Feed::FILE_TYPE_IMAGE) {
1795
                $path = $storage->getPathFeed();
1800
                $path = $this->storage->getPathFeed();
1796
                $item['shared_file_image'] = $storage->getGenericImage($path, $sharedFeed->uuid, $sharedFeed->file_name);
1801
                $item['shared_file_image'] = $this->storage->getGenericImage($path, $sharedFeed->uuid, $sharedFeed->file_name);
1797
            }
1802
            }
1798
            if ($sharedFeed->file_type == Feed::FILE_TYPE_DOCUMENT) {
1803
            if ($sharedFeed->file_type == Feed::FILE_TYPE_DOCUMENT) {
Línea 1799... Línea 1804...
1799
                $path = $storage->getPathFeed();
1804
                $path = $this->storage->getPathFeed();
Línea 1800... Línea 1805...
1800
                $item['shared_file_document'] = $storage->getGenericFile($path, $sharedFeed->uuid, $sharedFeed->file_name);
1805
                $item['shared_file_document'] = $this->storage->getGenericFile($path, $sharedFeed->uuid, $sharedFeed->file_name);
Línea 1813... Línea 1818...
1813
                $companyMapper = CompanyMapper::getInstance($this->adapter);
1818
                $companyMapper = CompanyMapper::getInstance($this->adapter);
1814
                $sharedCompany = $companyMapper->fetchOne($feed->company_id);
1819
                $sharedCompany = $companyMapper->fetchOne($feed->company_id);
Línea 1815... Línea 1820...
1815
    
1820
    
1816
                
1821
                
1817
                $item['shared_url'] = $this->url()->fromRoute('company/view', ['id' => $sharedCompany->uuid]);
1822
                $item['shared_url'] = $this->url()->fromRoute('company/view', ['id' => $sharedCompany->uuid]);
1818
                $item['shared_image'] = $storage->getCompanyImage($sharedCompany);
1823
                $item['shared_image'] = $this->storage->getCompanyImage($sharedCompany);
1819
                $item['shared_name'] = $sharedCompany->name;
1824
                $item['shared_name'] = $sharedCompany->name;
1820
            } else if ($feed->group_id) {
1825
            } else if ($feed->group_id) {
Línea 1821... Línea 1826...
1821
                $groupMapper = GroupMapper::getInstance($this->adapter);
1826
                $groupMapper = GroupMapper::getInstance($this->adapter);
1822
                $sharedGroup = $groupMapper->fetchOne($feed->group_id);
1827
                $sharedGroup = $groupMapper->fetchOne($feed->group_id);
1823
 
1828
 
1824
                
1829
                
1825
                $item['shared_url'] = '';
1830
                $item['shared_url'] = '';
Línea 1826... Línea 1831...
1826
                $item['shared_image'] = $storage->getGroupImage($sharedGroup);
1831
                $item['shared_image'] = $this->storage->getGroupImage($sharedGroup);
1827
                $item['shared_name'] = $sharedGroup->name;
1832
                $item['shared_name'] = $sharedGroup->name;
1828
            } else {
1833
            } else {
1829
                $sharedUser = $userMapper->fetchOne($sharedFeed->user_id);
1834
                $sharedUser = $userMapper->fetchOne($sharedFeed->user_id);
1830
                
1835
                
Línea 1864... Línea 1869...
1864
                array_push($comments , [
1869
                array_push($comments , [
1865
                    'unique' => uniqid(),
1870
                    'unique' => uniqid(),
1866
                    'user_url' => $this->url()->fromRoute('profile/view', ['id' => $user->uuid],['force_canonical' => true]),
1871
                    'user_url' => $this->url()->fromRoute('profile/view', ['id' => $user->uuid],['force_canonical' => true]),
1867
                    'user_name' => $user->first_name . ' ' . $user->last_name,
1872
                    'user_name' => $user->first_name . ' ' . $user->last_name,
1868
                    'company' => $owner,
1873
                    'company' => $owner,
1869
                    'user_image' => $storage->getUserImage($user),
1874
                    'user_image' => $this->storage->getUserImage($user),
1870
                    'time_elapsed' => Functions::timeAgo($record->added_on, $now),
1875
                    'time_elapsed' => Functions::timeAgo($record->added_on, $now),
1871
                    'comment' => $record->comment,
1876
                    'comment' => $record->comment,
1872
                    'link_abuse_report' => $user->id == $currentUser->id ? '' : $this->url()->fromRoute('helpers/abuse-report', ['type' => 'comment', 'id' => $record->uuid], ['force_canonical' => true]),
1877
                    'link_abuse_report' => $user->id == $currentUser->id ? '' : $this->url()->fromRoute('helpers/abuse-report', ['type' => 'comment', 'id' => $record->uuid], ['force_canonical' => true]),
1873
                    'link_delete' => $link_delete
1878
                    'link_delete' => $link_delete
1874
                ]);
1879
                ]);
Línea 1898... Línea 1903...
1898
 
1903
 
1899
        $feedMapper = FeedMapper::getInstance($this->adapter);
1904
        $feedMapper = FeedMapper::getInstance($this->adapter);
Línea 1900... Línea 1905...
1900
        $feed = $feedMapper->fetchOne($record->feed_id);
1905
        $feed = $feedMapper->fetchOne($record->feed_id);
1901
 
-
 
-
 
1906
 
Línea 1902... Línea 1907...
1902
        if ($record) {
1907
        if ($record) {
Línea 1903... Línea 1908...
1903
            $storage = Storage::getInstance($this->config);
1908
           
Línea 1904... Línea 1909...
1904
            
1909
            
1905
            $userMapper = UserMapper::getInstance($this->adapter);
1910
            $userMapper = UserMapper::getInstance($this->adapter);
1906
 
1911
 
1907
            $user = $userMapper->fetchOne($record->user_id);
1912
            $user = $userMapper->fetchOne($record->user_id);
1908
 
1913
 
1909
            $item['unique'] = uniqid();
1914
            $item['unique'] = uniqid();
1910
            $item['user_image'] = $storage->getUserImage($user);
1915
            $item['user_image'] = $this->storage->getUserImage($user);