Quellcode durchsuchen

gitflow-hotfix-stash: structure_sql2

Maha Bouchiba vor 2 Jahren
Ursprung
Commit
d8aca6a38a

+ 10 - 0
sql/schema-extensions/002-view_federation_structures.sql

@@ -12,6 +12,7 @@ AS
                AS practices,
            oar.articles, n1.parent_id as parentId, net1.name as parentName,
            CONCAT_WS(',', n1.parent_id, n2.parent_id, n3.parent_id, n4.parent_id, n5.parent_id) as parents
+<<<<<<< Updated upstream
     FROM opentalent.Organization o
              INNER JOIN opentalent.Parameters p on o.parameters_id = p.id
              LEFT JOIN opentalent.OrganizationAddressPostal oa on oa.organization_id = o.id
@@ -19,6 +20,15 @@ AS
              LEFT JOIN opentalent.Country c ON (c.id = a.addressCountry_id)
              LEFT JOIN opentalent.organization_contactpoint ocp ON ocp.organization_id = o.id
              INNER JOIN (SELECT * FROM opentalent.ContactPoint WHERE `contactType`='PRINCIPAL') cp ON cp.id = ocp.contactPoint_id
+=======
+    FROM Organization o
+             INNER JOIN Parameters p on o.parameters_id = p.id
+             LEFT JOIN OrganizationAddressPostal oa on oa.organization_id = o.id
+             LEFT JOIN AddressPostal a on oa.addressPostal_id = a.id
+             LEFT JOIN Country c ON (c.id = a.addressCountry_id)
+             LEFT JOIN organization_contactpoint ocp ON ocp.organization_id = o.id
+             LEFT JOIN (SELECT * FROM ContactPoint WHERE `contactType`='PRINCIPAL') cp ON cp.id = ocp.contactPoint_id
+>>>>>>> Stashed changes
              LEFT JOIN (
                 SELECT oar_.organization_id, CONCAT('[', GROUP_CONCAT(COLUMN_JSON(COLUMN_CREATE('id', oar_.id, 'title', oar_.title, 'date', DATE_FORMAT(oar_.date, '%Y-%m-%dT%TZ'), 'link', oar_.link))), ']') as articles
                 FROM (SELECT * FROM OrganizationArticle WHERE link is not null and link != '' ORDER BY date DESC) as oar_

+ 39 - 0
src/Service/Export/Encoder/DocXEncoder.php

@@ -0,0 +1,39 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Service\Export\Encoder;
+
+use Phpdocx\Create\CreateDocx;
+use App\Enum\Export\ExportFormatEnum;
+
+/**
+ * Encode HTML to docx format
+ */
+class DocXEncoder implements EncoderInterface
+{
+
+  public function support(string $format): bool
+  {
+    return $format === ExportFormatEnum::DOCX()->getValue();
+  }
+
+  /**
+   * Encode the given HTML content into docX, and
+   * return the encoded content
+   *
+   * @param string $html
+   * @param array<mixed> $options
+   * @return string
+   */
+  public function encode(string $html, array $options = []): string
+  {
+    $docx = new CreateDocx();
+    $docx->embedHTML($html);    
+    $tempFile = tempnam(sys_get_temp_dir(), 'docx');
+    $docx->createDocx($tempFile);
+    $content = file_get_contents($tempFile);
+    unlink($tempFile);
+    return $content;
+  }
+}