116 lines
4.0 KiB
PHP
116 lines
4.0 KiB
PHP
<?php
|
|
defined(page_security_key) or exit;
|
|
|
|
if (debug && debug_id == $_SESSION['id']){
|
|
ini_set('display_errors', '1');
|
|
ini_set('display_startup_errors', '1');
|
|
error_reporting(E_ALL);
|
|
}
|
|
|
|
include_once './assets/functions.php';
|
|
include_once './settings/settings_redirector.php';
|
|
|
|
//Check if allowed
|
|
if (isAllowed('marketing',$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
|
|
header('location: index.php');
|
|
exit;
|
|
}
|
|
|
|
//GET PARAMETERS:
|
|
$product_group = $_GET['product_group'] ?? '';
|
|
$product_content = $_GET['product_content'] ?? '';
|
|
|
|
template_header('Marketing', 'marketing');
|
|
echo '
|
|
<div class="content-title">
|
|
<div class="title">
|
|
<i class="fa-solid fa-house"></i>
|
|
<div class="txt">
|
|
<h2>'.$marketing_h2.'</h2>
|
|
<p>'.$marketing_p.'</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="products content-wrapper">
|
|
<div style="display: flex;align-items: center;align-content: center;flex-wrap: nowrap;flex-direction: column;">
|
|
<div class="">';
|
|
foreach ($marketing_structure as $marketing => $folders){
|
|
$style = '';
|
|
if (!empty($product_group) && $product_group !== $marketing) {
|
|
$style = ' style="opacity: 0.5; color: #999; background-color: #f5f5f5;"';
|
|
} elseif (!empty($product_group) && $product_group === $marketing) {
|
|
$style = ' style="background-color: #007cba; color: white;"';
|
|
}
|
|
echo '<a href="index.php?page=marketing&product_group='.$marketing.'" class="btn"'.$style.'>'.$marketing.'</a>';
|
|
}
|
|
echo'
|
|
</div>
|
|
<div class="">';
|
|
// Only show folders if a product group is selected
|
|
if (!empty($product_group) && isset($marketing_structure[$product_group])) {
|
|
foreach($marketing_structure[$product_group] as $folder){
|
|
echo '<a href="index.php?page=marketing&product_group='.$product_group.'&product_content='.$folder.'" class="btn"> <img src="./assets/images/folder3.png" width="15" height="15" alt=""> '.$folder.'</a>';
|
|
}
|
|
}
|
|
echo '
|
|
</div>
|
|
</div>';
|
|
|
|
|
|
if (isset($product_group) && $product_group !='' && isset($product_content) && $product_content !=''){
|
|
|
|
echo '
|
|
<div class="content-block">
|
|
<div class="products-wrapper">';
|
|
$dir_name = $main_marketing_dir.$product_group.'/'.$product_content;
|
|
|
|
$files = array_diff(scandir($dir_name), array('.', '..'));
|
|
echo'';
|
|
|
|
foreach ($files as $file) {
|
|
$filetype = strtolower(pathinfo($file,PATHINFO_EXTENSION));
|
|
|
|
if ( $filetype != '' && $filetype != 'ds_store'){
|
|
echo '
|
|
<div class="product">
|
|
<a href="'.$dir_name.'/'.$file.'" class="product">
|
|
';
|
|
if ( $filetype == "jpg" || $filetype == "png" || $filetype == "jpeg" || $filetype == "gif" || $filetype == "png"){
|
|
echo'
|
|
<img src="'.$dir_name.'/Thumb/'.$file.'" width="200" height="200" alt=""/> </a>
|
|
';
|
|
}
|
|
if ($filetype == "doc" || $filetype == "docx" || $filetype == "xls"|| $filetype == "xlsx"){
|
|
echo'
|
|
<img src="./assets/images/brochure.png" width="200" height="200" alt=""> </a>
|
|
';
|
|
}
|
|
if ( $filetype == "pdf"){
|
|
echo'
|
|
<img src="./assets/images/download-pdf.png" width="200" height="200" alt="'.ucfirst(substr($file, 0, strpos($file, "."))).'"></a>
|
|
<span class="name">'.ucfirst(substr(substr($file, 0, strpos($file, ".")),0 ,25)).'</span>
|
|
';
|
|
}
|
|
if ( $filetype == "mp4"){
|
|
echo'
|
|
<video width="200" height="200" controls>
|
|
<source src="'.$dir_name.'/'.$file.'" type="video/mp4">
|
|
Your browser does not support the video tag.
|
|
</video> </a>
|
|
';
|
|
}
|
|
|
|
echo'
|
|
<button class="btn"><a href="'.$dir_name.'/'.$file.'" style="text-decoration: none;color: #ffff;"download="">Download</a></button>
|
|
</div>';
|
|
}
|
|
}
|
|
|
|
echo '</div>
|
|
</div>
|
|
</div>
|
|
';
|
|
}
|
|
|
|
template_footer();
|
|
?>
|