Your IP : 216.73.216.43


Current Path : /home/cbequiperp/www/plugins/flexicontent_fields/image/tmpl/
Upload File :
Current File : /home/cbequiperp/www/plugins/flexicontent_fields/image/tmpl/value_gallery_pannellum.php

<?php  // *** DO NOT EDIT THIS FILE, CREATE A COPY !!

/**
 * (Popup) Gallery layout  --  Pannellum
 *
 * This layout supports inline_info, pretext, posttext
 */

$vp_max_height = (int) $field->parameters->get( $PPFX_ . 'vp_max_height', 50 );
$vp_max_height = $vp_max_height >= 20 ? $vp_max_height : 20;
$vp_max_height = $vp_max_height <= 95 ? $vp_max_height : 95;

if (static::$isTablet)
{
	$param_name  = $view === 'item' ? 'thumbinitemview_tablet' : 'thumbincatview_tablet';
	$tablet_size = (int) $field->parameters->get( $PPFX_ . $param_name, '');
	$tablet_size = isset(self::$index_to_thumb_size[$tablet_size]) ? self::$index_to_thumb_size[$tablet_size] : '';
}
elseif (static::$isMobile)
{
	$param_name  = $view === 'item' ? 'thumbinitemview_mobile' : 'thumbincatview_mobile';
	$mobile_size = (int) $field->parameters->get( $PPFX_ . $param_name, '');
	echo $mobile_size = isset(self::$index_to_thumb_size[$mobile_size]) ? self::$index_to_thumb_size[$mobile_size] : '';
}

$image_source     = $image_source = (int) $field->parameters->get('image_source', 0);
$protect_original = $image_source < 1 ? 0 : $field->parameters->get('protect_original', 1);


// ***
// *** Values loop
// ***

$i = -1;

foreach ($values as $n => $value)
{
	if ($protect_original)
	{
		$field->{$prop}[] = '<div class="alert alert-warning">'
			. 'Aborting loading of gallery code.<br>'
			. 'Original file is protected from direct access.<br>'
			. 'Inside field\'s configuration <i>(Editing TAB / Image Source TAB)</i> please turn off:<br>'
			. ' &nbsp; <b>"Prevent access to original images"</b>'
			. '</div>';
		continue;
	}

	// 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;

	if (static::$isTablet && $tablet_size)
	{
		$SIZE    = $tablet_size;
		$ABS_SRC = ${'abs_src' . $SIZE};
	}
	elseif (static::$isMobile && !static::$isTablet && $mobile_size)
	{
		$SIZE    = $mobile_size;
		$ABS_SRC = ${'abs_src' . $SIZE};
	}
	elseif ($size === 'o')
	{
		$SIZE    = 'l';
		$ABS_SRC = $abs_srcl;
	}
	else
	{
		$SIZE    = $size;
		$ABS_SRC = $abs_src;
	}

	$w = isset($value['size_w_' . $SIZE]) ? $value['size_w_' . $SIZE] : $field->parameters->get('w_' . $SIZE, self::$default_widths[$size]);
	$h = isset($value['size_h_' . $SIZE]) ? $value['size_h_' . $SIZE] : $field->parameters->get('h_' . $SIZE, self::$default_heights[$size]);
	
	// TODO: Check if this feature will be implemented (Params commented out in XML file too)
	$hots_spots_list = 0;

	if ($hots_spots_list === 1)
	{
		$hots_spots_list = "
		\"hotSpots\": [
			{
				\"pitch\": 14.1,
				\"yaw\": 1.5,
				\"type\": \"info\",
				\"text\": \"Baltimore Museum of Art\",
				\"URL\": \"https://artbma.org/\"
			},
			{
				\"pitch\": -9.4,
				\"yaw\": 222.6,
				\"type\": \"info\",
				\"text\": \"Art Museum Drive\"
			},
			{
				\"pitch\": -0.9,
				\"yaw\": 144.4,
				\"type\": \"info\",
				\"text\": \"North Charles Street\"
			}
		]
		";
	}
	else
	{
		$hots_spots_list = '';
	}

	$img_legend_custom = '
	<div id="panorama_' . $uniqueid . '" style="width: ' . $w . 'px; height: ' . $w . 'px; max-width: 100%; max-height: ' . $vp_max_height  . 'vh;"></div>
	<script>
		pannellum.viewer(\'panorama_' . $uniqueid . '\', {
			"type": "equirectangular",
			"panorama": "' . JUri::root(true).'/'.$srco . '",
			"preview": "' . $ABS_SRC . '",
			"title": "' . $title_encoded . '",
			' . $hots_spots_list . '
		});
	</script>	
	';

	$field->{$prop}[] = $pretext
		. $img_legend_custom
		. $inline_info
		. $posttext;
}


// ***
// *** Add per field custom JS
// ***

if (!isset(static::$js_added[$field->id][__FILE__]) )
{
	flexicontent_html::loadFramework('pannellum');

	$js = "";

	if ($js) JFactory::getDocument()->addScriptDeclaration($js);

	static::$js_added[$field->id][__FILE__] = 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});

	// Apply open/close tags
	$field->{$prop}  = $opentag . $field->{$prop} . $closetag;
}