<?php

Goweb::loadClass('Goweb_Admin');
Goweb::loadClass('Goweb_Admin_Section');
Goweb::loadModel('Catalogo_Model_Iva');

/**
 * Goweb Sitemanager 5 Framework
 * @version    5.0.0
 * @category   Frontoffice
 * @package    Catalogo
 * @subpackage Admin
 * @author     I&D <dev@goweb.pt>, Pedro Pinto <ppinto@goweb.pt>
 * @copyright  2009 (c) Goweb (http://www.goweb.pt)
 *
 * As classes _Admin sao responsaveis pela criacao automarica do backoffice.
 *
*/
class Catalogo_Admin extends Goweb_Admin {

    /**
     * Definicao para a montagem dinamica do back-office.
    */
    public function _setup() {        
        $this->_title = translate('Catalogo');
       
        $categoriasSection = new Goweb_Admin_Section();
        $categoriasSection->setModel(Goweb::getModelInstance('Catalogo_Model_Categoria', 'db'));
        $categoriasSection->setTitle(translate('Categorias'));
        $categoriasSection->setTitleSingular(translate('Categoria'));
        $categoriasSection->setListCols(array('id', 'titulo'));
        $categoriasSection->setOrdering('criado');
        $categoriasSection->setSearchCols('titulo');
        $categoriasSection->setListAction('listProduto');
        $categoriasSection->setParentIdCol('pai_id');
        $this->_addSection('categorias', $categoriasSection);

        $ivaSection = new Goweb_Admin_Section();
        $ivaSection->setModel(Goweb::getModelInstance('Catalogo_Model_Iva', 'db'));
        $ivaSection->setTitle(translate('Tabelas de I.V.A.'));
        $ivaSection->setTitleSingular(translate('Tabelas de I.V.A.'));
        $ivaSection->setListCols(array('titulo', 'iva',  'criado'));
        $ivaSection->setOrdering('titulo');
        $ivaSection->setSearchCols('titulo');        
        $this->_addSection('iva', $ivaSection);
    }
}