Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 11681 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11681 Rev 11682
Línea 547... Línea 547...
547
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
547
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
548
            ]);
548
            ]);
549
        }
549
        }
Línea 550... Línea 550...
550
    
550
    
-
 
551
        if ($request->isPost()) {
-
 
552
            
-
 
553
   
-
 
554
            $chatGroupMapper = ChatGroupMapper::getInstance($this->adapter);
-
 
555
            $chatGroup = $chatGroupMapper->fetchOneHptg($highPerformanceTeamsGroups->id);
-
 
556
            
-
 
557
            if(!$chatGroup) {
-
 
558
                return new JsonModel([
-
 
559
                    'success' => false,
-
 
560
                    'data' => 'ERROR_GROUP_NOT_FOUND'
-
 
561
                ]);
-
 
562
            }
-
 
563
            
-
 
564
            $chatGroupUserMapper = ChatGroupUserMapper::getInstance($this->adapter);
-
 
565
            $chatGroupOwner = $chatGroupUserMapper->fetchOwnerByGroupId($chatGroup->id);
-
 
566
            
-
 
567
            if($chatGroupOwner->user_id != $currentUser->id) {
-
 
568
                return new JsonModel([
-
 
569
                    'success' => false,
-
 
570
                    'data' => 'ERROR_CHAT_GROUP_YOU_ARE_NOT_OWNER'
-
 
571
                ]);
-
 
572
            }
-
 
573
 
-
 
574
 
-
 
575
            $chatGroupUserMessageMapper = ChatGroupUserMessageMapper::getInstance($this->adapter);
-
 
576
            $result = $chatGroupUserMessageMapper->deleteAllByGroupId($chatGroup->id);
-
 
577
            if(!$result) {
-
 
578
                return new JsonModel([
-
 
579
                    'success' => false,
-
 
580
                    'data' => $chatGroupUserMessageMapper->getError()
-
 
581
                ]);
-
 
582
            }
-
 
583
            
-
 
584
            $chatGroupMessageMapper = ChatGroupMessageMapper::getInstance($this->adapter);
-
 
585
            $result = $chatGroupMessageMapper->deleteAllByGroupId($chatGroup->id);
-
 
586
            if(!$result) {
-
 
587
                return new JsonModel([
-
 
588
                    'success' => false,
-
 
589
                    'data' => $chatGroupMessageMapper->getError()
-
 
590
                ]);
-
 
591
            }
-
 
592
            
-
 
593
            $result = $chatGroupUserMapper->deleteAllByGroupId($chatGroup->id);
-
 
594
            if(!$result) {
-
 
595
                return new JsonModel([
-
 
596
                    'success' => false,
-
 
597
                    'data' => $chatGroupUserMapper->getError()
-
 
598
                ]);
-
 
599
            }
-
 
600
            
-
 
601
            $chatGroupMapper->deleteByGroupId($chatGroup->id);
-
 
602
            if(!$result) {
-
 
603
                return new JsonModel([
-
 
604
                    'success' => false,
-
 
605
                    'data' => $chatGroupMapper->getError()
-
 
606
                ]);
-
 
607
            }
-
 
608
           
-
 
609
                    
-
 
610
            $fullpath_chat = $this->config['leaderslinked.fullpath.chat'];
-
 
611
            $dirpath = $fullpath_chat . $chatGroup->uuid;
-
 
612
                        
-
 
613
            Functions::rmDirRecursive($dirpath);
Línea 551... Línea 614...
551
        if ($request->isPost()) {
614
        
552
 
615
 
Línea 553... Línea -...
553
 
-
 
554
            $result = $highPerformanceTeamsGroupsMapper->delete($highPerformanceTeamsGroups->id);
-
 
555
            if ($result) {
-
 
556
 
-
 
557
   
-
 
558
                    $chatGroupMapper = ChatGroupMapper::getInstance($this->adapter);
-
 
559
                    $chatGroup = $chatGroupMapper->fetchOneHptg($highPerformanceTeamsGroups->id);
-
 
560
                    
-
 
561
                    if(!$chatGroup) {
-
 
562
                        return new JsonModel([
-
 
563
                            'success' => false,
-
 
564
                            'data' => 'ERROR_GROUP_NOT_FOUND'
-
 
565
                        ]);
-
 
566
                    }
-
 
567
                    
-
 
568
                    $chatGroupUserMapper = ChatGroupUserMapper::getInstance($this->adapter);
-
 
569
                    $chatGroupOwner = $chatGroupUserMapper->fetchOwnerByGroupId($chatGroup->id);
-
 
570
                    
-
 
571
                    if($chatGroupOwner->user_id != $currentUser->id) {
-
 
572
                        return new JsonModel([
-
 
573
                            'success' => false,
-
 
574
                            'data' => 'ERROR_CHAT_GROUP_YOU_ARE_NOT_OWNER'
-
 
575
                        ]);
-
 
576
                    }
-
 
577
        
-
 
578
        
-
 
579
                    $chatGroupUserMessageMapper = ChatGroupUserMessageMapper::getInstance($this->adapter);
-
 
580
                    $result = $chatGroupUserMessageMapper->deleteAllByGroupId($chatGroup->id);
-
 
581
                    if(!$result) {
-
 
582
                        return new JsonModel([
-
 
583
                            'success' => false,
-
 
584
                            'data' => $chatGroupUserMessageMapper->getError()
-
 
585
                        ]);
-
 
586
                    }
-
 
587
                    
-
 
588
                    $chatGroupMessageMapper = ChatGroupMessageMapper::getInstance($this->adapter);
-
 
589
                    $result = $chatGroupMessageMapper->deleteAllByGroupId($chatGroup->id);
-
 
590
                    if(!$result) {
-
 
591
                        return new JsonModel([
-
 
592
                            'success' => false,
-
 
593
                            'data' => $chatGroupMessageMapper->getError()
-
 
594
                        ]);
-
 
595
                    }
-
 
596
                    
-
 
597
                    $result = $chatGroupUserMapper->deleteAllByGroupId($chatGroup->id);
-
 
598
                    if(!$result) {
-
 
599
                        return new JsonModel([
-
 
600
                            'success' => false,
-
 
601
                            'data' => $chatGroupUserMapper->getError()
-
 
602
                        ]);
-
 
603
                    }
-
 
604
                    
-
 
605
                    $chatGroupMapper->deleteByGroupId($chatGroup->id);
-
 
606
                    if(!$result) {
-
 
607
                        return new JsonModel([
-
 
608
                            'success' => false,
-
 
609
                            'data' => $chatGroupMapper->getError()
-
 
610
                        ]);
-
 
611
                    }
-
 
612
                   
-
 
613
                            
-
 
614
                    $fullpath_chat = $this->config['leaderslinked.fullpath.chat'];
-
 
615
                    $dirpath = $fullpath_chat . $chatGroup->uuid;
-
 
Línea 616... Línea 616...
616
                                
616
 
Línea 617... Línea 617...
617
                    Functions::rmDirRecursive($dirpath);
617
            $result = $highPerformanceTeamsGroupsMapper->delete($highPerformanceTeamsGroups->id);
618
                
618
            if ($result) {