<?php

namespace App\Controllers;

require_once BASE_PATH . '/app/helpers/permissions.php';

use PDO;

use App\Core\Controller;
use App\Core\Database;
use App\Core\TenantContext;

class HomepageDesignController extends Controller
{

    public function index()
    {

        $db = Database::getInstance();

        $conferenceId =
            TenantContext::conferenceId();

        $stmt = $db->prepare("
            SELECT *
            FROM conference_home_sections
            WHERE conference_id = ?
            ORDER BY sort_order ASC
        ");

        $stmt->execute([
            $conferenceId
        ]);

        $sections =
            $stmt->fetchAll(PDO::FETCH_ASSOC);

        $this->render(
            'admin/homepage_design/index',
            [
                'sections' => $sections
            ]
        );
    }

}
