Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 841 Rev 842
Línea 110... Línea 110...
110
                if (!in_array($order_direction, ['ASC', 'DESC'])) {
110
                if (!in_array($order_direction, ['ASC', 'DESC'])) {
111
                    $order_direction = 'ASC';
111
                    $order_direction = 'ASC';
112
                }
112
                }
Línea 113... Línea 113...
113
 
113
 
114
                $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
-
 
115
                
-
 
116
                if($currentCompany) {
-
 
Línea -... Línea 114...
-
 
114
                $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
-
 
115
 
117
                $paginator = $jobDescriptionMapper->fetchAllDataTableByCompanyId($currentCompany->id, $search, $page, $records_x_page, $order_field, $order_direction);
116
                if ($currentCompany) {
118
 
117
                    $paginator = $jobDescriptionMapper->fetchAllDataTableByCompanyId($currentCompany->id, $search, $page, $records_x_page, $order_field, $order_direction);
119
                }else{
118
                } else {
120
                      $paginator = $jobDescriptionMapper->fetchAllDataTable($search, $page, $records_x_page, $order_field, $order_direction);  
119
                    $paginator = $jobDescriptionMapper->fetchAllDataTable($search, $page, $records_x_page, $order_field, $order_direction);
121
                }
120
                }
122
                $items = [];
121
                $items = [];
Línea 144... Línea 143...
144
                        'items' => $items,
143
                        'items' => $items,
145
                        'total' => $paginator->getTotalItemCount(),
144
                        'total' => $paginator->getTotalItemCount(),
146
                    ]
145
                    ]
147
                ]);
146
                ]);
148
            } else {
147
            } else {
149
                
148
 
150
                $form = new JobDescriptionForm($this->adapter, $currentCompany ? $currentCompany->id: 0);
149
                $form = new JobDescriptionForm($this->adapter, $currentCompany ? $currentCompany->id : 0);
Línea 151... Línea 150...
151
 
150
 
152
                $this->layout()->setTemplate('layout/layout-backend');
151
                $this->layout()->setTemplate('layout/layout-backend');
153
                $viewModel = new ViewModel();
152
                $viewModel = new ViewModel();
154
                $viewModel->setTemplate('leaders-linked/jobs-description/index.phtml');
153
                $viewModel->setTemplate('leaders-linked/jobs-description/index.phtml');
Línea 179... Línea 178...
179
                'competencies' => [],
178
                'competencies' => [],
180
                'jobs_description' => [],
179
                'jobs_description' => [],
181
            ];
180
            ];
Línea 182... Línea 181...
182
 
181
 
-
 
182
            $competencyTypeMapper = CompetencyTypeMapper::getInstance($this->adapter);
-
 
183
 
183
            $competencyTypeMapper = CompetencyTypeMapper::getInstance($this->adapter);
184
            if ($$currentCompany) {
-
 
185
                $records = $competencyTypeMapper->fetchAllByCompanyId($currentCompany->id);
Línea 184... Línea 186...
184
            $records = $competencyTypeMapper->fetchAllByCompanyId($currentCompany->id);
186
            }
185
 
187
 
186
            $competencyTypesUUID = [];
188
            $competencyTypesUUID = [];
187
            foreach ($records as $record) {
189
            foreach ($records as $record) {
Línea 194... Línea 196...
194
            }
196
            }
Línea 195... Línea 197...
195
 
197
 
-
 
198
 
196
 
199
 
-
 
200
            $competencyMapper = CompetencyMapper::getInstance($this->adapter);
Línea 197... Línea 201...
197
 
201
            if ($$currentCompany) {
198
            $competencyMapper = CompetencyMapper::getInstance($this->adapter);
202
                $records = $competencyMapper->fetchAllActiveByCompanyId($currentCompany->id);
Línea 711... Línea 715...
711
        }
715
        }
Línea 712... Línea 716...
712
 
716
 
Línea 713... Línea 717...
713
 
717
 
