| Current Path : /home/juvelize/martine/modules/mod_simple_unite_gallery/tmpl/ |
| Current File : /home/juvelize/martine/modules/mod_simple_unite_gallery/tmpl/default.php |
<?php
/**
* Simple Unit Gallery - Joomla Module
* Version : 1.2.12
* Package : Joomla 3.6.x
* copyright : Copyright (C) 2016 ConseilGouz. All rights reserved.
* license : http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
* From : Unit Gallery, https://github.com/vvvmax/unitegallery
* Updated on : July 2017
* 1.2.13 : add rel="noopener noreferrer" on href="_blank"
*/
// no direct access
defined('_JEXEC') or die;
$nummod_sf = $module->id;
?>
<div id="gallery_<?php echo $module->id;?>" style="display:none;">
<?php
if ($params->get('ug_dir_or_image') == "dir") { // images d'un r�pertoire
$ug_full_dir = $params->get('ug_full_dir',''); // r�pertoire complet ou non
$files = array();
$ug_big_dir = modSimpleUniteGalleryHelper::getFolder($ug_big_dir); // gestion r�pertoire dynamique
if ($ug_big_dir === false) {
echo '</div>'; // on ferme la div ouverte
return false;
}
if (strpos($params->get('ug_big_dir',''),'$') !== false) { // on a un r�pertoire param�trable
modSimpleUniteGalleryHelper::thumbnailFromDir($ug_big_dir,$params->get('ug_compression'));
}
$files = JFolder::files($ug_big_dir,null,null ,null , array('desc.txt','index.html','.htaccess'));
$desc = modSimpleUniteGalleryHelper::getDesc($ug_big_dir); // r�cup�ration fichier description s'il existe
if (count($files) == 0) { ?>
<img alt=""
src ="<?php echo $modulefield;?>unitegallery/images/pasdimage.png"
data-image="<?php echo $modulefield;?>unitegallery/images/pasdimage.png"
data-description=""
style="display:none">
<?php
} else {
$ug_thumb_dir = $ug_big_dir.'/th/'; // r�pertoire des miniatures
if ($ug_full_dir == "true") { // r�pertoire complet
foreach ($files as $file) {
$bigfile = $file;
$description = $bigfile;
$link = false;
$item = new stdClass();
$index = isset($desc[$bigfile]) ? $bigfile : '*';
if ($index == '*') {if (!isset($desc[$index])) {$index = false;}}
if ($index) {
$description = $desc[$index]['description'];
$link = $desc[$index]['link'];
$target = '';
if (is_numeric($link)) { // lien sur un article
$item->slidearticleid = $link;
$link = modSimpleUniteGalleryHelper::getArticle($item, $params);
$description = $item->article->text;
} else {
$target = ' target="_blank" rel="noopener noreferrer" '; // lien sur adresse web: nouvelle fen�tre
}
}
if ($link) {
echo '<a href="'.$link.'"'.$target.'>';
}
?>
<img alt="<?php echo $bigfile;?>"
src="<?php echo $ug_thumb_dir; ?><?php echo $file;?>"
<?php if (JFile::exists($ug_big_dir.'/'.$bigfile)) {
?>
data-image="<?php echo ''.JURI::base(true).'/'.$ug_big_dir; ?>/<?php echo $bigfile;?>"
<?php } else {?>
data-image="<?php echo $modulefield;?>unitegallery/images/pasdimage.png" <?php } ?>
data-description="<?php echo $description;?>"
style="display:none">
<?php
if ($link) { echo '</a>'; }
}
} else { // on prend juste les premi�res images du r�pertoire
$ug_file_nb = $params->get('ug_file_nb','5');
if ($ug_file_nb > count($files) ) {$ug_file_nb = count($files); } // d�passement capacit�
for ($i = 0; $i < $ug_file_nb; $i++) {
$bigfile = $files[$i];
$description = $bigfile;
$item = new stdClass();
$link = false;
$target = '';
$index = $desc[$bigfile] ? $bigfile : '*';
if ($index == '*') {if (!isset($desc[$index])) {$index = false;}}
if ($index) {
$description = $desc[$index]['description'];
$link = $desc[$index]['link'];
if (is_numeric($link)) { // lien sur un article
$item->slidearticleid = $link;
$link = modSimpleUniteGalleryHelper::getArticle($item, $params);
$description = $item->article->text;
}
else {
$target = ' target="_blank" rel="noopener noreferrer" '; // lien sur adresse web: nouvelle fen�tre
}
}
if ($link) {
echo '<a href="'.$link.'"'.$target.'>'; // lien externe : nouvelle fen�tre
}
?>
<img alt="<?php echo $bigfile;?>"
src="<?php echo $ug_thumb_dir; ?><?php echo $files[$i];?>"
<?php if (JFile::exists($ug_big_dir.'/'.$files[$i])) { ?>
data-image="<?php echo ''.JURI::base(true).'/'.$ug_big_dir; ?>/<?php echo $bigfile;?>"
<?php } else {?>
data-image="<?php echo $modulefield;?>unitegallery/images/pasdimage.png"
<?php } ?>
data-description="<?php echo $description;?>"
style="display:none">
<?php
if ($link) { echo '</a>'; }
}
}
}
} else { // images s�lectionn�es individuellement
$slideslist = json_decode(str_replace("||", "\"", $params->get('slideslist')));
foreach ($slideslist as $item) {
$imgcaption = str_replace("||", "\"", $item->imgcaption);
$imgname = str_replace("||", "\"", $item->imgname);
$imgthumb = $imgname;
$pos = strrpos($imgthumb,'/');
$len = strlen($imgthumb);
$imgthumb = substr($imgthumb,0,$pos+1).'th/'.substr($imgthumb,$pos+1,$len);
$imgtitle = str_replace("||", "\"", $item->imgtitle);
$imgcaption = str_replace("||", "\"", $item->imgcaption);
$slidearticleid = str_replace("||", "\"", $item->slidearticleid);
$link = null;
$imgdesc = $imgcaption;
if (isset($slidearticleid) && $slidearticleid) {
$link = modSimpleUniteGalleryHelper::getArticle($item, $params);
$imgdesc = $item->article->text;
}
if (isset($link)) {
echo '<a href="'.$link.'">';
}
?>
<img alt="<?php echo $imgcaption;?>"
src="<?php echo $imgthumb;?>"
<?php if ($imgname)
{
?> data-image="<?php echo $baseurl.'/'.$imgname; ?>"
<?php }
else { ?>
data-image="<?php echo $modulefield;?>unitegallery/images/pasdimage.png"
<?php } ?>
data-description="<?php echo $imgdesc;?>"
style="display:none">
<?php
if (isset($link)) { echo '</a>'; }
}
}
?>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#gallery_<?php echo $module->id;?>").unitegallery({
gallery_images_preload_type:"minimal",
tile_enable_shadow: true,
lightbox_type: "compact",
<?php
if ($params->get('ug_lightbox','true') == "false") { // no lightbox
if ($params->get('ug_link') == "true") { // link on image, no lightbox
echo 'tile_as_link:true,';
}
} else { // lightbox required
if ($params->get('ug_link') == "true") {
echo 'tile_show_link_icon:true,';
echo 'tile_link_newpage: false,';
}
}
if (($ug_texte == "fixe") || ($ug_texte == "true")) {
echo 'tile_enable_textpanel: true,';
echo 'tile_textpanel_source: "desc",';
echo 'lightbox_show_textpanel: true,';
if ($ug_texte == "fixe") {
echo 'tile_textpanel_always_on: true, ';
} else {
echo 'tile_textpanel_always_on: false, ';
}
}
if ($ug_type == "grid") { ?>
gallery_theme: "<?php echo $ug_type;?>",
grid_space_between_rows: <?php echo $ug_space_between_rows; ?>,
grid_space_between_cols: <?php echo $ug_space_between_cols; ?>,
slider_textpanel_enable_title: false,
grid_num_cols:1, /* 1.2.10 : une seule colonne */
<?php }
if ($ug_type == "carousel") { ?>
gallery_theme: "<?php echo $ug_type;?>",
theme_navigation_margin: 5, /* 1.2.10 : boutons plus proches */
tile_width: <?php echo $params->get('ug_tile_width');?>,
tile_height:<?php echo $params->get('ug_tile_height');?>,
carousel_space_between_rows: <?php echo $ug_space_between_rows; ?>,
carousel_space_between_tiles: <?php echo $ug_space_between_cols; ?>,
carousel_scroll_duration:<?php echo $params->get('ug_carousel_scroll_duration'); ?>,
carousel_autoplay_timeout:<?php echo $params->get('ug_carousel_autoplay_timeout'); ?>,
<?php if ($link) { ?>
tile_as_link: true, //act the tile as link, no lightbox will appear
tile_link_newpage: true,
<?php } ?>
<?php }
if ($ug_type == "slider") { ?>
gallery_theme: "<?php echo $ug_type;?>",
gallery_height:<?php echo $params->get('ug_tile_height');?>,
gallery_width:<?php echo $params->get('ug_tile_width');?>,
carousel_space_between_tiles: <?php echo $ug_space_between_cols; ?>,
slider_transition_speed:<?php echo $params->get('ug_carousel_scroll_duration'); ?>,
gallery_play_interval:<?php echo $params->get('ug_carousel_autoplay_timeout'); ?>,
slider_scale_mode: "fill",
slider_enable_fullscreen_button: true,
<?php if ($ug_texte == "true") { // on veut le texte: pas de "bullet"
echo 'slider_enable_text_panel:true,';
echo 'slider_textpanel_enable_title: false,';
echo 'slider_textpanel_desc_text_align: "center",';
echo 'slider_enable_bullets:false,';
}
}
if ($ug_type == "tiles") { ?>
tiles_space_between_rows: <?php echo $ug_space_between_rows; ?>,
tiles_space_between_cols: <?php echo $ug_space_between_cols; ?>,
<?php if ($ug_tiles_type == "column") { ?>
tiles_min_columns:<?php echo $params->get('ug_min_columns');?>,
<?php }
if ($ug_tiles_type == "tilesgrid") { ?>
gallery_theme: "<?php echo $ug_type;?>",
grid_num_rows:<?php echo $ug_grid_num_rows; ?>,
tile_height:<?php echo $params->get('ug_tile_height');?>,
grid_space_between_rows:<?php echo $ug_space_between_rows; ?>,
grid_space_between_cols:<?php echo $ug_space_between_cols; ?>,
<?php }
if ($ug_tiles_type == "nested") { ?>
tiles_type: "nested",
tiles_nested_optimal_tile_width:<?php echo $params->get('ug_tile_width'); ?>,
<?php }
if ($ug_tiles_type == "justified") { ?>
tiles_type: "justified",
tiles_justified_row_height: <?php echo $params->get('ug_tile_height');?>,
tiles_justified_space_between:<?php echo $ug_space_between_cols; ?>,
<?php }
} ?>
});
});
</script>