function smarty_function_white_firstPageMarkedEntry($params, &$smarty) { global $berta; $viewportWidth = 980; $viewportHeight = 800; if(!empty($params['entry'])) { $entry = $params['entry']; $imageSelect = !empty($params['imageselect']) ? $params['imageselect'] : 'random'; $wiggleClass = $berta->template->settings->get('firstPage', 'hoverWiggle') == 'yes' ? 'firstPageWiggle' : ''; $imgs = BertaGallery::getImagesArray($params['entry']['__raw']); if($imgs) { $img = $imageSelect == 'first' ? reset($imgs) : $imgs[array_rand($imgs)]; $sizeRatio = $berta->template->settings->get('firstPage', 'imageSizeRatio'); if($sizeRatio <= 0) $sizeRatio = 1; list($html, $w, $h) = BertaGallery::getHTML(array(0 => $img), $params['entry']['__raw']['mediafolder']['value'], 'slideshow', false, true, $sizeRatio); //BertaGallery::getHTML($img, $params['entry']['__raw']['mediafolder']['value']); $link = ''; if($berta->environment != 'engine' && $img['@attributes']['type'] == 'image') { $link = smarty_function_bertaLink(array( 'section' => $params['entry']['section']['name']['value'], 'tag' => !empty($params['entry']['tags']) ? reset($params['entry']['tags']) : null ), $smarty); $link = "<a class=\"firstPagePicLink\" href=\"$link\" style=\"width:{$w}px;height:{$h}px;\"></a>"; } $pos = !empty($entry['positionXY']) ? explode(',', $entry['positionXY']) : array(rand(0, $viewportWidth - $w), rand(0, $viewportHeight - $h)); $entryClasses = smarty_function_entryClasses(array('entry' => $params['entry']), $smarty); $html = "<div class=\"firstPagePic $wiggleClass $entryClasses xEditableDragXY xProperty-positionXY \" style=\"left:{$pos[0]}px;top:{$pos[1]}px;\">" . $html . ($berta->environment == 'engine' ? "<div class=\"xHandle\" style=\"width:{$w}px;height:{$h}px;\"></div>" : '') . $link . '</div>'; return $html; } else { $html = !empty($entry['description']) ? $entry['description'] : ''; if($html) { $pos = !empty($entry['positionXY']) ? explode(',', $entry['positionXY']) : array(rand(0, $viewportWidth - $w), rand(0, $viewportHeight - $h)); $entryClasses = smarty_function_entryClasses(array('entry' => $params['entry']), $smarty); $html = "<div class=\"firstPagePic $wiggleClass $entryClasses xEditableDragXY xProperty-positionXY \" style=\"left:{$pos[0]}px;top:{$pos[1]}px;\">" . $html . ($berta->environment == 'engine' ? "<div class=\"xHandle\" style=\"width:100%;height:100%;\"></div>" : '') . '</div>'; return $html; } } } return ''; }
public static function getHTMLForEntry($entry, $isAdminMode = false) { $imgs = BertaGallery::getImagesArray($entry); $galleryType = !empty($entry['mediaCacheData']['@attributes']['type']) ? $entry['mediaCacheData']['@attributes']['type'] : 'slideshow'; $imageSize = !empty($entry['mediaCacheData']['@attributes']['size']) ? $entry['mediaCacheData']['@attributes']['size'] : 'large'; //return entry ID - needed for milkbox $galleryFullScreen = !$isAdminMode && isset($entry['mediaCacheData']['@attributes']['fullscreen']) && $entry['mediaCacheData']['@attributes']['fullscreen'] == 'yes' ? $entry['id']['value'] : false; return BertaGallery::getHTML($imgs, $entry['mediafolder']['value'], $galleryType, $isAdminMode, false, 1, $galleryFullScreen, $imageSize); }
public static function getHTMLForGridView($section, $tag) { global $berta; $imgs = BertaGallery::getImagesArray($section); $mediaFolder = $section['mediafolder']; $mFolder = self::$options['MEDIA_ROOT'] . $mediaFolder . '/'; $mFolderABS = self::$options['MEDIA_ABS_ROOT'] . $mediaFolder . '/'; $alwaysSelectTag = $berta->settings->get('navigation', 'alwaysSelectTag') == 'yes'; $tagKeys = array_keys($berta->tags[$section['name']]); $notFirstTag = $tag != reset($tagKeys); $sectionKeys = array_keys($berta->sections); $firstSection = $section['name'] == reset($sectionKeys); if (($berta->environment == 'engine' || $berta->environment == 'site' && !$berta->apacheRewriteUsed) && !$firstSection) { $linkHref = '?section=' . $section['name']; if ($tag != null && ($alwaysSelectTag && $notFirstTag || !$alwaysSelectTag)) { $linkHref .= '&tag=' . $tag; } } elseif (($berta->environment == 'engine' || $berta->environment == 'site' && !$berta->apacheRewriteUsed) && $firstSection) { $linkHref = self::$options['SITE_ABS_ROOT']; if ($tag != null && ($alwaysSelectTag && $notFirstTag || !$alwaysSelectTag)) { $linkHref .= '?section=' . $section['name'] . '&tag=' . $tag; } } elseif ($berta->environment == 'site' && $berta->apacheRewriteUsed && !$firstSection) { $linkHref = self::$options['SITE_ABS_ROOT'] . $section['name'] . '/'; if ($tag != null && ($alwaysSelectTag && $notFirstTag || !$alwaysSelectTag)) { $linkHref .= $tag . '/'; } } elseif ($berta->environment == 'site' && $berta->apacheRewriteUsed && $firstSection) { $linkHref = self::$options['SITE_ABS_ROOT']; if ($tag != null && ($alwaysSelectTag && $notFirstTag || !$alwaysSelectTag)) { $linkHref .= $section['name'] . '/' . $tag . '/'; } } if ($imgs && count($imgs) > 0) { foreach ($imgs as $img) { if ($img['@attributes']['type'] == 'image') { $imgSrc = $img['@attributes']['src']; $imgSrc = self::images_getGridImageFor($mFolder . $imgSrc); $returnImages .= '<div class="box"><a href="' . $linkHref . '"><img class="xGridItem" src="' . $mFolderABS . $imgSrc . '" /></a></div>'; } } } return $returnImages; }