714
        if ($request->isGet()) {
718
        if ($request->isGet()) {
715
 
719
 
716
            return $this->renderPdf($currentCompany,$jobDescription);
720
            return $this->renderPdf($currentCompany, $jobDescription);
717
        } else {
721
        } else {
718
            $data = [
722
            $data = [
Línea 723... Línea 727...
723
            return new JsonModel($data);
727
            return new JsonModel($data);
724
        }
728
        }
Línea 725... Línea 729...
725
 
729
 
726
        return new JsonModel($data);
730
        return new JsonModel($data);
-
 
731
    }
727
    }
732
 
728
    /**
733
    /**
729
     * Render PDF
734
     * Render PDF
730
     * @param type $currentCompany
735
     * @param type $currentCompany
731
     * @param type $jobDescription
736
     * @param type $jobDescription
732
     * @return type
737
     * @return type
733
     */
738
     */
Línea 734... Línea 739...
734
    public function renderPDF($currentCompany, $jobDescription) {
739
    public function renderPDF($currentCompany, $jobDescription) {
735
 
740
 
736
        //Generate New PDF
741
        //Generate New PDF
737
        $pdf = new JobPDF();
742
        $pdf = new JobPDF();
738
        
743
 
739
        
744
 
740
        //get company Data
745
        //get company Data
741
        $companyMapper = CompanyMapper::getInstance($this->adapter);
746
        $companyMapper = CompanyMapper::getInstance($this->adapter);
742
        $company = $companyMapper->fetchOne($currentCompany->id);
747
        $company = $companyMapper->fetchOne($currentCompany->id);
743
      
748
 
744
        $target_path = $this->config['leaderslinked.fullpath.company'] . DIRECTORY_SEPARATOR . $company->uuid;
749
        $target_path = $this->config['leaderslinked.fullpath.company'] . DIRECTORY_SEPARATOR . $company->uuid;
745
        
750
 
Línea 746... Línea 751...
746
        $pdf->header = $company->header ? $target_path  . DIRECTORY_SEPARATOR. $company->header : '';
751
        $pdf->header = $company->header ? $target_path . DIRECTORY_SEPARATOR . $company->header : '';
Línea 747... Línea 752...
747
        $pdf->footer = $company->footer ? $target_path  . DIRECTORY_SEPARATOR. $company->footer : '';
752
        $pdf->footer = $company->footer ? $target_path . DIRECTORY_SEPARATOR . $company->footer : '';
748
 
753
 
Línea 815... Línea 820...
815
 
820
 
816
        $jobDescriptionCompetencyMapper = JobDescriptionCompetencyMapper::getInstance($this->adapter);
821
        $jobDescriptionCompetencyMapper = JobDescriptionCompetencyMapper::getInstance($this->adapter);
Línea 817... Línea 822...
817
        $jobDescriptionCompetency = $jobDescriptionCompetencyMapper->fetchByJobDescriptionId($jobDescription->id);
822
        $jobDescriptionCompetency = $jobDescriptionCompetencyMapper->fetchByJobDescriptionId($jobDescription->id);
818
 
823
 
819
        $competencyMapper = CompetencyMapper::getInstance($this->adapter);
824
        $competencyMapper = CompetencyMapper::getInstance($this->adapter);
Línea 820... Línea 825...
820
        
825
 
821
        $countCompetencies = count($jobDescriptionCompetency);
826
        $countCompetencies = count($jobDescriptionCompetency);
822
 
827
 
823
        if ($countCompetencies != 0) {
828
        if ($countCompetencies != 0) {
824
            
829
 
Línea 825... Línea 830...
825
            // add new page
830
            // add new page
Línea 826... Línea 831...
826
            
831
 
Línea 844... Línea 849...
844
 
849
 
845
                if ($i % 3 == 0 && $i < $countCompetencies) {
850
                if ($i % 3 == 0 && $i < $countCompetencies) {
846
                    $pdf->AddPage();
851
                    $pdf->AddPage();
847
                }
852
                }
848
            }
-
 
849
 
853
            }
Línea 850... Línea 854...
850
        }
854
        }
851
 
855