<?php
/**
* @package XenCentral Ad Server
* @author Skydevelop EU
* @copyright Drnoyan & Nalyan LDA, Portugal, EU
* @license http://www.dnf.pt/eula.html
* @link http://www.skydevelop.com
* @revision 97
* @version 2.0.0 beta 3 rev. 3
*/

class XenCentral_AdServer_ViewPublic_ZoneCode extends XenForo_ViewPublic_Base
{
    public function renderJson()
    {
        $randomId = XenCentral_AdServer_Zone::getRandomId();
        $src= XenForo_Link::buildPublicLink('full:ads/delivery', null, array(
            'zones' => $this->_params['zone']['zoneId'],
            'randomId' => $randomId
        ));

        $this->_params['embedCode'] = $this->createTemplateObject('xcas_zone_code', array(
            'randomId' => $randomId,
            'src' => $src,
            'reloadSrc'=>$src,
            'includeScript'=>true,
            'height'=> $this->_params['zone']['height'],
            'width'=> $this->_params['zone']['width']
        ));
    }

    public function renderHtml()
    {
        $this->renderJson();
    }
}