bundles/DevelopmentBundle/EventListener/WorkflowListener.php line 160

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * Date: 11/6/20
  5.  * Time: 10:26 AM
  6.  */
  7. namespace DevelopmentBundle\EventListener;
  8. use DevelopmentBundle\Compliance\AssociateCompliance;
  9. use DevelopmentBundle\Development\Development;
  10. use DevelopmentBundle\Development\Generate\DevelopmentSku;
  11. use DevelopmentBundle\Product\Product;
  12. use DevelopmentBundle\Validation\Validate;
  13. use Pimcore\Event\Model\DataObjectEvent;
  14. use Pimcore\Event\Model\ElementEventInterface;
  15. use Pimcore\Model\Asset;
  16. use Pimcore\Model\DataObject;
  17. use Pimcore\Model\Element\ValidationException;
  18. use Pimcore\Tool\Admin;
  19. use Symfony\Component\EventDispatcher\GenericEvent;
  20. use Symfony\Component\Workflow\Event\Event;
  21. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  22. use Symfony\Component\Workflow\Event\GuardEvent;
  23. use Symfony\Component\Workflow\Registry;
  24. class WorkflowListener implements EventSubscriberInterface
  25. {
  26.     protected $workflowRegistry;
  27.     const DEVELOPMENT_DIRECTORY PIMCORE_PROJECT_ROOT '/var/pdf/';
  28.     const PDF_DIRECTORY PIMCORE_PROJECT_ROOT '/public/var/assets';
  29.     /**
  30.      * WorkflowListener constructor.
  31.      * @param Registry $workflowRegistry
  32.      */
  33.     public function __construct(
  34.         Registry $workflowRegistry
  35.     )
  36.     {
  37.         $this->workflowRegistry $workflowRegistry;
  38.     }
  39.     /**
  40.      * @param GuardEvent $event
  41.      */
  42.     public function guardPublish(GuardEvent $event): void
  43.     {
  44.         $objects $event->getSubject();
  45.         if ('variant' == $objects->gettype()) {  // Workflow action is blocked on variant level
  46.             $event->setBlocked(true);
  47.         }
  48.         if ($objects->getModel() == null || $objects->getTier3() == null) {
  49.             $event->setBlocked(true);
  50.         }
  51.     }
  52.     public function onLeave(Event $event): void
  53.     {
  54.         /** @var \Pimcore\Model\DataObject\Development $object */
  55.         $object $event->getSubject();
  56.         $eventTransition $event->getTransition();
  57.         $transitionName $eventTransition->getName();
  58.         if ($transitionName == "set_compliances") {
  59.             $compliance = new AssociateCompliance();
  60.             $compliance->processAssociateCompliance($object);
  61.         }
  62.         if ($transitionName == "review_ready") {
  63.             $this->checkComplianceValidation($object);
  64.         }
  65.         if ($transitionName == 'create_sku') {
  66.             $this->checkComplianceValidation($object);
  67.             $this->checkProductValidation($object);
  68.             $this->developmentSku($object);
  69.             $this->getProductTierTree($object);
  70.         }
  71.         if ($transitionName == 'create_paf') {
  72.             $this->checkComplianceValidation($object);
  73.         }
  74.         if ($transitionName == "create_paf") {
  75.             $html $this->createPDFHTML($object);
  76.             $pdf \Pimcore\Web2Print\Processor::getInstance()->getPdfFromString($html);
  77.             $finalPdf "";
  78.             $filename $this->generatePDFFilename($object->getDevelopmentNumber()) . ".pdf";
  79.             foreach ($object->getAnnexRelation() as $annex) {
  80.                 $finalPdf $annex->getFullPath();
  81.             }
  82.             if ($finalPdf != null || !empty($finalPdf)) {
  83.                 file_put_contents(
  84.                     self::DEVELOPMENT_DIRECTORY $filename,
  85.                     $pdf
  86.                 );
  87.                 $pdf = new \Clegginabox\PDFMerger\PDFMerger;
  88.                 $pdf->addPDF(self::DEVELOPMENT_DIRECTORY $filename'all');
  89.                 $pdf->addPDF(self::PDF_DIRECTORY $finalPdf'all');
  90.                 $pdf->merge('file'self::DEVELOPMENT_DIRECTORY $filename'P');
  91.                 $newAsset = new \Pimcore\Model\Asset();
  92.                 $newAsset->setFilename($filename);
  93.                 $newAsset->setData(file_get_contents(self::DEVELOPMENT_DIRECTORY $filename));
  94.                 $newAsset->setParent(\Pimcore\Model\Asset::getByPath("/Epaf"));
  95.                 $newAsset->save();
  96.             } else {
  97.                 $newAsset = new \Pimcore\Model\Asset();
  98.                 $newAsset->setFilename($filename);
  99.                 $newAsset->setData($pdf);
  100.                 $newAsset->setParent(\Pimcore\Model\Asset::getByPath("/Epaf"));
  101.                 $newAsset->save();
  102.                 file_put_contents(
  103.                     self::DEVELOPMENT_DIRECTORY $filename,
  104.                     $pdf
  105.                 );
  106.             }
  107.         }
  108.     }
  109.     /**
  110.      * @return array|\string[][]
  111.      */
  112.     public static function getSubscribedEvents()
  113.     {
  114.         return [
  115.             'workflow.Development_Workflow.guard' => ['guardPublish'],
  116.             'workflow.Development_Workflow.leave' => ['onLeave'],
  117.         ];
  118.     }
  119.     /**
  120.      * @param ElementEventInterface $event
  121.      *
  122.      * @throws \Pimcore\Model\Element\ValidationException
  123.      */
  124.     public function onPreUpdate(ElementEventInterface $event): void
  125.     {
  126.         if ($event instanceof DataObjectEvent) {
  127.             $object $event->getObject();
  128.             if ($object instanceof DataObject\Development) {
  129.                 /** @var \Pimcore\Model\DataObject\Development $object */
  130.                 $this->checkValidation($object);
  131.                 $user Admin::getCurrentUser();
  132.                 if ($user != null) {
  133.                     $user \Pimcore\Tool\Session::getReadonly()->get("user");
  134.                     $devObj $object->setCategoryManager(strtok($user->getEmail(), '@'));
  135. //                    $object->save();
  136.                 }
  137.             }
  138.         }
  139.     }
  140.     /**
  141.      * @param ElementEventInterface $event
  142.      * Set inital workflow state to sku_created to avoid further workflow on variant
  143.      */
  144.     public function postAdd(ElementEventInterface $event): void
  145.     {
  146.         if ($event instanceof DataObjectEvent) {
  147.             // do something with the object
  148.             $object $event->getObject();
  149. //            if ($object instanceof DataObject\Labels) {
  150. //                $newObj = $object->setLabelName(basename($object->getFullPath()));
  151. //                $object->save();
  152. //            }
  153. //            if ($object instanceof DataObject\BillOfMaterials) {
  154. //                $billObj = $object->setDescription(basename($object->getFullPath()));
  155. //                $object->save();
  156. //            }
  157. //            if ($object instanceof DataObject\Components) {
  158. //                $comObj = $object->setDescription(basename($object->getFullPath()));
  159. //                $object->save();
  160. //            }
  161.         }
  162.     }
  163.     /**
  164.      * @param $objects
  165.      */
  166.     public function checkValidation($objects): void
  167.     {
  168.         if ($objects instanceof DataObject\Development and 'variant' != $objects->gettype()) {
  169.             if ($objects->getSkipValidation()) {
  170.                 if ($objects instanceof DataObject\Development and 'variant' != $objects->gettype()) {
  171.                     if (($objects->getDevelopmentNumber() != null || $objects->getDevelopmentNumber() != "")) {
  172.                         $objects->setSkipValidation(false);
  173.                         $objects->setOmitMandatoryCheck(true);
  174.                     } else {
  175.                         $complianceValidation = new Validate();
  176.                         $complianceValidation->preCheckValidate($objects);
  177.                     }
  178.                 }
  179.             } else {
  180.                 $complianceValidation = new Validate();
  181.                 $complianceValidation->preUpdateValidate($objects);
  182.             }
  183.             if ('variant' != $objects->gettype()) {
  184.                 if (($objects->getDevelopmentNumber() != null && $objects->getDevelopmentNumber() != "")) {
  185.                     $this->getDevelopmentName($objects);
  186.                 }
  187.             }
  188.         }
  189.     }
  190.     /**
  191.      * @param $objects
  192.      * @throws ValidationException
  193.      */
  194.     public function checkComplianceValidation($objects): void
  195.     {
  196.         $complianceValidation = new Validate();
  197.         $complianceValidation->complianceValidation($objects);
  198.     }
  199.     /**
  200.      * @param $object
  201.      * @throws ValidationException
  202.      */
  203.     public function checkProductValidation($object): void
  204.     {
  205.         $productValidation = new Validate();
  206.         $productValidation->productCreateValidation($object);
  207.     }
  208.     /**
  209.      * @param $objects
  210.      */
  211.     public function getDevelopmentName($objects): void
  212.     {
  213.         $developmentKey = new Development();
  214.         $developmentKey->developmentKey($objects);
  215. //        $compliance = new AssociateCompliance();
  216. //        $compliance->processAssociateCompliance($objects);
  217.     }
  218.     /**
  219.      * @param $object
  220.      */
  221.     public function developmentSku($object): void
  222.     {
  223.         $developmentSku = new DevelopmentSku();
  224.         $developmentSku->processDevelopmentSku($object);
  225.     }
  226.     /**
  227.      * @param $object
  228.      */
  229.     public function getProductTierTree($object): void
  230.     {
  231.         $productCreate = new Product();
  232.         $productCreate->processProduct($object);
  233.     }
  234.     /**
  235.      * @param $object
  236.      * @return string
  237.      */
  238.     public function getWorkflowStatus($object): string
  239.     {
  240.         $workflow $this->workflowRegistry->get($object'Development_Workflow');
  241.         return implode(', 'array_keys($workflow->getMarking($object)->getPlaces()));
  242.     }
  243.     public function preSendData(GenericEvent $event): void
  244.     {
  245.         $object $event->getArgument("object");
  246.         $data $event->getArgument("data");
  247.         if ($object instanceof DataObject\Development && !($object instanceof DataObject\Folder)) {
  248.             $layout json_encode($data["layout"]);
  249.             $new_layout $this->getPdfData($object$layout);
  250.             if ($object->getDevelopmentNumber() != null && $object->getModel() != null && $object->getTier3() != null && $object->getBillOfMaterials() != null) {
  251.                 $cloneObj $this->getCloneData($object);
  252.                 $new_layout preg_replace('/' $cloneObj['from'] . '/'$cloneObj['to'], $new_layout1);
  253.             }
  254.             $data['layout'] = json_decode($new_layout);
  255.             $event->setArgument("data"$data);
  256.         }
  257.     }
  258.     private function getPdfData($object$new_layout): string|array|null
  259.     {
  260.         $workflow $this->workflowRegistry->get($object'Development_Workflow');
  261.         $workflowState array_keys($workflow->getMarking($object)->getPlaces());
  262.         if ($object->getDevelopmentNumber() != null && $workflowState[0] == "PAF_Created") {
  263.             $pdfFileName $this->generatePDFFilename($object->getDevelopmentNumber());
  264.             if (file_exists(self::DEVELOPMENT_DIRECTORY $pdfFileName '.pdf')) {
  265.                 $from_man_property '"handler":""';
  266.                 $to_man_property '"handler":"(function() {\nExt.Ajax.request({\nurl: \"development\/downloadepaf\",\nbinary: true,\nmethod: \"POST\",\nparams: {dev_no: \"' $pdfFileName '\"},\nsuccess: function (response) {\nvar blob=new Blob([response.responseBytes], {type: \'arraybuffer\'});\nvar link=document.createElement(\'a\');\nlink.href=window.URL.createObjectURL(blob);\nlink.download=\"' $pdfFileName '.pdf\";\nlink.click();\nconsole.log(response);\n}\n});\n});"';
  267.             } else {
  268.                 $from_man_property '"handler":""';
  269.                 $to_man_property '"handler":"(function() {\nalert(\"PDF document is not found\");\n});"';
  270.             }
  271.         } else {
  272.             $from_man_property '"handler":""';
  273.             $to_man_property '"handler":"(function() {\nalert(\"Epaf document is not generated yet\");\n});"';
  274.         }
  275.         $new_layout preg_replace('/' $from_man_property '/'$to_man_property$new_layout1);
  276.         return $new_layout;
  277.     }
  278.     private function getCloneData($object): void
  279.     {
  280.         $cloneObj = [];
  281.         $developmentNo $object->getDevelopmentNumber();
  282.         $clone_property '"handler":"hello"';
  283. //        $to_clone_property = '"handler":"(function() {\nExt.Ajax.request({\nurl: \"development\/cloneobject\",\nmethod: \"POST\",\nparams: {dev_no: \"' . $developmentNo . '\"},\nsuccess: function (response) {\nconsole.log(response);\n}\n});\n});"';
  284. //        $cloneObj['from'] = $clone_property;
  285. //        $cloneObj['to'] = $to_clone_property;
  286. //        return $cloneObj;
  287.     }
  288.     private function createPDFHTML($object): string
  289.     {
  290.         $html "<html lang=\"en\"> <head><base href=\'" \Pimcore\Tool::getHostUrl() . "\'> <meta charset=\"utf-8\"> <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\"> <title>Tables</title> <style> .container{ width: 960px; margin: 50px auto; } </style> </head> <body> <div class=\"container\"> <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: solid thin; border-width: 1px 1px 0 1px; border-collapse: collapse; margin: 0 0 30px 0;\">";
  291.         $html .= "<thead> <tr> <th colspan=\"6\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap;\"><img src=\"data: " mime_content_type(self::PDF_DIRECTORY "/Developments/headLogo.jpg") . ";base64," .
  292.             base64_encode(file_get_contents(self::PDF_DIRECTORY "/Developments/headLogo.jpg")) . "alt=\"...\" width=\"120\" height=\"auto\"></th> </tr> </thead> <tbody> <tr> <td colspan=\"6\" align=\"center\" bgcolor=\"#c0c0c0\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 30px; font-weight: bold; color: #000000; text-transform: uppercase;\">Product Approval Form</td> </tr> <tr> <td rowspan=\"" $this->getRow($object'sku') . "\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">SKU/Colour:</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">SKU number</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">";
  293.         $html .= "Colour</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">PMS colour/finish</td> <td colspan=\"2\" rowspan=\" " $this->getRow($object'image') . " \" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $this->generateMultipleImages($object) . "</td> </tr>" $this->getVariantsData($object) . " ";
  294.         $html .= "<tr><td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Product Name:</td> <td colspan=\"3\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\"> " $object->getProductName() . " </td> </tr> <tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Dev't Number:</td> <td colspan=\"3\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $object->getDevelopmentNumber() . " </td> </tr> <tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Vendor/Factory:</td> <td colspan=\"3\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\"> " $object->getVendorFactory() . " </td> </tr> <tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Market:</td> <td colspan=\"3\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $object->getMarket() . "</td> </tr> <tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">TOTAL PRICE(USD):</td> <td colspan=\"3\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\" bgcolor=\"#ebf1de\"> $" $object->getTotalPriceUSD() . " </td> </tr> <tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">FOB Port:</td> <td colspan=\"3\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\"> " $object->getFobPort() . " </td> </tr> <tr>";
  295.         $html .= "<td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">MOQ:</td> <td colspan=\"3\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\"> " $object->getMoq() . " </td> </tr> <tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Payment Terms:</td> <td colspan=\"3\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\"> " $object->getPaymentTerm() . " </td> </tr> <tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Production Time:</td> <td colspan=\"3\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $object->getProductionTime() . "</td> ";
  296.         $html .= "<td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">Common:</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $object->getCommon() . "</td> </tr> <tr> <td colspan=\"4\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Handling Charge/Vendor Notes:</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">Similar</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal; font-style: italic;\">" $object->getSimilar() . "</td> </tr> <tr> <td colspan=\"4\" style=\"border: solid thin; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\"> " $this->generateComponentHTML($object) . " </td> <td colspan=\"4\" style=\"border: solid thin; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\"> <table width=\"100%\" border=\"0\" height=\"232\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse;\"> <tbody>";
  297.         $html .= " <tr> <td width=\"125\" style=\"border: solid thin; border-width: 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">Price Validity:</td> <td align=\"right\" style=\"border: solid thin; border-width: 0 0 1px 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $object->getPriceValidatity() . "</td> </tr> <tr> <td width=\"125\" style=\"border: solid thin; border-width: 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">Packaging:</td> <td align=\"right\" style=\"border: solid thin; border-width: 0 0 1px 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $object->getPacking() . "</td> </tr> <tr> <td width=\"125\" style=\"border: solid thin; border-width: 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">Instructions:</td> <td align=\"right\" style=\"border: solid thin; border-width: 0 0 1px 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $object->getInstructions() . "</td> </tr> <tr> <td width=\"125\" style=\"border: solid thin; border-width: 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">Batterys(s):</td> <td align=\"right\" style=\"border: solid thin; border-width: 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $object->getBattery() . "</td> </tr> </tbody> </table>";
  298.         $html .= " </td> </tr> </tbody> </table>" $this->generateBillOfMaterialsHTML($object) . "</tr></tbody> </table>" $this->generateProductDecs($object) . " " $this->generateSpecificationHTML($object) . " ";
  299.         $html .= " " $this->generateComplianceHTML($object) . "</tr><tr><td style=\"border: solid thin; padding: 0.5rem 0.5rem; white - space: nowrap; font - family: Helvetica, Arial, sans - serif; font - size: 14px; font - weight: normal;\"></td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white - space: nowrap; font - family: Helvetica, Arial, sans - serif; font - size: 14px; font - weight: normal;\"></td> <td colspan=\"2\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white - space: nowrap; font - family: Helvetica, Arial, sans - serif; font - size: 14px; font - weight: normal;\">Notified body required?</td></tr></tbody></table> " $this->generateLabelHTML($object) . " </tbody> </table><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: solid thin; border-collapse: collapse; margin: 0 0 30px 0;\"> <thead> <tr> <th colspan=\"2\" align=\"center\" bgcolor=\"#c0c0c0\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 18px; font-weight: bold; color: #000000; text-transform: uppercase;\">Manual</th> </tr> </thead> <tbody> <tr> <td width=\"50%\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: break-spaces; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\"><b>LEGAL TEXT ON MANUAL</b> <i>In " $this->getManualData($object) . "</i></td> <td width=\"50%\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">PHOTO</td> </tr> <tr> <td width=\"50%\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: break-spaces; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $this->getLanguageSize($object->getLanguageManual()) . " languages MANUAL<br>" $object->getSpeficationsManual() . "<br>Techincal specification and safety percautions on manual.</td> <td width=\"50%\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $this->getHideImage($object$object->getManualImage()) . "</td> </tr> </tbody> </table> <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: solid thin; border-collapse: collapse; margin: 0 0 30px 0;\"> <thead> <tr> <th colspan=\"4\" align=\"center\" bgcolor=\"#c0c0c0\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 18px; font-weight: bold; color: #000000; text-transform: uppercase;\">Packaging</th> </tr> </thead> <tbody> <tr> <td colspan=\"2\" width=\"50%\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: break-spaces; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal; word-wrap: break-word\">Packing Details:<br>" $object->getPackagingDetails() . "</td> <td colspan=\"2\" rowspan=\"4\" width=\"50%\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: break-spaces; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\"><ul><li>Curabitur laoreet nibh vel dui egestas, sed maximus tellus pellentesque.</li><li>Ut sit amet elit a lorem euismod bibendum.</li><li>Vestibulum a eros in enim consequat dignissim a ut nisi.</li><li>Mauris at ex lacinia lectus tincidunt cursus eu imperdiet turpis.</li><li>Pellentesque facilisis turpis molestie mi sodales, sed tincidunt orci facilisis.</li></ul></td> ";
  300.         $html .= "</tr> <tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: break-spaces; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Master Carton Size:</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: break-spaces; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $object->getMasterCartonSize() . "CM</td> </tr> <tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: break-spaces; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Qty per Carton</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: break-spaces; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $object->getQuantityPerCarton() . "</td> </tr> <tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: break-spaces; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">N.W. / G.W.:</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: break-spaces; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $object->getNettoGrossWeight() . "</td> </tr> </tbody> </table> <!-- Approvals --> <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: solid thin; border-collapse: collapse; margin: 0 0 30px 0;\"> <thead> <tr> <th colspan=\"4\" align=\"center\" bgcolor=\"#c0c0c0\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 18px; font-weight: bold; color: #000000; text-transform: uppercase;\">Approvals</th> </tr> </thead> <tbody> <tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">Category Manager:<br><br>Date:</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\"></td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">PD Merchandiser Stela Cai<br><br>Date: 2020/05/29</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">Vendor: Mossloo<br><br>Date: Miya</td> </tr> </tbody> </table> </div> </body></html>";
  301.         return $html;
  302.     }
  303.     private function getLanguageSize($language): int
  304.     {
  305.         if ($language != null || !empty($language)) {
  306.             return sizeof($language);
  307.         }
  308.         return 0;
  309.     }
  310.     private function getImageData($object$image): string
  311.     {
  312.         if ($image != null || !empty($image)) {
  313.             $image Asset\Image::getByPath($image);
  314.             return $image->getFullPath();
  315.         }
  316.         return '';
  317.     }
  318.     private function getVariantsData($development): string
  319.     {
  320.         $skuHTML " ";
  321.         foreach ($development->getChildren([DataObject\AbstractObject::OBJECT_TYPE_VARIANT]) as $child) {
  322.             $skuHTML .= "<tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $child->getSku() . "</td><td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $child->getColor1Code() . "</td><td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\"></td></tr>";
  323.         }
  324.         return $skuHTML;
  325.     }
  326.     private function generateComponentHTML($object): string
  327.     {
  328.         $componentData $object->getComponents();
  329.         $counter 1;
  330.         $componentHTML "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse;\"> <tbody> <tr> <td style=\"border: solid thin; border-width: 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Component</td> <td style=\"border: solid thin; border-width: 0 0 1px 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Breakdown</td> <td style=\"border: solid thin; border-width: 0 0 1px 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Weight (gr):</td> <td style=\"border: solid thin; border-width: 0 0 1px 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Price</td> </tr> <tr>";
  331.         foreach ($componentData as $component) {
  332.             $componentHTML .= "<td style=\"border: solid thin; border-width: 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">Component " $counter "</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $component->getDescription() . " </td> <td bgcolor=\"#ebf1de\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap;\">" $component->getWeight() . "</td> <td bgcolor=\"#ebf1de\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">" $component->getPrice() . "</td> </tr> ";
  333.             $counter++;
  334.         }
  335.         $componentHTML .= "<tr> <td colspan=\"4\" style=\"border: solid thin; border-width: 0; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">Consolidation Fee: " $object->getConsolidationFeeUSD() . " </td></tr>";
  336.         $componentHTML .= "</tbody></table>";
  337.         return $componentHTML;
  338.     }
  339.     private function generateBillOfMaterialsHTML($object): string
  340.     {
  341.         $BOMData $object->getBillOfMaterials();
  342.         $bomCounter 1;
  343.         $BOMHtml "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: solid thin; border-collapse: collapse; margin: 0 0 30px 0;\"> <thead> <tr> <th colspan=\"4\" align=\"center\" bgcolor=\"#c0c0c0\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 18px; font-weight: bold; color: #000000; text-transform: uppercase;\">Bill of Materials</th> </tr> </thead> <tbody><tr>";
  344.         foreach ($BOMData as $billOfMaterials) {
  345.             $BOMHtml .= "<td width=\"20\" align=\"center\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $bomCounter "</td> <td width=\"400\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $billOfMaterials->getDescription() . "</td>";
  346.             $bomCounter++;
  347.             if ($bomCounter == 1) {
  348.                 $BOMHtml .= "</tr><tr>";
  349.             }
  350.         }
  351.         return $BOMHtml;
  352.     }
  353.     private function generateComplianceHTML($object): string
  354.     {
  355.         $technicalComplianceData $object->getTechnicalCompliance();
  356.         $chemicalComplianceData $object->getChemicalCompliance();
  357.         $conditionData $object->getConditions();
  358.         $arrayCount 1;
  359.         $CompliancesHTML "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: solid thin; border-collapse: collapse; margin: 0 0 30px 0;\"> <thead> <tr> <th colspan=\"4\" align=\"center\" bgcolor=\"#c0c0c0\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 18px; font-weight: bold; color: #000000; text-transform: uppercase;\">Compliance Requirements</th> </tr> </thead> <tbody> <tr>";
  360.         foreach ($technicalComplianceData as $technicalData) {
  361.             if ($technicalData != null || !empty($technicalData)) {
  362.                 $CompliancesHTML .= "<td width=\"20\" align=\"center\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $arrayCount "</td> <td width=\"350\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $technicalData->getDescription() . "</td>";
  363.                 $arrayCount++;
  364.             }
  365.             if ($arrayCount == 1) {
  366.                 $CompliancesHTML .= "</tr><tr>";
  367.             }
  368.             if ($arrayCount == sizeof($technicalComplianceData)) {
  369.                 break;
  370.             }
  371.         }
  372.         foreach ($chemicalComplianceData as $chemicalData) {
  373.             if ($chemicalData != null || !empty($chemicalData)) {
  374.                 $CompliancesHTML .= "<td width=\"20\" align=\"center\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $arrayCount "</td> <td width=\"350\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $chemicalData->getDescription() . "</td>";
  375.                 $arrayCount++;
  376.             }
  377.             if ($arrayCount == 1) {
  378.                 $CompliancesHTML .= "</tr><tr>";
  379.             }
  380.             if ($arrayCount == sizeof($chemicalComplianceData)) {
  381.                 break;
  382.             }
  383.         }
  384.         foreach ($conditionData as $condition) {
  385.             if ($condition != null || !empty($condition)) {
  386.                 $CompliancesHTML .= "<td width=\"20\" align=\"center\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $arrayCount "</td> <td width=\"350\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $condition->getDescription() . "</td>";
  387.                 $arrayCount++;
  388.             }
  389.             if ($arrayCount == 1) {
  390.                 $CompliancesHTML .= "</tr><tr>";
  391.             }
  392.             if ($arrayCount == sizeof($conditionData)) {
  393.                 break;
  394.             }
  395.         }
  396.         return $CompliancesHTML;
  397.     }
  398.     private function generateLabelHTML($object): string
  399.     {
  400.         $labelsData $object->getLabels();
  401.         $labelHTML "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: solid thin; border-collapse: collapse; margin: 0 0 30px 0;\"> <thead> <tr> <th colspan=\"6\" align=\"center\" bgcolor=\"#c0c0c0\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 18px; font-weight: bold; color: #000000; text-transform: uppercase;\">Label</th> </tr> </thead> <tbody>";
  402.         $labelHTML .= "<tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\"></td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Label Name</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Size (Cm)</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\"></td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Label Name</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold;\">Size (Cm)</td> </tr>";
  403.         $labelCount 1;
  404.         if ($labelsData != null || !empty($labelsData)) {
  405.             foreach ($labelsData as $label) {
  406.                 if ($labelCount == 1) {
  407.                     $labelHTML .= "<tr> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $labelCount "</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $label->getLabelName() . "</td>";
  408.                     $labelCount++;
  409.                     continue;
  410.                 }
  411.                 if ($labelCount == 0) {
  412.                     $labelHTML .= "<td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $label->getLabelSize() . "</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $labelCount "</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $label->getLabelName() . "</td> <td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" $label->getLabelSize() . "</td> </tr>";
  413.                     $labelCount++;
  414.                     continue;
  415.                 }
  416.             }
  417.         }
  418.         $labelHTML .= "<tr> <td colspan=\"3\" align=\"center\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold; text-transform: uppercase;\">Label Front</td> <td colspan=\"3\" align=\"center\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold; text-transform: uppercase;\">Label Back</td> </tr> ";
  419.         $labelHTML .= "<tr> <td colspan=\"3\" height=\"80\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" .
  420.             $this->getHideImage($object$object->getLabelImageFront()) . "
  421. </td>
  422. <td colspan=\"3\" height=\"80\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal;\">" .
  423.             $this->getHideImage($object$object->getLabelImageBack()) . "</td> </tr>";
  424.         return $labelHTML;
  425.     }
  426.     private function getManualData($object): string
  427.     {
  428.         $manualData $object->getLanguageManual();
  429.         if ($manualData) {
  430.             $manual implode(", "array_filter($manualData));
  431.             $saveManual $manual;
  432.             $last strrchr($saveManual",");
  433.             $last_ str_replace(","" &"$last);
  434.             return str_replace("$last""$last_"$saveManual);
  435.         }
  436.     }
  437.     private function getRow($object$field): int
  438.     {
  439.         if ($field == 'image') {
  440.             $value sizeof($object->getChildren([DataObject\AbstractObject::OBJECT_TYPE_VARIANT]));
  441.             return $value;
  442.         }
  443.         if ($field == 'sku') {
  444.             $value sizeof($object->getChildren([DataObject\AbstractObject::OBJECT_TYPE_VARIANT]));
  445.             return $value;
  446.         }
  447.     }
  448.     private function generateMultipleImages($object): string
  449.     {
  450.         $imgHTML "&nbsp;<img src=\"data: " mime_content_type(self::PDF_DIRECTORY $this->getImageData($object$object->getImage1())) . ";base64," .
  451.             base64_encode(file_get_contents(self::PDF_DIRECTORY $this->getImageData($object$object->getImage1()))) . "alt=\"...\" width=\"190\" height=\"190\">&nbsp;";
  452.         $imgHTML2 "&nbsp;<img src=\"data: " mime_content_type(self::PDF_DIRECTORY $this->getImageData($object$object->getImage2())) . ";base64," .
  453.             base64_encode(file_get_contents(self::PDF_DIRECTORY $this->getImageData($object$object->getImage2()))) . "alt=\"...\" width=\"190\" height=\"190\">&nbsp;";
  454.         $imgHTML3 "&nbsp;<img src=\"data: " mime_content_type(self::PDF_DIRECTORY $this->getImageData($object$object->getImage3())) . ";base64," .
  455.             base64_encode(file_get_contents(self::PDF_DIRECTORY $this->getImageData($object$object->getImage3()))) . "alt=\"...\" width=\"190\" height=\"190\">&nbsp;";
  456.         $imgHTML4 "&nbsp;<img src=\"data: " mime_content_type(self::PDF_DIRECTORY $this->getImageData($object$object->getImage4())) . ";base64," .
  457.             base64_encode(file_get_contents(self::PDF_DIRECTORY $this->getImageData($object$object->getImage4()))) . "alt=\"...\" width=\"190\" height=\"190\">&nbsp;";
  458.         if (($object->getImage1() != null || !empty($object->getImage1())) && ($object->getImage2() == null || empty($object->getImage2())) && ($object->getImage3() == null || empty($object->getImage3())) && ($object->getImage4() == null || empty($object->getImage4()))) {
  459.             return $imgHTML;
  460.         } elseif (($object->getImage1() != null || !empty($object->getImage1())) && ($object->getImage2() != null || !empty($object->getImage2())) && ($object->getImage3() == null || empty($object->getImage3())) && ($object->getImage4() == null || empty($object->getImage4()))) {
  461.             $allImage "&nbsp;<img src=\"data: " mime_content_type(self::PDF_DIRECTORY $this->getImageData($object$object->getImage1())) . ";base64," .
  462.                 base64_encode(file_get_contents(self::PDF_DIRECTORY $this->getImageData($object$object->getImage1()))) . "alt=\"...\" width=\"410\" height=\"230\">&nbsp;" "<br>" .
  463.                 "&nbsp;<img src=\"data: " mime_content_type(self::PDF_DIRECTORY $this->getImageData($object$object->getImage2())) . ";base64," .
  464.                 base64_encode(file_get_contents(self::PDF_DIRECTORY $this->getImageData($object$object->getImage2()))) . " alt=\"...\" width=\"410\" height=\"230\">&nbsp;";
  465.             return $allImage;
  466.         } else {
  467.             $allImage $imgHTML $imgHTML2 "<br>" $imgHTML3 $imgHTML4;
  468.             return $allImage;
  469.         }
  470.     }
  471.     private function generateSpecificationHTML($object): string
  472.     {
  473.         if ($object->getSpeficationsManual() != null || !empty($object->getSpeficationsManual())) {
  474.             $specificationHTML "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: solid thin; border-collapse: collapse; margin: 0 0 30px 0;\"> <thead> <tr> <th colspan=\"6\" align=\"center\" bgcolor=\"#c0c0c0\" style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 18px; font-weight: bold; color: #000000; text-transform: uppercase;\">Specifications:</th> </tr> </thead> <tbody> <tr><td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal; word-wrap: break-word\"> " $object->getSpeficationsManual() . "</td></tr></tbody></table>";
  475.             return $specificationHTML;
  476.         }
  477.         return '';
  478.     }
  479.     private function generateProductDecs($object): string
  480.     {
  481.         if ($object->getProductDescription() != null || !empty($object->getProductDescription())) {
  482.             $prodDescHTML "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: solid thin; border-collapse: collapse; margin: 0 0 30px 0;\"> <tbody> <tr><td style=\"border: solid thin; padding: 0.5rem 0.5rem; white-space: nowrap; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal; word-wrap: break-word\">Description: " $object->getProductDescription() . " </td></tr></tbody></table>";
  483.             return $prodDescHTML;
  484.         }
  485.         return '';
  486.     }
  487.     protected function generatePDFFilename($developmentNum): string
  488.     {
  489.         $pdfFileName str_replace(":""_"$developmentNum);
  490.         $pdfFileName str_replace("-""_"$pdfFileName);
  491.         return $pdfFileName;
  492.     }
  493.     protected function getHideImage($object$data): string
  494.     {
  495.         if ($this->getImageData($object$data) != null || !empty($this->getImageData($object$data))) {
  496.             $imageData "<img src=\"data: " mime_content_type(self::PDF_DIRECTORY $this->getImageData($object$data)) . ";base64," .
  497.                 base64_encode(file_get_contents(self::PDF_DIRECTORY $this->getImageData($object$data))) . "\" width='400' height='400'>";
  498.         } else {
  499.             $imageData '';
  500.         }
  501.         return $imageData;
  502.     }
  503. }