<?php
//@*--
  

class Theme_Designer_Block_Adminhtml_Designer extends Mage_Adminhtml_Block_Template
{
    private $_cfg;

    public function _construct()
    {
        parent::_construct();
        $this->_cfg = Mage::getSingleton('designer/config');
        $this->setTheme($this->getRequest()->getParam('theme'));
    }

    public function getDesignerUrl($route, $params = array()) {
        $url = Mage::helper('adminhtml')->getUrl($route);
        return Mage::helper('core/url')->addRequestParam($url, array_merge(
            array('theme' => $this->getTheme(), 'domain' => $this->getRequest()->getParam('domain', '')), $params));
    }

    public function getPreviewUrl($route = null, $params = array()) {
        $coreUrlHelper = Mage::helper('core/url');

        $defaults = array(
            'template' => $this->getTheme(),
            'preview' => 1
        );

        if (is_null($route)) {
            return $coreUrlHelper->addRequestParam(
                Mage::getModel("catalog/category")->load(15)->getUrl(),
                $defaults
            );
        } else {
            return $this->getUrl($route, array_merge($defaults, $params));
        }
    }

}

//--*@