Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 1 Rev 4
Línea 848... Línea 848...
848
                $companyMicrolearningExtendUserProgramMapper = CompanyMicrolearningExtendUserProgramMapper::getInstance($this->adapter);
848
                $companyMicrolearningExtendUserProgramMapper = CompanyMicrolearningExtendUserProgramMapper::getInstance($this->adapter);
849
                $companyMicrolearningExtendUserPartnerMapper = CompanyMicrolearningExtendUserPartnerMapper::getInstance($this->adapter);
849
                $companyMicrolearningExtendUserPartnerMapper = CompanyMicrolearningExtendUserPartnerMapper::getInstance($this->adapter);
850
                $companyMicrolearningExtendUserSectorMapper = CompanyMicrolearningExtendUserSectorMapper::getInstance($this->adapter);
850
                $companyMicrolearningExtendUserSectorMapper = CompanyMicrolearningExtendUserSectorMapper::getInstance($this->adapter);
851
                $companyMicrolearningExtendUserStudentTypeMapper = CompanyMicrolearningExtendUserStudentTypeMapper::getInstance($this->adapter);
851
                $companyMicrolearningExtendUserStudentTypeMapper = CompanyMicrolearningExtendUserStudentTypeMapper::getInstance($this->adapter);
Línea -... Línea 852...
-
 
852
                
Línea -... Línea 853...
-
 
853
 
852
                
854
                
853
                
855
           
854
                $users_assigned = 0;
856
                $users_assigned = 0;
855
                $user_ids = [];
857
                $user_ids = [];
856
                foreach($records as $record)
858
                foreach($records as $record)
Línea 900... Línea 902...
900
                    
902
                    
901
                    if(!in_array($user->id, $user_ids)) {
903
                    if(!in_array($user->id, $user_ids)) {
902
                        array_push($user_ids, $user->id);
904
                        array_push($user_ids, $user->id);
Línea -... Línea 905...
-
 
905
                    }
-
 
906
                    
-
 
907
                    /*
-
 
908
                    echo '$filterCompany = ' . $filterCompany . PHP_EOL;
903
                    }
909
                    echo '$filterFunctio = ' . $filterFunction . PHP_EOL;
-
 
910
                    echo '$filterGroup = ' . $filterGroup . PHP_EOL;
-
 
911
                    echo '$filterInstitution = ' . $filterInstitution . PHP_EOL;
-
 
912
                    echo '$filterPartner = ' . $filterPartner . PHP_EOL;
904
                    
913
                    echo '$filterProgram = ' . $filterProgram . PHP_EOL;
-
 
914
                    echo '$filterSector = ' . $filterSector . PHP_EOL;
-
 
915
                    echo '$filterStudentType = ' . $filterStudentType . PHP_EOL;
-
 
916
                  */
-
 
917
                   
-
 
918
                    
-
 
919
                    $extendUser = $companyMicrolearningExtendUserMapper->fetchOneByCompanyIdAndUserId($currentCompany->id, $user->id);
-
 
920
                    if(!$extendUser) {
-
 
921
                        $extendUser = new CompanyMicrolearningExtendUser();
-
 
922
                        $extendUser->company_id = $currentCompany->id;
-
 
923
                        $extendUser->user_id = $user->id;
-
 
924
                    }
-
 
925
                    
-
 
926
                    
-
 
927
                    if($filterCompany) {
-
 
928
                        $record = $companyMicrolearningExtendUserCompanyMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterCompany);
-
 
929
      
-
 
930
                        if(!$record) {
-
 
931
                            $record = new CompanyMicrolearningExtendUserCompany();
-
 
932
                            $record->company_id = $currentCompany->id;
-
 
933
                            $record->name = $filterCompany;
-
 
934
                                    
-
 
935
                            $companyMicrolearningExtendUserCompanyMapper->insert($record);
-
 
936
                        }
-
 
937
                    
-
 
938
 
-
 
939
                        
-
 
940
                                
-
 
941
                        if($record->id) {
-
 
942
                            $extendUser->extend_company_id = $record->id;
-
 
943
                        }
-
 
944
                    }
-
 
945
                            
-
 
946
                    if($filterFunction) {
-
 
947
                        $record = $companyMicrolearningExtendUserFunctionMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterFunction);
