private function getTemplateDataFromCache($templateData) { $templateProxy = org_glizy_ObjectFactory::createObject('org.glizycms.template.models.proxy.TemplateProxy'); // $templateProxy->invalidateCache(); $cache = $templateProxy->getTemplateCache(); $cssFileName = __Paths::get('CACHE') . md5($this->getClassName() . '_' . $templateData->__id) . '.css'; $self = $this; $templateData = $cache->get($cssFileName, array(), function () use($self, $templateData, $cssFileName) { $newTemplateData = new StdClass(); $newTemplateData->footerLogo = ''; $self->updateTemplateData($templateData); $self->compileCss($templateData, $cssFileName); $templateData->footerLogo = @json_decode($templateData->footerLogo); if ($templateData->footerLogo && $templateData->footerLogo->id) { $image = org_glizy_helpers_Media::getImageById($templateData->footerLogo->id); if ($templateData->footerLogoLink) { $image = __Link::formatLink($templateData->footerLogoLink, $templateData->footerLogoTitle, $image); } $newTemplateData->footerLogo = $image; } $newTemplateData->css = $templateData->css; return $newTemplateData; }); return $templateData; }
private function renderTemplateHeader($view, $templateData) { $siteProp = unserialize(org_glizy_Registry::get(__Config::get('REGISTRY_SITE_PROP') . $view->_application->getLanguage(), '')); $view->addOutputCode($siteProp['title'], 'title1'); $view->addOutputCode($siteProp['subtitle'], 'title2'); /* $view->addOutputCode(str_replace('../getImage.php', 'getImage.php', $templateData->title1), 'title1'); $view->addOutputCode(str_replace('../getImage.php', 'getImage.php', $templateData->title2), 'title2'); */ $view->addOutputCode(str_replace('../getImage.php', 'getImage.php', $templateData->title3), 'title3'); $view->addOutputCode(str_replace('../getImage.php', 'getImage.php', $templateData->title4), 'title4'); $templateData->footerLogo = @json_decode($templateData->footerLogo); if ($templateData->footerLogo && $templateData->footerLogo->id) { $image = org_glizy_helpers_Media::getImageById($templateData->footerLogo->id); if ($templateData->footerLogoLink) { $image = __Link::formatLink($templateData->footerLogoLink, $templateData->footerLogoTitle, $image); } $view->addOutputCode($image, 'logoFooter'); } $view->addOutputCode(org_glizy_helpers_CSS::CSScode($templateData->customCss), 'head'); }
public function fixTemplateData(&$templateData, &$newTemplateData) { $templateData->footerLogo = @json_decode($templateData->footerLogo); if ($templateData->footerLogo && $templateData->footerLogo->id) { $image = org_glizy_helpers_Media::getImageById($templateData->footerLogo->id); if ($templateData->footerLogoLink) { $image = __Link::formatLink($templateData->footerLogoLink, $templateData->footerLogoTitle, $image); } $newTemplateData->footerLogo = $image; } }
public function render() { if (is_object($this->_content) && $this->_content->image && $this->_content->hotspots) { $media = org_glizycms_mediaArchive_MediaManager::getMediaById($this->_content->image); $speakingUrlManager = $this->_application->retrieveProxy('org.glizycms.speakingUrl.Manager'); if (is_object($media)) { $id = $this->getId(); $imageInfo = $media->getImageInfo(); $width = $imageInfo['width']; $height = $imageInfo['height']; $attributes = array(); $attributes['src'] = $media->getFileName(true); $attributes['width'] = $imageInfo['width']; $attributes['height'] = $imageInfo['height']; $attributes['alt'] = $media->title; $attributes['title'] = $media->title; $image = '<img ' . $this->_renderAttributes($attributes) . ' />'; $hotspots = ''; foreach ($this->_content->hotspots as $h) { $attributes = array(); $attributes['id'] = $id . '-' . $h->id; $attributes['class'] = 'movio-hotspot' . ($h->form == 'circle' ? '-circle' : ''); $attributes['style'] = 'display: block; top: ' . $h->top . 'px; left: ' . $h->left . 'px; height: ' . $h->height . 'px; width: ' . $h->width . 'px;'; if ($h->description) { $attributes['data-tooltip'] = glz_encodeOutput($h->description); } $link = ''; if ($h->type = 'linkEx' && $h->src) { $link = __Link::formatLink($h->src); } else { if ($h->type = 'link' && $h->srcInt) { $link = __Link::formatInternalLink($speakingUrlManager->makeUrl($h->srcInt)); } } if ($link) { $link = str_replace('<a ', '<a style="text-indent: -9999px; height: ' . $h->height . 'px; width: ' . $h->width . 'px; display: block;"', $link); } // <a target="_blank" style="height: 148px; width: 186px; display: block;" href="www.google.com" class="hotspot-circle"></a> $hotspots .= '<div ' . $this->_renderAttributes($attributes) . '>' . $link . '</div>'; } $css = trim('movio-hotspotContainer ' . $this->getAttribute('cssClass')); $output = <<<EOD <div id="{$id}" class="{$css}"> {$image} <div class="movio-imageHotspot-scale"> {$hotspots} </div> </div> <script src="static/jquery/jquery-transform/jquery.transform2d.js"></script> <script> jQuery( function(){ \$('div.movio-hotspotContainer').find('div[data-tooltip!=""]').qtip({ content: { attr: 'data-tooltip' }, position: { my: 'bottom left', at: 'bottom left', target: 'mouse' }, style: { classes: 'qtip-bootstrap' } }); var img = \$('div.movio-hotspotContainer img').first(); var scale = img.width() / parseInt(img.attr('width')); \$('.movio-imageHotspot-scale').css('transform', 'scale('+scale+','+scale+')'); }); </script> EOD; $this->addOutputCode($output); $this->addOutputCode(org_glizy_helpers_JS::linkStaticJSfile('jquery/jquery.qtip/jquery.qtip.min.js'), 'head'); $this->addOutputCode(org_glizy_helpers_CSS::linkStaticCSSfile('jquery/jquery.qtip/jquery.qtip.min.css'), 'head'); } } }