<?php

namespace bin\php\Classes;
if (!defined('APP_INIT')) {
    exit;
}

class pageNavbar
{
    public bool $breadCrumb;
    private array $buttons = array();
    private string $title;

    public function __construct($showBreadCrumb, $title = false)
    {
        $this->breadCrumb = $showBreadCrumb;
        $this->title = $title;
    }

    public function AddHTMLButton($html): void
    {
        $this->buttons[] = $html;
    }

    public function outPutNavbar(): void
    {
        ?>
        <div class="row">
            <div class="col d-flex justify-content-start">
                <?php if ($this->breadCrumb) { ?>
                    <div class="pb-2" id="breadCrumb">&nbsp;</div>
                <?php } elseif ($this->title) { ?>
                    <h2 class="px-4 mb-0"><?php echo $this->title ?></h2>
                <?php } else { ?>
                    <div></div>
                <?php } ?>
            </div>
            <div class="col d-flex justify-content-end">
                <?php if (count($this->buttons)) {
                    foreach ($this->buttons as $button) {
                        echo $button;
                    }
                } ?>
            </div>
        </div>
        <br>
    <?php }
}