-
 
948
                        if(!$record) {
-
 
949
                            $record = new CompanyMicrolearningExtendUserFunction();
-
 
950
                            $record->company_id = $currentCompany->id;
-
 
951
                            $record->name = $filterFunction;
-
 
952
                                    
-
 
953
                            $companyMicrolearningExtendUserFunctionMapper->insert($record);
-
 
954
                        }
-
 
955
                                
-
 
956
                        if($record->id) {
-
 
957
                            $extendUser->extend_function_id = $record->id;
-
 
958
                        }
-
 
959
                    }
-
 
960
                            
-
 
961
                    if($filterGroup) {
-
 
962
                        $record = $companyMicrolearningExtendUserGroupMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterGroup);
-
 
963
                        if(!$record) {
-
 
964
                            $record = new CompanyMicrolearningExtendUserGroup();
-
 
965
                            $record->company_id = $currentCompany->id;
-
 
966
                            $record->name = $filterGroup;
-
 
967
                                    
-
 
968
                            $companyMicrolearningExtendUserGroupMapper->insert($record);
-
 
969
                        }
-
 
970
                                
-
 
971
                        if($record->id) {
-
 
972
                            $extendUser->extend_group_id = $record->id;
-
 
973
                        }
-
 
974
                    }
-
 
975
                            
-
 
976
                    if($filterInstitution) {
-
 
977
                        $record = $companyMicrolearningExtendUserInstitutionMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterInstitution);
-
 
978
                        if(!$record) {
-
 
979
                            $record = new CompanyMicrolearningExtendUserInstitution();
-
 
980
                            $record->company_id = $currentCompany->id;
-
 
981
                            $record->name = $filterInstitution;
-
 
982
                                    
-
 
983
                            $companyMicrolearningExtendUserInstitutionMapper->insert($record);
-
 
984
                        }
-
 
985
                                
-
 
986
                        if($record->id) {
-
 
987
                            $extendUser->extend_institution_id = $record->id;
Línea -... Línea 988...
-
 
988
                        }
-
 
989
                    }
-
 
990
                            
-
 
991
                    if($filterProgram) {
-
 
992
                        $record = $companyMicrolearningExtendUserProgramMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterProgram);
-
 
993
                        if(!$record) {
-
 
994
                            $record = new CompanyMicrolearningExtendUserProgram();
-
 
995
                            $record->company_id = $currentCompany->id;
-
 
996
                            $record->name = $filterProgram;
-
 
997
                                    
-
 
998
                            $companyMicrolearningExtendUserProgramMapper->insert($record);
-
 
999
                        }
-
 
1000
                                
-
 
1001
                        if($record->id) {
Línea 905... Línea -...
905
                    if($filterCompany || $filterFunction || $filterGroup || $filterInstitution || $filterPartner
-
 
906
                        || $filterProgram || $filterSector || $filterStudentType) {
-
 
907
                            
-
 
908
                            
-
 
909
                            $extendUser = $companyMicrolearningExtendUserMapper->fetchOneByCompanyIdAndUserId($currentCompany->id, $user->id);
-
 
910
                            if(!$extendUser) {
-
 
911
                                $extendUser = new CompanyMicrolearningExtendUser();
-
 
912
                                $extendUser->company_id = $currentCompany->id;
-
 
913
                                $extendUser->user_id = $user->id;
-
 
914
                            }
-
 
915
                            
-
 
916
                            if($filterCompany) {
-
 
917
                                $record = $companyMicrolearningExtendUserCompanyMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterCompany);
-
 
918
                                if(!$record) {
-
 
919
                                    $record = new CompanyMicrolearningExtendUserCompany();
-
 
920
                                    $record->company_id = $currentCompany->id;
-
 
921
                                    $record->name = $filterCompany;
-
 
922
                                    
-
 
923
                                    $companyMicrolearningExtendUserCompanyMapper->insert($record);
-
 
924
                                }
-
 
925
                                
-
 
926
                                if($record->id) {
-
 
927
                                    $extendUser->extend_company_id = $record->id;
-
 
928
                                    
-
 
929
                                }
-
 
930
                            }
-
 
931
                            
-
 
932
                            if($filterFunction) {
-
 
933
                                $record = $companyMicrolearningExtendUserFunctionMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterFunction);
-
 
934
                                if(!$record) {
-
 
935
                                    $record = new CompanyMicrolearningExtendUserFunction();
-
 
936
                                    $record->company_id = $currentCompany->id;
-
 
937
                                    $record->name = $filterFunction;
-
 
938
                                    
-
 
939
                                    $companyMicrolearningExtendUserFunctionMapper->insert($record);
-
 
940
                                }
-
 
941
                                
-
 
942
                                if($record->id) {
-
 
943
                                    $extendUser->extend_function_id = $record->id;
-
 
944
                                    
-
 
945
                                }
-
 
946
                            }
