if (!defined('IN_CMS')) exit;
final class Parser {
static $language = 'pl';
static $root_ = '/';
static $widthGallery = 990;
static $typGallery = 2;
static $stalyWymiarGal = 1;
static $ustawSzerokosc = 0;
static $quantity_gal = 3;
static $marginGall = 10;
static $ramkaGal = 5;
static $colorGal = 'FFFFFF';
static $borderGal = 'CCCCCC';
static $showOpis = 0;
static $pos_title_cat = 0;
static $truncateTxt = 100;
static $gall_td_width = 0;
static $fontSize = '12';
static $fontColor = '000000';
static $fontTitleColor = '000000';
static $fontTitleSize = '11';
static $colorCap = '';
static $typCategory = 2;
static $quantity_cat = 5;
static $marginCat = 10;
static $stalyWymiarCat = 1;
static $limitCat = 0;
static $ramkaCat = 5;
static $colorCat = '';
static $borderCat = 'CCCCCC';
static $showPodpisCat = 1;
static $showOpisCat = 1;
static $seo = 0;
static $pos_title_img = 1;
static $cat_td_width = 0;
static $imgZoom = 1;
static $pozCat = array();
static $countCat = 0;
static $tabHeightImg = array();
static $pagenavig;
static $page = 0;
static $countImg = 0;
static $tabGalleryMenu = array();
private function __construct(){ }
static function getParamsGallery($wcdb){
$query = "SELECT pm.params FROM module AS m ";
$query .= " LEFT JOIN params_module AS pm ON pm.id_module = m.id ";
$query .= " WHERE m.module='gallery' AND pm.id_szablon=".ID_TEMPLATES;
$rows = $wcdb->loadResult($query);
if(isset($rows['params'])){
$params = getParams($rows['params']);
if(isset($params['stalyWymiar'])) self::$stalyWymiarGal = $params['stalyWymiar'];
if(isset($params['ustawSzerokosc'])) self::$ustawSzerokosc = $params['ustawSzerokosc'];
}
}
static function getGallery($wcdb,$idGallery,$request){
include('content/model/gallery_config.php');
$catImage = array();
$i = 0;
$query = 'SELECT c.id AS c_id, cd.name AS c_name, cd.tresc,cd.link AS c_link, g.quantity_col, g.pos_title_cat,g.params ';
$query .=' FROM gallery g, category c, category_description cd, gallery_img_category ic ';
$query .=' WHERE g.active = 1 AND g.id = ' . $idGallery . ' AND c.active = 1 AND c.typ = \'gall\' AND c.typ_id = g.id ';
$query .=' AND cd.id_category = c.id AND cd.language = \'' . $wcdb->real_escape_string( self::$language ) . '\' AND ic.id_cat = c.id ';
$query .=' AND ic.active = 1 GROUP BY c.id ORDER BY c.pos ASC';
$tabGal = $wcdb->loadObjectList($query,'c_id');
$tabCurrent = current($tabGal);
$sql = "SELECT id,id_link,tresc,link FROM `art_description`
WHERE `tresc` LIKE '%_gall_select_val%'
AND language = '".self::$language."'
AND active=1 AND `type` = 'links'";
$tabGalleryTresc = $wcdb->loadObjectList($sql);
$tabGalleryMenu = array();
if(count($tabGalleryTresc) > 0){
foreach($tabGalleryTresc as $value){
$regex = '/_gall_select_val=\"([kg])_([0-9]+)\"/';
if(preg_match_all($regex,$value->tresc,$tab)){
if(isset($tab[2]) && $tab[1][0] == 'k'){
foreach($tab[2] as $v){
$tabGalleryMenu[$v] = $value->link;
}
}
}
}
}
self::$tabGalleryMenu = $tabGalleryMenu;
//debugTxt($tabGalleryMenu);
//debugTxt($request->getMenuAll());
$params = array();
if($tabCurrent){
$params = getParams($tabCurrent->params);
self::$quantity_gal = $tabCurrent->quantity_col;
self::$pos_title_cat = $tabCurrent->pos_title_cat;
}
if(isset($tabConfigGallery['typGallery'])) self::$typGallery = $tabConfigGallery['typGallery'];
if(isset($tabConfigGallery['marginGall'])) self::$marginGall = $tabConfigGallery['marginGall'];
if(isset($tabConfigGallery['stalyWymiarGal'])) self::$stalyWymiarGal = $tabConfigGallery['stalyWymiarGal'];
if(isset($tabConfigGallery['ramkaGal'])) self::$ramkaGal = $tabConfigGallery['ramkaGal'];
if(isset($tabConfigGallery['colorGal'])) self::$colorGal = $tabConfigGallery['colorGal'];
if(isset($tabConfigGallery['borderGal'])) self::$borderGal = $tabConfigGallery['borderGal'];
if(isset($tabConfigGallery['showOpis'])) self::$showOpis = $tabConfigGallery['showOpis'];
if(isset($tabConfigGallery['truncateTxt'])) self::$truncateTxt = $tabConfigGallery['truncateTxt'];
if(isset($tabConfigGallery['fontSize'])) self::$fontSize = $tabConfigGallery['fontSize'];
if(isset($tabConfigGallery['fontColor'])) self::$fontColor = $tabConfigGallery['fontColor'];
if(isset($tabConfigGallery['fontTitleColor'])) self::$fontTitleColor = $tabConfigGallery['fontTitleColor'];
if(isset($tabConfigGallery['fontTitleSize'])) self::$fontTitleSize = $tabConfigGallery['fontTitleSize'];
if(isset($tabConfigGallery['colorCap'])) self::$colorCap = $tabConfigGallery['colorCap'];
if(isset($params['typGallery'])) self::$typGallery = $params['typGallery'];
if(isset($params['marginGall'])) self::$marginGall = $params['marginGall'];
if(isset($params['stalyWymiarGal'])) self::$stalyWymiarGal = $params['stalyWymiarGal'];
if(isset($params['ramkaGal'])) self::$ramkaGal = $params['ramkaGal'];
if(isset($params['colorGal'])) self::$colorGal = $params['colorGal'];
if(isset($params['borderGal'])) self::$borderGal = $params['borderGal'];
if(isset($params['showOpis'])) self::$showOpis = $params['showOpis'];
if(isset($params['truncateTxt'])) self::$truncateTxt = $params['truncateTxt'];
if(isset($params['fontSize'])) self::$fontSize = $params['fontSize'];
if(isset($params['fontColor'])) self::$fontColor = $params['fontColor'];
if(isset($params['fontTitleColor'])) self::$fontTitleColor = $params['fontTitleColor'];
if(isset($params['fontTitleSize'])) self::$fontTitleSize = $params['fontTitleSize'];
if(isset($params['colorCap'])) self::$colorCap = $params['colorCap'];
if(self::$typGallery == 1){
self::$widthGallery = Services::getConfigCms()->getContentWidth();
self::getParamsGallery($wcdb);
if(count($tabGal) > 0) self::showGalleryType1($wcdb,$tabGal,$idGallery,$request);
}
if(self::$typGallery == 2){
if(count($tabGal) > 0) self::showGalleryType2($wcdb,$tabGal,$idGallery,$request);
}
if(self::$typGallery == 3){
if(count($tabGal) > 0) self::showGalleryType3($wcdb,$tabGal,$idGallery,$request);
}
if(self::$typGallery == 4){
if(count($tabGal) > 0) self::showGalleryType2($wcdb,$tabGal,$idGallery,$request);
}
if(self::$typGallery == 5){
if(count($tabGal) > 0) self::showGalleryType5($wcdb,$tabGal,$idGallery,$request);
}
}
static function getImageCategory($wcdb,$idCategory,$request){
include('content/model/gallery_config.php');
$gallImage = array();
$query = "SELECT COUNT(*) AS ile,cat.limit,cat.img_seo, cat.quantity_col, cat.pos_title_img,cat.params,
cd.name,cd.link,cd.tytul_h1,cd.mt_title,cd.mt_description,cd.mt_keywords,cd.tresc
FROM gallery_img i, gallery_img_description d, gallery_img_category c,category cat ,category_description cd
WHERE
d.id_img = i.id
AND cat.id=c.id_cat
AND cd.id_category = cat.id
AND d.language = '".$wcdb->real_escape_string( self::$language )."'
AND cd.language = '".$wcdb->real_escape_string( self::$language )."'
AND c.id_img = i.id
AND c.active = 1
AND c.id_cat = ".$idCategory;
$rowsCatCount = $wcdb->loadResult($query);
self::$pozCat = $rowsCatCount;
$params = getParams($rowsCatCount['params']);
self::$quantity_cat = $rowsCatCount['quantity_col'];
self::$limitCat = $rowsCatCount['limit'];
self::$seo = $rowsCatCount['img_seo'];
self::$pos_title_img = $rowsCatCount['pos_title_img'];
if(isset($tabConfigCategory['typCategory'])) self::$typCategory = $tabConfigCategory['typCategory'];
if(isset($tabConfigCategory['typCategory'])) self::$typGallery = $tabConfigCategory['typCategory'];
if(isset($tabConfigCategory['stalyWymiarCat'])) self::$stalyWymiarCat = $tabConfigCategory['stalyWymiarCat'];
if(isset($tabConfigCategory['imgZoom'])) self::$imgZoom = $tabConfigCategory['imgZoom'];
if(isset($tabConfigCategory['marginCat'])) self::$marginCat = $tabConfigCategory['marginCat'];
if(isset($tabConfigCategory['ramkaCat'])) self::$ramkaCat = $tabConfigCategory['ramkaCat'];
if(isset($tabConfigCategory['colorCat'])) self::$colorCat = $tabConfigCategory['colorCat'];
if(isset($tabConfigCategory['borderCat'])) self::$borderCat = $tabConfigCategory['borderCat'];
if(isset($tabConfigCategory['showPodpisCat'])) self::$showPodpisCat = $tabConfigCategory['showPodpisCat'];
if(isset($tabConfigCategory['fontTitleColor'])) self::$fontTitleColor = $tabConfigCategory['fontTitleColor'];
if(isset($tabConfigCategory['fontTitleSize'])) self::$fontTitleSize = $tabConfigCategory['fontTitleSize'];
if(isset($tabConfigCategory['fontSize'])) self::$fontSize = $tabConfigCategory['fontSize'];
if(isset($tabConfigCategory['fontColor'])) self::$fontColor = $tabConfigCategory['fontColor'];
if(isset($tabConfigCategory['colorCap'])) self::$colorCap = $tabConfigCategory['colorCap'];
if(isset($params['typCategory'])) self::$typCategory = $params['typCategory'];
if(isset($params['typCategory'])) self::$typGallery = $params['typCategory'];
if(isset($params['stalyWymiarCat'])) self::$stalyWymiarCat = $params['stalyWymiarCat'];
if(isset($params['imgZoom'])) self::$imgZoom = $params['imgZoom'];
if(isset($params['marginCat'])) self::$marginCat = $params['marginCat'];
if(isset($params['ramkaCat'])) self::$ramkaCat = $params['ramkaCat'];
if(isset($params['colorCat'])) self::$colorCat = $params['colorCat'];
if(isset($params['borderCat'])) self::$borderCat = $params['borderCat'];
if(isset($params['showPodpisCat'])) self::$showPodpisCat = $params['showPodpisCat'];
if(isset($params['fontTitleColor'])) self::$fontTitleColor = $params['fontTitleColor'];
if(isset($params['fontTitleSize'])) self::$fontTitleSize = $params['fontTitleSize'];
if(isset($params['fontSize'])) self::$fontSize = $params['fontSize'];
if(isset($params['fontColor'])) self::$fontColor = $params['fontColor'];
if(isset($params['colorCap'])) self::$colorCap = $params['colorCap'];
if(self::$limitCat > 0){
$link = $request->getLink();
$page = 0;
$limit = self::$limitCat;
$catPage = 0;
if(preg_match('/pageG([0-9]+)_([0-9]+)/',$link,$tabLink))
$page = $tabLink[1];
if(isset($tabLink[2])) $catPage = $tabLink[2];
$linkParse = preg_replace('/,pageG([0-9]+)_([0-9]+)/', '', $link);
$linkParse = preg_replace('/'.permanent_link_ext.'/', '', $linkParse);
$linkParseS = explode('/',$linkParse);
$lp = array_shift($linkParseS);
$imageAll = $rowsCatCount['ile'];
$pageCount = ceil($imageAll/$limit);
if($catPage != $idCategory) $page = 0;
if($page > $pageCount) $page = 0;
$pageSql = 0;
if($page>0) $pageSql = $page-1;
$p = $pageSql*$limit;
self::$page = $p;
$lp .= ',pageG%s_'.$idCategory;
$lpc = implode('/',$linkParseS);
if($lpc != '') $linkPage = self::$root_.$lp.'/'.$lpc.permanent_link_ext.'#gal'.$idCategory;
else $linkPage = self::$root_.$lp.permanent_link_ext.'#gal'.$idCategory;
//$linkPage = self::$root_.$request->getCurrentSite().',pageG%s_'.$idCategory.'.html#gal'.$idCategory;
$Stronicowanie = new Stronicowanie($imageAll,$page,$linkPage,$limit);
if($Stronicowanie->max_pages > 1)
self::$pagenavig = $Stronicowanie->write_line(true);
}
if(self::$typCategory == 1){
self::$countImg = 0;
self::$widthGallery = Services::getConfigCms()->getContentWidth();
self::getParamsGallery($wcdb);
if($rowsCatCount['ile'] > 0) self::showCategoryType1($wcdb,$idCategory,$request);
}
if(self::$typCategory == 2){
self::$countImg = 0;
if($rowsCatCount['ile'] > 0) self::showCategoryType2($wcdb,$idCategory,$request);
}
if(self::$typCategory == 3){
self::$countImg = 0;
if($rowsCatCount['ile'] > 0) self::showCategoryType2($wcdb,$idCategory,$request);
}
if(self::$typCategory == 4){
self::$countImg = 0;
if($rowsCatCount['ile'] > 0) self::showCategoryType4($wcdb,$idCategory,$request);
}
if(self::$typCategory == 5){
self::$countImg = 0;
if($rowsCatCount['ile'] > 0) self::showCategoryType5($wcdb,$idCategory,$request);
}
return $rowsCatCount['ile'];
}
public static function parseGallery ($request,&$description, $language,$match,$widthGallery ){
$root_ = WWW_ADDRESS . ( $language != DEFAULT_LANGUAGE ? $language . '/' : '' );
$pagenavig = '';
Services::getLanguage()->setActualLang( $language );
$tmplGallery = '';
$smarty = Services::getTemplate();
add_file_css( 'keyframe.css' );
$menuAll = $request->getMenuAll();
$actualMenu = $request->getActualMenu();
$parentMenu = $actualMenu['id'];
$aMenu = array();
if($actualMenu['id_link'] == 0){
$aMenu = $actualMenu;
}
else{
$id_l = intval($actualMenu['id_link']);
$parentMenu = $actualMenu['id'];
$y = 0;
while($id_l != 0 && $y<5 ){
if($id_l >0) $parentMenu = $menuAll[$id_l]['id'];
if(isset($menuAll[$id_l])) $id_l = $menuAll[$id_l]['id_link'];
$y++;
}
}
$aMenu = $menuAll[$parentMenu];
if(Services::getConfigCms()->getContentWidthMin() > 0 && $request->isSubMenu && $aMenu['show_menu']){
$widthGallery = Services::getConfigCms()->getContentWidthMin();
}
self::$language = $language;
self::$root_ = $root_;
self::$widthGallery = $widthGallery;
//debugTxt($request->getLink());
//debugTxt($request->getMenuAll());
$match[0] = array_reverse( $match[0], true );
$gallery_match = array();
$galleryConfig = array();
foreach($match[0] as $idm_ => $m_){
$desc1 = substr( $description, 0, $m_[1] );
$desc2 = substr( $description, $m_[1] + strlen( $m_[0] ) );
$gallery_id = $match[2][$idm_][0];
$description = $desc1 . '[[::gallery='.$gallery_id.'::]]' . $desc2;
$gallery_match[$gallery_id] = $gallery_id;
$galleryConfig[$gallery_id] = $match[2][$idm_][0];
}
if(count($gallery_match) > 0){
$wcdb = Services::getDB();
$smarty = Services::getTemplate();
$actualMenu = $request->getActualMenu();
$ileD = 0;
foreach($gallery_match as $idg){
$tabGalKat = explode('_',$idg);
$smarty->assign('gallery',array());
$smarty->assign('category',array());
if(count($tabGalKat == 2)){
//---------------------------------------------------------GALERIA------------------------------------------
if($tabGalKat[0] == 'g'){
$idGallery = $tabGalKat[1];
Parser::getGallery($wcdb,$idGallery,$request);
}
//---------------------------------------------------------KATEGORIA------------------------------------------
if($tabGalKat[0] == 'k'){
$idCategory = $tabGalKat[1];
$gallImage = Parser::getImageCategory($wcdb,$idCategory,$request);
}
//---------------------------------------------------------------------------------------------------
if(self::$countCat > 0 || self::$countImg>0){
global $files_js_tab;
add_file_js_tmpl('gallery_m.js');
$smarty->assign('indx',$ileD);
if($tabGalKat[0] == 'g'){
switch (self::$typGallery){
case 1:
$files_js_tab['jquery'] = WWW_ADDRESS.'js/prettyphoto/jquery.js';
add_file_css( 'gallery.css' );
add_file_js_tmpl('gallery.js');
$_SESSION['linkPowrot'] = $root_.$request->getCurrentSite().permanent_link_ext;
$tmplGallery = 'templates/'.TEMPLATES.'/tmpl/gallery.tpl';
break;
case 2:
$files_js_tab['lazyload'] = WWW_ADDRESS.'lib/jquery.lazyload.js';
$files_js_tab['qazy'] = WWW_ADDRESS.'lib/qazy.js';
add_file_css( 'gallery2.css' );
add_file_js_tmpl('gallery2.js');
$tmplGallery = 'templates/'.TEMPLATES.'/tmpl/gallery2.tpl';
break;
case 3:
$files_js_tab['lazyload'] = WWW_ADDRESS.'lib/jquery.lazyload.js';
$files_js_tab['qazy'] = WWW_ADDRESS.'lib/qazy.js';
add_file_css( 'gallery3.css' );
add_file_js_tmpl('gallery3.js');
$tmplGallery = 'templates/'.TEMPLATES.'/tmpl/gallery3.tpl';
break;
case 4:
$files_js_tab['lazyload'] = WWW_ADDRESS.'lib/jquery.lazyload.js';
$files_js_tab['qazy'] = WWW_ADDRESS.'lib/qazy.js';
add_file_css( 'gallery4.css' );
add_file_js_tmpl('gallery4.js');
$tmplGallery = 'templates/'.TEMPLATES.'/tmpl/gallery4.tpl';
break;
case 5:
$files_js_tab['lazyload'] = WWW_ADDRESS.'lib/jquery.lazyload.js';
$files_js_tab['qazy'] = WWW_ADDRESS.'lib/qazy.js';
add_file_css( 'gallery5.css' );
add_file_js_tmpl('gallery5.js');
$tmplGallery = 'templates/'.TEMPLATES.'/tmpl/gallery5.tpl';
break;
}
}
if($tabGalKat[0] == 'k'){
$smarty->assign('idCategory',$idCategory);
switch (self::$typCategory){
case 1:
$files_js_tab['jquery'] = WWW_ADDRESS.'js/prettyphoto/jquery.js';
add_file_css( 'gallery.css' );
add_file_js_tmpl('gallery.js');
$_SESSION['linkPowrot'] = $root_.$request->getCurrentSite().permanent_link_ext;
$tmplGallery = 'templates/'.TEMPLATES.'/tmpl/gallery.tpl';
break;
case 2:
$files_js_tab['lazyload'] = WWW_ADDRESS.'lib/jquery.lazyload.js';
$files_js_tab['qazy'] = WWW_ADDRESS.'lib/qazy.js';
add_file_css( 'gallery2.css' );
add_file_js_tmpl('gallery_c2.js');
$tmplGallery = 'templates/'.TEMPLATES.'/tmpl/gallery2.tpl';
break;
case 3:
$files_js_tab['lazyload'] = WWW_ADDRESS.'lib/jquery.lazyload.js';
$files_js_tab['qazy'] = WWW_ADDRESS.'lib/qazy.js';
add_file_css( 'gallery3.css' );
add_file_js_tmpl('gallery_c3.js');
$tmplGallery = 'templates/'.TEMPLATES.'/tmpl/gallery3.tpl';
break;
case 4:
$files_js_tab['lazyload'] = WWW_ADDRESS.'lib/jquery.lazyload.js';
$files_js_tab['qazy'] = WWW_ADDRESS.'lib/qazy.js';
add_file_css( 'gallery4.css' );
add_file_js_tmpl('gallery_c4.js');
$tmplGallery = 'templates/'.TEMPLATES.'/tmpl/gallery4.tpl';
break;
case 5:
$files_js_tab['lazyload'] = WWW_ADDRESS.'lib/jquery.lazyload.js';
$files_js_tab['qazy'] = WWW_ADDRESS.'lib/qazy.js';
add_file_css( 'gallery5.css' );
add_file_js_tmpl('gallery_c5.js');
$tmplGallery = 'templates/'.TEMPLATES.'/tmpl/gallery5.tpl';
break;
}
}
$description = str_replace('[[::gallery='.$idg.'::]]', $smarty -> fetch( $tmplGallery ), $description);
}
else{
$description = str_replace('[[::gallery='.$idg.'::]]', '', $description);
}
}
$ileD++;
}
}
}
//-------------------------------------GALERIE-----------------------------------------
public function showGalleryType1($wcdb,$tabGal,$idGallery,$request){
$smarty = Services::getTemplate();
$inc = 0;
$quantity_gal = self::$quantity_gal;
$quantity_col = $quantity_gal > 0 ? ($quantity_gal < 20 ? (int)$quantity_gal : 20) : 3;
$l_ = round(self::$widthGallery / $quantity_col) - ($quantity_col < 10 ? 10 : 0);
if($l_ > 255) $l_ = 255;
$i=0;
$tabHeightImg = array();
$catImage = array();
$catDescription = array();
$reszta = 0;
foreach($tabGal as $d){
$sql = 'SELECT gi.id, gi.img, gi.img_w, gi.img_h FROM gallery_img gi, gallery_img_category c WHERE gi.id_gallery = ' . $idGallery . ' AND c.id_img = gi.id AND c.id_cat = '.$d->c_id.' AND c.active = 1 ORDER BY c.main DESC LIMIT 1';
$d2 = $wcdb->loadRowsList($sql);
if(count($d2) == 0) continue;
$d2 = $d2[0];
if($dim = getimagesize(ltrim(WWW_GALLERY,'/\\') . $d2['img'])){
$l_1 = $l_;
if(self::$ustawSzerokosc == 1){
if($dim[0]/$dim[1] < 1){
$l_1 = $l_*(intval($dim[0]/$dim[1]));
}
}
resizeImg( $dim[0], $dim[1], $l_, $l_1 );
$catImage[$d2['id']]['link'] = self::$root_.$request->getCurrentSite() . '/' . $d->c_link . '-c' . $d->c_id . permanent_link_ext;
$catImage[$d2['id']]['imgI'] = $d2['img'];
$catImage[$d2['id']]['img'] = WWW_GALLERY . 'image'.$dim[0].'x'.$dim[1].'/' . $d2['img'];
$catImage[$d2['id']]['img_w'] = $l_;
$catImage[$d2['id']]['img_h'] = $dim[1];
$catDescription[$d2['id']] = $d->c_name!=''?$d->c_name:' ';
$cat_config['width'] = $l_;
$cat_config['top'] = $d->pos_title_cat == 0;
if((self::$countCat)%$quantity_col == 0) {
$i++;
}
if(!isset($tabHeightImg[$i])) $tabHeightImg[$i] = 0;
if($dim[1] > $tabHeightImg[$i]){
$tabHeightImg[$i] = $dim[1];
}
self::$countCat++;
}
}
if(self::$countCat > 0){
if((self::$countCat%$quantity_col)) $reszta = $quantity_col-(self::$countCat%$quantity_col);
$i = 0;
$y = 0;
$m = 0;
foreach($catImage as $k=>$value){
if(($y)%$quantity_col == 0) {
$i++;
}
if(isset($tabHeightImg[$i])){
$catImage[$k]['div_h'] = ($tabHeightImg[$i]+2);
$m = floor(($tabHeightImg[$i]-$value['img_h'])/2);
}
if(self::$stalyWymiarGal == 1){
$catImage[$k]['margin_h'] = 0;
$catImage[$k]['img'] = WWW_GALLERY . 'image'.$value['img_w'].'x'.$tabHeightImg[$i].'xs2/' . $value['imgI'];
$catImage[$k]['img_h'] = $tabHeightImg[$i];
}
else{
$catImage[$k]['margin_h'] = $m;
}
$y++;
}
$smarty->assign('gallery_config', array(
'quantity_col' => $quantity_col,
'cat_top_title' => $cat_config['top'],
'cat_td_width' => $cat_config['width']
));
$smarty->assign('category', array('desc' => $catDescription, 'img' => $catImage));
$smarty->assign('reszta', $reszta);
$smarty->assign('contentWidth', self::$widthGallery);
$smarty->assign('parser', 1);
$smarty->assign('description', '');
}
}
static function showGalleryType2($wcdb,$tabGal,$idGallery,$request){
$truncateTxt = self::$truncateTxt;
$hMin = 0;
$smarty = Services::getTemplate();
$catImage = array();
$tabStyleLi = array();
$tabStyleTitleCap = array();
$tabStyleTitleCap2 = array();
$tabStyleFontCap = array();
$tabStyleBacgrCap = array();
$quantity_col = self::$quantity_gal > 0 ? (self::$quantity_gal < 20 ? (int)self::$quantity_gal : 20) : 2;
$widthBoxOrg = floor(self::$widthGallery / $quantity_col);
$ma = floor(self::$marginGall-floor(self::$marginGall/$quantity_col));
$pa = self::$ramkaGal*2;
$bo = ((self::$borderGal != '')?2:0);
$l_ = $widthBoxOrg-$ma-$pa-$bo;
self::$gall_td_width = $l_;
//if($quantity_col == 3) $truncateTxt = 50;
if($quantity_col > 3) {
//$truncateTxt = 20;
//self::$showOpis = 0;
}
foreach($tabGal as $key=>$d) {
$sql = 'SELECT c.id_cat,gi.id, gi.img, gi.img_w, gi.img_h ';
$sql .= 'FROM gallery_img gi, gallery_img_category c ';
$sql .= 'WHERE gi.id_gallery = ' . $idGallery;
$sql .= ' AND c.id_img = gi.id ';
$sql .= ' AND c.id_cat = '.$d->c_id;
$sql .= ' AND c.active = 1 ';
$sql .= ' ORDER BY c.main DESC LIMIT 1';
$d2 = $wcdb->loadObjectList($sql);
if(count($d2) == 0) continue;
$d2 = $d2[0];
if($dim = getimagesize(ltrim(WWW_GALLERY,'/\\') . $d2->img)){
resizeImg( $dim[0], $dim[1], $l_, $l_ );
if($hMin == 0 || $hMin>$dim[1]){
$hMin = $dim[1];
}
$catImage[$d2->id]['link'] = self::$root_.$request->getCurrentSite() . '/' . $d->c_link . '-c' . $d->c_id . permanent_link_ext;
if(isset(self::$tabGalleryMenu[$d->c_id])){
$catImage[$d2->id]['link'] = self::$root_.self::$tabGalleryMenu[$d->c_id]. permanent_link_ext;
}
$catImage[$d2->id]['imgI'] = $d2->img;
$catImage[$d2->id]['img_w'] = $l_;
$catImage[$d2->id]['img_h'] = $dim[1];
$catImage[$d2->id]['nameCat'] = $d->c_name!=''?$d->c_name:' ';
//$catImage[$d2->id]['trescCat'] = $d->tresc!=''?$d->tresc:' ';
$catImage[$d2->id]['imgSrc'] = $d2->img;
$catImage[$d2->id]['trescCat'] = truncateTxt(strip_tags($d->tresc),$truncateTxt,'...');
self::$countCat++;
}
}
foreach($catImage as $key=>$d) {
$catImage[$key]['img_h'] = $hMin;
if(self::$stalyWymiarGal == 1){
$catImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'xs2/' . $d['imgSrc'];
}
else{
if(self::$colorGal != '')
$catImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'x'.self::$colorGal.'xs4/' . $d['imgSrc'];
else
$catImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'xs4/' . $d['imgSrc'];
}
}
if(intval(self::$fontTitleSize) > 0) $tabStyleTitleCap[]= 'font-size:'.self::$fontTitleSize.'px';
if(self::$fontTitleColor != '') $tabStyleTitleCap[]= 'color:#'.self::$fontTitleColor;
if(intval(self::$fontSize) > 0) $tabStyleFontCap[]= 'font-size:'.self::$fontSize.'px';
if(self::$fontColor != '') $tabStyleFontCap[]= 'color:#'.self::$fontColor;
if(self::$colorCap != '') $tabStyleBacgrCap[] = 'background-color:rgba('.self::$colorCap.')';
$styleLi = '';
if(self::$borderGal != '') $tabStyleLi[] = 'border:1px solid #'.self::$borderGal;
if(self::$colorGal != '') $tabStyleLi[] = 'background-color:#'.self::$colorGal;
$tabStyleLi[] = 'margin:0px '.self::$marginGall.'px '.self::$marginGall.'px 0px';
$tabStyleLi[] = 'padding:'.self::$ramkaGal.'px';
$styleLi = implode(';',$tabStyleLi).';';
if(intval(self::$fontTitleSize) > 0) $tabStyleTitleCap2[]= 'font-size:'.self::$fontTitleSize.'px';
if(self::$fontTitleColor != '') $tabStyleTitleCap2[]= 'color:#'.self::$fontTitleColor;
if(intval(self::$ramkaGal)>0)
$tabStyleTitleCap2[]= 'padding:'.(self::$ramkaGal).'px;width:calc(100% - '.(self::$ramkaGal*2).'px)';
else
$tabStyleTitleCap2[]= 'padding:5px';
if(self::$colorGal != '') $tabStyleTitleCap2[] = 'background-color:#'.self::$colorGal;
$styleTitleCap = '';
$styleTitleCap2 = '';
$styleFontCap = '';
$styleBacgrCap = '';
if(count($tabStyleTitleCap) > 0) $styleTitleCap = ' style="'.implode(';',$tabStyleTitleCap).';" ';
if(count($tabStyleFontCap) > 0) $styleFontCap = ' style="'.implode(';',$tabStyleFontCap).';" ';
if(count($tabStyleBacgrCap) > 0) $styleBacgrCap = ' style="'.implode(';',$tabStyleBacgrCap).';" ';
if(count($tabStyleTitleCap2) > 0) $styleTitleCap2 = ' style="'.implode(';',$tabStyleTitleCap2).';" ';
$smarty->assign('gallery_config', array(
'quantity_col' => $quantity_col,
'widthImg' => self::$gall_td_width,
'margin' => self::$marginGall,
'ramkaGal' => self::$ramkaGal,
'colorGal' => self::$colorGal,
'borderGal' => self::$borderGal,
'showOpis' => self::$showOpis,
'stalyWymiarGal' => self::$stalyWymiarGal,
'fontColor' => self::$fontColor,
'fontTitleSize' => self::$fontTitleSize,
'widthGallery' => self::$widthGallery
));
$smarty->assign('styleLi', $styleLi);
$smarty->assign('styleTitleCap', $styleTitleCap);
$smarty->assign('styleTitleCap2', $styleTitleCap2);
$smarty->assign('styleFontCap', $styleFontCap);
$smarty->assign('styleBacgrCap', $styleBacgrCap);
$smarty->assign('idGallery', $idGallery);
$smarty->assign('gallery', $catImage);
$smarty->assign('contentWidth', self::$widthGallery);
$smarty->assign('parser', 1);
$smarty->assign('description', '');
}
static function showGalleryType3($wcdb,$tabGal,$idGallery,$request){
$truncateTxt = self::$truncateTxt;
$hMin = 0;
$smarty = Services::getTemplate();
$catImage = array();
$tabStyleLi = array();
$tabStyleTitleCap = array();
$tabStyleFontCap = array();
$tabStyleBacgrCap = array();
$quantity_col = self::$quantity_gal > 0 ? (self::$quantity_gal < 20 ? (int)self::$quantity_gal : 20) : 2;
$widthBoxOrg = floor(self::$widthGallery / self::$quantity_gal);
$ma = round(self::$marginGall-(self::$marginGall/self::$quantity_gal));
$pa = self::$ramkaGal*2;
$bo = ((self::$borderGal != '')?2:0);
$widthBoxOrg = $widthBoxOrg-$ma-$pa-$bo;
$l_ = floor(($widthBoxOrg-$ma-$pa-$bo)/2);
self::$gall_td_width = $l_;
foreach($tabGal as $key=>$d) {
$sql = 'SELECT c.id_cat,gi.id, gi.img, gi.img_w, gi.img_h ';
$sql .= 'FROM gallery_img gi, gallery_img_category c ';
$sql .= 'WHERE gi.id_gallery = ' . $idGallery;
$sql .= ' AND c.id_img = gi.id ';
$sql .= ' AND c.id_cat = '.$d->c_id;
$sql .= ' AND c.active = 1 ';
$sql .= ' ORDER BY c.main DESC LIMIT 1';
$d2 = $wcdb->loadObjectList($sql);
if(count($d2) == 0) continue;
$d2 = $d2[0];
if($dim = getimagesize(ltrim(WWW_GALLERY,'/\\') . $d2->img)){
resizeImg( $dim[0], $dim[1], $l_, $l_ );
if($hMin == 0 || $hMin>$dim[1]){
$hMin = $dim[1];
}
$catImage[$d2->id]['link'] = self::$root_.$request->getCurrentSite() . '/' . $d->c_link . '-c' . $d->c_id . permanent_link_ext;
if(isset(self::$tabGalleryMenu[$d->c_id])){
$catImage[$d2->id]['link'] = self::$root_.self::$tabGalleryMenu[$d->c_id]. permanent_link_ext;
}
$catImage[$d2->id]['imgI'] = $d2->img;
$catImage[$d2->id]['img_w'] = $l_;
$catImage[$d2->id]['img_h'] = $dim[1];
$catImage[$d2->id]['nameCat'] = $d->c_name!=''?$d->c_name:' ';
//$catImage[$d2->id]['trescCat'] = $d->tresc!=''?$d->tresc:' ';
$catImage[$d2->id]['imgSrc'] = $d2->img;
if($truncateTxt > 0)
$catImage[$d2->id]['trescCat'] = truncateTxt(strip_tags($d->tresc),$truncateTxt,'...');
else
$catImage[$d2->id]['trescCat'] = strip_tags($d->tresc);
self::$countCat++;
}
}
foreach($catImage as $key=>$d) {
$catImage[$key]['img_h'] = $hMin;
if(self::$stalyWymiarGal == 1){
$catImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'xs2/' . $d['imgSrc'];
}
else{
if(self::$colorGal != '')
$catImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'x'.self::$colorGal.'xs4/' . $d['imgSrc'];
else
$catImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'xs4/' . $d['imgSrc'];
}
}
$marginAImg = self::$ramkaGal;
if($marginAImg == 0) $marginAImg = 5;
if(intval(self::$fontTitleSize) > 0) $tabStyleTitleCap[]= 'font-size:'.self::$fontTitleSize.'px';
if(self::$fontTitleColor != '') $tabStyleTitleCap[]= 'color:#'.self::$fontTitleColor;
if(intval(self::$fontSize) > 0) $tabStyleFontCap[]= 'font-size:'.self::$fontSize.'px';
if(self::$fontColor != '') $tabStyleFontCap[]= 'color:#'.self::$fontColor;
if(self::$colorCap != '') $tabStyleBacgrCap[] = 'background-color:rgba('.self::$colorCap.')';
$styleLi = '';
if(self::$borderGal != '') $tabStyleLi[] = 'border:1px solid #'.self::$borderGal;
if(self::$colorGal != '') $tabStyleLi[] = 'background-color:#'.self::$colorGal;
$tabStyleLi[] = 'margin:0px '.self::$marginGall.'px '.self::$marginGall.'px 0px';
$tabStyleLi[] = 'padding:'.self::$ramkaGal.'px';
$styleLi = implode(';',$tabStyleLi).';';
$styleTitleCap = '';
$styleFontCap = '';
$styleBacgrCap = '';
if(count($tabStyleTitleCap) > 0) $styleTitleCap = ' style="'.implode(';',$tabStyleTitleCap).';" ';
if(count($tabStyleFontCap) > 0) $styleFontCap = ' style="'.implode(';',$tabStyleFontCap).';" ';
if(count($tabStyleBacgrCap) > 0) $styleBacgrCap = ' style="'.implode(';',$tabStyleBacgrCap).';" ';
$smarty->assign('gallery_config', array(
'quantity_col' => $quantity_col,
'widthImg' => self::$gall_td_width,
'margin' => self::$marginGall,
'ramkaGal' => self::$ramkaGal,
'colorGal' => self::$colorGal,
'borderGal' => self::$borderGal,
'showOpis' => self::$showOpis,
'stalyWymiarGal' => self::$stalyWymiarGal,
'widthBoxOrg' => $widthBoxOrg,
'marginAImg' => $marginAImg,
'fontColor' => self::$fontColor,
'widthGallery' => self::$widthGallery
));
$smarty->assign('styleLi', $styleLi);
$smarty->assign('styleTitleCap', $styleTitleCap);
$smarty->assign('styleFontCap', $styleFontCap);
$smarty->assign('styleBacgrCap', $styleBacgrCap);
$smarty->assign('gallery', $catImage);
$smarty->assign('contentWidth', self::$widthGallery);
$smarty->assign('parser', 1);
$smarty->assign('description', '');
}
static function showGalleryType5($wcdb,$tabGal,$idGallery,$request){
$truncateTxt = self::$truncateTxt;
$hMin = 0;
$smarty = Services::getTemplate();
$catImage = array();
$tabStyleLi = array();
$tabStyleTitleCap = array();
$tabStyleFontCap = array();
$tabStyleBacgrCap = array();
$quantity_col = self::$quantity_gal > 0 ? (self::$quantity_gal < 20 ? (int)self::$quantity_gal : 20) : 2;
$widthBoxOrg = floor(self::$widthGallery / $quantity_col);
$ma = floor(self::$marginGall-floor(self::$marginGall/$quantity_col));
$pa = self::$ramkaGal*2;
$bo = ((self::$borderGal != '')?2:0);
$l_ = $widthBoxOrg-$ma-$pa-$bo;
self::$gall_td_width = $l_;
/*
if($quantity_col == 3) $truncateTxt = 50;
if($quantity_col > 3) {
$truncateTxt = 20;
self::$showOpis = 0;
}
*/
foreach($tabGal as $key=>$d) {
$sql = 'SELECT c.id_cat,gi.id, gi.img, gi.img_w, gi.img_h ';
$sql .= 'FROM gallery_img gi, gallery_img_category c ';
$sql .= 'WHERE gi.id_gallery = ' . $idGallery;
$sql .= ' AND c.id_img = gi.id ';
$sql .= ' AND c.id_cat = '.$d->c_id;
$sql .= ' AND c.active = 1 ';
$sql .= ' ORDER BY c.main DESC LIMIT 1';
$d2 = $wcdb->loadObjectList($sql);
if(count($d2) == 0) continue;
$d2 = $d2[0];
if($dim = getimagesize(ltrim(WWW_GALLERY,'/\\') . $d2->img)){
resizeImg( $dim[0], $dim[1], $l_, $l_ );
if($hMin == 0 || $hMin>$dim[1]){
$hMin = $dim[1];
}
$catImage[$d2->id]['link'] = self::$root_.$request->getCurrentSite() . '/' . $d->c_link . '-c' . $d->c_id . permanent_link_ext;
if(isset(self::$tabGalleryMenu[$d->c_id])){
$catImage[$d2->id]['link'] = self::$root_.self::$tabGalleryMenu[$d->c_id]. permanent_link_ext;
}
$catImage[$d2->id]['imgI'] = $d2->img;
$catImage[$d2->id]['img_w'] = $l_;
$catImage[$d2->id]['img_h'] = $dim[1];
$catImage[$d2->id]['nameCat'] = $d->c_name!=''?$d->c_name:' ';
//$catImage[$d2->id]['trescCat'] = $d->tresc!=''?$d->tresc:' ';
$catImage[$d2->id]['imgSrc'] = $d2->img;
$catImage[$d2->id]['trescCat'] = truncateTxt(strip_tags($d->tresc),$truncateTxt,'...');
self::$countCat++;
}
}
foreach($catImage as $key=>$d) {
$catImage[$key]['img_h'] = $hMin;
if(self::$stalyWymiarGal == 1){
$catImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'xs2/' . $d['imgSrc'];
}
else{
if(self::$colorGal != '')
$catImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'x'.self::$colorGal.'xs4/' . $d['imgSrc'];
else
$catImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'xs4/' . $d['imgSrc'];
}
}
if(intval(self::$fontTitleSize) > 0) $tabStyleTitleCap[]= 'font-size:'.self::$fontTitleSize.'px';
if(self::$fontTitleColor != '') $tabStyleTitleCap[]= 'color:#'.self::$fontTitleColor;
if(intval(self::$fontSize) > 0) $tabStyleFontCap[]= 'font-size:'.self::$fontSize.'px';
if(self::$fontColor != '') $tabStyleFontCap[]= 'color:#'.self::$fontColor;
if(self::$colorCap != '') $tabStyleBacgrCap[] = 'background-color:rgba('.self::$colorCap.')';
$styleLi = '';
if(self::$borderGal != '') $tabStyleLi[] = 'border:1px solid #'.self::$borderGal;
if(self::$colorGal != '') $tabStyleLi[] = 'background-color:#'.self::$colorGal;
$tabStyleLi[] = 'margin:0px '.self::$marginGall.'px '.self::$marginGall.'px 0px';
$tabStyleLi[] = 'padding:'.self::$ramkaGal.'px';
$styleLi = implode(';',$tabStyleLi).';';
if(intval(self::$fontTitleSize) > 0) $tabStyleTitleCap2[]= 'font-size:'.self::$fontTitleSize.'px';
if(self::$fontTitleColor != '') $tabStyleTitleCap2[]= 'color:#'.self::$fontTitleColor;
$styleTitleCap = '';
$styleFontCap = '';
$styleBacgrCap = '';
if(count($tabStyleTitleCap) > 0) $styleTitleCap = implode(';',$tabStyleTitleCap).';text-align:center;padding-top:5px;';
if(count($tabStyleFontCap) > 0) $styleFontCap = ' style="'.implode(';',$tabStyleFontCap).';" ';
if(count($tabStyleBacgrCap) > 0) $styleBacgrCap = ' style="'.implode(';',$tabStyleBacgrCap).';" ';
$smarty->assign('gallery_config', array(
'quantity_col' => $quantity_col,
'widthImg' => self::$gall_td_width,
'margin' => self::$marginGall,
'ramkaGal' => self::$ramkaGal,
'colorGal' => self::$colorGal,
'borderGal' => self::$borderGal,
'showOpis' => self::$showOpis,
'stalyWymiarGal' => self::$stalyWymiarGal,
'fontColor' => self::$fontColor,
'fontTitleSize' => self::$fontTitleSize,
'widthGallery' => self::$widthGallery
));
$smarty->assign('styleLi', $styleLi);
$smarty->assign('styleTitleCap', $styleTitleCap);
$smarty->assign('styleFontCap', $styleFontCap);
$smarty->assign('styleBacgrCap', $styleBacgrCap);
$smarty->assign('gallery', $catImage);
$smarty->assign('contentWidth', self::$widthGallery);
$smarty->assign('parser', 1);
$smarty->assign('description', '');
}
//--------------------------------------------------KATEGORIE------------------------------------------------
function showCategoryType1($wcdb,$idCategory,$request){
$smarty = Services::getTemplate();
$query = "SELECT i.id, i.img, i.img_w, i.img_h, d.description,d.long_description,cat.img_seo, cat.quantity_col, cat.pos_title_img,
IF(cd.tytul_h1!='',cd.tytul_h1,cd.name) AS c_name, cd.link AS c_link,cat.id AS c_id
FROM gallery_img i, gallery_img_description d, gallery_img_category c,category cat ,category_description cd
WHERE
d.id_img = i.id
AND cat.id=c.id_cat
AND cd.id_category = cat.id
AND d.language = '".$wcdb->real_escape_string( self::$language )."'
AND cd.language = '".$wcdb->real_escape_string( self::$language )."'
AND c.id_img = i.id
AND c.active = 1
AND c.id_cat = ".$idCategory."
ORDER BY c.pos ASC,c.id_img DESC";
if(self::$limitCat != 0) $query .= " LIMIT ".self::$page.','.self::$limitCat;
$tabCategory = $wcdb->loadRowsList($query);
if(count($tabCategory)>0){
$i = 0;
$quantity_col = 0;
$seo = 1;
$seo = (bool)self::$seo;
$quantity_col = self::$quantity_cat > 0 ? (self::$quantity_cat < 20 ? (int)self::$quantity_cat : 20) : 3;
$l_ = round(self::$widthGallery / $quantity_col) - ($quantity_col < 10 ? 10 : 0);
if($l_ > 255) $l_ = 255;
foreach($tabCategory as $d){
if($dim = getimagesize(ltrim(WWW_GALLERY,'/\\') . $d['img'])){
$l_1 = $l_;
if(self::$ustawSzerokosc == 1){
if($dim[0]/$dim[1] < 1){
$l_1 = $l_*(intval($dim[0]/$dim[1]));
}
}
resizeImg( $dim[0], $dim[1], $l_, $l_1);
$gGallery[$d['id']] = $d['id'];
$gall_config['width'] = $l_;
$gall_config['top'] = $d['pos_title_img'] == 0;
$gallImage[$d['id']]['link'] = $seo ? self::$root_.$request->getCurrentSite() .'/' . $d['c_link'] . '-c' . $d['c_id'] . '/' . bez_smieci($d['description']!=''?$d['description']:preg_replace('/\.\w+$/','',$d['img'])) . '-g' . $d['id'] . permanent_link_ext : WWW_GALLERY . $d['img'];
//$gallImage[$d['id']]['link'] = $root_.$request->getCurrentSite() . '/' . $d['c_link'] . '-c' . $d['c_id'] . permanent_link_ext;
$gallImage[$d['id']]['imgI'] = $d['img'];
$gallImage[$d['id']]['img'] = WWW_GALLERY . 'image'.$dim[0].'x'.$dim[1].'/' . $d['img'];
$gallImage[$d['id']]['img_w'] = $l_;
$gallImage[$d['id']]['img_h'] = $dim[1];
$gallDescription[$d['id']] = $d['description'];
$gallImage[$d['id']]['alt'] = ($d['description']!=''?$d['description']:'image-'.$d['id']);
$gallImage[$d['id']]['linkA'] = self::$root_.$request->getCurrentSite() . '/'. $d['c_link'] . '-c' . $d['c_id'].'/' . bez_smieci($d['description']!=''?$d['description']:preg_replace('/\.\w+$/','',$d['img'])) . '-g' . $d['id'] . permanent_link_ext;
if((self::$countImg)%$quantity_col == 0) {
$i++;
}
if(!isset($tabHeightImg_im[$i])) $tabHeightImg_im[$i] = 0;
if($dim[1] > $tabHeightImg_im[$i]){
$tabHeightImg_im[$i] = $dim[1];
}
self::$countImg++;
}
}
}
$resztaImg = 0;
if(self::$countImg > 0){
if((self::$countImg%$quantity_col)) $resztaImg = $quantity_col-(self::$countImg%$quantity_col);
$i = 0;
$y = 0;
$m = 0;
foreach($gallImage as $k=>$value){
if(($y)%$quantity_col == 0) {
$i++;
}
if(isset($tabHeightImg_im[$i])){
$gallImage[$k]['div_h'] = $tabHeightImg_im[$i];
$m = floor(($tabHeightImg_im[$i]-$value['img_h'])/2);
}
if(self::$stalyWymiarGal == 1){
$gallImage[$k]['margin_h'] = 0;
$gallImage[$k]['img'] = WWW_GALLERY . 'image'.$value['img_w'].'x'.$tabHeightImg_im[$i].'xs2/' . $value['imgI'];
$gallImage[$k]['img_h'] = $tabHeightImg_im[$i];
}
else{
$gallImage[$k]['margin_h'] = $m;
}
$y++;
}
}
$smarty->assign('gallery_config', array(
'seo' => $seo,
'quantity_col' => $quantity_col,
'gall_top_title' => $gall_config['top'],
'gall_td_width' => $gall_config['width'],
));
$smarty->assign('gallery', array('desc' => $gallDescription, 'img' => $gallImage));
$smarty->assign('resztaImg', $resztaImg);
$smarty->assign('pagenavig',self::$pagenavig);
$smarty->assign('contentWidth', self::$widthGallery);
$smarty->assign('parser', 1);
$smarty->assign('description', '');
}
static function showCategoryType2($wcdb,$idCategory,$request){
$smarty = Services::getTemplate();
$quantity_col = 0;
$tabCategory = array();
$gallImage = array();
$tabStyleLi = array();
$tabStyleTitleCap = array();
$tabStyleTitleCap2 = array();
$tabStyleFontCap = array();
$tabStyleBacgrCap = array();
$tabCategory = self::getKategoriaID($wcdb,$idCategory);
if(count($tabCategory)>0){
foreach($tabCategory as $d){
$seo = (bool)$d->img_seo;
$quantity_col = self::$quantity_cat > 0 ? (self::$quantity_cat < 20 ? (int)self::$quantity_cat : 20) : 2;
$widthBoxOrg = floor(self::$widthGallery / self::$quantity_cat);
$ma = floor(self::$marginCat-(floor(self::$marginCat/self::$quantity_cat)));
$pa = self::$ramkaCat*2;
$bo = ((self::$borderCat != '')?2:0);
$l_ = $widthBoxOrg-$ma-$pa-$bo;
self::$cat_td_width = $l_;
$hMin = 0;
//self::$cat_td_width = $l_;
if($dim = getimagesize(ltrim(WWW_GALLERY,'/\\') . $d->img)){
resizeImg( $dim[0], $dim[1], $l_, $l_);
if($hMin == 0 || $hMin>$dim[1]){
$hMin = $dim[1];
}
$gallImage[$d->id]['link'] = $seo ? self::$root_.$request->getCurrentSite() .'/' . $d->c_link . '-c' . $d->c_id . '/' . bez_smieci($d->description!=''?$d->description:preg_replace('/\.\w+$/','',$d->img)) . '-g' . $d->id . permanent_link_ext : WWW_GALLERY . $d->img;
$gallImage[$d->id]['imgI'] = $d->img;
$gallImage[$d->id]['img_w'] = $l_;
$gallImage[$d->id]['img_h'] = $dim[1];
$gallImage[$d->id]['tresc'] = $d->description;
$gallImage[$d->id]['alt'] = ($d->description!=''?$d->description:'image-'.$d->id);
$gallImage[$d->id]['linkA'] = self::$root_.$request->getCurrentSite() . '/'. $d->c_link . '-c' . $d->c_id.'/' . bez_smieci($d->description!=''?$d->description:preg_replace('/\.\w+$/','',$d->img)) . '-g' . $d->id . permanent_link_ext;
$gallImage[$d->id]['trescCat'] = $d->description!=''?$d->description:' ';
$gallImage[$d->id]['imgSrc'] = $d->img;
$gallImage[$d->id]['desc'] = $d->description;
self::$countImg++;
}
}
foreach($gallImage as $key=>$d) {
$gallImage[$key]['img_h'] = $hMin;
if(self::$stalyWymiarCat == 1){
$gallImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'xs2/' . $d['imgSrc'];
}
else{
if(self::$colorCat != '')
$gallImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'x'.self::$colorCat.'xs4/' . $d['imgSrc'];
else
$gallImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'xs4/' . $d['imgSrc'];
}
}
}
$styleLi = '';
$styleTitleCap = '';
$styleTitleCap2 = '';
if(self::$borderCat != '') $tabStyleLi[] = 'border:1px solid #'.self::$borderCat;
if(self::$colorCat != '') $tabStyleLi[] = 'background-color:#'.self::$colorCat;
$tabStyleLi[] = 'margin:0px '.self::$marginCat.'px '.self::$marginCat.'px 0px';
$tabStyleLi[] = 'padding:'.self::$ramkaCat.'px';
$styleLi = implode(';',$tabStyleLi).';';
if(intval(self::$ramkaCat) > 0) $tabStyleTitleCap[] = 'padding:'.self::$ramkaCat.'px;width: calc(100% - '.(self::$ramkaCat*2).'px)';
else $tabStyleTitleCap[] = 'padding:5px';
if(self::$stalyWymiarCat){
if(self::$colorCap != '') $tabStyleTitleCap[] = 'background-color:rgba('.self::$colorCap.')';
}
if(intval(self::$fontTitleSize) > 0) $tabStyleTitleCap[]= 'font-size:'.self::$fontTitleSize.'px';
if(self::$fontTitleColor != '') $tabStyleTitleCap[]= 'color:#'.self::$fontTitleColor;
if(count($tabStyleTitleCap) > 0) $styleTitleCap = ' style="'.implode(';',$tabStyleTitleCap).';" ';
if(intval(self::$fontTitleSize) > 0) $tabStyleTitleCap2[]= 'font-size:'.self::$fontTitleSize.'px';
if(self::$fontTitleColor != '') $tabStyleTitleCap2[]= 'color:#'.self::$fontTitleColor;
if(intval(self::$ramkaCat) > 0) $tabStyleTitleCap2[] = 'padding:'.self::$ramkaCat.'px;width: calc(100% - '.(self::$ramkaCat*2).'px)';
else $tabStyleTitleCap2[] = 'padding:5px';
if(self::$colorCat != '') $tabStyleTitleCap2[] = 'background-color:#'.self::$colorCat;
if(count($tabStyleTitleCap2) > 0) $styleTitleCap2 = ' style="'.implode(';',$tabStyleTitleCap2).';" ';
$smarty->assign('styleLi', $styleLi);
$smarty->assign('styleTitleCap', $styleTitleCap);
$smarty->assign('styleTitleCap2', $styleTitleCap2);
//$smarty->assign('styleTitleCap', $styleTitleCap);
//$smarty->assign('styleTitleCap2', $styleTitleCap2);
//$smarty->assign('styleFontCap', $styleFontCap);
//$smarty->assign('styleBacgrCap', $styleBacgrCap);
$smarty->assign('category_config', array(
'quantity_col' => $quantity_col,
'widthImg' => self::$cat_td_width,
'margin' => self::$marginCat,
'ramkaCat' => self::$ramkaCat,
'colorCat' => self::$colorCat,
'borderCat' => self::$borderCat,
'showPodpisCat' => self::$showPodpisCat,
'stalyWymiarCat' => self::$stalyWymiarCat,
'fontColor' => self::$fontColor,
'fontTitleSize' => self::$fontTitleSize,
'imgZoom' => self::$imgZoom,
'widthGallery' => self::$widthGallery
));
$smarty->assign('idCategory', $idCategory);
$smarty->assign('category', $gallImage);
$smarty->assign('pagenavig',self::$pagenavig);
$smarty->assign('contentWidth', self::$widthGallery);
$smarty->assign('parser', 1);
$smarty->assign('description', '');
}
static function showCategoryType4($wcdb,$idCategory,$request){
$smarty = Services::getTemplate();
$quantity_col = 0;
$tabCategory = array();
$gallImage = array();
$tabStyleTitleCap = array();
$truncateTxt = self::$truncateTxt;
$tabCategory = self::getKategoriaID($wcdb,$idCategory);
if(count($tabCategory)>0){
foreach($tabCategory as $d){
$seo = (bool)$d->img_seo;
$quantity_col = self::$quantity_cat > 0 ? (self::$quantity_cat < 20 ? (int)self::$quantity_cat : 20) : 2;
if($quantity_col == 1) $quantity_col = 2;
$widthBoxOrg = floor(self::$widthGallery / $quantity_col);
$ma = floor(self::$marginCat-(floor(self::$marginCat/self::$quantity_cat)));
$pa = self::$ramkaCat*2;
$bo = ((self::$borderCat != '')?2:0);
$l_ = $widthBoxOrg-$ma-$pa-$bo;
self::$cat_td_width = $l_;
if(self::$countImg == 0){
$l_ = $l_*2+self::$marginCat+$pa+$bo;
}
$hMin = 0;
//self::$cat_td_width = $l_;
if($dim = getimagesize(ltrim(WWW_GALLERY,'/\\') . $d->img)){
resizeImg( $dim[0], $dim[1], $l_, $l_);
if($hMin == 0 || $hMin>$dim[1]){
$hMin = $dim[1];
}
$gallImage[$d->id]['link'] = $seo ? self::$root_.$request->getCurrentSite() .'/' . $d->c_link . '-c' . $d->c_id . '/' . bez_smieci($d->description!=''?$d->description:preg_replace('/\.\w+$/','',$d->img)) . '-g' . $d->id . permanent_link_ext : WWW_GALLERY . $d->img;
$gallImage[$d->id]['imgI'] = $d->img;
$gallImage[$d->id]['img_w'] = $l_;
$gallImage[$d->id]['img_h'] = $dim[1];
$gallImage[$d->id]['tresc'] = $d->description;
$gallImage[$d->id]['alt'] = ($d->description!=''?$d->description:'image-'.$d->id);
$gallImage[$d->id]['linkA'] = self::$root_.$request->getCurrentSite() . '/'. $d->c_link . '-c' . $d->c_id.'/' . bez_smieci($d->description!=''?$d->description:preg_replace('/\.\w+$/','',$d->img)) . '-g' . $d->id . permanent_link_ext;
$gallImage[$d->id]['trescCat'] = $d->description!=''?$d->description:' ';
$gallImage[$d->id]['imgSrc'] = $d->img;
$gallImage[$d->id]['desc'] = $d->description;
if($truncateTxt > 0)
$gallImage[$d->id]['long_desc'] = truncateTxt(strip_tags($d->long_description),$truncateTxt,'...');
else
$gallImage[$d->id]['long_desc'] = strip_tags($d->long_description);
self::$countImg++;
}
}
$y = 0;
foreach($gallImage as $key=>$d) {
$hMinS = $hMin;
$l_s = $l_;
if($y == 0) {
$hMinS = $hMin*2+self::$marginCat*2+$pa+$bo;
$l_s = $l_*2+self::$marginCat+$pa+$bo;
}
$gallImage[$key]['img_h'] = $hMinS;
if(self::$stalyWymiarCat == 1){
$gallImage[$key]['img'] = WWW_GALLERY . 'image'.$l_s.'x'.$hMinS.'xs2/' . $d['imgSrc'];
}
else{
if(self::$colorCat != '')
$gallImage[$key]['img'] = WWW_GALLERY . 'image'.$l_s.'x'.$hMinS.'x'.self::$colorCat.'xs4/' . $d['imgSrc'];
else
$gallImage[$key]['img'] = WWW_GALLERY . 'image'.$l_s.'x'.$hMinS.'xs4/' . $d['imgSrc'];
}
$y++;
}
}
if(intval(self::$fontTitleSize) > 0) $tabStyleTitleCap[]= 'font-size:'.self::$fontTitleSize.'px';
if(self::$fontTitleColor != '') $tabStyleTitleCap[]= 'color:#'.self::$fontTitleColor;
if(intval(self::$ramkaCat) > 0) $tabStyleTitleCap[] = 'padding:'.self::$ramkaCat.'px;width: calc(100% - '.(self::$ramkaCat*2).'px)';
else $tabStyleTitleCap[] = 'padding:5px';
if(self::$colorCap != '') $tabStyleTitleCap[] = 'background-color:rgba('.self::$colorCap.')';
if(count($tabStyleTitleCap) > 0) $styleTitleCap = ' style="'.implode(';',$tabStyleTitleCap).';" ';
$smarty->assign('styleTitleCap', $styleTitleCap);
$smarty->assign('category_config', array(
'quantity_col' => $quantity_col,
'widthImg' => $l_,
'margin' => self::$marginCat,
'ramkaCat' => self::$ramkaCat,
'colorCat' => self::$colorCat,
'borderCat' => self::$borderCat,
'showPodpisCat' => self::$showPodpisCat,
'stalyWymiarCat' => self::$stalyWymiarCat,
'fontColor' => self::$fontColor,
'fontTitleSize' => self::$fontTitleSize,
'showFirstDesc' => self::$showOpisCat,
'imgZoom' => self::$imgZoom,
'widthGallery' => self::$widthGallery
));
$smarty->assign('idCategory', $idCategory);
$smarty->assign('category', $gallImage);
$smarty->assign('pagenavig',self::$pagenavig);
$smarty->assign('contentWidth', self::$widthGallery);
$smarty->assign('parser', 1);
$smarty->assign('description', '');
}
static function showCategoryType5($wcdb,$idCategory,$request){
$smarty = Services::getTemplate();
$quantity_col = 0;
$tabCategory = array();
$gallImage = array();
$tabCategory = self::getKategoriaID($wcdb,$idCategory);
if(count($tabCategory)>0){
foreach($tabCategory as $d){
$seo = (bool)$d->img_seo;
$quantity_col = self::$quantity_cat > 0 ? (self::$quantity_cat < 20 ? (int)self::$quantity_cat : 20) : 2;
$widthBoxOrg = floor(self::$widthGallery / self::$quantity_cat);
$ma = floor(self::$marginCat-(floor(self::$marginCat/self::$quantity_cat)));
$pa = self::$ramkaCat*2;
$bo = ((self::$borderCat != '')?2:0);
$l_ = $widthBoxOrg-$ma-$pa-$bo;
self::$cat_td_width = $l_;
$hMin = 0;
//self::$cat_td_width = $l_;
if($dim = getimagesize(ltrim(WWW_GALLERY,'/\\') . $d->img)){
resizeImg( $dim[0], $dim[1], $l_, $l_);
//debugTxt($l_);
if($hMin == 0 || $hMin>$dim[1]){
$hMin = $dim[1];
}
$gallImage[$d->id]['link'] = $seo ? self::$root_.$request->getCurrentSite() .'/' . $d->c_link . '-c' . $d->c_id . '/' . bez_smieci($d->description!=''?$d->description:preg_replace('/\.\w+$/','',$d->img)) . '-g' . $d->id . permanent_link_ext : WWW_GALLERY . $d->img;
$gallImage[$d->id]['imgI'] = $d->img;
$gallImage[$d->id]['img_w'] = $l_;
$gallImage[$d->id]['img_h'] = $dim[1];
$gallImage[$d->id]['tresc'] = strip_tags($d->long_description);
$gallImage[$d->id]['alt'] = ($d->description!=''?$d->description:'image-'.$d->id);
$gallImage[$d->id]['linkA'] = self::$root_.$request->getCurrentSite() . '/'. $d->c_link . '-c' . $d->c_id.'/' . bez_smieci($d->description!=''?$d->description:preg_replace('/\.\w+$/','',$d->img)) . '-g' . $d->id . permanent_link_ext;
$gallImage[$d->id]['trescCat'] = $d->description!=''?$d->description:' ';
$gallImage[$d->id]['imgSrc'] = $d->img;
$gallImage[$d->id]['desc'] = $d->description;
self::$countImg++;
}
}
foreach($gallImage as $key=>$d) {
$gallImage[$key]['img_h'] = $hMin;
if(self::$stalyWymiarCat == 1){
$gallImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'xs2/' . $d['imgSrc'];
}
else{
if(self::$colorCat != '')
$gallImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'x'.self::$colorCat.'xs4/' . $d['imgSrc'];
else
$gallImage[$key]['img'] = WWW_GALLERY . 'image'.$l_.'x'.$hMin.'xs4/' . $d['imgSrc'];
}
$gallImage[$key]['imgMax'] = WWW_GALLERY . 'image'.($l_+100).'x'.($hMin+100).'xs5/' . $d['imgSrc'];
}
}
$smarty->assign('category_config', array(
'quantity_col' => $quantity_col,
'widthImg' => self::$cat_td_width,
'margin' => self::$marginCat,
'ramkaCat' => self::$ramkaCat,
'colorCat' => self::$colorCat,
'borderCat' => self::$borderCat,
'showPodpisCat' => self::$showPodpisCat,
'stalyWymiarCat' => self::$stalyWymiarCat,
'fontTitleColor' => self::$fontTitleColor,
'fontTitleSize' => self::$fontTitleSize,
'imgZoom' => self::$imgZoom,
'widthGallery' => self::$widthGallery
));
$smarty->assign('idCategory', $idCategory);
$smarty->assign('category', $gallImage);
$smarty->assign('pagenavig',self::$pagenavig);
$smarty->assign('contentWidth', self::$widthGallery);
$smarty->assign('parser', 1);
$smarty->assign('description', '');
}
//----------------------------------------------------------------------------------------------------
static function getKategoriaID($wcdb,$idCategory){
$query = "SELECT i.id, i.img, i.img_w, i.img_h, d.description,d.long_description,cat.img_seo, cat.quantity_col, cat.pos_title_img,
IF(cd.tytul_h1!='',cd.tytul_h1,cd.name) AS c_name, cd.link AS c_link,cat.id AS c_id
FROM gallery_img i, gallery_img_description d, gallery_img_category c,category cat ,category_description cd
WHERE
d.id_img = i.id
AND cat.id=c.id_cat
AND cd.id_category = cat.id
AND d.language = '".$wcdb->real_escape_string( self::$language )."'
AND cd.language = '".$wcdb->real_escape_string( self::$language )."'
AND c.id_img = i.id
AND c.active = 1
AND c.id_cat = ".$idCategory."
ORDER BY c.pos ASC,c.id_img DESC";
if(self::$limitCat > 0) $query .= " LIMIT ".self::$page.','.self::$limitCat;
$tabCategory = $wcdb->loadObjectList($query);
return $tabCategory;
}
static function buildGalleryFromDescription($request, $dsc, $lang ){
}
}
?>
Fatal error: Class 'Parser' not found in /srv/www/webs/heileautoteile/webroot/content/model/wrapper.php on line 0