Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 3086 Rev 3639
Línea 68... Línea 68...
68
      
68
      
69
        
69
        
Línea -... Línea 70...
-
 
70
        return $this->executeFetchOneObject($select, $prototype);
-
 
71
    }
-
 
72
    
-
 
73
    
-
 
74
    /**
-
 
75
     *
-
 
76
     * @param string $uuid
-
 
77
     * @param int $network_id
-
 
78
     * @return User
-
 
79
     */
-
 
80
    public function fetchOneByUuidAndNetworkId($uuid, $network_id)
-
 
81
    {
-
 
82
        $prototype = new User();
-
 
83
        $select = $this->sql->select(self::_TABLE);
-
 
84
        $select->where->equalTo('uuid', $uuid);
-
 
85
        $select->where->equalTo('network_id', $network_id);
-
 
86
        
-
 
87
        
70
        return $this->executeFetchOneObject($select, $prototype);
88
        return $this->executeFetchOneObject($select, $prototype);
71
    }
89
    }
72
    
90
    
73
    /**
91
    /**
74
     * 
92
     * 
Línea 109... Línea 127...
109
        
127
        
110
        return $this->executeFetchOneObject($select, $prototype);
128
        return $this->executeFetchOneObject($select, $prototype);
Línea 111... Línea 129...
111
    }
129
    }
-
 
130
    
-
 
131
    /**
-
 
132
     *
-
 
133
     * @param string $email
-
 
134
     * @param int $network_id
-
 
135
     * @return void|User
-
 
136
     */
-
 
137
    public function fetchOneByEmailAndNetworkId($email, $network_id)
-
 
138
    {
-
 
139
        $prototype = new User();
-
 
140
        $select = $this->sql->select(self::_TABLE);
-
 
141
        $select->where->equalTo('email', $email);
-
 
142
        $select->where->equalTo('network_id', $network_id);
-
 
143
        
-
 
144
        //echo $select->getSqlString($this->adapter->platform); exit;
-
 
145
        
-
 
146
        return $this->executeFetchOneObject($select, $prototype);
-
 
147
    }
112
    
148
    
113
    /**
149
    /**
114
     * 
150
     * 
115
     * @param string $password_reset_key
151
     * @param string $password_reset_key
116
     * @return void|User
152
     * @return void|User
Línea 135... Línea 171...
135
        $select = $this->sql->select(self::_TABLE);
171
        $select = $this->sql->select(self::_TABLE);
136
        $select->where->equalTo('activation_key', $activation_key);
172
        $select->where->equalTo('activation_key', $activation_key);
Línea 137... Línea 173...
137
        
173
        
138
        return $this->executeFetchOneObject($select, $prototype);
174
        return $this->executeFetchOneObject($select, $prototype);
-
 
175
    }
-
 
176
    
-
 
177
    
-
 
178
    /**
-
 
179
     *
-
 
180
     * @param int $network_id
-
 
181
     * @return int
-
 
182
     */
-
 
183
    public function fetchCountByNetworkId($network_id)
-
 
184
    {
-
 
185
        
-
 
186
        $select = $this->sql->select(self::_TABLE);
-
 
187
        $select->columns(['total' => new Expression('COUNT(*)')]);
-
 
188
        $select->where->equalTo('network_id', $network_id);
-
 
189
       
-
 
190
        $record = $this->executeFetchOneArray($select);
-
 
191
        
-
 
192
        return $record['total'];
Línea 139... Línea 193...
139
    }
193
    }
140
   
194
   
Línea 237... Línea 291...
237
    }
291
    }
Línea 238... Línea 292...
238
    
292
    
239
    /**
293
    /**
240
     * 
294
     * 
-
 
295
     * @param int $user_id
-
 
296
     * @return boolean
-
 
297
     */
-
 
298
    public function leaveImpersonate($user_id)
-
 
299
    {
-
 
300
        $values = [
-
 
301
            'impersonate_user_id' => new Expression('NULL')
-
 
302
        ];
-
 
303
        
-
 
304
        $update = $this->sql->update(self::_TABLE);
-
 
305
        $update->set($values);
-
 
306
        $update->where->equalTo('id', $user_id);
-
 
307
        
-
 
308
        return $this->executeUpdate($update);
-
 
309
    }
-
 
310
    
-
 
