<?php
loadcontroller('base/base_controller');
abstract class ControllerBaseList extends BaseController
{
    protected function loadScript()
    {
        $this->document->addScript("admin/public/js/$this->referencePathFile.js");
    }

    protected function breadcrumbs()
    {

        $this->dataVue['breadcrumbs'] = [
            [
                'href' => $this->url->link('common/home', 'token=' . $this->token, 'SSL'),
                'text' => $this->language->get('text_home'),
            ],
            [
                'href' => $this->url->link($this->referencePathFile, 'token=' . $this->token , 'SSL'),
                'text' => $this->language->get('heading_title'),
            ],
        ];
    }

    public function index($settings = [])
    {

        $this->settings = $settings;

        $this->loadLanguage();
        $this->breadcrumbs();

        $this->document->setTitle($this->language->get('heading_title'));
        $this->loadScript();

        $this->loadModel();

        $this->loadController();

        $this->loadData();
        $this->actionUrls();
        $this->childrens();

        $this->response->setOutput($this->render($this->referencePathFile));
    }

    protected function renderPagination($total,$page = 0){

        $pagination = new Pagination();
        $pagination->total = $total;
        $pagination->page = $page;
        $pagination->limit = $this->config->get('config_admin_limit');
        $pagination->text = $this->language->get('text_pagination');
        $pagination->url = $this->url->link($this->referencePathFile, 'token=' . $this->session->data['token']  . '&page={page}', 'SSL');

        return $pagination->render(true,true);

    }

}
?>