Download the UpdateCase Client and install in your CakePHP website. "src/Util/UpdateCaseUtil.php"
Download UpdateCase Client
var $variant_id = ###; function initUpdateCase($variant_id = false) { if ($variant_id) $this->variant_id = $variant_id; $this->updateCase = new UpdateCaseUtil(['debug' => true,'variant_id' => $this->variant_id,'version' => 6,'lang' => $this->request->getAttribute('lang')]); $this->set('updateCase',$this->updateCase); }
public function image(int $revision_id): Response { $fileJPG = APP.'Files'.DS.'updateCase'.DS.'images'.DS.$revision_id.'.jpg'; $filePNG = APP.'Files'.DS.'updateCase'.DS.'images'.DS.$revision_id.'.png'; if (file_exists($fileJPG)) { $file = $fileJPG; $mime = 'image/jpg'; } elseif (file_exists($filePNG)) { $file = $filePNG; $mime = 'image/png'; } if (true) { $streamFactory = new StreamFactory(); return $this->response ->withType($mime) ->withBody($streamFactory->createStreamFromFile($file)); } else { //show a placeholder image when the images does not exist // return $this->response // ->withType($file['extension']) // ->withBody($streamFactory->createStreamFromFile($file['file'])); } } public function file(int $revision_id): Response { $file = APP.'Files'.DS.'updateCase'.DS.'images'.DS.$revision_id.'.pdf'; //@todo check if file exists otherwise show a placeholder //need to get the type automatically if (true) { $streamFactory = new StreamFactory(); return $this->response ->withType('application/pdf') ->withBody($streamFactory->createStreamFromFile($file)); } else { //show a placeholder image when the images does not exist // return $this->response // ->withType($file['extension']) // ->withBody($streamFactory->createStreamFromFile($file['file'])); } } function sync() { $this->initUpdateCase($this->variant_id); $id = $this->updateCase->sync(); $this->Flash->warning('Updated #'.$id); $this->redirect('/'); }