Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 17
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Jingga
4 *
5 * PHP Version 8.1
6 *
7 * @package   Modules\Admin
8 * @copyright Dennis Eichhorn
9 * @license   OMS License 2.0
10 * @version   1.0.0
11 * @link      https://jingga.app
12 */
13declare(strict_types=1);
14
15require_once __DIR__ . '/../phpOMS/Autoloader.php';
16
17use phpOMS\Autoloader;
18
19Autoloader::addPath(__DIR__ . '/../Resources');
20
21/** @var \phpOMS\Views\View $this */
22/** @var \Modules\Media\Models\Collection $media */
23$media = $this->data['media'];
24
25/** @var array $data */
26$data = $this->data['data'] ?? [];
27
28include $media->getSourceByName('template.php')->getAbsolutePath();
29
30$word    = new DefaultWord();
31$section = $word->createFirstPage();
32
33$file = \tempnam(\sys_get_temp_dir(), 'oms_');
34if ($file === false) {
35    return;
36}
37
38$writer = \PhpOffice\PhpWord\IOFactory::createWriter($word, 'Word2007');
39$writer->save($file);
40
41if ($file !== false) {
42    $content = \file_get_contents($file);
43    if ($content !== false) {
44        echo $content;
45    }
46
47    \unlink($file);
48}