-
 
947
                            
-
 
948
                            if($filterGroup) {
-
 
949
                                $record = $companyMicrolearningExtendUserGroupMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterGroup);
-
 
950
                                if(!$record) {
-
 
951
                                    $record = new CompanyMicrolearningExtendUserGroup();
-
 
952
                                    $record->company_id = $currentCompany->id;
-
 
953
                                    $record->name = $filterGroup;
-
 
954
                                    
-
 
955
                                    $companyMicrolearningExtendUserGroupMapper->insert($record);
-
 
956
                                }
-
 
957
                                
-
 
958
                                if($record->id) {
-
 
959
                                    $extendUser->extend_group_id = $record->id;
-
 
960
                                    
-
 
961
                                }
-
 
962
                            }
-
 
963
                            
-
 
964
                            if($filterInstitution) {
-
 
965
                                $record = $companyMicrolearningExtendUserInstitutionMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterInstitution);
-
 
966
                                if(!$record) {
-
 
967
                                    $record = new CompanyMicrolearningExtendUserInstitution();
-
 
968
                                    $record->company_id = $currentCompany->id;
-
 
969
                                    $record->name = $filterInstitution;
-
 
970
                                    
-
 
971
                                    $companyMicrolearningExtendUserInstitutionMapper->insert($record);
-
 
972
                                }
-
 
973
                                
-
 
974
                                if($record->id) {
-
 
975
                                    $extendUser->extend_institution_id = $record->id;
-
 
976
                                    
1002
                            $extendUser->extend_program_id = $record->id;
977
                                }
-
 
978
                            }
-
 
979
                            
-
 
980
                            if($filterProgram) {
-
 
981
                                $record = $companyMicrolearningExtendUserProgramMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterProgram);
-
 
982
                                if(!$record) {
-
 
983
                                    $record = new CompanyMicrolearningExtendUserProgram();
-
 
984
                                    $record->company_id = $currentCompany->id;
-
 
985
                                    $record->name = $filterProgram;
-
 
986
                                    
-
 
987
                                    $companyMicrolearningExtendUserProgramMapper->insert($record);
-
 
988
                                }
1003
                        }
989
                                
-
 
990
                                if($record->id) {
-
 
991
                                    $extendUser->extend_program_id = $record->id;
1004
                    }
992
                                    
-
 
993
                                }
1005
                            
994
                            }
1006
                    if($filterPartner) {
995
                            
1007
                        
996
                            if($filterPartner) {
1008
                   
997
                                $record = $companyMicrolearningExtendUserPartnerMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterPartner);
1009
                        $record = $companyMicrolearningExtendUserPartnerMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterPartner);
998
                                if(!$record) {
1010
                        if(!$record) {
999
                                    $record = new CompanyMicrolearningExtendUserPartner();
1011
                            $record = new CompanyMicrolearningExtendUserPartner();
1000
                                    $record->company_id = $currentCompany->id;
-
 
1001
                                    $record->name = $filterPartner;
-
 
1002
                                    
-
 
1003
                                    $companyMicrolearningExtendUserPartnerMapper->insert($record);
-
 
1004
                                }
-
 
1005
                                
-
 
1006
                                if($record->id) {
1012
                            $record->company_id = $currentCompany->id;
1007
                                    $extendUser->extend_partner_id = $record->id;
-
 
1008
                                    
-
 
1009
                                }
-
 
1010
                            }
-
 
1011
                            
-
 
1012
                            if($filterSector) {
-
 
1013
                                $record = $companyMicrolearningExtendUserSectorMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterSector);
