<?php
declare(strict_types=1);

namespace App\Controllers;

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

final class AdminSessionsController extends Controller
{
    public function index(): void
    {
        require_admin_area();
        
        $orgId = (int) current_org_id();
require_org_context();

        $db=Database::getInstance();
        $orgId=(int)current_org_id();

        $sql="
          SELECT s.*
          FROM conference_sessions s
          JOIN conferences c ON c.id=s.conference_id
          WHERE c.org_id=:org_id
          ORDER BY s.id DESC
          LIMIT 400
        ";
        $st=$db->prepare($sql);
        $st->execute([':org_id'=>$orgId]);
        $rows=$st->fetchAll()?:[];

        $this->view('admin/sessions/index',['rows'=>$rows]);
    }
}
