aboutsummaryrefslogtreecommitdiff
path: root/src/View/CalendarBuilder.php
blob: 34b19529f64ec5ac7dfbdc47c2fc9b4d2da96715 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
// src/View/CalendarBuilder.php

declare(strict_types=1);

namespace App\View;

use App\Entity\Node;

class CalendarBuilder extends AbstractBuilder
{
    public function __construct(Node $node)
    {
        parent::__construct($node);
        $viewFile = self::VIEWS_PATH . $node->getName() . '.php';

        $calendar_js_file = IS_ADMIN ? 'calendar_admin' : 'calendar';
        
        if(file_exists($viewFile))
        {
            if(!empty($node->getNodeData()->getData()))
            {
                extract($node->getNodeData()->getData());
            }

            ob_start();
            require $viewFile;
            $this->html = ob_get_clean(); // pas de concaténation ici, on écrase
        }
    }
}