<?php
namespace WpBookingHotelAdmin\app\Html;

use WpBookingHotel\Factory;

class HtmlBackend
{
    public static function render_checkbox($value="",$key="item"){
        ob_start();
        include __DIR__.DS."/hmtl/checkbox.php";
        $content=ob_get_clean();
        return $content;
    }
    public static function render_check_all($key="item"){
        ob_start();
        $content=ob_get_clean();
        return $content;
    }

    public static function render_price($price,$format="$")
    {
        ob_start();
        include __DIR__.DS."/hmtl/price.php";
        $content=ob_get_clean();
        return $content;
    }
    public static function render_date($date,$format="m/d/Y"){
        $date=Factory::getDate($date);
        ob_start();
        include __DIR__.DS."/hmtl/date.php";
        $content=ob_get_clean();
        return $content;
    }
    public static function function_get_view()
    {
        $file_xml_path_app = WPBOOKINGHOTEL_ADMIN_PATH . "/app/views.xml";
        $xml = simplexml_load_file($file_xml_path_app);
        $list_menu_by_xml = [];
        $index = 21;
        foreach ($xml->view as $view) {
            $list_menu_by_xml[] = (object)[
                'id' => (string)$view->attributes()['id'],
                'menu_slug' => (string)$view->attributes()['menu_slug'],
                'label' => (string)$view->attributes()['label'],
                'page_title' => (string)$view->attributes()['page_title'],
                'capability' => (string)$view->attributes()['capability'],
                'icon' => (string)$view->attributes()['icon'],
                'is_system' => (boolean)$view->attributes()['is_system'],
            ];
            $index++;
        }
        return $list_menu_by_xml;
    }

}