src/Controller/ReportController.php line 44

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Correction;
  4. use App\Entity\Compilation;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use DateTime;
  7. class ReportController extends BeehiveController{
  8.   const ALLGEMEINES      0;
  9.   const NACH_ALLGEMEINES 1;
  10.   const ALEX             25000;
  11.   const NACH_ALEX        25001;
  12.   const LOND             580000;
  13.   const LOND1            580000;
  14.   const LOND2            581000;
  15.   const LOND3            582000;
  16.   const NACH_LOND        582001;
  17.   const TAIT             1250000;
  18.   const NACH_TAIT        1250001;
  19.   public function leiden($compilationVolume 13): Response {
  20.     $entityManager $this->getDoctrine()->getManager();
  21.     $repository $entityManager->getRepository(Correction::class);
  22.     $query $entityManager->createQuery('
  23.       SELECT e, c, t FROM App\Entity\Correction c
  24.       LEFT JOIN c.tasks t JOIN c.edition e JOIN c.compilation c2 WHERE c2.volume = :compilationVolume ORDER BY e.sort, c.sort'
  25.     );
  26.     $query->setParameters(array('compilationVolume' => $compilationVolume));
  27.     $corrections $query->getResult();
  28.     $compilation = new Compilation();
  29.     if(count($corrections)){
  30.       $compilation current($corrections)->getCompilation();
  31.     }
  32.     return $this->render('report/leiden.html.twig', ['compilation' => $compilation'corrections' => $corrections]);
  33.   }
  34.   public function overview($compilationVolume 13): Response {
  35.     return $this->render('report/overview.html.twig'$this->getData($compilationVolume));
  36.   }
  37.   public function print($compilationVolume 13$editionId): Response {
  38.     return $this->render('report/print.html.twig'$this->getData($compilationVolume$editionId));
  39.   }
  40.   public function pdf($compilationVolume 13$editionId): Response {
  41.     $data $this->getData($compilationVolume$editionId);
  42.     $xml $this->getXml($data);
  43.     $oo file_get_contents($this->get('kernel')->getRootDir() . '/../src/Papyrillio/BeehiveBundle/Resources/print/content_null.xml');
  44.     foreach($xml as $key => $xmlSnippet){
  45.       $oo str_replace('<!--' $key '-->'$xmlSnippet$oo);
  46.     }
  47.     file_put_contents($this->get('kernel')->getRootDir() . '/../src/Papyrillio/BeehiveBundle/Resources/print/content.xml'$oo);
  48.     if(0){
  49.     exec('cd /Users/Admin/beehive.dev/src/Papyrillio/BeehiveBundle/Resources/print/ && zip bl.odt content.xml');
  50.     $response = new Response(file_get_contents($this->get('kernel')->getRootDir() . '/../src/Papyrillio/BeehiveBundle/Resources/print/bl.odt'));
  51.     $response->headers->set('Content-Type''application/vnd.oasis.opendocument.text');
  52.     } else {
  53.     $response = new Response(file_get_contents($this->get('kernel')->getRootDir() . '/../src/Papyrillio/BeehiveBundle/Resources/print/content.xml'));
  54.     $response->headers->set('Content-Type''text/xml');
  55.     }
  56.     return $response;
  57.   }
  58.   protected function getXml(Array $data){
  59.     $xml = array();
  60.     foreach($data['editions'] as $editionSort => $corrections){
  61.       $edition $corrections[0]->getEdition();
  62.       $xml[$edition->getCodeTitle()] = '';
  63.       foreach($corrections as $correction){
  64.        $xml[$edition->getCodeTitle()] .= self::getTableRow($correction);
  65.       }
  66.     }
  67.     return $xml;
  68.   }
  69.   protected function getXml2(Array $data){
  70.     $xmlStyle '';
  71.     $xmlTables '';
  72.     foreach($data['editions'] as $editionSort => $corrections){
  73.       //echo 'editionSort: '. $editionSort . ' - ' . $xmlPointer . "\n";
  74.       $edition $corrections[0]->getEdition();
  75.       $xmlStyle .= self::getStyle($edition);
  76.       $xmlTables .= self::getHeader($edition);
  77.       $xmlTables .= self::getTableStart($edition);
  78.       foreach($corrections as $correction){
  79.         $xmlTables .= self::getTableRow($correction);
  80.       }
  81.       $xmlTables .= self::getTableEnd($edition);
  82.     }
  83.     return array('BL' => $xmlTables'BLSTYLE' => $xmlStyle);
  84.   }
  85.   protected function getXml1(Array $data){
  86.     $xml = array(
  87.       self::ALLGEMEINES => '',
  88.       self::NACH_ALLGEMEINES => '',
  89.       self::ALEX => '',
  90.       self::NACH_ALEX => '',
  91.       self::LOND => '',
  92.       self::NACH_LOND => '',
  93.       self::TAIT => '',
  94.       self::NACH_TAIT => '' );
  95.     $xmlPointer self::ALLGEMEINES;
  96.     foreach($data['editions'] as $editionSort => $corrections){
  97.       if($editionSort === self::ALLGEMEINES){
  98.         $xmlPointer self::ALLGEMEINES;
  99.       } else if ($editionSort self::ALLGEMEINES && $editionSort self::ALEX) {
  100.         $xmlPointer self::NACH_ALLGEMEINES;
  101.       } else if($editionSort === self::ALEX){
  102.         $xmlPointer self::ALEX;
  103.       } else if ($editionSort self::ALEX && $editionSort self::LOND) {
  104.         $xmlPointer self::NACH_ALEX;
  105.       } else if($editionSort >= self::LOND && $editionSort self::NACH_LOND){
  106.         $xmlPointer self::LOND;
  107.       } else if ($editionSort >= self::NACH_LOND && $editionSort self::TAIT) {
  108.         $xmlPointer self::NACH_LOND;
  109.       } else if($editionSort === self::TAIT){
  110.         $xmlPointer self::TAIT;
  111.       } else if ($editionSort self::TAIT) {
  112.         $xmlPointer self::NACH_TAIT;
  113.       }
  114.       //echo 'editionSort: '. $editionSort . ' - ' . $xmlPointer . "\n";
  115.       $edition $corrections[0]->getEdition();
  116.       $xml[$xmlPointer] .= self::getTableHeader($edition);
  117.       foreach($corrections as $correction){
  118.         $xml[$xmlPointer] .= self::getTableContent($correction);
  119.       }
  120.     }
  121.     return $xml;
  122.   }
  123.   protected static function getStyle($edition){
  124.     $code $edition->getCodeTitle();
  125.     if($edition->getSort() === self::ALLGEMEINES){
  126.       return '';
  127.     } else if(in_array($edition->getSort(), array(self::ALEXself::LOND1self::LOND2self::LOND3self::TAIT))){
  128.       return '<style:style style:name="' $code '" style:family="table">
  129.             <style:table-properties style:width="11.7cm" table:align="margins"/>
  130.         </style:style>
  131.         <style:style style:name="' $code '.A" style:family="table-column">
  132.             <style:table-column-properties style:column-width="1.328cm" style:rel-column-width="7439*"/>
  133.         </style:style>
  134.         <style:style style:name="' $code '.B" style:family="table-column">
  135.             <style:table-column-properties style:column-width="1.782cm" style:rel-column-width="9978*"/>
  136.         </style:style>
  137.         <style:style style:name="' $code '.C" style:family="table-column">
  138.             <style:table-column-properties style:column-width="0.921cm" style:rel-column-width="5157*"/>
  139.         </style:style>
  140.         <style:style style:name="' $code '.D" style:family="table-column">
  141.             <style:table-column-properties style:column-width="7.669cm" style:rel-column-width="42961*"/>
  142.         </style:style>
  143.         <style:style style:name="' $code '.1" style:family="table-row">
  144.             <style:table-row-properties fo:keep-together="always"/>
  145.         </style:style>
  146.         <style:style style:name="' $code '.A1" style:family="table-cell">
  147.             <style:table-cell-properties fo:padding-left="0.101cm" fo:padding-right="0.101cm" fo:padding-top="0.097cm" fo:padding-bottom="0.097cm" fo:border-left="none" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="none"/>
  148.         </style:style>
  149.         <style:style style:name="' $code '.B1" style:family="table-cell">
  150.             <style:table-cell-properties fo:padding-left="0.101cm" fo:padding-right="0.101cm" fo:padding-top="0cm" fo:padding-bottom="0cm" fo:border="none"/>
  151.         </style:style>
  152.         <style:style style:name="' $code '.D1" style:family="table-cell">
  153.             <style:table-cell-properties fo:padding-left="0.101cm" fo:padding-right="0.101cm" fo:padding-top="0cm" fo:padding-bottom="0cm" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="none"/>
  154.         </style:style>';
  155.     } else {
  156.       return '<style:style style:name="' $code '" style:family="table">
  157.             <style:table-properties style:width="11.7cm" table:align="margins"/>
  158.         </style:style>
  159.         <style:style style:name="' $code '.A" style:family="table-column">
  160.             <style:table-column-properties style:column-width="1.499cm" style:rel-column-width="8398*"/>
  161.         </style:style>
  162.         <style:style style:name="' $code '.B" style:family="table-column">
  163.             <style:table-column-properties style:column-width="1.55cm" style:rel-column-width="8684*"/>
  164.         </style:style>
  165.         <style:style style:name="' $code '.C" style:family="table-column">
  166.             <style:table-column-properties style:column-width="8.65cm" style:rel-column-width="48453*"/>
  167.         </style:style>
  168.         <style:style style:name="' $code '.1" style:family="table-row">
  169.             <style:table-row-properties fo:keep-together="always"/>
  170.         </style:style>
  171.         <style:style style:name="' $code '.A1" style:family="table-cell">
  172.             <style:table-cell-properties fo:padding-left="0.101cm" fo:padding-right="0.101cm" fo:padding-top="0cm" fo:padding-bottom="0cm" fo:border="none"/>
  173.         </style:style>
  174.         <style:style style:name="' $code '.C1" style:family="table-cell">
  175.             <style:table-cell-properties fo:padding-left="0.101cm" fo:padding-right="0.101cm" fo:padding-top="0cm" fo:padding-bottom="0cm" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="none"/>
  176.         </style:style>';
  177.     }
  178.   }
  179.   protected static function getHeader($edition){
  180.     if($edition->getSort() === self::ALLGEMEINES){
  181.         return '';
  182.     }
  183.     return '<text:h text:style-name="Heading_20_1" text:outline-level="1">' $edition->getTitle() . '</text:h>';
  184.   }
  185.   protected static function getTableStart($edition){
  186.     if($edition->getSort() === self::ALLGEMEINES){
  187.       return '<table:table table:name="Allgemeines" table:style-name="Allgemeines">
  188.                 <table:table-column table:style-name="Allgemeines.A"/>
  189.                 <table:table-column table:style-name="Allgemeines.B"/>';
  190.     } else if(in_array($edition->getSort(), array(self::ALEXself::LOND1self::LOND2self::LOND3self::TAIT))){
  191.       return '<table:table table:name="' $edition->getCodeTitle() .  '" table:style-name="' $edition->getCodeTitle() .  '">
  192.                 <table:table-column table:style-name="' $edition->getCodeTitle() .  '.A"/>
  193.                 <table:table-column table:style-name="' $edition->getCodeTitle() .  '.B"/>
  194.                 <table:table-column table:style-name="' $edition->getCodeTitle() .  '.C"/>
  195.                 <table:table-column table:style-name="' $edition->getCodeTitle() .  '.D"/>';
  196.     } else {
  197.       return '<table:table table:name="' $edition->getCodeTitle() .  '" table:style-name="' $edition->getCodeTitle() .  '">
  198.                 <table:table-column table:style-name="' $edition->getCodeTitle() .  '.A"/>
  199.                 <table:table-column table:style-name="' $edition->getCodeTitle() .  '.B"/>
  200.                 <table:table-column table:style-name="' $edition->getCodeTitle() .  '.C"/>';
  201.     }
  202.   }
  203.   protected static function getTableEnd($edition){
  204.     return '</table:table>';
  205.   }
  206.   protected static function getTableRow($correction){
  207.     $code $correction->getEdition()->getCodeTitle();
  208.     if($correction->getEdition()->getSort() === self::ALLGEMEINES){
  209.       return '<table:table-row table:style-name="Allgemeines.1">
  210.                     <table:table-cell table:style-name="Allgemeines.A1" office:value-type="string">
  211.                         <text:p text:style-name="blTableContentLine">' $correction->getText() . '</text:p>
  212.                     </table:table-cell>
  213.                     <table:table-cell table:style-name="Allgemeines.B1" office:value-type="string">
  214.                         <text:p text:style-name="blTableContentCorrection"><text:bookmark-start text:name="correction' $correction->getId() . '"/>' $correction->getDescription(Correction::MODE_OOXML) . '<text:bookmark-end text:name="correction' $correction->getId() . '"/></text:p>
  215.                     </table:table-cell>
  216.                 </table:table-row>';
  217.     } else if(in_array($correction->getEdition()->getSort(), array(self::ALEXself::LOND1self::LOND2self::LOND3self::TAIT))){
  218.       $blTableContentNumber $blTableContentNumber $correction->getSortText();
  219.       if($correction->getEdition()->getSort() === self::ALEX) {
  220.         $blTableContentNumber '<text:span text:style-name="T3">' . ($correction->getInventoryNumber() ? 'Inv. ' '') . '</text:span>' . ($correction->getInventoryNumber() ? $correction->getInventoryNumber() : $correction->getText());
  221.       }
  222.       return '<table:table-row table:style-name="' $code '.1">
  223.                     <table:table-cell table:style-name="' $code '.A1" office:value-type="string">
  224.                         <text:p text:style-name="blTableContentPage">' . ($correction->getPage() ? 'S. ' $correction->getPage() : '') . '</text:p>
  225.                     </table:table-cell>
  226.                     <table:table-cell table:style-name="' $code '.B1" office:value-type="string">
  227.                         <text:p text:style-name="blTableContentNumber">' $blTableContentNumber '</text:p>
  228.                     </table:table-cell>
  229.                     <table:table-cell table:style-name="' $code '.B1" office:value-type="string">
  230.                         <text:p text:style-name="blTableContentLine">' $correction->getPosition() . '</text:p>
  231.                     </table:table-cell>
  232.                     <table:table-cell table:style-name="' $code '.D1" office:value-type="string">
  233.                         <text:p text:style-name="blTableContentCorrection"><text:bookmark-start text:name="correction' $correction->getId() . '"/>' $correction->getDescription(Correction::MODE_OOXML) . '<text:bookmark-end text:name="correction' $correction->getId() . '"/></text:p>
  234.                     </table:table-cell>
  235.                 </table:table-row>';
  236.     } else {
  237.       return '<table:table-row table:style-name="' $code '.1">
  238.                     <table:table-cell table:style-name="' $code '.A1" office:value-type="string">
  239.                         <text:p text:style-name="blTableContentNumber">' $correction->getText() . '</text:p>
  240.                     </table:table-cell>
  241.                     <table:table-cell table:style-name="' $code '.A1" office:value-type="string">
  242.                         <text:p text:style-name="blTableContentLine">' $correction->getPosition() . '</text:p>
  243.                     </table:table-cell>
  244.                     <table:table-cell table:style-name="' $code '.C1" office:value-type="string">
  245.                         <text:p text:style-name="blTableContentCorrection"><text:bookmark-start text:name="correction' $correction->getId() . '"/>' $correction->getDescription(Correction::MODE_OOXML) . '<text:bookmark-end text:name="correction' $correction->getId() . '"/></text:p>
  246.                     </table:table-cell>
  247.                 </table:table-row>';
  248.     }
  249.  
  250.     return '';
  251.   }
  252.   protected static function getTableHeader($edition){
  253.     if(!in_array($edition->getSort(), array(self::ALLGEMEINESself::ALEXself::TAIT))){
  254.       if($edition->getSort() >= self::LOND && $edition->getSort() < self::NACH_LOND){
  255.         return '<table:table-row table:style-name="Lond.1">
  256.                   <table:table-cell table:style-name="Lond.A1" office:value-type="string">
  257.                       <text:p text:style-name="blTableContentPage"/>
  258.                   </table:table-cell>
  259.                   <table:table-cell table:style-name="Lond.A1" office:value-type="string">
  260.                       <text:p text:style-name="blTableContentNumber"/>
  261.                   </table:table-cell>
  262.                   <table:table-cell table:style-name="Lond.A1" office:value-type="string">
  263.                       <text:p text:style-name="blTableContentLine"/>
  264.                   </table:table-cell>
  265.                   <table:table-cell table:style-name="Lond.A1" office:value-type="string">
  266.                       <text:h text:style-name="Heading_20_1" text:outline-level="1">' $edition->getTitle() . '</text:h>
  267.                   </table:table-cell>
  268.               </table:table-row>';
  269.       } else {
  270.         return '<table:table-row table:style-name="NachAllgemeines.1">
  271.                   <table:table-cell table:style-name="NachAllgemeines.A1" office:value-type="string">
  272.                       <text:p text:style-name="blTableContentNumber"/>
  273.                   </table:table-cell>
  274.                   <table:table-cell table:style-name="NachAllgemeines.A1" office:value-type="string">
  275.                       <text:p text:style-name="blTableContentLine"/>
  276.                   </table:table-cell>
  277.                   <table:table-cell table:style-name="NachAllgemeines.A1" office:value-type="string">
  278.                       <text:h text:style-name="Heading_20_1" text:outline-level="1">' $edition->getTitle() . '</text:h>
  279.                   </table:table-cell>
  280.               </table:table-row>';
  281.       }
  282.     }
  283.     return '';
  284.   }
  285.   protected static function getTableContent($correction){
  286.     if($correction->getEdition()->getSort() === self::ALLGEMEINES){
  287.       return '<table:table-row table:style-name="Allgemeines.1">
  288.                     <table:table-cell table:style-name="Allgemeines.A1" office:value-type="string">
  289.                         <text:p text:style-name="blTableContentLine">' $correction->getText() . '</text:p>
  290.                     </table:table-cell>
  291.                     <table:table-cell table:style-name="Allgemeines.B2" office:value-type="string">
  292.                         <text:p text:style-name="blTableContentCorrection">' $correction->getDescription(Correction::MODE_OOXML) . '</text:p>
  293.                     </table:table-cell>
  294.                 </table:table-row>';
  295.     } else if($correction->getEdition()->getSort() > self::ALLGEMEINES && $correction->getEdition()->getSort() < self::ALEX) {
  296.       return '<table:table-row table:style-name="NachAllgemeines.1">
  297.                     <table:table-cell table:style-name="NachAllgemeines.A1" office:value-type="string">
  298.                         <text:p text:style-name="blTableContentNumber">' $correction->getText() . '</text:p>
  299.                     </table:table-cell>
  300.                     <table:table-cell table:style-name="NachAllgemeines.A1" office:value-type="string">
  301.                         <text:p text:style-name="blTableContentLine">' $correction->getPosition() . '</text:p>
  302.                     </table:table-cell>
  303.                     <table:table-cell table:style-name="NachAllgemeines.C3" office:value-type="string">
  304.                         <text:p text:style-name="blTableContentCorrection">' $correction->getDescription(Correction::MODE_OOXML) . '</text:p>
  305.                     </table:table-cell>
  306.                 </table:table-row>';
  307.     } else if($correction->getEdition()->getSort() === self::ALEX) {
  308.       return '<table:table-row table:style-name="Alex.1">
  309.                     <table:table-cell table:style-name="Alex.A1" office:value-type="string">
  310.                         <text:p text:style-name="blTableContentPage">' . ($correction->getPage() ? 'S. ' $correction->getPage() : '') . '</text:p>
  311.                     </table:table-cell>
  312.                     <table:table-cell table:style-name="Alex.A1" office:value-type="string">
  313.                         <text:p text:style-name="blTableContentNumber"><text:span text:style-name="T3">' . ($correction->getInventoryNumber() ? 'Inv. ' '') . '</text:span>' . ($correction->getInventoryNumber() ? $correction->getInventoryNumber() : $correction->getText()) . '</text:p>
  314.                     </table:table-cell>
  315.                     <table:table-cell table:style-name="Alex.A1" office:value-type="string">
  316.                         <text:p text:style-name="blTableContentLine">' $correction->getPosition() . '</text:p>
  317.                     </table:table-cell>
  318.                     <table:table-cell table:style-name="Alex.D3" office:value-type="string">
  319.                         <text:p text:style-name="blTableContentCorrection">' $correction->getDescription(Correction::MODE_OOXML) . '</text:p>
  320.                     </table:table-cell>
  321.                 </table:table-row>';
  322.     } else if($correction->getEdition()->getSort() > self::ALEX && $correction->getEdition()->getSort() < self::LOND) {
  323.       return '<table:table-row table:style-name="NachAlex.1">
  324.                     <table:table-cell table:style-name="NachAlex.A1" office:value-type="string">
  325.                         <text:p text:style-name="blTableContentNumber">' $correction->getText() . '</text:p>
  326.                     </table:table-cell>
  327.                     <table:table-cell table:style-name="NachAlex.A1" office:value-type="string">
  328.                         <text:p text:style-name="blTableContentLine">' $correction->getPosition() . '</text:p>
  329.                     </table:table-cell>
  330.                     <table:table-cell table:style-name="NachAlex.C3" office:value-type="string">
  331.                         <text:p text:style-name="blTableContentCorrection">' $correction->getDescription(Correction::MODE_OOXML) . '</text:p>
  332.                     </table:table-cell>
  333.                 </table:table-row>';
  334.     } else if($correction->getEdition()->getSort() >= self::LOND && $correction->getEdition()->getSort() < self::NACH_LOND) {
  335.       return '<table:table-row table:style-name="Lond.1">
  336.                     <table:table-cell table:style-name="Lond.A1" office:value-type="string">
  337.                         <text:p text:style-name="blTableContentPage">' . ($correction->getPage() ? 'S. ' $correction->getPage() : '') . '</text:p>
  338.                     </table:table-cell>
  339.                     <table:table-cell table:style-name="Lond.A1" office:value-type="string">
  340.                         <text:p text:style-name="blTableContentNumber">' $correction->getSortText() . '</text:p>
  341.                     </table:table-cell>
  342.                     <table:table-cell table:style-name="Lond.A1" office:value-type="string">
  343.                         <text:p text:style-name="blTableContentLine">' $correction->getPosition() . '</text:p>
  344.                     </table:table-cell>
  345.                     <table:table-cell table:style-name="Lond.D3" office:value-type="string">
  346.                         <text:p text:style-name="blTableContentCorrection">' $correction->getDescription(Correction::MODE_OOXML) . '</text:p>
  347.                     </table:table-cell>
  348.                 </table:table-row>';
  349.     } else if($correction->getEdition()->getSort() >= self::NACH_LOND && $correction->getEdition()->getSort() < self::TAIT) {
  350.       return '<table:table-row table:style-name="NachLond.1">
  351.                     <table:table-cell table:style-name="NachLond.A1" office:value-type="string">
  352.                         <text:p text:style-name="blTableContentNumber">' $correction->getText() . '</text:p>
  353.                     </table:table-cell>
  354.                     <table:table-cell table:style-name="NachLond.A1" office:value-type="string">
  355.                         <text:p text:style-name="blTableContentLine">' $correction->getPosition() . '</text:p>
  356.                     </table:table-cell>
  357.                     <table:table-cell table:style-name="NachLond.C5" office:value-type="string">
  358.                         <text:p text:style-name="blTableContentCorrection">' $correction->getDescription(Correction::MODE_OOXML) . '</text:p>
  359.                     </table:table-cell>
  360.                 </table:table-row>';
  361.     } else if($correction->getEdition()->getSort() === self::TAIT) {
  362.       return '<table:table-row table:style-name="Tait.1">
  363.                     <table:table-cell table:style-name="Tait.A1" office:value-type="string">
  364.                         <text:p text:style-name="blTableContentPage">' . ($correction->getPage() ? 'S. ' $correction->getPage() : '') . '</text:p>
  365.                     </table:table-cell>
  366.                     <table:table-cell table:style-name="Tait.A1" office:value-type="string">
  367.                         <text:p text:style-name="blTableContentNumber">' $correction->getSortText() . '</text:p>
  368.                     </table:table-cell>
  369.                     <table:table-cell table:style-name="Tait.A1" office:value-type="string">
  370.                         <text:p text:style-name="blTableContentLine">' $correction->getPosition() . '</text:p>
  371.                     </table:table-cell>
  372.                     <table:table-cell table:style-name="Tait.D3" office:value-type="string">
  373.                         <text:p text:style-name="blTableContentCorrection">' $correction->getDescription(Correction::MODE_OOXML) . '</text:p>
  374.                     </table:table-cell>
  375.                 </table:table-row>';
  376.     } else if($correction->getEdition()->getSort() > self::TAIT) {
  377.       return '<table:table-row table:style-name="NachTait.1">
  378.                     <table:table-cell table:style-name="NachTait.A1" office:value-type="string">
  379.                         <text:p text:style-name="blTableContentNumber">' $correction->getText() . '</text:p>
  380.                     </table:table-cell>
  381.                     <table:table-cell table:style-name="NachTait.A1" office:value-type="string">
  382.                         <text:p text:style-name="blTableContentLine">' $correction->getPosition() . '</text:p>
  383.                     </table:table-cell>
  384.                     <table:table-cell table:style-name="NachTait.C3" office:value-type="string">
  385.                         <text:p text:style-name="blTableContentCorrection">' $correction->getDescription(Correction::MODE_OOXML) . '</text:p>
  386.                     </table:table-cell>
  387.                 </table:table-row>';
  388.     }
  389.     return '';
  390.   }
  391.   protected function getData($compilationVolume 13$editionId null){
  392.     $entityManager $this->getDoctrine()->getManager();
  393.     $repository $entityManager->getRepository(Correction::class);
  394.     $where 'WHERE c2.volume = :compilationVolume';
  395.     $parameters = array('compilationVolume' => $compilationVolume);
  396.     if($editionId){
  397.       $where .= ' AND e.id = :editionId';
  398.       $parameters['editionId'] = $editionId;
  399.     }
  400.     $query $entityManager->createQuery('
  401.       SELECT e, c, t FROM App\Entity\Correction c
  402.       LEFT JOIN c.tasks t JOIN c.edition e JOIN c.compilation c2 ' $where ' ORDER BY e.sort, c.sort'
  403.     );
  404.     $query->setParameters($parameters);
  405.     //$query->setFirstResult(0)->setMaxResults(100); // cl: DEBUG
  406.     $corrections $query->getResult();
  407.     $compilation = new Compilation();
  408.     if(count($corrections)){
  409.       $compilation current($corrections)->getCompilation();
  410.     } else if ($compilationVolume) {
  411.       $repositoryCompilation $entityManager->getRepository(Compilation::class);
  412.       $compilation $repositoryCompilation->findOneBy(array('volume' => $compilationVolume));
  413.     }
  414.     $correctionsGroupedByEdition = array();
  415.     $currentText '';
  416.     foreach($corrections as $correction){
  417.       if($correction->getText() != $currentText){
  418.         $currentText $correction->getText();
  419.       } else if (isset($correctionsGroupedByEdition[$correction->getEdition()->getId()])){
  420.         $correction->setText('');
  421.       }
  422.       $correctionsGroupedByEdition[$correction->getEdition()->getSort()][] = $correction;
  423.     }
  424.     
  425.     return array('compilation' => $compilation'editions' => $correctionsGroupedByEdition);
  426.   }
  427.   public function leidenSnippet($id): Response {
  428.     $entityManager $this->getDoctrine()->getManager();
  429.     $repository $entityManager->getRepository(Correction::class);
  430.     $corrections $repository->findBy(array('id' => $id));
  431.     return $this->render('report/leidenSnippet.html.twig', ['corrections' => $corrections]);
  432.   }
  433. }