-
 
1014
                                if(!$record) {
-
 
1015
                                    $record = new CompanyMicrolearningExtendUserSector();
-
 
1016
                                    $record->company_id = $currentCompany->id;
-
 
1017
                                    $record->name = $filterSector;
1013
                            $record->name = $filterPartner;
1018
                                    
1014
                                    
1019
                                    $companyMicrolearningExtendUserSectorMapper->insert($record);
1015
                            $companyMicrolearningExtendUserPartnerMapper->insert($record);
1020
                                }
-
 
1021
                                
-
 
1022
                                if($record->id) {
-
 
1023
                                    $extendUser->extend_function_id_id = $record->id;
-
 
1024
                                    
-
 
1025
                                }
-
 
1026
                            }
-
 
1027
                            
-
 
1028
                            if($filterStudentType) {
-
 
1029
                                $record = $companyMicrolearningExtendUserStudentTypeMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterStudentType);
-
 
1030
                                if(!$record) {
-
 
1031
                                    $record = new CompanyMicrolearningExtendUserStudentType();
-
 
1032
                                    $record->company_id = $currentCompany->id;
-
 
1033
                                    $record->name = $filterStudentType;
-
 
1034
                                    
-
 
1035
                                    $companyMicrolearningExtendUserStudentTypeMapper->insert($record);
-
 
1036
                                }
-
 
1037
                                
-
 
1038
                                if($record->id) {
1016
                        }
1039
                                    $extendUser->extend_student_type_id = $record->id;
-
 
1040
                                    
-
 
1041
                                }
-
 
1042
                            }
-
 
1043
                            
-
 
1044
                            if($extendUser->id) {
1017
                                
Línea -... Línea 1018...
-
 
1018
                        if($record->id) {
-
 
1019
                            $extendUser->extend_partner_id = $record->id;
-
 
1020
                        }
-
 
1021
                    }
-
 
1022
                            
-
 
1023
                    if($filterSector) {
-
 
1024
                        $record = $companyMicrolearningExtendUserSectorMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterSector);
-
 
1025
                        if(!$record) {
-
 
1026
                            $record = new CompanyMicrolearningExtendUserSector();
-
 
1027
                            $record->company_id = $currentCompany->id;
-
 
1028
                            $record->name = $filterSector;
-
 
1029
                                    
-
 
1030
                            $companyMicrolearningExtendUserSectorMapper->insert($record);
-
 
1031
                        }
Línea -... Línea 1032...
-
 
1032
                                
-
 
1033
                        if($record->id) {
-
 
1034
                            $extendUser->extend_sector_id = $record->id;
-
 
1035
                        }
-
 
1036
                    }
-
 
1037
                            
-
 
1038
                    if($filterStudentType) {
-
 
1039
                        $record = $companyMicrolearningExtendUserStudentTypeMapper->fetchOneByCompanyIdAndName($currentCompany->id, $filterStudentType);
1045
                                $companyMicrolearningExtendUserMapper->update($extendUser);
1040
                        if(!$record) {
-
 
1041
                            $record = new CompanyMicrolearningExtendUserStudentType();
-
 
1042
                            $record->company_id = $currentCompany->id;
-
 
1043
                            $record->name = $filterStudentType;
-
 
1044
                                    
-
 
1045
                            $companyMicrolearningExtendUserStudentTypeMapper->insert($record);
-
 
1046
                        }
-
 
1047
                        if($record->id) {
-
 
1048
                            $extendUser->extend_student_type_id = $record->id;
-
 
1049
                        }
-
 
1050
                    }
-
 
1051
                    
-
 
1052
                    //print_r($extendUser); exit;
-
 
1053
                    
-
 
1054
 
-
 
1055
                            
-
 
1056
                    if($extendUser->id) {
-
 
1057
                       $result =   $companyMicrolearningExtendUserMapper->update($extendUser);
1046
                            } else {
1058
                    } else {
Línea -... Línea 1059...
-
 
1059
                       $result = $companyMicrolearningExtendUserMapper->insert($extendUser);
1047
                                $companyMicrolearningExtendUserMapper->insert($extendUser);
1060
                    }
1048
                            }
1061
                
1049
                            
1062
                
1050
                            
1063