File: D:/HostingSpaces/SBogers10/verrassendveel.komma.pro/wwwroot/php/getThemes.php
<?php
function getThemes(){
$output = '';
if(isset($_GET['sub'])){
$output .= show();
}
else{
$output .= index();
}
return $output;
}
function index(){
global $mysqli;
//// Get Info Introtext \\\\
$introquery = 'SELECT title, description
FROM themesintro, content_status AS s
WHERE s.active = 1
AND s.itemId = themesintro.id
AND s.linkname = "themesintro"
LIMIT 1';
$introresult = $mysqli->query($introquery);
$introrecord = $introresult->fetch_assoc();
$introtitle = fromDatabase($introrecord['title']);
$introdescription = fromDatabase($introrecord['description']);
//// create variable \\\\
$output = '';
$output .= '<div class="pagetop"></div>';
$output .= '<div class="mid-content-container page-top-margin">';
$output .= '<h1>'.$introtitle.'</h1>';
$output .= '<hr class="mid-content" />';
//// intro tekst \\\\
$output .= '<div class="page-column">';
$output .= $introdescription;
$output .= '</div>';
$output .= '<div class="clear"></div>';
//// Get Info themes \\\\
$query = 'SELECT themes.id,
themes.title,
themes.description,
themes.thumbnail
FROM themes, content_status AS s
WHERE s.active = 1
AND s.itemId = themes.id
AND s.linkname = "themes"
ORDER BY themes.itemOrder DESC';
$result = $mysqli->query($query);
$output .= '<div class="thumb-row">';
$blocks = '';
$i = 1;
while($record = $result->fetch_assoc()){
$title = fromDatabase($record['title']);
$shortcode = $record['thumbnail'];
$blocks .='<div class="block">
<h2>'.$title.'</h2>';
$blocks .= '<div class="image-container">';
# prepare image holder for nice hover effect
# ( 1 ) get both hover and thumbnail images
$shortcode = substr($shortcode, 1, -1);
$mediaResult = $mysqli->query('SELECT title, path, filename_hover FROM media_files WHERE shortcode = "'.$shortcode.'" LIMIT 1');
$mediaRecord = $mediaResult->fetch_assoc();
$filename = $mediaRecord['path'];
$hover = $mediaRecord['filename_hover'];
$mediaTitle = fromDatabase($mediaRecord['title']);
$linkTitle = linkname($title);
$blocks .= '<a class="image-holder" href="./wat-zoek-je/'.$linkTitle.'/">';
$blocks .= '<img src="./images/uploads/'.$hover.'" alt="'.$mediaTitle.'" />';
$blocks .= '</a>';
$blocks .= '<a class="hover-button web-btn" href="./wat-zoek-je/'.$linkTitle.'/">
<span class="btn-text">Lees meer</span>
<span class="arrow btn-arrow"></span>
<span class="btn-green-288"></span>
<span class="btn-darkgreen-288 hover"></span>
</a>';
$blocks .= '</div></div>';
$output .= $blocks;
$blocks = '';
$i++;
}
$output .= '<div class="clear thumb-img-replacement"></div>';
$output .= '</div>';
$output .= '</div>';
//// return output \\\\
return $output;
}
function show(){
global $mysqli;
//// Get Info Introtext \\\\
$introquery = 'SELECT title, description
FROM themesintro, content_status AS s
WHERE s.active = 1
AND s.itemId = themesintro.id
AND s.linkname = "themesintro"
LIMIT 1';
$introresult = $mysqli->query($introquery);
$introrecord = $introresult->fetch_assoc();
$introtitle = fromDatabase($introrecord['title']);
//// get id \\\\
$idquery = 'SELECT themes.id, themes.title
FROM themes, content_status AS s
WHERE s.active = 1
AND s.itemId = themes.id
AND s.linkname = "themes"';
$idresult = $mysqli->query($idquery);
while($idrecord = $idresult->fetch_assoc())
{
$title = fromDatabase($idrecord['title']);
$link = linkname($title);
if($link == $_GET['sub']) $itemId = $idrecord['id'];
}
if(isset($itemId) && !empty($itemId)){
//// Get Info ervaringen \\\\
$query = 'SELECT themes.id,
themes.title,
themes.description,
themes.thumbnail
FROM themes, content_status AS s
WHERE s.active = 1
AND s.itemId = themes.id
AND s.linkname = "themes"
AND themes.id = '.$itemId.' LIMIT 1';
$result = $mysqli->query($query);
$record = $result->fetch_assoc();
$title = fromDatabase($record['title']);
$description = fromDatabase($record['description']);
$description = replaceShortcodes($description, 352);
$shortcode = $record['thumbnail'];
//// create variable \\\\
$output = '';
$output .= '<div class="pagetop"></div>';
$output .= '<div class="mid-content-container page-top-margin">';
$output .= '<h1>'.$introtitle.' › '.$title.'</h1>';
$output .= '<hr class="mid-content" />';
//// intro tekst \\\\
$output .= '<div class="page-column margin-right-40 no-mobile-margin-bottom">';
$output .= include $_SERVER['DOCUMENT_ROOT'] . '/app/views/partials/backButton.php';
$output .= '<span class="interiew-name">' . $title .'</span>';
$output .= $description;
$output .= '</div>';
//// image \\\\
$output .= '<div class="page-column no-mobile-margin-top">';
$shortcode = substr($shortcode, 1, -1);
$mediaResult = $mysqli->query('SELECT title, path, filename_hover FROM media_files WHERE shortcode = "'.$shortcode.'" LIMIT 1');
$mediaRecord = $mediaResult->fetch_assoc();
$filename = $mediaRecord['path'];
$hover = $mediaRecord['filename_hover'];
$mediaTitle = $mediaRecord['title'];
$photoRel = linkname($mediaTitle);
$photoRel = str_replace('-','',$photoRel);
///// photos \\\\\
$photoquery = 'SELECT mf.title, mf.path
FROM media_files AS mf, themes_photos AS ph
WHERE ph.shortcode = mf.shortcode
AND ph.itemId = '.$itemId.'
ORDER by ph.photoOrder';
$photosResult = $mysqli->query($photoquery);
$numphotos = $photosResult->num_rows;
$first = '';
$other = '';
$count = 0;
while($photoRecord = $photosResult->fetch_assoc()){
$photoPath = $photoRecord['path'];
if($count == 0){ $first = './images/uploads/'.$photoPath; }
else{
$other .= '<a href="./images/uploads/'.$photoPath.'" rel="lightbox['.$photoRel.']" class="hidden"> </a>';
}
$count++;
}
if($numphotos > 0){ $output .= '<a class="image-holder interview-image" href="'.$first.'" rel="lightbox['.$photoRel.']">'; }
else{$output .= '<span class="image-holder interview-image">'; }
// als de naam leeg is is het geen interview maar gwoon informatie
if($numphotos > 0) $output .= '<span class="plus"></span>';
if($numphotos > 0) $output .= '<span class="white"></span>';
if($numphotos > 0){ $output .= '<img src="./images/uploads/'.$filename.'" alt="'.$mediaTitle.'" class="grayscale" />'; }
else{ $output .= '<img src="./images/uploads/'.$hover.'" alt="'.$mediaTitle.'" class="grayscale" />'; }
$output .= '<img src="./images/uploads/'.$hover.'" alt="'.$mediaTitle.'" class="hover" />';
if($numphotos > 0){$output .= '</a>';}
else{$output .= '</span>'; }
$output .= $other;
$output .= '</div>';
$output .= '<div class="clear"></div>';
$output .= '<h2>Onze winkels in de categorie: ' . $title. '</h2>';
//// Get Info Winkelaanbod \\\\
$query = 'SELECT w.id, w.title, w.onderschrift, w.website, w.telefoon, w.naam, w.description, w.thumbnail
FROM winkelaanbod AS w, content_status AS s, themes_shops
WHERE s.active = 1
AND s.itemId = w.id
AND s.linkname = "winkelaanbod"
AND themes_shops.shop_id = w.id
AND themes_shops.theme_id = ' . $itemId;
if( ! $result = $mysqli->query($query)) dd($mysqli->error);
$output .= '<div class="thumb-row">';
$shops = [];
while($record = $result->fetch_assoc()){
$shops[] = $record;
}
shuffle($shops);
$blocks = '';
$i = 1;
foreach($shops as $shop)
{
$bedrijfsnaam = fromDatabase($shop['title']);
$onderschrift = fromDatabase($shop['onderschrift']);
$shortcode = $shop['thumbnail'];
$blocks .='<div class="block">
<h2>'.$bedrijfsnaam.'</h2>
<span class="pay-off">'.$onderschrift.'</span>';
$blocks .= '<div class="image-container">';
# prepare image holder for nice hover effect
# ( 1 ) get both hover and thumbnail images
$shortcode = substr($shortcode, 1, -1);
$mediaResult = $mysqli->query('SELECT title, path, filename_hover FROM media_files WHERE shortcode = "'.$shortcode.'" LIMIT 1');
$mediaRecord = $mediaResult->fetch_assoc();
$hover = $mediaRecord['filename_hover'];
$mediaTitle = fromDatabase($mediaRecord['title']);
$linkBedrijfsnaam = linkname($bedrijfsnaam);
$subpageLinkName = linkname($title);
$blocks .= '<a class="image-holder" href="./onze-winkels/'.$linkBedrijfsnaam.'/?ref=aanbod-' . $subpageLinkName . '">';
// als de naam leeg is is het geen interview maar gwoon informatie
// if(!empty($naam)) $imageOutput .= '<span class="mic"></span>';
$blocks .= '<span class="white"></span>';
$blocks .= '<img src="./images/uploads/'.$hover.'" alt="'.$mediaTitle.'" class="" />';
$blocks .= '</a>';
$blocks .= '<a class="hover-button web-btn" href="./onze-winkels/'.$linkBedrijfsnaam.'/?ref=aanbod-' . $subpageLinkName . '">
<span class="btn-text">Lees meer</span>
<span class="arrow btn-arrow"></span>
<span class="btn-green-288"></span>
<span class="btn-darkgreen-288 hover"></span>
</a>';
$blocks .= '</div></div>';
$output .= $blocks;
$blocks = '';
$i++;
}
$output .= '<div class="clear thumb-img-replacement"></div>';
$output .= '</div>';
$output .= '<br />';
$output .= '<hr />';
$output .= '<br />';
$output .= '<br />';
$output .= '<div class="clear"></div>';
$output .= '</div>';
}
else{
$output = '';
$output .= '<div class="pagetop"></div>';
$output .= '<div class="mid-content-container page-top-margin">';
$output .= '<h1>Oeps...</h1>';
$output .= '<hr class="mid-content" />';
//// intro tekst \\\\
$output .= '<div class="page-column">';
$output .= 'Dit aanbod is helaas niet gevonden. Onze excuses voor het ongemak.';
$output .= '</div>';
$output .= '<div class="clear"></div>';
$output .= '</div>';
}
return $output;
}