public function removeConfigFile() { if (!$this->file || !file_exists($this->file)) { return false; } if ($this->archiver != null) { } else { if ($this->checkZipConsole()) { //todo: implement } else { if ($this->checkZipSupport()) { $zip = new ZipArchive(); $zipRes = $zip->open($this->file); if ($zipRes) { $zip->deleteName('wp-config.php'); $zip->deleteName('clone'); $zip->close(); return true; } return false; } else { //use pclzip $zip = new PclZip($this->file); $list = $zip->delete(PCLZIP_OPT_BY_NAME, 'wp-config.php'); $list2 = $zip->delete(PCLZIP_OPT_BY_NAME, 'clone'); if ($list == 0) { return false; } return true; } } } return false; }
/** * @return string */ public function finishAndGetDocument() { $content = $this->create(); $this->zip->deleteName('content.xml'); $this->zip->addFromString('content.xml', $content); $this->zip->close(); $content = file_get_contents($this->tmpZipFile); unlink($this->tmpZipFile); return $content; }
function processPluginsFolder($folder, $requiredMpsVersion, $pluginsVersion) { $files = scandir($folder); foreach ($files as $zipfile) { if (pathinfo($zipfile, PATHINFO_EXTENSION) == 'zip') { $za = new ZipArchive(); $za->open($folder . $zipfile); for ($i = 0; $i < $za->numFiles; $i++) { $stat = $za->statIndex($i); $pluginXmlFile = $stat['name']; if (endsWith($pluginXmlFile, "META-INF/plugin.xml")) { $stream = $za->getStream($pluginXmlFile); $content = stream_get_contents($stream); $xml = simplexml_load_string($content); if (fixPluginXml($xml, $requiredMpsVersion, $pluginsVersion)) { $za->deleteName($pluginXmlFile); $za->addFromString($pluginXmlFile, $xml->asXML()); } printPluginXml($xml, $zipfile, $requiredMpsVersion, $pluginsVersion); break; } } } } }
public function docxTemplate($filepath = false, $templates = false, $output = false) { if ($filepath === false || $templates === false || $output === false) { return false; } if (file_exists($output)) { unlink($output); } copy($filepath, $output); if (!file_exists($output)) { die('File not found.'); } $zip = new ZipArchive(); if (!$zip->open($output)) { die('File not open.'); } $documentXml = $zip->getFromName('word/document.xml'); $rekeys = array_keys($templates); for ($i = 0; $i < count($templates); $i++) { $reg = ''; $reg .= substr($rekeys[$i], 0, 1); for ($i2 = 1; $i2 < strlen($rekeys[$i]); $i2++) { $reg .= '(<.*?>)*+' . substr($rekeys[$i], $i2, 1); } $reg = '#' . str_replace(array('#', '{', '[', ']', '}'), array('#', '{', '[', ']', '}'), $reg) . '#'; $documentXml = preg_replace($reg, $templates[$rekeys[$i]], $documentXml); print '->' . $reg . '<br/>'; } $zip->deleteName('word/document.xml'); $zip->addFromString('word/document.xml', $documentXml); $zip->close(); }
public function remplace_image($search, $urlImage) { /* recherche des images dans le document * /word/media */ if (!file_exists($urlImage)) { return "RI : pb urlImage."; } $name = 'word/media/' . $search; $info = $this->_objZip->statName($name); // l'image n'est pas trouvé if ($info === FALSE) { return "RI : L'image n'est pas présente dans le docx. (" . $name . ")"; } // image est trouvé, il reste à la remplacer $ret = $this->_objZip->deleteName($name); if (!$ret) { return 'RI pb delete image'; } $ret = $this->_objZip->addFile($urlImage, $name); if (!$ret) { return 'RI addFile'; } return TRUE; }
/** * @inheritdoc */ public function offsetUnset($offset) { if ($this->archive->locateName($offset) !== false) { $this->archive->deleteName($offset); } else { return null; } }
public function removeCacheItem($cacheId, $cachetype, $metaData) { list($zipName, $fileName, $subFolder) = $this->calculateFilePath($cacheId, $cachetype, $metaData); $zip = new ZipArchive(); if ($zip->open($zipName, ZipArchive::CREATE) !== true) { throw new CacheIsCorruptException('Unable to open ZIP file'); } // if $zip->deleteName($fileName); $zip->close(); }
/** * @param $pathInArchive * @return $this * @throws \Thelia\Exception\FileNotFoundException * @throws \ErrorException * * This method deletes a file in the archive */ public function deleteFile($pathInArchive) { $pathInArchive = $this->formatFilePath($pathInArchive); if (!$this->hasFile($pathInArchive)) { $this->throwFileNotFound($pathInArchive); } $deleted = $this->zip->deleteName($pathInArchive); if (!$deleted) { throw new \ErrorException($this->translator->trans("The file %file has not been deleted", ["%file" => $pathInArchive])); } return $this; }
public static function write($archive, $filename, $content) { $zip = new ZipArchive(); if (file_exists($archive)) { $zip->open(realpath($archive)); } else { $zip->open(getcwd() . '/' . $archive, ZipArchive::CREATE); } if ($zip->locateName($filename) !== false) { $zip->deleteName($filename); } $error = $zip->addFromString($filename, $content); return $error; }
/** * @param array $markers * @param string $documentIndex * @return mixed * @throws \ErrorException */ public function getDocumentFile($markers = [], $documentIndex, $directory) { $sourceFile = $this->filename; $file = basename($sourceFile, '.' . $this->mode); $destFile = $directory . $file . '-' . $documentIndex . '.' . $this->mode; if (is_file($destFile)) { unlink($destFile); } if (!is_dir(dirname($destFile))) { mkdir(dirname($destFile), 0700); } copy($sourceFile, $destFile); $zip = new \ZipArchive(); // И пытаемся открыть переданный zip-файл if ($zip->open($destFile)) { $documentXml = $zip->getFromName($this->contentFile); $documentXml = str_replace($markers['search'], $markers['replacement'], $documentXml); $zip->deleteName($this->contentFile); $zip->addFromString($this->contentFile, $documentXml); $zip->close(); } return $destFile; }
$zip->addEmptyDir(Backup::encode($dest)); continue; } $ob->out($item->getPathname() . ' => ' . $dest . "\n"); $zip->addFile($item->getPathname(), Backup::encode($dest)); } foreach ($installIterator as $item) { if ($item->isDir()) { continue; } $dest = str_replace($installFolder . DIRECTORY_SEPARATOR, '', 'installation' . DIRECTORY_SEPARATOR . $item->getPathname()); $ob->out($item->getPathname() . ' => ' . $dest . "\n"); $zip->addFile($item->getPathname(), str_replace('\\', '/', $dest)); } $zip->addFile($backupSQLFile->getPathname(), $backupSQLFile->getBasename()); $zip->deleteName('configuration.dist.php'); $zip->renameName('configuration.php', 'configuration.dist.php'); $zip->close(); echo 'ZIP ok'; } else { echo 'failed'; } ?> </pre> <script> toBottom(); stop = true; </script> <?php
/** * zipDocx * * zip the docx with all the change in word/document.xml */ private function zipDocx() { try { $templateInfo = $this->docx->getTemplateInfo(); $zip = new \ZipArchive(); if ($zip->open($this->docx->getPathTmpDir() . '/' . $this->docx->getTmpName() . '.docx') === TRUE) { $zip->deleteName('word/document.xml'); $zip->addFromString('word/document.xml', $this->docx->getXmlContent()); $zip->close(); $this->docx->addToLogs('zip in ' . $this->docx->getPathTmpDir() . '/' . $this->docx->getTmpName() . '.docx'); } else { throw new \Exception('Fail to zip ' . $templateInfo['basename']); } } catch (\Exception $e) { $this->docx->addToLogs('zip : ' . $e->getMessage()); } }
/** * {@inheritdoc} */ public function remove($file_path) { $this->zip->deleteName($file_path); return $this; }
/** * @Security("has_role('ROLE_ADMIN')") */ public function uploadNewDoctypeAction(Request $request) { $data = array(); $form = $this->createForm(new DocTypeType(), $data); $session = $request->getSession(); if ($request->getMethod() == 'POST') { $form->handleRequest($this->get('request')); if ($form->isValid()) { $data = $form->getData(); // Création d'un fichier temporaire $file = $data['template']; $filename = sha1(uniqid(mt_rand(), true)); $filename .= '.' . $file->guessExtension(); $file->move('tmp/', $filename); $docxFullPath = 'tmp/' . $filename; // Extraction des infos XML $templatesXML = $this->getDocxContent($docxFullPath); $relationship = $this->getDocxRelationShip($docxFullPath); // Nettoyage des XML $templatesXMLTraite = array(); foreach ($templatesXML as $templateName => $templateXML) { $this->cleanDocxFields($templateXML); $this->cleanDocxTableRow($templateXML); $this->cleanDocxParagraph($templateXML); $this->linkDocxImages($templateXML, $relationship); $this->arrayPushAssoc($templatesXMLTraite, $templateName, $templateXML); } // Enregistrement dans le fichier temporaire $zip = new \ZipArchive(); $zip->open($docxFullPath); foreach ($templatesXMLTraite as $templateXMLName => $templateXMLContent) { $zip->deleteName('word/' . $templateXMLName); $zip->addFromString('word/' . $templateXMLName, $templateXMLContent); } $zip->close(); if (array_key_exists('etude', $data)) { $etude = $data['etude']; } else { $etude = null; } // Vérification du template (document étude) if ($etude && ($data['name'] == self::DOCTYPE_AVANT_PROJET || $data['name'] == self::DOCTYPE_CONVENTION_CLIENT || $data['name'] == self::DOCTYPE_SUIVI_ETUDE) && $data['verification'] && $this->publipostage($docxFullPath, self::ROOTNAME_ETUDE, $etude->getId(), true)) { $session->getFlashBag()->add('success', 'Le template a été vérifié, il ne contient pas d\'erreur'); } if (array_key_exists('etudiant', $data)) { $etudiant = $data['etudiant']; } else { $etudiant = null; } $etudiant = $data['etudiant']; // Vérification du template (document étudiant) if ($etudiant && ($data['name'] == self::DOCTYPE_CONVENTION_ETUDIANT || $data['name'] == self::DOCTYPE_DECLARATION_ETUDIANT_ETR) && $data['verification'] && $this->publipostage($docxFullPath, self::ROOTNAME_ETUDIANT, $etudiant->getId(), true)) { $session->getFlashBag()->add('success', 'Le template a été vérifié, il ne contient pas d\'erreur'); } // Enregistrement du template $em = $this->getDoctrine()->getManager(); $user = $this->getUser(); $personne = $user->getPersonne(); $file = new File($docxFullPath); $doc = new Document(); $doc->setAuthor($personne)->setName($data['name'])->setFile($file); $kernel = $this->get('kernel'); $doc->setRootDir($kernel->getRootDir()); $em->persist($doc); $docs = $em->getRepository('MgatePubliBundle:Document')->findBy(array('name' => $doc->getName())); foreach ($docs as $doc) { $doc->setRootDir($kernel->getRootDir()); $em->remove($doc); } $em->flush(); $session->getFlashBag()->add('success', 'Le document a été mis à jour : '); return $this->redirect($this->generateUrl('Mgate_publi_documenttype_upload')); } } return $this->render('MgatePubliBundle:DocType:upload.html.twig', array('form' => $form->createView())); }
if ($ae->aenderung_begruendung_html) { $text_begruendung = $ae->aenderung_begruendung; } else { $text_begruendung = '<div>' . HtmlBBcodeUtils::bbcode2html($ae->aenderung_begruendung) . '</div>'; } if (!isset($COL_BEGRUENDUNG)) { $text = '<p><strong>Änderungsantrag:</strong></p>' . $diffhtml; $text .= '<p><strong>Begründung:</strong></p>' . $text_begruendung; $doc->setCell($row, $COL_ANTRAGSTEXT, OdsTemplateEngine::$TYPE_HTML, $text); } else { if ($DEBUG) { echo CHtml::encode($text_begruendung); } $doc->setCell($row, $COL_ANTRAGSTEXT, OdsTemplateEngine::$TYPE_HTML, $diffhtml); $doc->setCell($row, $COL_BEGRUENDUNG, OdsTemplateEngine::$TYPE_HTML, $text_begruendung); } } if (!$antraege_separat) { /** @var int $antrag_row_from */ $doc->drawBorder($antrag_row_from, $first_col, $row, $COL_VERFAHREN, 1.5); } } $content = $doc->create(); if ($DEBUG) { $doc->debugOutput(); } $zip->deleteName("content.xml"); $zip->addFromString("content.xml", $content); $zip->close(); readfile($tmpZipFile); unlink($tmpZipFile);
private function createModArchive() { $zip = new ZipArchive(); $filename = self::PACKAGE . '-' . self::VERSION . '.zip'; if ($zip->open($this->getBuildDir() . DIRECTORY_SEPARATOR . $filename, ZipArchive::CREATE) !== true) { throw new RuntimeException('Zip create error'); } $zip->addGlob('*.php'); $zip->addGlob('*.xml'); $zip->addGlob('*.txt'); $zip->addGlob('languages/*.xml'); $zip->addGlob('upgrades/*.*'); $zip->deleteName('RoboFile.php'); //self $zip->close(); $this->say("Created zip {$filename}"); }
public function generatePassAction($id) { $em = $this->getDoctrine()->getManager(); $task1 = $em->getRepository('KamranPassbookBundle:mgeneral')->findOneBy(array('couponId' => $id)); $task2 = $em->getRepository('KamranPassbookBundle:mappearance')->findOneBy(array('couponId' => $id)); $task3 = $em->getRepository('KamranPassbookBundle:mdatasetting')->findOneBy(array('couponId' => $id)); $task4 = $em->getRepository('KamranPassbookBundle:mheader')->findOneBy(array('couponId' => $id)); $task5 = $em->getRepository('KamranPassbookBundle:mprimary')->findOneBy(array('couponId' => $id)); $task6 = $em->getRepository('KamranPassbookBundle:msecondary')->findOneBy(array('couponId' => $id)); $task7 = $em->getRepository('KamranPassbookBundle:mauxiliary')->findOneBy(array('couponId' => $id)); $task8 = $em->getRepository('KamranPassbookBundle:mbackfields')->findOneBy(array('couponId' => $id)); $task9 = $em->getRepository('KamranPassbookBundle:mrelevance')->findOneBy(array('couponId' => $id)); $task10 = $em->getRepository('KamranPassbookBundle:mdistribution')->findOneBy(array('couponId' => $id)); $passid = $task1->getPassKey(); $category = $task1->getCategoryName(); $taskid = $task2->getId(); $mainlogo = $task2->getLogoName(); $mainicon = $task2->getIconName(); $genericthumbnail = $task2->getGenericThumbnail(); $boardingpassfooter = $task2->getBoardingPassFooter(); $couponstrip = $task2->getCouponStrip(); $storecardstrip = $task2->getStoreCardStrip(); $etstrip = $task2->getEventTicketStrip(); $etthumbnail = $task2->getEventTicketThumbnail(); $etbackground = $task2->getEventTicketBackground(); $barcodestatus = $task3->getCouponBarcodeStatus(); $root = $this->get('kernel')->getRootDir(); /////path to root $pkPassFile = $root . '/logs/pkpass/' . $id . '.pkpass'; $zip = new \ZipArchive(); if (file_exists($pkPassFile)) { if ($zip->open($pkPassFile) === TRUE) { $zip->deleteName('thumbnail.png'); $zip->deleteName('*****@*****.**'); $zip->deleteName('strip.png'); $zip->deleteName('*****@*****.**'); $zip->deleteName('logo.png'); $zip->deleteName('*****@*****.**'); $zip->deleteName('footer.png'); $zip->deleteName('*****@*****.**'); $zip->deleteName('background.png'); $zip->deleteName('*****@*****.**'); $zip->close(); } } $imagedir = __DIR__ . "/../../../../web/upload/"; if (!$task2 && !$task3 && !$task4 && !$task5 && !$task6 && !$task7 && !$task8 && !$task9 && !$task10) { throw $this->createNotFoundException('No pass found for id ' . $id); } /////////////////////////pass generation///////////////////////// ///////////////////////////////////////////////////////////////// //echo $task3->getCouponAutoGenerateValue(); // setting pass type and images switch ($task1->getCategoryName()) { case "Generic": $pass = new Generic($id, $task1->getTemplateName()); if ($genericthumbnail) { $thumbnail = new Image($imagedir . $taskid . "/" . $genericthumbnail . "", 'thumbnail'); $pass->addImage($thumbnail); $thumbnail = new Image($imagedir . $taskid . "/" . $genericthumbnail . "", 'thumbnail@2x'); $pass->addImage($thumbnail); } break; case "Boarding Pass": switch ($task1->getBoardingPassTransit()) { case "PKTransitTypeAir": $pass = new BoardingPass($id, $task1->getTemplateName(), BoardingPass::TYPE_AIR); break; case "PKTransitTypeBus": $pass = new BoardingPass($id, $task1->getTemplateName(), BoardingPass::TYPE_BUS); break; case "PKTransitTypeTrain": $pass = new BoardingPass($id, $task1->getTemplateName(), BoardingPass::TYPE_TRAIN); break; case "PKTransitTypeBoat": $pass = new BoardingPass($id, $task1->getTemplateName(), BoardingPass::TYPE_BOAT); break; case "PKTransitTypeGeneric": $pass = new BoardingPass($id, $task1->getTemplateName(), BoardingPass::TYPE_GENERIC); break; } if ($boardingpassfooter) { $footer = new Image($imagedir . $taskid . "/" . $boardingpassfooter . "", 'footer'); $pass->addImage($footer); $footer = new Image($imagedir . $taskid . "/" . $boardingpassfooter . "", 'footer@2x'); $pass->addImage($footer); } break; case "Coupon": $pass = new Coupon($id, $task1->getTemplateName()); if ($couponstrip) { $strip = new Image($imagedir . $taskid . "/" . $couponstrip . "", 'strip'); $pass->addImage($strip); $strip = new Image($imagedir . $taskid . "/" . $couponstrip . "", 'strip@2x'); $pass->addImage($strip); } break; case "Event Ticket": $pass = new EventTicket($id, $task1->getTemplateName()); switch ($task2->getEventTicketStatus()) { case "Layout 1: Strip": if ($etstrip) { $strip = new Image($imagedir . $taskid . "/" . $etstrip . "", 'strip'); $pass->addImage($strip); $strip = new Image($imagedir . $taskid . "/" . $etstrip . "", 'strip@2x'); $pass->addImage($strip); } break; case "Layout 2: Background/Thumbnail": if ($etbackground) { $background = new Image($imagedir . $taskid . "/" . $etbackground . "", 'background'); $pass->addImage($background); $background = new Image($imagedir . $taskid . "/" . $etbackground . "", 'background@2x'); $pass->addImage($background); } if ($etthumbnail) { $thumbnail = new Image($imagedir . $taskid . "/" . $etthumbnail . "", 'thumbnail'); $pass->addImage($thumbnail); $thumbnail = new Image($imagedir . $taskid . "/" . $etthumbnail . "", 'thumbnail@2x'); $pass->addImage($thumbnail); } break; } break; case "Store Card": $pass = new StoreCard($id, $task1->getTemplateName()); if ($storecardstrip) { $strip = new Image($imagedir . $taskid . "/" . $storecardstrip . "", 'strip'); $pass->addImage($strip); $strip = new Image($imagedir . $taskid . "/" . $storecardstrip . "", 'strip@2x'); $pass->addImage($strip); } break; } $pass->setBackgroundColor($task2->getBackgroundColorCode()); $pass->setForegroundColor($task2->getFieldValueColorCode()); $pass->setLabelColor($task2->getFieldLabelColorCode()); $pass->setLogoText($task2->getLogoText()); // Add icon image if ($mainicon == "") { $icon = new Image($root . '/Resources/Images/LogoIcon58x58.png', 'icon'); $pass->addImage($icon); $icon = new Image($root . '/Resources/Images/LogoIcon58x58@2x.png', 'icon@2x'); $pass->addImage($icon); } else { $icon = new Image($imagedir . $taskid . "/" . $mainicon . "", 'icon'); $pass->addImage($icon); $icon = new Image($imagedir . $taskid . "/" . $mainicon . "", 'icon@2x'); $pass->addImage($icon); } if ($mainlogo) { $logo = new Image($imagedir . $taskid . "/" . $mainlogo . "", 'logo'); $pass->addImage($logo); $logo = new Image($imagedir . $taskid . "/" . $mainlogo . "", 'logo@2x'); $pass->addImage($logo); } // Create pass structure $structure = new Structure(); // Add header field switch ($task4->getCouponHeaderValueType()) { case "text": $header = new Field($task4->getCouponHeaderValueType() . "h1", " "); if ($task4->getCouponHeaderTextValue()) { $header->setValue($task4->getCouponHeaderTextValue()); } if ($task4->getCouponHeaderLabel()) { $header->setLabel(strtoupper($task4->getCouponHeaderLabel())); } $header->setTextAlignment($task4->getCouponHeaderAlignmnet()); $structure->addHeaderField($header); break; case "datentime": $header = new DateField($task4->getCouponHeaderValueType() . "h1", " "); if ($task4->getCouponHeaderValueDate()) { $header->setValue($task4->getCouponHeaderValueDate()); $header->setDateStyle($task4->getcouponHeaderValueDateFormate()); $header->setTimeStyle($task4->getcouponHeaderValueTimeFormate()); } if ($task4->getCouponHeaderLabel()) { $header->setLabel(strtoupper($task4->getCouponHeaderLabel())); } $header->setTextAlignment($task4->getCouponHeaderAlignmnet()); $structure->addHeaderField($header); break; case "number": $header = new NumberField($task4->getCouponHeaderValueType() . "h1", " "); if ($task4->getCouponHeaderNumberValue()) { $header->setValue($task4->getCouponHeaderNumberValue()); $header->setNumberStyle($task4->getCouponHeaderNumberFormate()); } if ($task4->getCouponHeaderLabel()) { $header->setLabel(strtoupper($task4->getCouponHeaderLabel())); } $header->setTextAlignment($task4->getCouponHeaderAlignmnet()); $structure->addHeaderField($header); break; case "currency": $header = new NumberField($task4->getCouponHeaderValueType() . "h1", " "); if ($task4->getCouponHeaderCurrencyValue()) { $header->setValue($task4->getCouponHeaderCurrencyValue()); $header->setCurrencyCode($task4->getCouponHeaderCurrencyCode()); } if ($task4->getCouponHeaderLabel()) { $header->setLabel(strtoupper($task4->getCouponHeaderLabel())); } $header->setTextAlignment($task4->getCouponHeaderAlignmnet()); $structure->addHeaderField($header); break; } // Add primary field switch ($task5->getCouponPrimaryFieldValueType()) { case "text": $primary = new Field($task5->getCouponPrimaryFieldValueType() . "p1", " "); if ($task5->getCouponPrimaryFieldTextValue()) { $primary->setValue($task5->getCouponPrimaryFieldTextValue()); } if ($task5->getCouponPrimaryFieldLabel()) { $primary->setLabel(strtoupper($task5->getCouponPrimaryFieldLabel())); } $structure->addPrimaryField($primary); break; case "datentime": $primary = new DateField($task5->getCouponPrimaryFieldValueType() . "p1", " "); if ($task5->getCouponPrimaryFieldValueDate()) { $primary->setValue($task5->getCouponPrimaryFieldValueDate()); $primary->setDateStyle($task5->getCouponPrimaryFieldValueDateFormate()); $primary->setTimeStyle($task5->getCouponPrimaryFieldValueTimeFormate()); } if ($task5->getCouponPrimaryFieldLabel()) { $primary->setLabel(strtoupper($task5->getCouponPrimaryFieldLabel())); } $structure->addPrimaryField($primary); break; case "number": $primary = new NumberField($task5->getCouponPrimaryFieldValueType() . "p1", " "); if ($task5->getCouponPrimaryFieldNumberValue()) { $primary->setValue($task5->getCouponPrimaryFieldNumberValue()); $primary->setNumberStyle($task5->getCouponPrimaryFieldNumberFormate()); } if ($task5->getCouponPrimaryFieldLabel()) { $primary->setLabel(strtoupper($task5->getCouponPrimaryFieldLabel())); } $structure->addPrimaryField($primary); break; case "currency": $primary = new NumberField($task5->getCouponPrimaryFieldValueType() . "p1", " "); if ($task5->getCouponPrimaryFieldCurrencyValue()) { $primary->setValue($task5->getCouponPrimaryFieldCurrencyValue()); $primary->setCurrencyCode($task5->getCouponPrimaryFieldCurrencyCode()); } if ($task5->getCouponPrimaryFieldLabel()) { $primary->setLabel(strtoupper($task5->getCouponPrimaryFieldLabel())); } $structure->addPrimaryField($primary); break; } // Add secondary field switch ($task6->getCouponSecondaryFieldTotalFields()) { case 0: break; case 1: switch ($task6->getCouponSecondaryFieldValueTypeOne()) { case "text": $secondary1 = new Field($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldTextValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldTextValueOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "datentime": $secondary1 = new DateField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldValueDateOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldValueDateOne()); $secondary1->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateOne()); $secondary1->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "number": $secondary1 = new NumberField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldNumberValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldNumberValueOne()); $secondary1->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "currency": $secondary1 = new NumberField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldCurrencyValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldCurrencyValueOne()); $secondary1->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; } break; case 2: switch ($task6->getCouponSecondaryFieldValueTypeOne()) { case "text": $secondary1 = new Field($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldTextValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldTextValueOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "datentime": $secondary1 = new DateField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldValueDateOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldValueDateOne()); $secondary1->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateOne()); $secondary1->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "number": $secondary1 = new NumberField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldNumberValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldNumberValueOne()); $secondary1->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "currency": $secondary1 = new NumberField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldCurrencyValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldCurrencyValueOne()); $secondary1->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; } switch ($task6->getCouponSecondaryFieldValueTypeTwo()) { case "text": $secondary2 = new Field($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldTextValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldTextValueTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "datentime": $secondary2 = new DateField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldValueDateTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldValueDateTwo()); $secondary2->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateTwo()); $secondary2->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "number": $secondary2 = new NumberField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldNumberValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldNumberValueTwo()); $secondary2->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "currency": $secondary2 = new NumberField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldCurrencyValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldCurrencyValueTwo()); $secondary2->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; } break; case 3: if ($task1->getCategoryName() == 'Coupon') { switch ($task6->getCouponSecondaryFieldValueTypeOne()) { case "text": $secondary1 = new Field($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldTextValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldTextValueOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "datentime": $secondary1 = new DateField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldValueDateOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldValueDateOne()); $secondary1->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateOne()); $secondary1->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "number": $secondary1 = new NumberField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldNumberValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldNumberValueOne()); $secondary1->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "currency": $secondary1 = new NumberField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldCurrencyValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldCurrencyValueOne()); $secondary1->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeOne()); } $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; } switch ($task6->getCouponSecondaryFieldValueTypeTwo()) { case "text": $secondary2 = new Field($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldTextValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldTextValueTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "datentime": $secondary2 = new DateField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldValueDateTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldValueDateTwo()); $secondary2->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateTwo()); $secondary2->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "number": $secondary2 = new NumberField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldNumberValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldNumberValueTwo()); $secondary2->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "currency": $secondary2 = new NumberField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldCurrencyValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldCurrencyValueTwo()); $secondary2->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; } } else { switch ($task6->getCouponSecondaryFieldValueTypeOne()) { case "text": $secondary1 = new Field($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldTextValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldTextValueOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "datentime": $secondary1 = new DateField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldValueDateOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldValueDateOne()); $secondary1->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateOne()); $secondary1->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "number": $secondary1 = new NumberField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldNumberValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldNumberValueOne()); $secondary1->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "currency": $secondary1 = new NumberField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldCurrencyValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldCurrencyValueOne()); $secondary1->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; } switch ($task6->getCouponSecondaryFieldValueTypeTwo()) { case "text": $secondary2 = new Field($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldTextValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldTextValueTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "datentime": $secondary2 = new DateField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldValueDateTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldValueDateTwo()); $secondary2->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateTwo()); $secondary2->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "number": $secondary2 = new NumberField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldNumberValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldNumberValueTwo()); $secondary2->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "currency": $secondary2 = new NumberField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldCurrencyValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldCurrencyValueTwo()); $secondary2->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; } switch ($task6->getCouponSecondaryFieldValueTypeThree()) { case "text": $secondary3 = new Field($task6->getCouponSecondaryFieldValueTypeThree() . "s31", " "); if ($task6->getCouponSecondaryFieldTextValueThree()) { $secondary3->setValue($task6->getCouponSecondaryFieldTextValueThree()); } if ($task6->getCouponSecondaryFieldLabelThree()) { $secondary3->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelThree())); } $secondary3->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetThree()); $structure->addSecondaryField($secondary3); break; case "datentime": $secondary3 = new DateField($task6->getCouponSecondaryFieldValueTypeThree() . "s31", " "); if ($task6->getCouponSecondaryFieldValueDateThree()) { $secondary3->setValue($task6->getCouponSecondaryFieldValueDateThree()); $secondary3->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateThree()); $secondary3->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateThree()); } if ($task6->getCouponSecondaryFieldLabelThree()) { $secondary3->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelThree())); } $secondary3->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetThree()); $structure->addSecondaryField($secondary3); break; case "number": $secondary3 = new NumberField($task6->getCouponSecondaryFieldValueTypeThree() . "s31", " "); if ($task6->getCouponSecondaryFieldNumberValueThree()) { $secondary3->setValue($task6->getCouponSecondaryFieldNumberValueThree()); $secondary3->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateThree()); } if ($task6->getCouponSecondaryFieldLabelThree()) { $secondary3->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelThree())); } $secondary3->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetThree()); $structure->addSecondaryField($secondary3); break; case "currency": $secondary3 = new NumberField($task6->getCouponSecondaryFieldValueTypeThree() . "s31", " "); if ($task6->getCouponSecondaryFieldCurrencyValueThree()) { $secondary3->setValue($task6->getCouponSecondaryFieldCurrencyValueThree()); $secondary3->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeThree()); } if ($task6->getCouponSecondaryFieldLabelThree()) { $secondary3->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelThree())); } $secondary3->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetThree()); $structure->addSecondaryField($secondary3); break; } } break; case 4: if ($task1->getCategoryName() == 'Coupon') { switch ($task6->getCouponSecondaryFieldValueTypeOne()) { case "text": $secondary1 = new Field($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldTextValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldTextValueOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "datentime": $secondary1 = new DateField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldValueDateOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldValueDateOne()); $secondary1->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateOne()); $secondary1->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "number": $secondary1 = new NumberField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldNumberValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldNumberValueOne()); $secondary1->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "currency": $secondary1 = new NumberField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldCurrencyValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldCurrencyValueOne()); $secondary1->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; } switch ($task6->getCouponSecondaryFieldValueTypeTwo()) { case "text": $secondary2 = new Field($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldTextValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldTextValueTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "datentime": $secondary2 = new DateField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldValueDateTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldValueDateTwo()); $secondary2->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateTwo()); $secondary2->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "number": $secondary2 = new NumberField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldNumberValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldNumberValueTwo()); $secondary2->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "currency": $secondary2 = new NumberField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldCurrencyValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldCurrencyValueTwo()); $secondary2->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; } } else { switch ($task6->getCouponSecondaryFieldValueTypeOne()) { case "text": $secondary1 = new Field($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldTextValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldTextValueOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "datentime": $secondary1 = new DateField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldValueDateOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldValueDateOne()); $secondary1->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateOne()); $secondary1->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "number": $secondary1 = new NumberField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldNumberValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldNumberValueOne()); $secondary1->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; case "currency": $secondary1 = new NumberField($task6->getCouponSecondaryFieldValueTypeOne() . "s11", " "); if ($task6->getCouponSecondaryFieldCurrencyValueOne()) { $secondary1->setValue($task6->getCouponSecondaryFieldCurrencyValueOne()); $secondary1->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeOne()); } if ($task6->getCouponSecondaryFieldLabelOne()) { $secondary1->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelOne())); } $secondary1->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetOne()); $structure->addSecondaryField($secondary1); break; } switch ($task6->getCouponSecondaryFieldValueTypeTwo()) { case "text": $secondary2 = new Field($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldTextValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldTextValueTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "datentime": $secondary2 = new DateField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldValueDateTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldValueDateTwo()); $secondary2->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateTwo()); $secondary2->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "number": $secondary2 = new NumberField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldNumberValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldNumberValueTwo()); $secondary2->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; case "currency": $secondary2 = new NumberField($task6->getCouponSecondaryFieldValueTypeTwo() . "s21", " "); if ($task6->getCouponSecondaryFieldCurrencyValueTwo()) { $secondary2->setValue($task6->getCouponSecondaryFieldCurrencyValueTwo()); $secondary2->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeTwo()); } if ($task6->getCouponSecondaryFieldLabelTwo()) { $secondary2->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelTwo())); } $secondary2->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetTwo()); $structure->addSecondaryField($secondary2); break; } switch ($task6->getCouponSecondaryFieldValueTypeThree()) { case "text": $secondary3 = new Field($task6->getCouponSecondaryFieldValueTypeThree() . "s31", " "); if ($task6->getCouponSecondaryFieldTextValueThree()) { $secondary3->setValue($task6->getCouponSecondaryFieldTextValueThree()); } if ($task6->getCouponSecondaryFieldLabelThree()) { $secondary3->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelThree())); } $secondary3->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetThree()); $structure->addSecondaryField($secondary3); break; case "datentime": $secondary3 = new DateField($task6->getCouponSecondaryFieldValueTypeThree() . "s31", " "); if ($task6->getCouponSecondaryFieldValueDateThree()) { $secondary3->setValue($task6->getCouponSecondaryFieldValueDateThree()); $secondary3->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateThree()); $secondary3->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateThree()); } if ($task6->getCouponSecondaryFieldLabelThree()) { $secondary3->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelThree())); } $secondary3->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetThree()); $structure->addSecondaryField($secondary3); break; case "number": $secondary3 = new NumberField($task6->getCouponSecondaryFieldValueTypeThree() . "s31", " "); if ($task6->getCouponSecondaryFieldNumberValueThree()) { $secondary3->setValue($task6->getCouponSecondaryFieldNumberValueThree()); $secondary3->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateThree()); } if ($task6->getCouponSecondaryFieldLabelThree()) { $secondary3->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelThree())); } $secondary3->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetThree()); $structure->addSecondaryField($secondary3); break; case "currency": $secondary3 = new NumberField($task6->getCouponSecondaryFieldValueTypeThree() . "s31", " "); if ($task6->getCouponSecondaryFieldCurrencyValueThree()) { $secondary3->setValue($task6->getCouponSecondaryFieldCurrencyValueThree()); $secondary3->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeThree()); } if ($task6->getCouponSecondaryFieldLabelThree()) { $secondary3->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelThree())); } $secondary3->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetThree()); $structure->addSecondaryField($secondary3); break; } switch ($task6->getCouponSecondaryFieldValueTypeFour()) { case "text": $secondary4 = new Field($task6->getCouponSecondaryFieldValueTypeFour() . "s41", " "); if ($task6->getCouponSecondaryFieldTextValueFour()) { $secondary4->setValue($task6->getCouponSecondaryFieldTextValueFour()); } if ($task6->getCouponSecondaryFieldLabelFour()) { $secondary4->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelFour())); } $secondary4->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetFour()); $structure->addSecondaryField($secondary4); break; case "datentime": $secondary4 = new DateField($task6->getCouponSecondaryFieldValueTypeFour() . "s41", " "); if ($task6->getCouponSecondaryFieldValueDateFour()) { $secondary4->setValue($task6->getCouponSecondaryFieldValueDateFour()); $secondary4->setDateStyle($task6->getCouponSecondaryFieldValueDateFormateFour()); $secondary4->setTimeStyle($task6->getCouponSecondaryFieldValueTimeFormateFour()); } if ($task6->getCouponSecondaryFieldLabelFour()) { $secondary4->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelFour())); } $secondary4->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetFour()); $structure->addSecondaryField($secondary4); break; case "number": $secondary4 = new NumberField($task6->getCouponSecondaryFieldValueTypeFour() . "s41", " "); if ($task6->getCouponSecondaryFieldNumberValueFour()) { $secondary4->setValue($task6->getCouponSecondaryFieldNumberValueFour()); $secondary4->setNumberStyle($task6->getCouponSecondaryFieldNumberFormateFour()); } if ($task6->getCouponSecondaryFieldLabelFour()) { $secondary4->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelFour())); } $secondary4->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetFour()); $structure->addSecondaryField($secondary4); break; case "currency": $secondary4 = new NumberField($task6->getCouponSecondaryFieldValueTypeFour() . "s41", " "); if ($task6->getCouponSecondaryFieldCurrencyValueFour()) { $secondary4->setValue($task6->getCouponSecondaryFieldCurrencyValueFour()); $secondary4->setCurrencyCode($task6->getCouponSecondaryFieldCurrencyCodeFour()); } if ($task6->getCouponSecondaryFieldLabelFour()) { $secondary4->setLabel(strtoupper($task6->getCouponSecondaryFieldLabelFour())); } $secondary4->setTextAlignment($task6->getCouponSecondaryFieldAlignmnetFour()); $structure->addSecondaryField($secondary4); break; } } break; } // Add auxiliary field if ($task1->getCategoryName() == "Generic" && $task3->getCouponBarcodeType() == "Aztec") { } else { if ($task1->getCategoryName() == "Generic" && $task3->getCouponBarcodeType() == "QRCode") { } else { switch ($task7->getCouponAuxiliaryFieldTotalFields()) { case 0: break; case 1: switch ($task7->getCouponAuxiliaryFieldValueTypeOne()) { case "text": $auxiliary1 = new Field($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldTextValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldTextValueOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "datentime": $auxiliary1 = new DateField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldValueDateOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldValueDateOne()); $auxiliary1->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateOne()); $auxiliary1->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "number": $auxiliary1 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldNumberValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldNumberValueOne()); $auxiliary1->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "currency": $auxiliary1 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldCurrencyValueOne()); $auxiliary1->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; } break; case 2: switch ($task7->getCouponAuxiliaryFieldValueTypeOne()) { case "text": $auxiliary1 = new Field($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldTextValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldTextValueOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "datentime": $auxiliary1 = new DateField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldValueDateOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldValueDateOne()); $auxiliary1->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateOne()); $auxiliary1->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "number": $auxiliary1 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldNumberValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldNumberValueOne()); $auxiliary1->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "currency": $auxiliary1 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldCurrencyValueOne()); $auxiliary1->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; } switch ($task7->getCouponAuxiliaryFieldValueTypeTwo()) { case "text": $auxiliary2 = new Field($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldTextValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldTextValueTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "datentime": $auxiliary2 = new DateField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldValueDateTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldValueDateTwo()); $auxiliary2->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateTwo()); $auxiliary2->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "number": $auxiliary2 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldNumberValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldNumberValueTwo()); $auxiliary2->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "currency": $auxiliary2 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldCurrencyValueTwo()); $auxiliary2->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; } break; case 3: if ($task1->getCategoryName() == 'Coupon') { switch ($task7->getCouponAuxiliaryFieldValueTypeOne()) { case "text": $auxiliary1 = new Field($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldTextValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldTextValueOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "datentime": $auxiliary1 = new DateField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldValueDateOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldValueDateOne()); $auxiliary1->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateOne()); $auxiliary1->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "number": $auxiliary1 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldNumberValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldNumberValueOne()); $auxiliary1->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "currency": $auxiliary1 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldCurrencyValueOne()); $auxiliary1->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; } switch ($task7->getCouponAuxiliaryFieldValueTypeTwo()) { case "text": $auxiliary2 = new Field($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldTextValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldTextValueTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "datentime": $auxiliary2 = new DateField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldValueDateTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldValueDateTwo()); $auxiliary2->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateTwo()); $auxiliary2->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "number": $auxiliary2 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldNumberValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldNumberValueTwo()); $auxiliary2->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "currency": $auxiliary2 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldCurrencyValueTwo()); $auxiliary2->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; } break; } else { switch ($task7->getCouponAuxiliaryFieldValueTypeOne()) { case "text": $auxiliary1 = new Field($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldTextValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldTextValueOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "datentime": $auxiliary1 = new DateField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldValueDateOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldValueDateOne()); $auxiliary1->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateOne()); $auxiliary1->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "number": $auxiliary1 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldNumberValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldNumberValueOne()); $auxiliary1->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "currency": $auxiliary1 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldCurrencyValueOne()); $auxiliary1->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; } switch ($task7->getCouponAuxiliaryFieldValueTypeTwo()) { case "text": $auxiliary2 = new Field($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldTextValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldTextValueTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "datentime": $auxiliary2 = new DateField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldValueDateTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldValueDateTwo()); $auxiliary2->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateTwo()); $auxiliary2->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "number": $auxiliary2 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldNumberValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldNumberValueTwo()); $auxiliary2->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "currency": $auxiliary2 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldCurrencyValueTwo()); $auxiliary2->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; } switch ($task7->getCouponAuxiliaryFieldValueTypeThree()) { case "text": $auxiliary3 = new Field($task7->getCouponAuxiliaryFieldValueTypeThree() . "a31", " "); if ($task7->getCouponAuxiliaryFieldTextValueThree()) { $auxiliary3->setValue($task7->getCouponAuxiliaryFieldTextValueThree()); } if ($task7->getCouponAuxiliaryFieldLabelThree()) { $auxiliary3->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelThree())); } $structure->addAuxiliaryField($auxiliary3); break; case "datentime": $auxiliary3 = new DateField($task7->getCouponAuxiliaryFieldValueTypeThree() . "a31", " "); if ($task7->getCouponAuxiliaryFieldValueDateThree()) { $auxiliary3->setValue($task7->getCouponAuxiliaryFieldValueDateThree()); $auxiliary3->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateThree()); $auxiliary3->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateThree()); } if ($task7->getCouponAuxiliaryFieldLabelThree()) { $auxiliary3->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelThree())); } $structure->addAuxiliaryField($auxiliary3); break; case "number": $auxiliary3 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeThree() . "a31", " "); if ($task7->getCouponAuxiliaryFieldNumberValueThree()) { $auxiliary3->setValue($task7->getCouponAuxiliaryFieldNumberValueThree()); $auxiliary3->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateThree()); } if ($task7->getCouponAuxiliaryFieldLabelThree()) { $auxiliary3->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelThree())); } $structure->addAuxiliaryField($auxiliary3); break; case "currency": $auxiliary3 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeThree() . "a31", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueThree()) { $auxiliary3->setValue($task7->getCouponAuxiliaryFieldCurrencyValueThree()); $auxiliary3->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeThree()); } if ($task7->getCouponAuxiliaryFieldLabelThree()) { $auxiliary3->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelThree())); } $structure->addAuxiliaryField($auxiliary3); break; } break; } case 4: if ($task1->getCategoryName() == 'Coupon') { switch ($task7->getCouponAuxiliaryFieldValueTypeOne()) { case "text": $auxiliary1 = new Field($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldTextValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldTextValueOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "datentime": $auxiliary1 = new DateField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldValueDateOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldValueDateOne()); $auxiliary1->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateOne()); $auxiliary1->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "number": $auxiliary1 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldNumberValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldNumberValueOne()); $auxiliary1->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "currency": $auxiliary1 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldCurrencyValueOne()); $auxiliary1->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; } switch ($task7->getCouponAuxiliaryFieldValueTypeTwo()) { case "text": $auxiliary2 = new Field($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldTextValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldTextValueTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "datentime": $auxiliary2 = new DateField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldValueDateTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldValueDateTwo()); $auxiliary2->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateTwo()); $auxiliary2->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "number": $auxiliary2 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldNumberValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldNumberValueTwo()); $auxiliary2->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "currency": $auxiliary2 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldCurrencyValueTwo()); $auxiliary2->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; } break; } else { switch ($task7->getCouponAuxiliaryFieldValueTypeOne()) { case "text": $auxiliary1 = new Field($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldTextValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldTextValueOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "datentime": $auxiliary1 = new DateField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldValueDateOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldValueDateOne()); $auxiliary1->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateOne()); $auxiliary1->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "number": $auxiliary1 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldNumberValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldNumberValueOne()); $auxiliary1->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; case "currency": $auxiliary1 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeOne() . "a11", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueOne()) { $auxiliary1->setValue($task7->getCouponAuxiliaryFieldCurrencyValueOne()); $auxiliary1->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeOne()); } if ($task7->getCouponAuxiliaryFieldLabelOne()) { $auxiliary1->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelOne())); } $structure->addAuxiliaryField($auxiliary1); break; } switch ($task7->getCouponAuxiliaryFieldValueTypeTwo()) { case "text": $auxiliary2 = new Field($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldTextValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldTextValueTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "datentime": $auxiliary2 = new DateField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldValueDateTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldValueDateTwo()); $auxiliary2->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateTwo()); $auxiliary2->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "number": $auxiliary2 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldNumberValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldNumberValueTwo()); $auxiliary2->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; case "currency": $auxiliary2 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeTwo() . "a21", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueTwo()) { $auxiliary2->setValue($task7->getCouponAuxiliaryFieldCurrencyValueTwo()); $auxiliary2->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeTwo()); } if ($task7->getCouponAuxiliaryFieldLabelTwo()) { $auxiliary2->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelTwo())); } $structure->addAuxiliaryField($auxiliary2); break; } switch ($task7->getCouponAuxiliaryFieldValueTypeThree()) { case "text": $auxiliary3 = new Field($task7->getCouponAuxiliaryFieldValueTypeThree() . "a31", " "); if ($task7->getCouponAuxiliaryFieldTextValueThree()) { $auxiliary3->setValue($task7->getCouponAuxiliaryFieldTextValueThree()); } if ($task7->getCouponAuxiliaryFieldLabelThree()) { $auxiliary3->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelThree())); } $structure->addAuxiliaryField($auxiliary3); break; case "datentime": $auxiliary3 = new DateField($task7->getCouponAuxiliaryFieldValueTypeThree() . "a31", " "); if ($task7->getCouponAuxiliaryFieldValueDateThree()) { $auxiliary3->setValue($task7->getCouponAuxiliaryFieldValueDateThree()); $auxiliary3->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateThree()); $auxiliary3->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateThree()); } if ($task7->getCouponAuxiliaryFieldLabelThree()) { $auxiliary3->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelThree())); } $structure->addAuxiliaryField($auxiliary3); break; case "number": $auxiliary3 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeThree() . "a31", " "); if ($task7->getCouponAuxiliaryFieldNumberValueThree()) { $auxiliary3->setValue($task7->getCouponAuxiliaryFieldNumberValueThree()); $auxiliary3->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateThree()); } if ($task7->getCouponAuxiliaryFieldLabelThree()) { $auxiliary3->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelThree())); } $structure->addAuxiliaryField($auxiliary3); break; case "currency": $auxiliary3 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeThree() . "a31", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueThree()) { $auxiliary3->setValue($task7->getCouponAuxiliaryFieldCurrencyValueThree()); $auxiliary3->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeThree()); } if ($task7->getCouponAuxiliaryFieldLabelThree()) { $auxiliary3->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelThree())); } $structure->addAuxiliaryField($auxiliary3); break; } switch ($task7->getCouponAuxiliaryFieldValueTypeFour()) { case "text": $auxiliary4 = new Field($task7->getCouponAuxiliaryFieldValueTypeFour() . "a41", " "); if ($task7->getCouponAuxiliaryFieldTextValueFour()) { $auxiliary4->setValue($task7->getCouponAuxiliaryFieldTextValueFour()); } if ($task7->getCouponAuxiliaryFieldLabelFour()) { $auxiliary4->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelFour())); } $structure->addAuxiliaryField($auxiliary4); break; case "datentime": $auxiliary4 = new DateField($task7->getCouponAuxiliaryFieldValueTypeFour() . "a41", " "); if ($task7->getCouponAuxiliaryFieldValueDateFour()) { $auxiliary4->setValue($task7->getCouponAuxiliaryFieldValueDateFour()); $auxiliary4->setDateStyle($task7->getCouponAuxiliaryFieldValueDateFormateFour()); $auxiliary4->setTimeStyle($task7->getCouponAuxiliaryFieldValueTimeFormateFour()); } if ($task7->getCouponAuxiliaryFieldLabelFour()) { $auxiliary4->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelFour())); } $structure->addAuxiliaryField($auxiliary4); break; case "number": $auxiliary4 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeFour() . "a41", " "); if ($task7->getCouponAuxiliaryFieldNumberValueFour()) { $auxiliary4->setValue($task7->getCouponAuxiliaryFieldNumberValueFour()); $auxiliary4->setNumberStyle($task7->getCouponAuxiliaryFieldNumberFormateFour()); } if ($task7->getCouponAuxiliaryFieldLabelFour()) { $auxiliary4->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelFour())); } $structure->addAuxiliaryField($auxiliary4); break; case "currency": $auxiliary4 = new NumberField($task7->getCouponAuxiliaryFieldValueTypeFour() . "a41", " "); if ($task7->getCouponAuxiliaryFieldCurrencyValueFour()) { $auxiliary4->setValue($task7->getCouponAuxiliaryFieldCurrencyValueFour()); $auxiliary4->setCurrencyCode($task7->getCouponAuxiliaryFieldCurrencyCodeFour()); } if ($task7->getCouponAuxiliaryFieldLabelFour()) { $auxiliary4->setLabel(strtoupper($task7->getCouponAuxiliaryFieldLabelFour())); } $structure->addAuxiliaryField($auxiliary4); break; } } break; } } } // Add Back Fields switch ($task8->getCouponBackFieldTotalFields()) { case 0: break; case 1: $backfield1 = new Field("Textb11", " "); if ($task8->getCouponBackFieldTextValueOne()) { $backfield1->setValue($task8->getCouponBackFieldTextValueOne()); } if ($task8->getCouponBackFieldLabelOne()) { $backfield1->setLabel($task8->getCouponBackFieldLabelOne()); } $structure->addBackField($backfield1); break; case 2: $backfield1 = new Field("Textb11", " "); if ($task8->getCouponBackFieldTextValueOne()) { $backfield1->setValue($task8->getCouponBackFieldTextValueOne()); } if ($task8->getCouponBackFieldLabelOne()) { $backfield1->setLabel($task8->getCouponBackFieldLabelOne()); } $structure->addBackField($backfield1); $backfield2 = new Field("Textb21", " "); if ($task8->getCouponBackFieldTextValueTwo()) { $backfield2->setValue($task8->getCouponBackFieldTextValueTwo()); } if ($task8->getCouponBackFieldLabelTwo()) { $backfield2->setLabel($task8->getCouponBackFieldLabelTwo()); } $structure->addBackField($backfield2); break; case 3: $backfield1 = new Field("Textb11", " "); if ($task8->getCouponBackFieldTextValueOne()) { $backfield1->setValue($task8->getCouponBackFieldTextValueOne()); } if ($task8->getCouponBackFieldLabelOne()) { $backfield1->setLabel($task8->getCouponBackFieldLabelOne()); } $structure->addBackField($backfield1); $backfield2 = new Field("Textb21", " "); if ($task8->getCouponBackFieldTextValueTwo()) { $backfield2->setValue($task8->getCouponBackFieldTextValueTwo()); } if ($task8->getCouponBackFieldLabelTwo()) { $backfield2->setLabel($task8->getCouponBackFieldLabelTwo()); } $structure->addBackField($backfield2); $backfield3 = new Field("Textb31", " "); if ($task8->getCouponBackFieldTextValueThree()) { $backfield3->setValue($task8->getCouponBackFieldTextValueThree()); } if ($task8->getCouponBackFieldLabelThree()) { $backfield3->setLabel($task8->getCouponBackFieldLabelThree()); } $structure->addBackField($backfield3); break; case 4: $backfield1 = new Field("Textb11", " "); if ($task8->getCouponBackFieldTextValueOne()) { $backfield1->setValue($task8->getCouponBackFieldTextValueOne()); } if ($task8->getCouponBackFieldLabelOne()) { $backfield1->setLabel($task8->getCouponBackFieldLabelOne()); } $structure->addBackField($backfield1); $backfield2 = new Field("Textb21", " "); if ($task8->getCouponBackFieldTextValueTwo()) { $backfield2->setValue($task8->getCouponBackFieldTextValueTwo()); } if ($task8->getCouponBackFieldLabelTwo()) { $backfield2->setLabel($task8->getCouponBackFieldLabelTwo()); } $structure->addBackField($backfield2); $backfield3 = new Field("Textb31", " "); if ($task8->getCouponBackFieldTextValueThree()) { $backfield3->setValue($task8->getCouponBackFieldTextValueThree()); } if ($task8->getCouponBackFieldLabelThree()) { $backfield3->setLabel($task8->getCouponBackFieldLabelThree()); } $structure->addBackField($backfield3); $backfield4 = new Field("Textb41", " "); if ($task8->getCouponBackFieldTextValueFour()) { $backfield4->setValue($task8->getCouponBackFieldTextValueFour()); } if ($task8->getCouponBackFieldLabelFour()) { $backfield4->setLabel($task8->getCouponBackFieldLabelFour()); } $structure->addBackField($backfield4); break; case 5: $backfield1 = new Field("Textb11", " "); if ($task8->getCouponBackFieldTextValueOne()) { $backfield1->setValue($task8->getCouponBackFieldTextValueOne()); } if ($task8->getCouponBackFieldLabelOne()) { $backfield1->setLabel($task8->getCouponBackFieldLabelOne()); } $structure->addBackField($backfield1); $backfield2 = new Field("Textb21", " "); if ($task8->getCouponBackFieldTextValueTwo()) { $backfield2->setValue($task8->getCouponBackFieldTextValueTwo()); } if ($task8->getCouponBackFieldLabelTwo()) { $backfield2->setLabel($task8->getCouponBackFieldLabelTwo()); } $structure->addBackField($backfield2); $backfield3 = new Field("Textb31", " "); if ($task8->getCouponBackFieldTextValueThree()) { $backfield3->setValue($task8->getCouponBackFieldTextValueThree()); } if ($task8->getCouponBackFieldLabelThree()) { $backfield3->setLabel($task8->getCouponBackFieldLabelThree()); } $structure->addBackField($backfield3); $backfield4 = new Field("Textb41", " "); if ($task8->getCouponBackFieldTextValueFour()) { $backfield4->setValue($task8->getCouponBackFieldTextValueFour()); } if ($task8->getCouponBackFieldLabelFour()) { $backfield4->setLabel($task8->getCouponBackFieldLabelFour()); } $structure->addBackField($backfield4); $backfield5 = new Field("Textb51", " "); if ($task8->getCouponBackFieldTextValueFive()) { $backfield5->setValue($task8->getCouponBackFieldTextValueFive()); } if ($task8->getCouponBackFieldLabelFive()) { $backfield5->setLabel($task8->getCouponBackFieldLabelFive()); } $structure->addBackField($backfield5); break; case 6: $backfield1 = new Field("Textb11", " "); if ($task8->getCouponBackFieldTextValueOne()) { $backfield1->setValue($task8->getCouponBackFieldTextValueOne()); } if ($task8->getCouponBackFieldLabelOne()) { $backfield1->setLabel($task8->getCouponBackFieldLabelOne()); } $structure->addBackField($backfield1); $backfield2 = new Field("Textb21", " "); if ($task8->getCouponBackFieldTextValueTwo()) { $backfield2->setValue($task8->getCouponBackFieldTextValueTwo()); } if ($task8->getCouponBackFieldLabelTwo()) { $backfield2->setLabel($task8->getCouponBackFieldLabelTwo()); } $structure->addBackField($backfield2); $backfield3 = new Field("Textb31", " "); if ($task8->getCouponBackFieldTextValueThree()) { $backfield3->setValue($task8->getCouponBackFieldTextValueThree()); } if ($task8->getCouponBackFieldLabelThree()) { $backfield3->setLabel($task8->getCouponBackFieldLabelThree()); } $structure->addBackField($backfield3); $backfield4 = new Field("Textb41", " "); if ($task8->getCouponBackFieldTextValueFour()) { $backfield4->setValue($task8->getCouponBackFieldTextValueFour()); } if ($task8->getCouponBackFieldLabelFour()) { $backfield4->setLabel($task8->getCouponBackFieldLabelFour()); } $structure->addBackField($backfield4); $backfield5 = new Field("Textb51", " "); if ($task8->getCouponBackFieldTextValueFive()) { $backfield5->setValue($task8->getCouponBackFieldTextValueFive()); } if ($task8->getCouponBackFieldLabelFive()) { $backfield5->setLabel($task8->getCouponBackFieldLabelFive()); } $structure->addBackField($backfield5); $backfield6 = new Field("Textb61", " "); if ($task8->getCouponBackFieldTextValueSix()) { $backfield6->setValue($task8->getCouponBackFieldTextValueSix()); } if ($task8->getCouponBackFieldLabelSix()) { $backfield6->setLabel($task8->getCouponBackFieldLabelSix()); } $structure->addBackField($backfield6); break; case 7: $backfield1 = new Field("Textb11", " "); if ($task8->getCouponBackFieldTextValueOne()) { $backfield1->setValue($task8->getCouponBackFieldTextValueOne()); } if ($task8->getCouponBackFieldLabelOne()) { $backfield1->setLabel($task8->getCouponBackFieldLabelOne()); } $structure->addBackField($backfield1); $backfield2 = new Field("Textb21", " "); if ($task8->getCouponBackFieldTextValueTwo()) { $backfield2->setValue($task8->getCouponBackFieldTextValueTwo()); } if ($task8->getCouponBackFieldLabelTwo()) { $backfield2->setLabel($task8->getCouponBackFieldLabelTwo()); } $structure->addBackField($backfield2); $backfield3 = new Field("Textb31", " "); if ($task8->getCouponBackFieldTextValueThree()) { $backfield3->setValue($task8->getCouponBackFieldTextValueThree()); } if ($task8->getCouponBackFieldLabelThree()) { $backfield3->setLabel($task8->getCouponBackFieldLabelThree()); } $structure->addBackField($backfield3); $backfield4 = new Field("Textb41", " "); if ($task8->getCouponBackFieldTextValueFour()) { $backfield4->setValue($task8->getCouponBackFieldTextValueFour()); } if ($task8->getCouponBackFieldLabelFour()) { $backfield4->setLabel($task8->getCouponBackFieldLabelFour()); } $structure->addBackField($backfield4); $backfield5 = new Field("Textb51", " "); if ($task8->getCouponBackFieldTextValueFive()) { $backfield5->setValue($task8->getCouponBackFieldTextValueFive()); } if ($task8->getCouponBackFieldLabelFive()) { $backfield5->setLabel($task8->getCouponBackFieldLabelFive()); } $structure->addBackField($backfield5); $backfield6 = new Field("Textb61", " "); if ($task8->getCouponBackFieldTextValueSix()) { $backfield6->setValue($task8->getCouponBackFieldTextValueSix()); } if ($task8->getCouponBackFieldLabelSix()) { $backfield6->setLabel($task8->getCouponBackFieldLabelSix()); } $structure->addBackField($backfield6); $backfield7 = new Field("Textb71", " "); if ($task8->getCouponBackFieldTextValueSeven()) { $backfield7->setValue($task8->getCouponBackFieldTextValueSeven()); } if ($task8->getCouponBackFieldLabelSeven()) { $backfield7->setLabel($task8->getCouponBackFieldLabelSeven()); } $structure->addBackField($backfield7); break; case 8: $backfield1 = new Field("Textb11", " "); if ($task8->getCouponBackFieldTextValueOne()) { $backfield1->setValue($task8->getCouponBackFieldTextValueOne()); } if ($task8->getCouponBackFieldLabelOne()) { $backfield1->setLabel($task8->getCouponBackFieldLabelOne()); } $structure->addBackField($backfield1); $backfield2 = new Field("Textb21", " "); if ($task8->getCouponBackFieldTextValueTwo()) { $backfield2->setValue($task8->getCouponBackFieldTextValueTwo()); } if ($task8->getCouponBackFieldLabelTwo()) { $backfield2->setLabel($task8->getCouponBackFieldLabelTwo()); } $structure->addBackField($backfield2); $backfield3 = new Field("Textb31", " "); if ($task8->getCouponBackFieldTextValueThree()) { $backfield3->setValue($task8->getCouponBackFieldTextValueThree()); } if ($task8->getCouponBackFieldLabelThree()) { $backfield3->setLabel($task8->getCouponBackFieldLabelThree()); } $structure->addBackField($backfield3); $backfield4 = new Field("Textb41", " "); if ($task8->getCouponBackFieldTextValueFour()) { $backfield4->setValue($task8->getCouponBackFieldTextValueFour()); } if ($task8->getCouponBackFieldLabelFour()) { $backfield4->setLabel($task8->getCouponBackFieldLabelFour()); } $structure->addBackField($backfield4); $backfield5 = new Field("Textb51", " "); if ($task8->getCouponBackFieldTextValueFive()) { $backfield5->setValue($task8->getCouponBackFieldTextValueFive()); } if ($task8->getCouponBackFieldLabelFive()) { $backfield5->setLabel($task8->getCouponBackFieldLabelFive()); } $structure->addBackField($backfield5); $backfield6 = new Field("Textb61", " "); if ($task8->getCouponBackFieldTextValueSix()) { $backfield6->setValue($task8->getCouponBackFieldTextValueSix()); } if ($task8->getCouponBackFieldLabelSix()) { $backfield6->setLabel($task8->getCouponBackFieldLabelSix()); } $structure->addBackField($backfield6); $backfield7 = new Field("Textb71", " "); if ($task8->getCouponBackFieldTextValueSeven()) { $backfield7->setValue($task8->getCouponBackFieldTextValueSeven()); } if ($task8->getCouponBackFieldLabelSeven()) { $backfield7->setLabel($task8->getCouponBackFieldLabelSeven()); } $structure->addBackField($backfield7); $backfield8 = new Field("Textb81", " "); if ($task8->getCouponBackFieldTextValueEight()) { $backfield8->setValue($task8->getCouponBackFieldTextValueEight()); } if ($task8->getCouponBackFieldLabelEight()) { $backfield8->setLabel($task8->getCouponBackFieldLabelEight()); } $structure->addBackField($backfield8); break; case 9: $backfield1 = new Field("Textb11", " "); if ($task8->getCouponBackFieldTextValueOne()) { $backfield1->setValue($task8->getCouponBackFieldTextValueOne()); } if ($task8->getCouponBackFieldLabelOne()) { $backfield1->setLabel($task8->getCouponBackFieldLabelOne()); } $structure->addBackField($backfield1); $backfield2 = new Field("Textb21", " "); if ($task8->getCouponBackFieldTextValueTwo()) { $backfield2->setValue($task8->getCouponBackFieldTextValueTwo()); } if ($task8->getCouponBackFieldLabelTwo()) { $backfield2->setLabel($task8->getCouponBackFieldLabelTwo()); } $structure->addBackField($backfield2); $backfield3 = new Field("Textb31", " "); if ($task8->getCouponBackFieldTextValueThree()) { $backfield3->setValue($task8->getCouponBackFieldTextValueThree()); } if ($task8->getCouponBackFieldLabelThree()) { $backfield3->setLabel($task8->getCouponBackFieldLabelThree()); } $structure->addBackField($backfield3); $backfield4 = new Field("Textb41", " "); if ($task8->getCouponBackFieldTextValueFour()) { $backfield4->setValue($task8->getCouponBackFieldTextValueFour()); } if ($task8->getCouponBackFieldLabelFour()) { $backfield4->setLabel($task8->getCouponBackFieldLabelFour()); } $structure->addBackField($backfield4); $backfield5 = new Field("Textb51", " "); if ($task8->getCouponBackFieldTextValueFive()) { $backfield5->setValue($task8->getCouponBackFieldTextValueFive()); } if ($task8->getCouponBackFieldLabelFive()) { $backfield5->setLabel($task8->getCouponBackFieldLabelFive()); } $structure->addBackField($backfield5); $backfield6 = new Field("Textb61", " "); if ($task8->getCouponBackFieldTextValueSix()) { $backfield6->setValue($task8->getCouponBackFieldTextValueSix()); } if ($task8->getCouponBackFieldLabelSix()) { $backfield6->setLabel($task8->getCouponBackFieldLabelSix()); } $structure->addBackField($backfield6); $backfield7 = new Field("Textb71", " "); if ($task8->getCouponBackFieldTextValueSeven()) { $backfield7->setValue($task8->getCouponBackFieldTextValueSeven()); } if ($task8->getCouponBackFieldLabelSeven()) { $backfield7->setLabel($task8->getCouponBackFieldLabelSeven()); } $structure->addBackField($backfield7); $backfield8 = new Field("Textb81", " "); if ($task8->getCouponBackFieldTextValueEight()) { $backfield8->setValue($task8->getCouponBackFieldTextValueEight()); } if ($task8->getCouponBackFieldLabelEight()) { $backfield8->setLabel($task8->getCouponBackFieldLabelEight()); } $structure->addBackField($backfield8); $backfield9 = new Field("Textb91", " "); if ($task8->getCouponBackFieldTextValueNine()) { $backfield9->setValue($task8->getCouponBackFieldTextValueNine()); } if ($task8->getCouponBackFieldLabelNine()) { $backfield9->setLabel($task8->getCouponBackFieldLabelNine()); } $structure->addBackField($backfield9); break; case 10: $backfield1 = new Field("Textb11", " "); if ($task8->getCouponBackFieldTextValueOne()) { $backfield1->setValue($task8->getCouponBackFieldTextValueOne()); } if ($task8->getCouponBackFieldLabelOne()) { $backfield1->setLabel($task8->getCouponBackFieldLabelOne()); } $structure->addBackField($backfield1); $backfield2 = new Field("Textb21", " "); if ($task8->getCouponBackFieldTextValueTwo()) { $backfield2->setValue($task8->getCouponBackFieldTextValueTwo()); } if ($task8->getCouponBackFieldLabelTwo()) { $backfield2->setLabel($task8->getCouponBackFieldLabelTwo()); } $structure->addBackField($backfield2); $backfield3 = new Field("Textb31", " "); if ($task8->getCouponBackFieldTextValueThree()) { $backfield3->setValue($task8->getCouponBackFieldTextValueThree()); } if ($task8->getCouponBackFieldLabelThree()) { $backfield3->setLabel($task8->getCouponBackFieldLabelThree()); } $structure->addBackField($backfield3); $backfield4 = new Field("Textb41", " "); if ($task8->getCouponBackFieldTextValueFour()) { $backfield4->setValue($task8->getCouponBackFieldTextValueFour()); } if ($task8->getCouponBackFieldLabelFour()) { $backfield4->setLabel($task8->getCouponBackFieldLabelFour()); } $structure->addBackField($backfield4); $backfield5 = new Field("Textb51", " "); if ($task8->getCouponBackFieldTextValueFive()) { $backfield5->setValue($task8->getCouponBackFieldTextValueFive()); } if ($task8->getCouponBackFieldLabelFive()) { $backfield5->setLabel($task8->getCouponBackFieldLabelFive()); } $structure->addBackField($backfield5); $backfield6 = new Field("Textb61", " "); if ($task8->getCouponBackFieldTextValueSix()) { $backfield6->setValue($task8->getCouponBackFieldTextValueSix()); } if ($task8->getCouponBackFieldLabelSix()) { $backfield6->setLabel($task8->getCouponBackFieldLabelSix()); } $structure->addBackField($backfield6); $backfield7 = new Field("Textb71", " "); if ($task8->getCouponBackFieldTextValueSeven()) { $backfield7->setValue($task8->getCouponBackFieldTextValueSeven()); } if ($task8->getCouponBackFieldLabelSeven()) { $backfield7->setLabel($task8->getCouponBackFieldLabelSeven()); } $structure->addBackField($backfield7); $backfield8 = new Field("Textb81", " "); if ($task8->getCouponBackFieldTextValueEight()) { $backfield8->setValue($task8->getCouponBackFieldTextValueEight()); } if ($task8->getCouponBackFieldLabelEight()) { $backfield8->setLabel($task8->getCouponBackFieldLabelEight()); } $structure->addBackField($backfield8); $backfield9 = new Field("Textb91", " "); if ($task8->getCouponBackFieldTextValueNine()) { $backfield9->setValue($task8->getCouponBackFieldTextValueNine()); } if ($task8->getCouponBackFieldLabelNine()) { $backfield9->setLabel($task8->getCouponBackFieldLabelNine()); } $structure->addBackField($backfield9); $backfield10 = new Field("Textb10", " "); if ($task8->getCouponBackFieldTextValueTen()) { $backfield10->setValue($task8->getCouponBackFieldTextValueTen()); } if ($task8->getCouponBackFieldLabelTen()) { $backfield10->setLabel($task8->getCouponBackFieldLabelTen()); } $structure->addBackField($backfield10); break; } $backfielddefault = new Field("Textb12", " "); $backfielddefault->setValue("This pass has been created and issued by a Company user from " . $task1->getOrganizationName() . " with the following e-mail : " . $task1->getUserEmail() . " (the 'Pass Issuer') " . "\n\t\t\t\n\t\t\tPut your email text here\n\n\t\t"); $backfielddefault->setLabel("About this Pass:"******" ".$lng; } break; case 2: if ($task9->getCouponRelevanceLocationAddressOne()) { $lat = floatval($task9->getCouponRelevanceLocationAddressOneLatitude()); $lng = floatval($task9->getCouponRelevanceLocationAddressOneLongitude()); $relevance1 = new Location($lat, $lng); $relevance1->setRelevantText($task9->getCouponRelevanceLocationTextOne()); $pass->addLocation($relevance1); } if ($task9->getCouponRelevanceLocationAddressTwo()) { $lat = floatval($task9->getCouponRelevanceLocationAddressTwoLatitude()); $lng = floatval($task9->getCouponRelevanceLocationAddressTwoLongitude()); $relevance2 = new Location($lat, $lng); $relevance2->setRelevantText($task9->getCouponRelevanceLocationTextTwo()); $pass->addLocation($relevance2); } break; case 3: if ($task9->getCouponRelevanceLocationAddressOne()) { $lat = floatval($task9->getCouponRelevanceLocationAddressOneLatitude()); $lng = floatval($task9->getCouponRelevanceLocationAddressOneLongitude()); $relevance1 = new Location($lat, $lng); $relevance1->setRelevantText($task9->getCouponRelevanceLocationTextOne()); $pass->addLocation($relevance1); } if ($task9->getCouponRelevanceLocationAddressTwo()) { $lat = $task9->getCouponRelevanceLocationAddressTwoLatitude(); $lng = $task9->getCouponRelevanceLocationAddressTwoLongitude(); $relevance2 = new Location($lat, $lng); $relevance2->setRelevantText($task9->getCouponRelevanceLocationTextTwo()); $pass->addLocation($relevance2); } if ($task9->getCouponRelevanceLocationAddressThree()) { $lat = $task9->getCouponRelevanceLocationAddressThreeLatitude(); $lng = $task9->getCouponRelevanceLocationAddressThreeLongitude(); $relevance3 = new Location($lat, $lng); $relevance3->setRelevantText($task9->getCouponRelevanceLocationTextThree()); $pass->addLocation($relevance3); } break; case 4: if ($task9->getCouponRelevanceLocationAddressOne()) { $lat = $task9->getCouponRelevanceLocationAddressOneLatitude(); $lng = $task9->getCouponRelevanceLocationAddressOneLongitude(); $relevance1 = new Location($lat, $lng); $relevance1->setRelevantText($task9->getCouponRelevanceLocationTextOne()); $pass->addLocation($relevance1); } if ($task9->getCouponRelevanceLocationAddressTwo()) { $lat = $task9->getCouponRelevanceLocationAddressTwoLatitude(); $lng = $task9->getCouponRelevanceLocationAddressTwoLongitude(); $relevance2 = new Location($lat, $lng); $relevance2->setRelevantText($task9->getCouponRelevanceLocationTextTwo()); $pass->addLocation($relevance2); } if ($task9->getCouponRelevanceLocationAddressThree()) { $lat = $task9->getCouponRelevanceLocationAddressThreeLatitude(); $lng = $task9->getCouponRelevanceLocationAddressThreeLongitude(); $relevance3 = new Location($lat, $lng); $relevance3->setRelevantText($task9->getCouponRelevanceLocationTextThree()); $pass->addLocation($relevance3); } if ($task9->getCouponRelevanceLocationAddressFour()) { $lat = $task9->getCouponRelevanceLocationAddressFourLatitude(); $lng = $task9->getCouponRelevanceLocationAddressFourLongitude(); $relevance4 = new Location($lat, $lng); $relevance4->setRelevantText($task9->getCouponRelevanceLocationTextFour()); $pass->addLocation($relevance4); } break; case 5: if ($task9->getCouponRelevanceLocationAddressOne()) { $lat = $task9->getCouponRelevanceLocationAddressOneLatitude(); $lng = $task9->getCouponRelevanceLocationAddressOneLongitude(); $relevance1 = new Location($lat, $lng); $relevance1->setRelevantText($task9->getCouponRelevanceLocationTextOne()); $pass->addLocation($relevance1); } if ($task9->getCouponRelevanceLocationAddressTwo()) { $lat = $task9->getCouponRelevanceLocationAddressTwoLatitude(); $lng = $task9->getCouponRelevanceLocationAddressTwoLongitude(); $relevance2 = new Location($lat, $lng); $relevance2->setRelevantText($task9->getCouponRelevanceLocationTextTwo()); $pass->addLocation($relevance2); } if ($task9->getCouponRelevanceLocationAddressThree()) { $lat = $task9->getCouponRelevanceLocationAddressThreeLatitude(); $lng = $task9->getCouponRelevanceLocationAddressThreeLongitude(); $relevance3 = new Location($lat, $lng); $relevance3->setRelevantText($task9->getCouponRelevanceLocationTextThree()); $pass->addLocation($relevance3); } if ($task9->getCouponRelevanceLocationAddressFour()) { $lat = $task9->getCouponRelevanceLocationAddressFourLatitude(); $lng = $task9->getCouponRelevanceLocationAddressFourLongitude(); $relevance4 = new Location($lat, $lng); $relevance4->setRelevantText($task9->getCouponRelevanceLocationTextFour()); $pass->addLocation($relevance4); } if ($task9->getCouponRelevanceLocationAddressFive()) { $lat = $task9->getCouponRelevanceLocationAddressFiveLatitude(); $lng = $task9->getCouponRelevanceLocationAddressFiveLongitude(); $relevance5 = new Location($lat, $lng); $relevance5->setRelevantText($task9->getCouponRelevanceLocationTextFive()); $pass->addLocation($relevance5); } break; case 6: if ($task9->getCouponRelevanceLocationAddressOne()) { $lat = $task9->getCouponRelevanceLocationAddressOneLatitude(); $lng = $task9->getCouponRelevanceLocationAddressOneLongitude(); $relevance1 = new Location($lat, $lng); $relevance1->setRelevantText($task9->getCouponRelevanceLocationTextOne()); $pass->addLocation($relevance1); } if ($task9->getCouponRelevanceLocationAddressTwo()) { $lat = $task9->getCouponRelevanceLocationAddressTwoLatitude(); $lng = $task9->getCouponRelevanceLocationAddressTwoLongitude(); $relevance2 = new Location($lat, $lng); $relevance2->setRelevantText($task9->getCouponRelevanceLocationTextTwo()); $pass->addLocation($relevance2); } if ($task9->getCouponRelevanceLocationAddressThree()) { $lat = $task9->getCouponRelevanceLocationAddressThreeLatitude(); $lng = $task9->getCouponRelevanceLocationAddressThreeLongitude(); $relevance3 = new Location($lat, $lng); $relevance3->setRelevantText($task9->getCouponRelevanceLocationTextThree()); $pass->addLocation($relevance3); } if ($task9->getCouponRelevanceLocationAddressFour()) { $lat = $task9->getCouponRelevanceLocationAddressFourLatitude(); $lng = $task9->getCouponRelevanceLocationAddressFourLongitude(); $relevance4 = new Location($lat, $lng); $relevance4->setRelevantText($task9->getCouponRelevanceLocationTextFour()); $pass->addLocation($relevance4); } if ($task9->getCouponRelevanceLocationAddressFive()) { $lat = $task9->getCouponRelevanceLocationAddressFiveLatitude(); $lng = $task9->getCouponRelevanceLocationAddressFiveLongitude(); $relevance5 = new Location($lat, $lng); $relevance5->setRelevantText($task9->getCouponRelevanceLocationTextFive()); $pass->addLocation($relevance5); } if ($task9->getCouponRelevanceLocationAddressSix()) { $lat = $task9->getCouponRelevanceLocationAddressSixLatitude(); $lng = $task9->getCouponRelevanceLocationAddressSixLongitude(); $relevance6 = new Location($lat, $lng); $relevance6->setRelevantText($task9->getCouponRelevanceLocationTextSix()); $pass->addLocation($relevance6); } break; case 7: if ($task9->getCouponRelevanceLocationAddressOne()) { $lat = $task9->getCouponRelevanceLocationAddressOneLatitude(); $lng = $task9->getCouponRelevanceLocationAddressOneLongitude(); $relevance1 = new Location($lat, $lng); $relevance1->setRelevantText($task9->getCouponRelevanceLocationTextOne()); $pass->addLocation($relevance1); } if ($task9->getCouponRelevanceLocationAddressTwo()) { $lat = $task9->getCouponRelevanceLocationAddressTwoLatitude(); $lng = $task9->getCouponRelevanceLocationAddressTwoLongitude(); $relevance2 = new Location($lat, $lng); $relevance2->setRelevantText($task9->getCouponRelevanceLocationTextTwo()); $pass->addLocation($relevance2); } if ($task9->getCouponRelevanceLocationAddressThree()) { $lat = $task9->getCouponRelevanceLocationAddressThreeLatitude(); $lng = $task9->getCouponRelevanceLocationAddressThreeLongitude(); $relevance3 = new Location($lat, $lng); $relevance3->setRelevantText($task9->getCouponRelevanceLocationTextThree()); $pass->addLocation($relevance3); } if ($task9->getCouponRelevanceLocationAddressFour()) { $lat = $task9->getCouponRelevanceLocationAddressFourLatitude(); $lng = $task9->getCouponRelevanceLocationAddressFourLongitude(); $relevance4 = new Location($lat, $lng); $relevance4->setRelevantText($task9->getCouponRelevanceLocationTextFour()); $pass->addLocation($relevance4); } if ($task9->getCouponRelevanceLocationAddressFive()) { $lat = $task9->getCouponRelevanceLocationAddressFiveLatitude(); $lng = $task9->getCouponRelevanceLocationAddressFiveLongitude(); $relevance5 = new Location($lat, $lng); $relevance5->setRelevantText($task9->getCouponRelevanceLocationTextFive()); $pass->addLocation($relevance5); } if ($task9->getCouponRelevanceLocationAddressSix()) { $lat = $task9->getCouponRelevanceLocationAddressSixLatitude(); $lng = $task9->getCouponRelevanceLocationAddressSixLongitude(); $relevance6 = new Location($lat, $lng); $relevance6->setRelevantText($task9->getCouponRelevanceLocationTextSix()); $pass->addLocation($relevance6); } if ($task9->getCouponRelevanceLocationAddressSeven()) { $lat = $task9->getCouponRelevanceLocationAddressSevenLatitude(); $lng = $task9->getCouponRelevanceLocationAddressSevenLongitude(); $relevance7 = new Location($lat, $lng); $relevance7->setRelevantText($task9->getCouponRelevanceLocationTextSeven()); $pass->addLocation($relevance7); } break; case 8: if ($task9->getCouponRelevanceLocationAddressOne()) { $lat = $task9->getCouponRelevanceLocationAddressOneLatitude(); $lng = $task9->getCouponRelevanceLocationAddressOneLongitude(); $relevance1 = new Location($lat, $lng); $relevance1->setRelevantText($task9->getCouponRelevanceLocationTextOne()); $pass->addLocation($relevance1); } if ($task9->getCouponRelevanceLocationAddressTwo()) { $lat = $task9->getCouponRelevanceLocationAddressTwoLatitude(); $lng = $task9->getCouponRelevanceLocationAddressTwoLongitude(); $relevance2 = new Location($lat, $lng); $relevance2->setRelevantText($task9->getCouponRelevanceLocationTextTwo()); $pass->addLocation($relevance2); } if ($task9->getCouponRelevanceLocationAddressThree()) { $lat = $task9->getCouponRelevanceLocationAddressThreeLatitude(); $lng = $task9->getCouponRelevanceLocationAddressThreeLongitude(); $relevance3 = new Location($lat, $lng); $relevance3->setRelevantText($task9->getCouponRelevanceLocationTextThree()); $pass->addLocation($relevance3); } if ($task9->getCouponRelevanceLocationAddressFour()) { $lat = $task9->getCouponRelevanceLocationAddressFourLatitude(); $lng = $task9->getCouponRelevanceLocationAddressFourLongitude(); $relevance4 = new Location($lat, $lng); $relevance4->setRelevantText($task9->getCouponRelevanceLocationTextFour()); $pass->addLocation($relevance4); } if ($task9->getCouponRelevanceLocationAddressFive()) { $lat = $task9->getCouponRelevanceLocationAddressFiveLatitude(); $lng = $task9->getCouponRelevanceLocationAddressFiveLongitude(); $relevance5 = new Location($lat, $lng); $relevance5->setRelevantText($task9->getCouponRelevanceLocationTextFive()); $pass->addLocation($relevance5); } if ($task9->getCouponRelevanceLocationAddressSix()) { $lat = $task9->getCouponRelevanceLocationAddressSixLatitude(); $lng = $task9->getCouponRelevanceLocationAddressSixLongitude(); $relevance6 = new Location($lat, $lng); $relevance6->setRelevantText($task9->getCouponRelevanceLocationTextSix()); $pass->addLocation($relevance6); } if ($task9->getCouponRelevanceLocationAddressSeven()) { $lat = $task9->getCouponRelevanceLocationAddressSevenLatitude(); $lng = $task9->getCouponRelevanceLocationAddressSevenLongitude(); $relevance7 = new Location($lat, $lng); $relevance7->setRelevantText($task9->getCouponRelevanceLocationTextSeven()); $pass->addLocation($relevance7); } if ($task9->getCouponRelevanceLocationAddressEight()) { $lat = $task9->getCouponRelevanceLocationAddressEightLatitude(); $lng = $task9->getCouponRelevanceLocationAddressEightLongitude(); $relevance8 = new Location($lat, $lng); $relevance8->setRelevantText($task9->getCouponRelevanceLocationTextEight()); $pass->addLocation($relevance8); } break; case 9: if ($task9->getCouponRelevanceLocationAddressOne()) { $lat = $task9->getCouponRelevanceLocationAddressOneLatitude(); $lng = $task9->getCouponRelevanceLocationAddressOneLongitude(); $relevance1 = new Location($lat, $lng); $relevance1->setRelevantText($task9->getCouponRelevanceLocationTextOne()); $pass->addLocation($relevance1); } if ($task9->getCouponRelevanceLocationAddressTwo()) { $lat = $task9->getCouponRelevanceLocationAddressTwoLatitude(); $lng = $task9->getCouponRelevanceLocationAddressTwoLongitude(); $relevance2 = new Location($lat, $lng); $relevance2->setRelevantText($task9->getCouponRelevanceLocationTextTwo()); $pass->addLocation($relevance2); } if ($task9->getCouponRelevanceLocationAddressThree()) { $lat = $task9->getCouponRelevanceLocationAddressThreeLatitude(); $lng = $task9->getCouponRelevanceLocationAddressThreeLongitude(); $relevance3 = new Location($lat, $lng); $relevance3->setRelevantText($task9->getCouponRelevanceLocationTextThree()); $pass->addLocation($relevance3); } if ($task9->getCouponRelevanceLocationAddressFour()) { $lat = $task9->getCouponRelevanceLocationAddressFourLatitude(); $lng = $task9->getCouponRelevanceLocationAddressFourLongitude(); $relevance4 = new Location($lat, $lng); $relevance4->setRelevantText($task9->getCouponRelevanceLocationTextFour()); $pass->addLocation($relevance4); } if ($task9->getCouponRelevanceLocationAddressFive()) { $lat = $task9->getCouponRelevanceLocationAddressFiveLatitude(); $lng = $task9->getCouponRelevanceLocationAddressFiveLongitude(); $relevance5 = new Location($lat, $lng); $relevance5->setRelevantText($task9->getCouponRelevanceLocationTextFive()); $pass->addLocation($relevance5); } if ($task9->getCouponRelevanceLocationAddressSix()) { $lat = $task9->getCouponRelevanceLocationAddressSixLatitude(); $lng = $task9->getCouponRelevanceLocationAddressSixLongitude(); $relevance6 = new Location($lat, $lng); $relevance6->setRelevantText($task9->getCouponRelevanceLocationTextSix()); $pass->addLocation($relevance6); } if ($task9->getCouponRelevanceLocationAddressSeven()) { $lat = $task9->getCouponRelevanceLocationAddressSevenLatitude(); $lng = $task9->getCouponRelevanceLocationAddressSevenLongitude(); $relevance7 = new Location($lat, $lng); $relevance7->setRelevantText($task9->getCouponRelevanceLocationTextSeven()); $pass->addLocation($relevance7); } if ($task9->getCouponRelevanceLocationAddressEight()) { $lat = $task9->getCouponRelevanceLocationAddressEightLatitude(); $lng = $task9->getCouponRelevanceLocationAddressEightLongitude(); $relevance8 = new Location($lat, $lng); $relevance8->setRelevantText($task9->getCouponRelevanceLocationTextEight()); $pass->addLocation($relevance8); } if ($task9->getCouponRelevanceLocationAddressNine()) { $lat = $task9->getCouponRelevanceLocationAddressNineLatitude(); $lng = $task9->getCouponRelevanceLocationAddressNineLongitude(); $relevance9 = new Location($lat, $lng); $relevance9->setRelevantText($task9->getCouponRelevanceLocationTextNine()); $pass->addLocation($relevance9); } break; case 10: if ($task9->getCouponRelevanceLocationAddressOne()) { $lat = $task9->getCouponRelevanceLocationAddressOneLatitude(); $lng = $task9->getCouponRelevanceLocationAddressOneLongitude(); $relevance1 = new Location($lat, $lng); $relevance1->setRelevantText($task9->getCouponRelevanceLocationTextOne()); $pass->addLocation($relevance1); } if ($task9->getCouponRelevanceLocationAddressTwo()) { $lat = $task9->getCouponRelevanceLocationAddressTwoLatitude(); $lng = $task9->getCouponRelevanceLocationAddressTwoLongitude(); $relevance2 = new Location($lat, $lng); $relevance2->setRelevantText($task9->getCouponRelevanceLocationTextTwo()); $pass->addLocation($relevance2); } if ($task9->getCouponRelevanceLocationAddressThree()) { $lat = $task9->getCouponRelevanceLocationAddressThreeLatitude(); $lng = $task9->getCouponRelevanceLocationAddressThreeLongitude(); $relevance3 = new Location($lat, $lng); $relevance3->setRelevantText($task9->getCouponRelevanceLocationTextThree()); $pass->addLocation($relevance3); } if ($task9->getCouponRelevanceLocationAddressFour()) { $lat = $task9->getCouponRelevanceLocationAddressFourLatitude(); $lng = $task9->getCouponRelevanceLocationAddressFourLongitude(); $relevance4 = new Location($lat, $lng); $relevance4->setRelevantText($task9->getCouponRelevanceLocationTextFour()); $pass->addLocation($relevance4); } if ($task9->getCouponRelevanceLocationAddressFive()) { $lat = $task9->getCouponRelevanceLocationAddressFiveLatitude(); $lng = $task9->getCouponRelevanceLocationAddressFiveLongitude(); $relevance5 = new Location($lat, $lng); $relevance5->setRelevantText($task9->getCouponRelevanceLocationTextFive()); $pass->addLocation($relevance5); } if ($task9->getCouponRelevanceLocationAddressSix()) { $lat = $task9->getCouponRelevanceLocationAddressSixLatitude(); $lng = $task9->getCouponRelevanceLocationAddressSixLongitude(); $relevance6 = new Location($lat, $lng); $relevance6->setRelevantText($task9->getCouponRelevanceLocationTextSix()); $pass->addLocation($relevance6); } if ($task9->getCouponRelevanceLocationAddressSeven()) { $lat = $task9->getCouponRelevanceLocationAddressSevenLatitude(); $lng = $task9->getCouponRelevanceLocationAddressSevenLongitude(); $relevance7 = new Location($lat, $lng); $relevance7->setRelevantText($task9->getCouponRelevanceLocationTextSeven()); $pass->addLocation($relevance7); } if ($task9->getCouponRelevanceLocationAddressEight()) { $lat = $task9->getCouponRelevanceLocationAddressEightLatitude(); $lng = $task9->getCouponRelevanceLocationAddressEightLongitude(); $relevance8 = new Location($lat, $lng); $relevance8->setRelevantText($task9->getCouponRelevanceLocationTextEight()); $pass->addLocation($relevance8); } if ($task9->getCouponRelevanceLocationAddressNine()) { $lat = $task9->getCouponRelevanceLocationAddressNineLatitude(); $lng = $task9->getCouponRelevanceLocationAddressNineLongitude(); $relevance9 = new Location($lat, $lng); $relevance9->setRelevantText($task9->getCouponRelevanceLocationTextNine()); $pass->addLocation($relevance9); } if ($task9->getCouponRelevanceLocationAddressTen()) { $lat = $task9->getCouponRelevanceLocationAddressTenLatitude(); $lng = $task9->getCouponRelevanceLocationAddressTenLongitude(); $relevance10 = new Location($lat, $lng); $relevance10->setRelevantText($task9->getCouponRelevanceLocationTextTen()); $pass->addLocation($relevance10); } break; } $pass->setRelevantDate($task9->getCouponRelevanceLocationDate()); // Set pass structure $pass->setStructure($structure); // Add barcode switch ($barcodestatus) { case "hide": break; case "show": $barcode = new Barcode($task3->getCouponBarcodeType(), $task3->getCouponAutoGenerateValue(), 'iso-8859-1'); if ($task3->getBarcodeAlternateText() == 'same') { $barcode->setAltText($task3->getCouponAutoGenerateValue()); } else { //if($task3->getBarcodeAlternateTextValue()){ $barcode->setAltText($task3->getBarcodeAlternateTextValue()); //} } $pass->setBarcode($barcode); break; } //$helper = $this->get('passbook.passhelper'); // Create pass factory instance $factory = new PassFactory('name', 'key', $task1->getOrganizationName(), $root . '/Resources/certificates/certificate_name.p12', '', $root . '/Resources/certificates/apple_certificate.pem'); $factory->setOutputPath($root . '/logs/pkpass'); //$factory->setOutputPath($helper->absolutePath($helper->pkPassDir)); $factory->package($pass); return $id; }
echo "ZIP OK\n"; $listzip = ""; for ($i = 0; $i < $zip->numFiles; $i++) { $listzip = $listzip . ($zip->getNameIndex($i) . "\n"); } file_put_contents($tmp_folder . $newpmazipfilename . ".filelist.log", $listzip); //log filelist unset($listzip); //clear mem //rename folder $i = 0; while ($item_name = $zip->getNameIndex($i)) { $zip->renameIndex($i, str_replace($newpmaname . "/", "", $item_name)); $i++; } $zip->deleteName($newpmaname . "/"); //delete last empty dir $zip->close(); //synch updated folder structure //extract ZIP $res = $zip->open($tmp_folder . $newpmazipfilename); echo 'Extraction ' . ($zip->extractTo($target_folder) ? "OK\n" : "Error\n"); //modifies archive file modification times $zip->close(); //send mail $mail_body = "PMA auto update executed to target ver " . $version->version . " released on " . $version->date; //mail body $subject = "PMA Update executed to " . $version->version; //subject $header = "From: " . $Name . " <" . $email . ">\r\n"; //optional headerfields
/** * ==================================================================== * REMOVE FILE(S) FROM A ZIP FILE * ==================================================================== * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Parameter | Type | Description * --------- | ----- | ----------------------------------------------- * $files | array | Array of file(s) to be deleted from the ZIP * --------- | ----- | ----------------------------------------------- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * */ public static function deleteFiles($files = array()) { $zip = new ZipArchive(); $files = (array) $files; if (File::exist(self::$open) && $zip->open(self::$open)) { foreach ($files as $file) { if ($zip->locateName($file) !== false) { $zip->deleteName($file); } } $zip->close(); } return new static(); }
function zipCleaner($archive, $file) { $zip = new ZipArchive(); if ($zip->open($archive) === TRUE) { $zip->deleteName($file); $zip->close(); } }
// print_r($vehicle_data); // echo "</pre>"; // exit(); ///////////////////////////////////////////////////////////////////////////////////////////////////// $blank_orig = "blank/statement.docx"; $name = md5(date("F j, Y, g:i:s ")); copy($blank_orig, "blank/tmp/{$name}.docx"); $blank = "blank/tmp/{$name}.docx"; $zip = new ZipArchive(); if (!$zip->open($blank)) { exit('Не удалось открыть бланк заявления'); } $data_xml = $zip->getFromName("word/document.xml"); //Заменяем все найденные переменные в файле на значения $data_xml = str_replace(array_keys($params), array_values($params), $data_xml); $zip->deleteName('word/document.xml'); $zip->addFromString('word/document.xml', $data_xml); $zip->close(); //ОТдаём файл браузеру // заставляем браузер показать окно сохранения файла header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=Заявление.docx'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($blank)); // читаем файл и отправляем его пользователю readfile($blank); unlink($blank);
function installTheme($filePath) { Validation::notEmpty($filePath, 'filePath'); $zip = new \ZipArchive(); $res = $zip->open($filePath); // there was an error with this file upon extraction, so I just deleted it :) $zip->deleteName("."); if ($res === TRUE) { $themePath = $this->getNewThemeFolder(self::FOLDER_UNASSIGNED . '/'); $zip->extractTo(realpath($this->toFullPath($themePath))); $zip->close(); return true; } else { return false; } }
/** * Adds a file to Archive * * @param $file_name string * @param $name_in_archive string * @return bool Add worked or not */ public function add_file($file_name, $name_in_archive = '') { $file_name = trim($file_name); //check param if (empty($file_name)) { trigger_error(__('File name cannot be empty', 'backwpup'), E_USER_WARNING); return FALSE; } if (version_compare(PHP_VERSION, '5.3', '>=')) { clearstatcache(TRUE, $file_name); } if (!is_readable($file_name)) { trigger_error(sprintf(_x('File %s does not exist or is not readable', 'File to add to archive', 'backwpup'), $file_name), E_USER_WARNING); return TRUE; } if (empty($name_in_archive)) { $name_in_archive = $file_name; } //remove reserved chars $name_in_archive = str_replace(array("?", "<", ">", ":", "%", "\"", "*", "|", chr(0)), '', $name_in_archive); switch ($this->get_method()) { case 'gz': if ($this->file_count > 0) { trigger_error(__('This archive method can only add one file', 'backwpup'), E_USER_WARNING); return FALSE; } //add file to archive if (!($fd = fopen($file_name, 'rb'))) { trigger_error(sprintf(__('Cannot open source file %s to archive', 'backwpup'), $file_name), E_USER_WARNING); return FALSE; } while (!feof($fd)) { fwrite($this->filehandel, fread($fd, 8192)); } fclose($fd); $this->file_count++; break; case 'bz': if ($this->file_count > 0) { trigger_error(__('This archive method can only add one file', 'backwpup'), E_USER_WARNING); return FALSE; } //add file to archive if (!($fd = fopen($file_name, 'rb'))) { trigger_error(sprintf(__('Cannot open source file %s to archive', 'backwpup'), $file_name), E_USER_WARNING); return FALSE; } while (!feof($fd)) { fwrite($this->filehandel, bzcompress(fread($fd, 8192))); } fclose($fd); $this->file_count++; break; case 'Tar': case 'TarGz': case 'TarBz2': //convert chars for archives file names if (function_exists('iconv') && stristr(PHP_OS, 'win') !== false) { $test = @iconv('ISO-8859-1', 'UTF-8', $name_in_archive); if ($test) { $name_in_archive = $test; } } return $this->tar_file($file_name, $name_in_archive); break; case 'ZipArchive': //convert chars for archives file names if (function_exists('iconv') && stristr(PHP_OS, 'win') === false) { $test = @iconv('UTF-8', 'CP437', $name_in_archive); if ($test) { $name_in_archive = $test; } } $file_size = filesize($file_name); if ($file_size === FALSE) { return FALSE; } //check if entry already in archive and delete it if it not in full size if ($zip_file_stat = $this->ziparchive->statName($name_in_archive)) { if ($zip_file_stat['size'] != $file_size) { $this->ziparchive->deleteName($name_in_archive); //reopen on deletion $this->file_count = 21; } else { //file already complete in archive return TRUE; } } //close and reopen, all added files are open on fs if ($this->file_count > 20) { //35 works with PHP 5.2.4 on win if (!$this->ziparchive->close()) { $this->ziparchive_status(); trigger_error(__('ZIP archive cannot be closed correctly', 'backwpup'), E_USER_ERROR); sleep(1); } $this->ziparchive = NULL; if (!$this->check_archive_filesize()) { return FALSE; } $this->ziparchive = new ZipArchive(); $ziparchive_open = $this->ziparchive->open($this->file, ZipArchive::CREATE); if ($ziparchive_open !== TRUE) { $this->ziparchive_status(); return FALSE; } $this->file_count = 0; } if ($file_size < 1024 * 1024 * 2) { if (!$this->ziparchive->addFromString($name_in_archive, file_get_contents($file_name))) { $this->ziparchive_status(); trigger_error(sprintf(__('Cannot add "%s" to zip archive!', 'backwpup'), $name_in_archive), E_USER_ERROR); return FALSE; } else { $file_factor = round($file_size / (1024 * 1024), 4) * 2; $this->file_count = $this->file_count + $file_factor; } } else { if (!$this->ziparchive->addFile($file_name, $name_in_archive)) { $this->ziparchive_status(); trigger_error(sprintf(__('Cannot add "%s" to zip archive!', 'backwpup'), $name_in_archive), E_USER_ERROR); return FALSE; } else { $this->file_count++; } } break; case 'PclZip': $this->pclzip_file_list[] = array(PCLZIP_ATT_FILE_NAME => $file_name, PCLZIP_ATT_FILE_NEW_FULL_NAME => $name_in_archive); if (count($this->pclzip_file_list) >= 100) { if (0 == $this->pclzip->add($this->pclzip_file_list)) { trigger_error(sprintf(__('PclZip archive add error: %s', 'backwpup'), $this->pclzip->errorInfo(TRUE)), E_USER_ERROR); return FALSE; } $this->pclzip_file_list = array(); } break; } return TRUE; }
$filePath = $file->getRealPath(); $temp = explode("/", $name); array_shift($temp); $newName = implode("/", $temp); // Add current file to archive $zip->addFile($filePath, $newName); } } } $skeleton1 = file_get_contents('elements/sk1.html'); $skeleton2 = file_get_contents('elements/sk2.html'); $skeleton3 = file_get_contents('elements/sk3.html'); foreach ($_POST['pages'] as $page => $content) { $t_seo = json_decode($_POST['seo'][$page]); $seo_tags = '<title>' . $t_seo[0] . '</title>' . "\n" . '<meta name="description" content="' . $t_seo[1] . '">' . "\n" . '<meta name="keywords" content="' . $t_seo[2] . '">' . "\n" . $t_seo[3]; $new_content = $skeleton1 . $seo_tags . $skeleton2 . stripslashes($content) . $skeleton3; //$zip->addFromString($page.".html", $_POST['doctype']."\n".stripslashes($new_content)); $zip->addFromString($page . ".html", stripslashes($new_content)); } $zip->deleteName('pix_mail\\config.php'); $zip->addFromString("pix_mail/config.php", $pixfort_mail); $zip->close(); $yourfile = $filename; $file_name = basename($yourfile); header("Content-Type: application/zip"); header("Content-Transfer-Encoding: Binary"); header("Content-Disposition: attachment; filename={$file_name}"); header("Content-Length: " . filesize($yourfile)); readfile($yourfile); unlink('website.zip'); exit;
function processOdtTemplate($template) { $zipFile = fopen("zipFile.odt", "w"); fwrite($zipFile, $template, strlen($template)); fclose($zipFile); $zip = new ZipArchive(); if ($zip->open('zipFile.odt') !== TRUE) { throw new Exception("Template isn't a .odt file"); } $data = $zip->getFromName('content.xml'); if ($data == '') { throw new Exception("Template doesn't contain content.xml"); } $expanded = $this->expandTemplate($data); $zip->deleteName('content.xml'); $zip->addFromString('content.xml', $expanded); $zip->close(); $newData = file_get_contents("zipFile.odt"); return $newData; }
<?php $expect = array("mimetype", "Configurations2/statusbar/", "Configurations2/accelerator/current.xml", "Configurations2/floater/", "Configurations2/popupmenu/", "Configurations2/progressbar/", "Configurations2/menubar/", "Configurations2/toolbar/", "Configurations2/images/Bitmaps/", "content.xml", "styles.xml", "meta.xml", "Thumbnails/thumbnail.png", "settings.xml", "META-INF/manifest.xml"); $dirname = dirname(__FILE__) . '/'; include $dirname . 'utils.inc'; $file = $dirname . '__tmp_bug7658.odt'; $zip = new ZipArchive(); copy($dirname . 'bug7658.odt', $file); if (!$zip->open($file)) { echo 'failed'; } $zip->deleteName('content.xml'); $zip->addFile($dirname . "bug7658.xml", "content.xml"); $zip->close(); echo "\n"; $zip->open($file); for ($i = 0; $i < $zip->numFiles; $i++) { $sb = $zip->statIndex($i); $found[] = $sb['name']; } $ar = array_diff($found, $expect); var_dump($ar); unset($zip); unlink($file);
/** * Replace image by $path/$imageName * @param string $path * @param string $imageName */ public function replaceImage($path, $imageName) { $this->_objZip->deleteName('word/media/' . $imageName); $this->_objZip->addFile($path, 'word/media/' . $imageName); }
function del_file($mod, $fname) { $module = $this->get($mod); if (!isset($module['files'][$fname])) { throw new Exception('Файла нет в модуле'); } //Удаляем запись из базы $res = $this->db->prepare("DELETE FROM modules_files WHERE module=? AND fname=?;"); $res->execute(array($module['id'], $fname)); //Удаляем файл из архива $zip = new ZipArchive(); if ($zip->open($this->modules_dir . '/' . $mod) !== true) { throw new Exception('Ошибка открытия файла модуля'); } $res = $zip->deleteName($fname); $zip->close(); return $res; }
public function create() { //existing archive if ($this->objZip && $this->objZip->numFiles > 0) { $tmpExisting = $this->pfh->FilePath(md5(generateRandomBytes()) . '.zip', 'tmp'); //Move archive to temp folder $this->pfh->copy($this->zipfile, $tmpExisting); //open existing zip $objZip = new ZipArchive(); $resZip = $objZip->open($tmpExisting); if ($resZip) { if (is_array($this->files['add'])) { foreach ($this->files['add'] as $key => $value) { if (is_file($value)) { $blnResult = $objZip->addFile($value, $key); if (!$blnResult) { return false; } } } } if (is_array($this->files['delete'])) { foreach ($this->files['delete'] as $key => $value) { $blnResult = $objZip->deleteName($value, $key); //if (!$blnResult) return false; } } $this->objZip->close(); $objZip->close(); $this->pfh->FileMove($tmpExisting, $this->zipfile); return true; } else { return false; } } else { $strTempArchiv = $this->pfh->FilePath(md5(generateRandomBytes()) . '.zip', 'tmp'); //Create new archive $blnOpen = $this->objZip->open($strTempArchiv, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE); if ($blnOpen) { foreach ($this->files['add'] as $key => $value) { if (is_file($value)) { $blnResult = $this->objZip->addFile($value, $key); if (!$blnResult) { return false; } } } $this->objZip->close(); $this->pfh->FileMove($strTempArchiv, $this->zipfile); return true; } else { $this->objZip = false; return false; } } }
/** * Signs and packs a PKPass directory * * @param string $passPath The starting pass directory * @param string $certPath Path to the developer's certificate in .pem format * @param string $certPassword Password for the certificate * @param string $outputPath Path of the .pkpass output file * @param boolean $zip Create ZIP/PKPass package * @return void * @throws exception */ public static function signPass($passPath, $certPath, $certPassword, $outputPath, $zip = true) { self::checkAppleCertificate(); // Validate that requested contents are not a signed // and expanded pass archive. self::validateDirectoryAsUnsignedRawPass($passPath); // Get a temporary place to stash the pass contents $tempDir = sys_get_temp_dir() . '/' . pathinfo($passPath, PATHINFO_BASENAME); // Try to delete if already exists if (file_exists($tempDir) && is_dir($tempDir)) { if (!self::rrmdir($tempDir)) { throw new \Exception("Unable to remove temporary directory '{$tempDir}'", 502); } } // Make a copy of the pass contents to the temporary folder self::rcopy($passPath, $tempDir); // Clean out the unneeded .DS_Store files if ($junks = glob($tempDir . '*/.DS_Store')) { foreach ($junks as $j) { unlink($j); } } // Build the json manifest $manifestData = array(); $files = new \DirectoryIterator($passPath); foreach ($files as $file) { // Ignore unwanted files if (in_array($file, array('.', '..', '.DS_Store'))) { continue; } $key = trim(str_replace($passPath, '', $file->getPathName()), '/'); $manifestData[$key] = sha1_file($file->getPathName()); } // Write the manifest.json file $manifestPath = $tempDir . '/manifest.json'; if (!file_put_contents($manifestPath, json_encode($manifestData))) { throw new \Exception("Unable to write file '{$manifestPath}'", 511); } // Sign the manifest $signaturePath = $tempDir . '/signature'; // We cannot use openssl_pkcs7_sign() because the binary output feature // doesn't work and is not valid for Apple verify script // Sign using openssl shell command $signCommand = sprintf('openssl smime -binary -sign -certfile "%s" -signer "%s" -inkey "%s" -in "%s" -out "%s" -outform DER -passin pass:%s', APPLE_CERTIFICATE, $certPath, $certPath, $manifestPath, $signaturePath, $certPassword); $signResult = false; $signOut = array(); // needed but unused exec($signCommand, $signOut, $signResult); unset($signOut); if (0 !== $signResult) { throw new \Exception("Unable to sign manifest file '{$manifestPath}'", 511); } // Package pass if ($zip === true) { $zip = new \ZipArchive(); $zipFile = $outputPath; if ($zip->open($zipFile, \ZipArchive::CREATE) != true) { throw new \Exception("Unable open archive '{$zipFile}'"); } $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($tempDir)); $excludes = array('.DS_Store', '.', '..'); foreach ($files as $file) { if (in_array(basename($file), $excludes)) { continue; } if (is_dir($file)) { $zip->addEmptyDir(str_replace("{$tempDir}/", '', "{$file}/")); } elseif (is_file($file)) { $zip->addFromString(str_replace("{$tempDir}/", '', $file), file_get_contents($file)); } } // Search for residual .DS_Store files $zip->deleteName('.DS_Store'); $zip->close(); } else { if (!mkdir($outputPath)) { throw new \Exception("Unable to create output directory '{$outputPath}'", 512); } // The output pass is a directory self::rcopy($tempDir, $outputPath); } // Clean up the temp directory if (!self::rrmdir($tempDir)) { throw new \Exception("Unable to cleanup temporary directory '{$tempDir}'", 502); } }