311
    /**
-
 
312
     *
-
 
313
     * @param int $user_id
-
 
314
     * @param int $impersonate_user_id
-
 
315
     * @return boolean
-
 
316
     */
-
 
317
    public function startImpersonate($user_id, $impersonate_user_id)
-
 
318
    {
-
 
319
        $values = [
-
 
320
            'impersonate_user_id' => $impersonate_user_id
-
 
321
        ];
-
 
322
        
-
 
323
        $update = $this->sql->update(self::_TABLE);
-
 
324
        $update->set($values);
-
 
325
        $update->where->equalTo('id', $user_id);
-
 
326
        
-
 
327
        return $this->executeUpdate($update);
-
 
328
    }
-
 
329
    
-
 
330
    /**
-
 
331
     * 
241
     * @param int $user_id
332
     * @param int $user_id
242
     * @param string $password_reset_key
333
     * @param string $password_reset_key
243
     * @return boolean
334
     * @return boolean
244
     */
335
     */
245
    public function updatePasswordResetKey($user_id, $password_reset_key)
336
    public function updatePasswordResetKey($user_id, $password_reset_key)
Línea 683... Línea 774...
683
        $prototype = new User();
774
        $prototype = new User();
Línea 684... Línea 775...
684
        
775
        
685
        return $this->executeFetchAllObject($select, $prototype);
776
        return $this->executeFetchAllObject($select, $prototype);
Línea -... Línea 777...
-
 
777
    }
-
 
778
    
-
 
779
    /**
-
 
780
     *
-
 
781
     * @param int $network_id
-
 
782
     * @param string $search
-
 
783
     * @return User[]
-
 
784
     */
-
 
785
    public function fetchAllSuggestByNetworkIdAndSearch($network_id, $search)
-
 
786
    {
-
 
787
        
-
 
788
        $select = $this->sql->select();
-
 
789
        $select->from(self::_TABLE);
-
 
790
        $select->where->equalTo('network_id', $network_id);
-
 
791
        $select->where->equalTo('status', User::STATUS_ACTIVE);
-
 
792
        $select->where->equalTo('email_verified', User::EMAIL_VERIFIED_YES);
-
 
793
        
-
 
794
        if($search) {
-
 
795
            $select->where->nest()
-
 
796
            ->like('first_name', '%' . $search . '%')
-
 
797
            ->or->like('last_name', '%' . $search . '%')
-
 
798
            ->or->like('email', '%' . $search . '%')
-
 
799
            ->unnest();
-
 
800
            
-
 
801
        }
-
 
802
        
-
 
803
        $select->order(['first_name', 'last_name']);
-
 
804
        
-
 
805
        // echo $select->getSqlString($this->adapter->platform); exit;
-
 
806
        
-
 
807
        $prototype = new User();
-
 
808
        
-
 
809
        return $this->executeFetchAllObject($select, $prototype);
-
 
810
    }
-
 
811
    
-
 
812
    /**
-
 
813
     *
-
 
814
     * @param int $company_id
-
 
815
     * @param int $network_id
-
 
816
     * @param string $search
-
 
817
     * @return User[]
-
 
818
     */
-
 
819
    public function fetchAllSuggestForInvitationByCompanyIdAndNetworkIdAndSearch($company_id, $network_id, $search)
-
 
820
    {
-
 
821
        $selectCompanyUsers = $this->sql->select(CompanyUserMapper::_TABLE);
-
 
822
        $selectCompanyUsers->columns(['user_id']);
-
 
823
        $selectCompanyUsers->where->equalTo('company_id', $company_id);
-
 
824
        $selectCompanyUsers->where->in('status', [
-
 
825
            CompanyUser::STATUS_ACCEPTED,
-
 
826
            CompanyUser::STATUS_PENDING,
-
 
827
            CompanyUser::STATUS_SENT,
-
 
828
            
-
 
829
        ]);
-
 
830
        
-
 
831
        //echo $selectCompanyUsers->getSqlString($this->adapter->platform); exit;
-
 
832
        
-
 
833
        $select = $this->sql->select();
-
 
834
        $select->from(self::_TABLE);
-
 
835
        $select->where->notIn('id', $selectCompanyUsers);
-
 
836
        $select->where->equalTo('network_id', $network_id);
-
 
837
        $select->where->equalTo('status', User::STATUS_ACTIVE);
-
 
838
        $select->where->equalTo('email_verified', User::EMAIL_VERIFIED_YES);
-
 
839
        
-
 
840
        if($search) {
-
 
841
            $select->where->nest()
-
 
842
            ->like('first_name', '%' . $search . '%')
-
 
843
            ->or->like('last_name', '%' . $search . '%')
-
 
844
            ->or->like('email', '%' . $search . '%')
-
 
845
            ->unnest();
-
 
846
            
-
 
847
        }
-
 
848
        
-
 
849
        $select->order(['first_name', 'last_name']);
-
 
850
        
-
 
851
        // echo $select->getSqlString($this->adapter->platform); exit;
-
 
852
        
-
 
853
        $prototype = new User();
-
 
854
        
Línea 686... Línea 855...
686
    }
