<?php
######## NACITANIE DB ################################################################################
if ($str==1) $str_start=0; else $str_start=($str*$strankovanie)-$strankovanie;
$_REQUEST["refresh"]="y"; //ak je profil a nieje strana tak refresh=y
//zoradenie fotografii 0-cas pridania 1-hodnotenie 2-komentare
if ($order==0) $order_by='date';
if ($order==1) $order_by='pocet_hodnotenie';
if ($order==2) $order_by='pocet_koment';
$smer_text="DESC";
######## NACITANIE DB ################################################################################
$hodnotene_foto=array();
$hodnotene_cesta=array();
$pocet_komentovarray=array();
$pocet_hodnoteniearray=array();
$oblubenearray=array();
if (isset($_REQUEST["refresh"]) ) $refresh=$_REQUEST["refresh"]; else $refresh='n';
$sql ="SELECT fotoalbum.*,
(SELECT user FROM users WHERE users.ID_user=fotoalbum.user_id) AS user,
(SELECT meno FROM users WHERE users.ID_user=fotoalbum.user_id) AS meno,
(SELECT priezvisko FROM users WHERE users.ID_user=fotoalbum.user_id) AS priezvisko,
(SELECT COUNT(*) FROM fotoalbum WHERE style LIKE '%".$kat."') AS count,
(SELECT COUNT(komentar) FROM komentare WHERE komentare.predmet='koment-foto' AND fotoalbum.ID_fotky=komentare.id_predmet ) AS pocet_koment,
(SELECT SUM(znamka) FROM hodnotenie WHERE fotoalbum.ID_fotky=hodnotenie.foto_id ) AS pocet_hodnotenie,
(SELECT oblubene.id_polozky FROM oblubene WHERE oblubene.id_polozky=fotoalbum.ID_fotky AND kategoria='foto-galeria' AND uzivatel='".$user_id."') AS oblubene
FROM fotoalbum
WHERE fotoalbum.style LIKE '%".$kat."' ".$profilfoto."
GROUP BY fotoalbum.ID_fotky ORDER BY ".$order_by." ".$smer_text;
//echo $sql;
$result_fotoalbum=mysqli_query($con,$sql);
if (mysqli_num_rows($result_fotoalbum)){
while ($row_fotoalbum=mysqli_fetch_assoc($result_fotoalbum))
{
##### ARRAY FOTOGRAFIE
$pocet_komentovarray[]=intval($row_fotoalbum['pocet_koment']);
$pocet_hodnoteniearray[]=intval($row_fotoalbum['pocet_hodnotenie']);
$oblubenearray[]=intval($row_fotoalbum['oblubene']);
$hodnotene_foto[]=$row_fotoalbum['ID_fotky'];
$hodnotene_cesta[]=$row_fotoalbum['foto_id'];
$hodnotene_name[]=$row_fotoalbum['foto_name'];
$hodnotene_style[]=$row_fotoalbum['style'];
$hodnotene_foto_name[]=$row_fotoalbum['foto_name'];
if ($galeria=='profil') $seria=$row_fotoalbum['seria'];
$hodnotene_spolupraca[]=$row_fotoalbum['spolupracovali'];
$hodnotene_under18[]=$row_fotoalbum['under18'];
$nick_pridal=$row_fotoalbum['user'];
$meno_pridal=$row_fotoalbum["meno"]." ".$row_fotoalbum["priezvisko"];
if ($meno_pridal!=" ") $meno_pridal=$nick_pridal." (".$meno_pridal.")";
$hodnotene_menopridal[]=$meno_pridal;
}
mysqli_free_result($result_fotoalbum) ;
}
########################################################################################################
################# STRANKOVANIE
$count=count($hodnotene_foto);
if ($count > $strankovanie) $pages= ceil($count/$strankovanie); else $pages=1;
$str_end= $str*$strankovanie;
if ($str_end > $count) $str_end=$count;
?>
<div class="frame-full" >
<div class="perc50 left" style="margin-top:6px;"><?php echo $tabulkyusersarray[6].' '.($str_start+1).' - '.$str_end.' ('.$tabulkyusersarray[7].' '.$count.')';?></div>
<div class="perc50 right" ><div id="pages" style=""><?php echo strankovanie($ciel,$str, $pages, $count, $strankovanie,10);?></div></div>
</div>
<?php
#################
$pocet_strip=$str_start+$strankovanie; //pocet foto v jednom stripe
//$key=array_search($id_hodnotenej, $hodnotene_foto); //poradie fotky v array
for ($i=$str_start;$i<$pocet_strip;$i++)
{
if (isset($hodnotene_foto[$i])){
$pocet_komentov=$pocet_komentovarray[$i];
$pocet_hodnotenie=$pocet_hodnoteniearray[$i];
$oblubene=$oblubenearray[$i];
$id_fotky_strip=$hodnotene_foto[$i];
$foto_id_strip=$hodnotene_cesta[$i];
$meno_pridal=$hodnotene_menopridal[$i];
$under18=$hodnotene_under18[$i];
$foto_name=$hodnotene_foto_name[$i];
$foto_name=$hodnotene_name[$i];
$style=$hodnotene_style[$i];
$spolupraca=$hodnotene_spolupraca[$i];
$sirka=15; $margin="0 5px"; $font="1em"; $width="";
if ($pocet_hodnotenie!=0) $img_znamka="<div style='float:left;cursor:help;'><img style='float:left;margin:$margin;' src='".$static."images/others_ico/body.png' border='0' $width alt='z' title='$upload_array[10]'/><div style='float:left;font-size:$font;' title='hodnotenie'>".$pocet_hodnotenie.'</div></div>';
else $img_znamka=null;
if ($pocet_komentov!=0) $img_koment="<div style='float:left;cursor:help;'><img style='float:left;margin:$margin;' src='".$static."images/others_ico/koment.png' border='0' $width alt='k' title='$upload_array[11]'/><div style='float:right;font-size:$font;' title='komentáre'>".$pocet_komentov.'</div></div>';
else $img_koment=null;
if ($oblubene!=0) $img_love="<div style='float:right;margin:$margin;cursor:help;'><img style='' src='".$static."images/others_ico/love-min.png' border='0' $width alt='l' title='$upload_array[12]'/></div>";
else $img_love=null;
## ZOBRAZOVANIE FOTIEK
$format=189;
$obrazok=fotalbum_exist($foto_id_strip); //po novom uz ma foto_id aj priponu
?>
<div class='<?php echo $perc_box;?> box_no_border shade ' style=''>
<div style='position: relative;'>
<a class='fancybox' rel='gallery' href='<?php echo $obrazok[0];?>' title='<?php echo $meno_pridal;?>'>
<img class="fade" src='<?php echo $obrazok[1];?>' alt='' height='' width='100%' style='' title='' />
</a>
</div>
<div style='height:<?php echo $sirka;?>px;overflow:hidden;'><?php echo $img_znamka.$img_love.$img_koment;?></div>
<?php if (($id_page==1)) { require "zobrazovanie_galerie_user.php"; }
//if ($galeria=='galeria_profil') echo '<hr style="margin:3px auto;" /><h3 style="text-align:center;font-size:0.85em;">'.$galeriakategoriearray[$style].'</h3>';
?>
</div>
<?php
}
}
?>
<div class="frame-full" >
<div class="perc50 left" style="margin-top:6px;"><?php echo $tabulkyusersarray[6].' '.($str_start+1).' - '.$str_end.' ('.$tabulkyusersarray[7].' '.$count.')';?></div>
<div class="perc50 right" ><div id="pages" style=""><?php echo strankovanie($ciel,$str, $pages, $count, $strankovanie,10);?></div></div>
</div>
<script type="text/javascript">
jQuery(document).keydown(function(event){
var key=event.which;
switch(key)
{
case 37:
document.getElementById('stranka_lava').onclick() // Key left.
break;
case 39:
document.getElementById('stranka_prava').onclick() // Key right.
break;
}
});
</script>
<script type="text/javascript">
$(".fancybox")
.attr('rel', 'gallery')
.fancybox({
padding : 0
});
</script>
preferences:
45.15 ms | 402 KiB | 5 Q