Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 10073 Rev 10118
Línea 766... Línea 766...
766
        }
766
        }
Línea 767... Línea 767...
767
        
767
        
768
        return new JsonModel($response);
768
        return new JsonModel($response);
Línea 769... Línea -...
769
    }
-
 
770
    
-
 
771
    public function post($dataPost)
-
 
772
    {
-
 
773
        
-
 
774
        
-
 
775
        
-
 
776
        
-
 
777
        
-
 
778
    }
-
 
Línea 779... Línea 769...
779
    
769
    }
780
    
770
    
781
    
771
    
782
    public function timelineAction()
772
    public function timelineAction()
Línea 933... Línea 923...
933
        
923
        
934
        
924
        
Línea -... Línea 925...
-
 
925
        return new JsonModel($response);
-
 
926
    }
-
 
927
    
-
 
928
    public function oneFeed(){
-
 
929
        $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
930
        $currentUser = $currentUserPlugin->getUser();
-
 
931
        $currentCompany = $currentUserPlugin->getCompany();
-
 
932
 
-
 
933
        $request = $this->getRequest();
-
 
934
        if($request->isGet()) {
-
 
935
            
-
 
936
            $feed_uuid =  $this->params()->fromRoute('feed_uuid');
-
 
937
           
-
 
938
            if(!isset($feed_uuid)){
-
 
939
                    $data = [
-
 
940
                        'success'   => false,
-
 
941
                        'data'   => 'ERROR_INVALID_PARAMETER'
-
 
942
                    ];
-
 
943
                    
-
 
944
                    return new JsonModel($data);
-
 
945
            }
-
 
946
                   
-
 
947
            $items = [];
-
 
948
            $feedMapper = FeedMapper::getInstance($this->adapter);
-
 
949
            $feed  = $feedMapper->fetchOneByUuid($feed_uuid);
-
 
950
 
-
 
951
            if (!$feed) {
-
 
952
                $data = [
-
 
953
                    'success' => false,
-
 
954
                    'data' => 'ERROR_RECORD_NOT_FOUND'
-
 
955
                ];
-
 
956
        
-
 
957
                return new JsonModel($data);
-
 
958
            }        
-
 
959
 
-
 
960
            if($feed->type=='hptg'){
-
 
961
 
-
 
962
                $group_uuid =  $this->params()->fromRoute('group_uuid');
-
 
963
                $topic_uuid   = $this->params()->fromRoute('topic_uuid');
-
 
964
 
-
 
965
                if(!isset($topic_uuid)){
-
 
966
                
-
 
967
                    $data = [
-
 
968
                        'success'   => false,
-
 
969
                        'data'   => 'ERROR_INVALID_PARAMETER'
-
 
970
                    ];
-
 
971
                    
-
 
972
                    return new JsonModel($data);
-
 
973
                }
-
 
974
                if(!isset($group_uuid)){
-
 
975
                
-
 
976
                    $data = [
-
 
977
                        'success'   => false,
-
 
978
                        'data'   => 'ERROR_INVALID_PARAMETER'
-
 
979
                    ];
-
 
980
                    
-
 
981
                    return new JsonModel($data);
-
 
982
                }
-
 
983
                $highPerformanceTeamsGroupsMapper = HighPerformanceTeamsGroupsMapper::getInstance($this->adapter);
-
 
984
                $highPerformanceTeamsGroups = $highPerformanceTeamsGroupsMapper->fetchOneByUuid($group_uuid);
-
 
985
                        
-
 
986
                if (!$highPerformanceTeamsGroups) {
-
 
987
                    $data = [
-
 
988
                        'success' => false,
-
 
989
                        'data' => 'ERROR_RECORD_NOT_FOUND'
-
 
990
                    ];
-
 
991
            
-
 
992
                    return new JsonModel($data);
-
 
993
                }
-
 
994
 
-
 
995
                       
-
 
996
                if($highPerformanceTeamsGroups->status != HighPerformanceTeamsGroups::STATUS_ACTIVE) {
-
 
997
            
-
 
998
                    return new JsonModel([
-
 
999
                        'success' => false,
-
 
1000
                        'data' => 'ERROR_UNAUTHORIZED'
-
 
1001
                    ]);
-
 
1002
            
-
 
1003
                } 
-
 
1004
 
-
 
1005
                if($feed->high_performance_group_id!=$highPerformanceTeamsGroups->id){
-
 
1006
                    return new JsonModel([
-
 
1007
                        'success' => false,
-
 
1008
                        'data' => 'ERROR_METHOD_NOT_ALLOWED'
-
 
1009
                    ]);
-
 
1010
                }
-
 
1011
                
-
 
1012
                $topicMapper = TopicMapper::getInstance($this->adapter);
-
 
1013
                $topic = $topicMapper->fetchOneByUuid($topic_uuid);
-
 
1014
 
-
 
1015
                if (!$topic) {
-
 
1016
                    $data = [
-
 
1017
                        'success' => false,
-
 
1018
                        'data' => 'ERROR_RECORD_NOT_FOUND'
-
 
1019
                    ];
-
 
1020
            
-
 
1021
                    return new JsonModel($data);
-
 
1022
                }    
-
 
1023
 
-
 
1024
                if($feed->topic_id!=$topic->id){
-
 
1025
                    return new JsonModel([
-
 
1026
                        'success' => false,
-
 
1027
                        'data' => 'ERROR_METHOD_NOT_ALLOWED'
-
 
1028
                    ]);
-
 
1029
                }  
-
 
1030
            
-
 
1031
            }
-
 
1032
 
-
 
1033
            $items = $this->renderFeed($records);      
-
 
1034
                
-
 
1035
            $response = [
-
 
1036
                'success' => true,
-
 
1037
                'data' => [
-
 
1038
                    'item' =>$items,
-
 
1039
                    'topic_title'=>$topic->title,
-
 
1040
                    'feed_title'=>$feed->title
-
 
1041
                ]
-
 
1042
            ];
-
 
1043
            
-
 
1044
            
935
        return new JsonModel($response);
1045
            return new JsonModel($response);
936
    }
1046
        }
937
    
1047
    }
938
    /**
1048
    /**
939
     *
1049
     *
940
     * @param string $str
1050
     * @param string $str
941
     * @return string
-
 
942
     */
1051
     * @return string
943
    private function normalizeString ($str = '')
1052
     */
Línea 944... Línea 1053...
944
    {
1053
    private function normalizeString ($str = ''){