855
        return $this->executeFetchAllObject($select, $prototype);
687
    
856
    }
688
    
857
    
689
    /**
858
    /**
Línea 731... Línea 900...
731
    }
900
    }
Línea 732... Línea 901...
732
    
901
    
733
    /**
902
    /**
734
     *
903
     *
-
 
904
     * @param int $group_id
-
 
905
     * @param int $network_id
-
 
906
     * @param string $search
-
 
907
     * @return User[]
-
 
908
     */
-
 
909
    public function fetchAllSuggestForInvitationByGroupIdAndNetworkIdAndSearch($group_id, $network_id, $search)
-
 
910
    {
-
 
911
        $selectGroupMembers = $this->sql->select(GroupMemberMapper::_TABLE);
-
 
912
        $selectGroupMembers->columns(['user_id']);
-
 
913
        $selectGroupMembers->where->equalTo('group_id', $group_id);
-
 
914
        $selectGroupMembers->where->in('status', [
-
 
915
            CompanyUser::STATUS_ACCEPTED,
-
 
916
        ]);
-
 
917
        
-
 
918
        //echo $selectGroupMembers->getSqlString($this->adapter->platform); exit;
-
 
919
        
-
 
920
        $select = $this->sql->select();
-
 
921
        $select->from(self::_TABLE);
-
 
922
        $select->where->equalTo('network_id', $network_id);
-
 
923
        $select->where->notIn('id', $selectGroupMembers);
-
 
924
        $select->where->equalTo('status', User::STATUS_ACTIVE);
-
 
925
        $select->where->equalTo('email_verified', User::EMAIL_VERIFIED_YES);
-
 
926
        
-
 
927
        if($search) {
-
 
928
            $select->where->nest()
-
 
929
            ->like('first_name', '%' . $search . '%')
-
 
930
            ->or->like('last_name', '%' . $search . '%')
-
 
931
            ->or->like('email', '%' . $search . '%')
-
 
932
            ->unnest();
-
 
933
            
-
 
934
        }
-
 
935
        
-
 
936
        $select->order(['first_name', 'last_name']);
-
 
937
        
-
 
938
        // echo $select->getSqlString($this->adapter->platform); exit;
-
 
939
        
-
 
940
        $prototype = new User();
-
 
941
        
-
 
942
        return $this->executeFetchAllObject($select, $prototype);
-
 
943
    }
-
 
944
    
-
 
945
    /**
-
 
946
     *
735
     * @param int $group_id
947
     * @param int $group_id
736
     * @param string $search
948
     * @param string $search
737
     * @return User[]
949
     * @return User[]
738
     */
950
     */
739
    public function fetchAllSuggestForInvitationByGroupId($group_id, $search)
951
    public function fetchAllSuggestForInvitationByGroupId($group_id, $search)
Línea 769... Línea 981...
769
        $prototype = new User();
981
        $prototype = new User();
Línea 770... Línea 982...
770
        
982
        
771
        return $this->executeFetchAllObject($select, $prototype);
983
        return $this->executeFetchAllObject($select, $prototype);
Línea -... Línea 984...
-
 
984
    }
-
 
985
 
772
    }
986
    
773
 
987
    
774
    public function fetchAllSuggestForInvitationByHptgId($group_id,$company_id, $search)
988
    public function fetchAllSuggestForInvitationByHptgId($group_id,$company_id, $search)
775
    {
989
    {
776
        $selectGroupMembers = $this->sql->select(HighPerformanceTeamsGroupsMembersMapper::_TABLE);
990
        $selectGroupMembers = $this->sql->select(HighPerformanceTeamsGroupsMembersMapper::_TABLE);