<?php
namespace NethServer\Module;

/*
 * Copyright (C) 2018 LibreSchool
 * 
 * This script is part of the LibreSchool Project.
 * 
 * This is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This project is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with LibreSchool stuff.  If not, see <http://www.gnu.org/licenses/>.
 */

class Profile extends \Nethgui\Controller\TableController
{

    protected function initializeAttributes(\Nethgui\Module\ModuleAttributesInterface $base)
    {
        return \Nethgui\Module\CompositeModuleAttributesProvider::extendModuleAttributes($base, 'Management', 10)->extendFromComposite($this);
    }

    public function initialize()
    {
        $columns = array(
            'Key',
            'FirstName',
            'LastName',
            'Actions',
        );

        $this
            ->setTableAdapter($this->getPlatform()->getTableAdapter('accounts', 'user'))
            ->setColumns($columns)
            ->addTableAction(new \Nethgui\Controller\Table\Help('Help'))
            ->addRowAction(new Profile\Clean('all'))
            ->addRowAction(new Profile\Clean('gui'))
            ->addRowAction(new Profile\Clean('libreoffice'));
        
        parent::initialize();
    }

}