| Current Path : /home/cbequiperp/www/plugins/flexicontent_fields/image/tmpl/ |
| Current File : /home/cbequiperp/www/plugins/flexicontent_fields/image/tmpl/value_gallery_fancybox.php |
<?php // *** DO NOT EDIT THIS FILE, CREATE A COPY !!
/**
* (Popup) Gallery layout -- Fancybox
*
* This layout supports inline_info, pretext, posttext
*/
// ***
// *** Values loop
// ***
$i = -1;
foreach ($values as $n => $value)
{
// Include common layout code for preparing values, but you may copy here to customize
$result = include( JPATH_ROOT . '/plugins/flexicontent_fields/image/tmpl_common/prepare_value_display.php' );
if ($result === _FC_CONTINUE_) continue;
if ($result === _FC_BREAK_) break;
$title_attr = htmlspecialchars($desc ? '<b>' . $title . '</b><br> ' . $desc : $title, ENT_COMPAT, 'UTF-8');
$group_str = $group_name ? 'data-fancybox="' . $group_name . '"' : '';
$legend_icon = '';
if (!empty($usemediaurl) && !empty($value['mediaurl']))
{
$attribs = 'href="' . $value['mediaurl'] . '" ';
// Video providers natively supported by this JS gallery
if (strpos($value['mediaurl'], 'youtube') !== false || strpos($value['mediaurl'], 'vimeo') !== false)
{
$style .= 'position: relative; display: inline-block;';
$legend_icon = '<span class="fc-centered-icon-box"><span class="icon-video-2"></span></span>';
}
// Non video URL or a video provider not supported nativley by this JS gallery
else
{
$attribs .= ' data-type="iframe"';
}
}
else
{
$attribs = 'href="' . JUri::root(true).'/'.$srcl . '" ';
}
$field->{$prop}[] = $pretext.
'<a style="' . $style . '" ' . $attribs . ' class="fc_image_thumb fb_gallery" ' . $group_str . ' data-title="' . $title_attr . '" data-caption="' . $title_attr . '">
' . $img_legend . '
' . $legend_icon . '
</a>'
. $inline_info
. $posttext;
}
// ***
// *** Add per field custom JS
// ***
if ( !isset(static::$js_added[$field->id][__FILE__]) )
{
flexicontent_html::loadFramework('fancybox');
$js = '';
if ($js) JFactory::getDocument()->addScriptDeclaration($js);
static::$js_added[$field->id][__FILE__] = array();
}
// ***
// *** Add - per (field, item) pair - custom JS
// ***
$uid = 'fc_'.$field_name_js."_fcitem".$item->id;
if (!isset(static::$js_added[$field->id][__FILE__][$item->id]))
{
//$js = file_get_contents(JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'librairies'.DS.'fancybox'.DS.'dist'.DS.'jquery.fancybox.js');
//$js = str_replace('unique_gal_id', $uid, $js);
//TODO render json format for button buttons: ["zoom","share","slideShow","fullScreen","download","thumbs","close"],
$display_infobar = $field->parameters->get( $PPFX_ . 'diplay_infobar', 'true' );
$display_toolbar = $field->parameters->get( $PPFX_ . 'diplay_toolbar', 'auto' );
$display_thumbs = $field->parameters->get( $PPFX_ . 'diplay_thumbs_autostart', 'false' );
$animation_effect = $field->parameters->get( $PPFX_ . 'animation_effect', 'zoom' );
$animation_duration = (int) $field->parameters->get( $PPFX_ . 'animation_duration', 400 );
$transition_effect = $field->parameters->get( $PPFX_ . 'transition_effect', 'fade' );
$transition_duration = (int) $field->parameters->get( $PPFX_ . 'transition_duration', 400 );
$loop = $field->parameters->get( $PPFX_ . 'loop_mode', 'false' );
$keyboard = $field->parameters->get( $PPFX_ . 'keyboard_mode', 'true' );
$image_protect = $field->parameters->get( $PPFX_ . 'protect_image', 'true' );
$slideshow_autostart = $field->parameters->get( $PPFX_ . 'slideshow_autostart', 'false' );
$slideshow_speed = (int) $field->parameters->get( $PPFX_ . 'slideshow_speed', 3000 );
$buttons_shown = $field->parameters->get( $PPFX_ . 'buttons_shown', array('zoom','share','slideShow','fullScreen','download','thumbs','close') );
$js = "
(function($)
{
$(document).ready(function()
{
$('#fb_gallery_" . $uid . " a.fb_gallery').fancybox({
loop: $loop,
keyboard: $keyboard,
infobar: $display_infobar,
toolbar: '$display_toolbar',
button : " . '["' . implode('","', $buttons_shown ) . '"]' . ",
protect: $image_protect,
animationEffect: '$animation_effect',
animationDuration: $animation_duration,
transitionEffect: '$transition_effect',
transitionDuration: $transition_duration,
slideShow: {autoStart: $slideshow_autostart,speed: $slideshow_speed}
});
});
})(jQuery);
";
if ($js) JFactory::getDocument()->addScriptDeclaration($js);
static::$js_added[$field->id][__FILE__][$item->id] = true;
}
/**
* Include common layout code before finalize values
*/
$result = include( JPATH_ROOT . '/plugins/flexicontent_fields/image/tmpl_common/before_values_finalize.php' );
if ($result !== _FC_RETURN_)
{
// ***
// *** Add container HTML (if required by current layout) and add value separator (if supported by current layout), then finally apply open/close tags
// ***
// Add value separator
$field->{$prop} = implode($separatorf, $field->{$prop});
$field->{$prop} = '
<div id="fb_gallery_' . $uid . '">
<ul>
' . $field->{$prop} . '
</ul>
</div>
';
// Apply open/close tags
$field->{$prop} = $opentag . $field->{$prop} . $closetag;
}