*/ /** * Render image block for use in external pages. * * @package ImageBlock * @subpackage UserInterface */ class ExternalView extends GalleryView { /** * @see GalleryView::isImmediate */ function isImmediate() { return true; } /** * Specify the template instance to use for our immediate view. Used by our test code. * @param object GalleryTemplate */ function setTemplate(&$template) { $this->_template =& $template; } /** * @see GalleryView::loadTemplate() */ function renderImmediate($status, $error) { GalleryCoreApi::requireOnce('modules/imageblock/classes/ImageBlockHelper.class'); global $gallery; $SlideShow = array(); $startId = null; /* Force UrlGenerator to not add session id into urls.. */ $session =& $gallery->getSession(); $session->_isUsingCookies = true; $frameIds = array(); $params = array('maxSize' => null); foreach (array('blocks', 'show', 'itemId', 'maxSize', 'linkTarget', 'itemFrame', 'albumFrame') as $key) { $tmp = GalleryUtilities::getRequestVariables($key); if (!empty($tmp)) { $params[$key] = $tmp; if ($key == 'itemFrame' || $key == 'albumFrame') { $frameIds[$tmp] = 1; } } } GalleryCoreApi::requireOnce('modules/core/classes/GalleryTemplate.class'); if (isset($this->_template)) { $template =& $this->_template; } else { $template = new GalleryTemplate(dirname(dirname(dirname(__FILE__)))); } $ret = ImageBlockHelper::loadImageBlocks($template, $params); if ($ret) { return $ret->wrap(__FILE__, __LINE__); } if (!empty($frameIds)) { $frameIds = array_keys($frameIds); list ($ret, $imageframe) = GalleryCoreApi::newFactoryInstance('ImageFrameInterface_1_1'); if ($ret) { return $ret->wrap(__FILE__, __LINE__); } if (isset($imageframe)) { $ret = $imageframe->init($template, $frameIds); if ($ret) { return $ret->wrap(__FILE__, __LINE__); } } } if ($template->hasVariable('ImageBlockData')) { $ImageBlockData =& $template->getVariableByReference('ImageBlockData'); $ImageBlockData['forceFullUrl'] = 1; $template->setVariable('l10Domain', 'modules_imageblock'); if (!headers_sent()) { header("Content-type: text/html; charset=UTF-8"); } $template->display('gallery:modules/imageblock/templates/ImageBlock.tpl'); } return null; } } ?>