<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
namespace ModulesGarden\HostingQuotaNotifications\App\UI\Groups\Pages\Configuration;


use ModulesGarden\HostingQuotaNotifications\Core\UI\Widget\DataTable\DataProviders\DataProvider;
use \ModulesGarden\HostingQuotaNotifications\Core\UI\Widget\DataTable\DataTable;
use \ModulesGarden\HostingQuotaNotifications\Core\UI\Interfaces\AdminArea;
use \ModulesGarden\HostingQuotaNotifications\Core\UI\Widget\DataTable\DataProviders\Providers\ArrayDataProvider;
use \ModulesGarden\HostingQuotaNotifications\App\UI\Groups\Providers\Configuration\StepsProvider;
use \ModulesGarden\HostingQuotaNotifications\App\UI\Groups\Buttons\Configuration\StepDeleteButton;
use \ModulesGarden\HostingQuotaNotifications\App\UI\Groups\Buttons\Configuration\AddStepButton;
use \ModulesGarden\HostingQuotaNotifications\App\UI\Groups\Buttons\Configuration\MassDeleteStepButton;
use \ModulesGarden\HostingQuotaNotifications\App\UI\Groups\Buttons\Configuration\EditStepButton;
/**
 * Description of StepBase
 *
 * @author Artur Pilch <artur.pi@modulesgarden.com>
 */
class StepBase extends DataTable implements AdminArea
{
    protected $type;

    public function initContent()
    {
        $this->addButton(new AddStepButton());
        
        $this->addActionButton(new EditStepButton());
        $this->addActionButton(new StepDeleteButton());
        
        $this->addMassActionButton(new MassDeleteStepButton());
    }

    protected function loadData()
    {

        $provider = new StepsProvider();
        $dataProv = new ArrayDataProvider();
        $dataProv->setDefaultSorting('value', DataProvider::SORT_ASC);
        $dataProv->setData($provider->getSteps($this->type));
        $this->setDataProvider($dataProv);
    }
}
