Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 6683 Rev 6684
Línea 758... Línea 758...
758
 
758
 
Línea 759... Línea 759...
759
            $form->setData($dataPost);
759
            $form->setData($dataPost);
760
 
760
 
761
            if ($form->isValid()) {
-
 
-
 
761
            if ($form->isValid()) {
-
 
762
                $dataPost = (array) $form->getData();
-
 
763
                return new JsonModel([
-
 
764
                    'success' => false,
762
                $dataPost = (array) $form->getData();
765
                    'data' => $dataPost
763
                
766
                ]);
Línea 764... Línea 767...
764
                $hydrator = new ObjectPropertyHydrator();
767
                $hydrator = new ObjectPropertyHydrator();
765
                $hydrator->hydrate($dataPost, $survey);
768
                $hydrator->hydrate($dataPost, $survey);
Línea 770... Línea 773...
770
               
773
               
771
                $surveyFormMapper = SurveyFormMapper::getInstance($this->adapter);
774
                $surveyFormMapper = SurveyFormMapper::getInstance($this->adapter);
772
                $surveyForm = $surveyFormMapper->fetchOneByUuid($dataPost['form_id']);
775
                $surveyForm = $surveyFormMapper->fetchOneByUuid($dataPost['form_id']);
Línea 773... Línea 776...
773
                $survey->form_id = $surveyForm->id;
776
                $survey->form_id = $surveyForm->id;
774
               
-
 
775
                if($surveyMapper->update($survey)){
-
 
776
                    $survey = $surveyMapper->fetchOne($survey->id);
-
 
777
 
-
 
778
                    $jobDescription = new SurveyJobDescription();
-
 
779
                    $skill = new SurveySkill();
-
 
780
                    $industry = new SurveyIndustry();
-
 
781
                    $language = new SurveyLanguage();
-
 
782
 
-
 
783
                    if(!empty($dataPost['location_search'])){ 
-
 
784
 
-
 
785
                        $surveyLocationMapper = SurveyLocationMapper::getInstance($this->adapter);
-
 
786
    
-
 
787
                        $ok = true;
-
 
788
 
-
 
789
                        $formatted_address = $dataPost['formatted_address'];
-
 
790
                        $city1 = $dataPost['city1'];
-
 
791
                        $city2 = $dataPost['city2'];
-
 
792
                        $address1 = $dataPost['address1'];
-
 
793
                        $address2 = $dataPost['address2'];
-
 
794
                        $country = $dataPost['country'];
-
 
795
                        $latitude = $dataPost['latitude'];
-
 
796
                        $longitude = $dataPost['longitude'];
-
 
797
                        $postal_code = $dataPost['postal_code'];
-
 
798
                        $state = $dataPost['state'];
-
 
799
 
-
 
800
                        
-
 
801
                        $record = new SurveyLocation();
-
 
802
                        $record->formatted_address = $formatted_address; 
-
 
803
                        $record->city1 = $city1;
-
 
804
                        $record->city2 = $city2;
-
 
805
                        $record->address1 = $address1;
-
 
806
                        $record->address2 = $address2;
-
 
807
                        $record->country = $country;
-
 
808
                        $record->latitude = $latitude;
-
 
809
                        $record->longitude = $longitude;
-
 
810
                        $record->postal_code = $postal_code;
-
 
811
                        $record->state = $state;
-
 
812
                        $record->survey_id = $survey->id;
-
 
813
                        $result = $surveyLocationMapper->update($record);
-
 
814
                        $ok = $ok && $result;
-
 
815
                           //}
-
 
816
                          if($ok){
-
 
817
    
-
 
818
                        }
-
 
819
                    }
-
 
820
 
-
 
821
                    if(!empty($dataPost['job_description_id'])){ 
-
 
822
 
-
 
823
                       // print_r($dataPost['job_description_id']);
-
 
824
 
-
 
825
                        $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
-
 
826
                        $surveyJobDescriptionMapper = SurveyJobDescriptionMapper::getInstance($this->adapter);
-
 
827
 
-
 
828
                        $ok = true;
-
 
829
 
-
 
830
                        foreach($dataPost['job_description_id'] as $jobDescriptionUuid) {
-
 
831
                        
-
 
832
                           // echo '$jobDescriptionUuid = ' . $jobDescriptionUuid ; 
-
 
833
 
-
 
834
 
-
 
835
                            $jobDescription = $jobDescriptionMapper->fetchOneByUuid($jobDescriptionUuid);
-
 
836
 
-
 
837
                           // print_r($jobDescription);
-
 
838
                            //print_r($currentCompany);
-
 
839
 
-
 
840
                            if($jobDescription && $jobDescription->company_id == $currentCompany->id) {
-
 
841
                                $record = new SurveyJobDescription();
-
 
842
                                $record->job_description_id = $jobDescription->id;
-
 
843
                                $record->survey_id = $survey->id;
-
 
844
 
-
 
845
                            
-
 
846
 
-
 
847
                                $result = $surveyJobDescriptionMapper->update($record);
-
 
848
                                $ok = $ok && $result;
-
 
849
                            }
-
 
850
                        }
-
 
851
                    
-
 
852
                        if($ok){
-
 
853
 
-
 
854
                        }
-
 
855
                    }
-
 
856
 
-
 
857
                    $data = [
-
 
858
                        'success' => true,
-
 
859
                        'data' => 'LABEL_RECORD_ADDED'
-
 
860
                    ];
-
 
861
                    //      return new JsonModel($data); 
-
 
862
 
-
 
863
                    if(!empty($dataPost['skill_id'])){ 
-
 
864
 
-
 
865
                        // print_r($dataPost['skill_id']);
-
 
866
 
-
 
867
                         $skillMapper = SkillMapper::getInstance($this->adapter);
-
 
868
                         $surveySkillMapper = SurveySkillMapper::getInstance($this->adapter);
-
 
869
 
-
 
870
                         $ok = true;
-
 
871
 
-
 
872
                         foreach($dataPost['skill_id'] as $skillUuid) {
-
 
873
 
-
 
874
                            // echo '$jobCategoryUuid = ' . $jobCategoryUuid ; 
-
 
875
 
-
 
876
 
-
 
877
                             $skill = $skillMapper->fetchOneByUuid($skillUuid);
-
 
878
 
-
 
879
                            // print_r($skill);
-
 
880
                            //print_r($currentCompany);
-
 
881
 
-
 
882
                            //if($skill && $skill->company_id == $currentCompany->id) {
-
 
883
                                $record = new SurveySkill();
-
 
884
                                $record->skill_id = $skill->id;
-
 
885
                                $record->survey_id = $survey->id;
-
 
886
 
-
 
887
 
-
 
888
                                $result = $surveySkillMapper->update($record);
-
 
889
                                $ok = $ok && $result;
-
 
890
                            // }
-
 
891
                         }
-
 
892
                     
-
 
893
                         if($ok){
-
 
894
 
-
 
895
                         }
-
 
896
                     }
-
 
897
 
-
 
898
                    $data = [
-
 
899
                        'success' => true,
-
 
900
                        'data' => 'test'
-
 
901
                    ];
-
 
902
                    //      return new JsonModel($data); exit;
-
 
903
 
-
 
904
                    if(!empty($dataPost['industry_id'])){ 
-
 
905
 
-
 
906
                        // print_r($dataPost['industry_id']);
-
 
907
 
-
 
908
                         $industryMapper = IndustryMapper::getInstance($this->adapter);
-
 
909
                         $surveyIndustryMapper = SurveyIndustryMapper::getInstance($this->adapter);
-
 
910
 
-
 
911
                         $ok = true;
-
 
912
 
-
 
913
                         foreach($dataPost['industry_id'] as $industryUuid) {
-
 
914
 
-
 
915
                            // echo '$industryUuid = ' . $industryUuid ; 
-
 
916
 
-
 
917
 
-
 
918
                             $industry = $industryMapper->fetchOneByUuid($industryUuid);
-
 
919
 
-
 
920
                            // print_r($industry);
-
 
921
                             //print_r($currentCompany);
-
 
922
 
-
 
923
                             //if($industry && $industry->company_id == $currentCompany->id) {
-
 
924
                                 $record = new SurveyIndustry();
-
 
925
                                 $record->industry_id = $industry->id;
-
 
926
                                 $record->survey_id = $survey->id;
-
 
927
 
-
 
928
                            
-
 
929
 
-
 
930
                                 $result = $surveyIndustryMapper->update($record);
-
 
931
                                 $ok = $ok && $result;
-
 
932
                             //}
-
 
933
                         }
-
 
934
                     
-
 
935
                         if($ok){
-
 
936
 
-
 
937
                         }
-
 
938
                     }
-
 
939
 
-
 
940
                    $data = [
-
 
941
                        'success' => true,
-
 
942
                        'data' => 'test industry'
-
 
943
                    ];
-
 
944
                    // return new JsonModel($data); exit;
-
 
945
                
-
 
946
                    if(!empty($dataPost['language_id'])){ 
-
 
947
 
-
 
948
                        $surveyLanguageMapper = SurveyLanguageMapper::getInstance($this->adapter);
-
 
949
 
-
 
950
                        $ok = true;
-
 
951
 
-
 
952
                        foreach($dataPost['language_id'] as $language_id) {
-
 
953
 
-
 
954
                                $record = new SurveyLanguage();
-
 
955
                                $record->language_id = $language_id;
-
 
956
                                $record->survey_id = $survey->id;
-
 
957
 
-
 
958
 
-
 
959
                                $result = $surveyLanguageMapper->update($record);
-
 
960
                                $ok = $ok && $result;
-
 
961
                           //}
-
 
962
                        }
-
 
963
                          if($ok){
-
 
964
 
-
 
965
                        }
-
 
966
                     }
-
 
967
                }
-
 
968
 
-
 
Línea 969... Línea 777...
969
            return new JsonModel($data);
777
               
970
               
778
                $result = $surveyMapper->update($survey);
971
 
779
 
972
                if ($result) {
780
                if ($result) {