<?php

Goweb::loadClass('Goweb_Controller_Action_Admin');
Goweb::loadClass('Goweb_View');

/**
 * Goweb Sitemanager 4 Framework
 * @version    4.0.0
 * @category   Backoffice
 * @package    Cms
 * @author     I&D <dev@goweb.pt>
 * @copyright  2006 (c) Goweb (http://www.goweb.pt)
*/
class Cms_BaseComponent extends Goweb_Controller_Action_Admin {
    
    /**
     * Actions
     *
     * @var array
    */
    protected $_actions = null;
    
    /**
     * Elementos codificados
     *
     * @var array
    */
    protected $_encodeElements = array();

    /**
     * Inicializacao das variaveis
    */
    public function indexAction() {
        if (!$this->view) {
            $this->view = new Goweb_View(GENERIC_VIEWS_PATH);
        }
        if (!$this->_actions) {
            throw new Goweb_Exception('&Eacute; necess&aacute;rio preencher o atributo "$_actions".');
        }
        $this->view->actions = $this->_actions;
        $this->_helper->viewRenderer->setRender('list_component_actions');
    }

    /**
     * Devolve o array das accoes do modulo
     *
     * @return array
    */
    public function getActions() {
        return $this->_actions;
    }

    /**
     * Atribui os elementos ao Modulo
     *
     * @return string
    */
    public function encodeElement($element) {
        $this->_encodeElements[] = $element;
    }
    
    /**
     * Devolve os elementos do Modulo
     *
     * @return array
    */
    public function getEncodeElements() {
        return $this->_encodeElements;
    }
}