ci = &get_instance(); $this->ci->load->library( 'services/curl/CurlWrapper' ); $this->ci->load->library( 'services/ConvertWord2PDF' ); $this->ci->load->config('conversionentities'); } public function getConversionStatus() { return $this->conversionStatus; } public function handle( $dossier ) { $this->setDossier( $dossier ); $this->setUploadType(); $this->convertContent(); $this->setNonConversion(); } private function setdossier( $dossier ) { $this->dossier = $dossier; } private function setUploadType() { $this->setWord(); $this->setPDF(); $this->setExcel(); } private function setWord() { if ( in_array( strtoupper( $this->dossier->extension ), $this->wordExtensions ) ) return $this->word = TRUE; $this->word = FALSE; } private function setPDF() { if ( in_array( strtoupper( $this->dossier->extension ), $this->pdfExtensions ) ) return $this->pdf = TRUE; $this->pdf = FALSE; } private function setExcel() { if ( in_array( strtoupper( $this->dossier->extension ), $this->excelExtensions ) ) return $this->excel = TRUE; $this->excel = FALSE; } private function convertContent() { $this->convertWord(); $this->convertPDF(); $this->convertExcel(); } private function convertWord() { if ( ! $this->word ) return; $this->ci->convertword2pdf->handle( $this->dossier ); if ( ! $this->ci->convertword2pdf->getConversionResult() ) return $this->conversionStatus = $this->ci->config->item('failedconversion'); $this->conversionStatus = $this->ci->config->item('wordpdfconversionsuccess'); } private function convertPDF() { if ( ! $this->pdf ) return; $this->conversionStatus = $this->ci->config->item('ispdfdocument'); } private function convertExcel() { if ( ! $this->excel ) return; $this->conversionStatus = $this->ci->config->item('nonconversion'); } private function setNonConversion() { if ( $this->word ) return; if ( $this->pdf ) return; if ( $this->excel ) return; $this->conversionStatus = $this->ci->config->item('nonconversion'); } }