1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00
Oinktube/plugin/Gallery/view/Category.php
2021-10-29 10:10:00 -03:00

146 lines
No EOL
8.5 KiB
PHP

<?php
if ((!empty($videos)) || (!empty($obj) && $obj->SubCategorys)) {
?>
<?php
if (($obj->CategoryDescription) && (!empty($_GET['catName']))) {
$category = Category::getCategoryByName($_GET['catName']);
?>
<h1 style="text-align: center;" class="categories_id_<?php echo $category['id']; ?>"><?php echo __($category['name']); ?></h1>
<p style="margin-left: 10%; margin-right: 10%; max-height: 200px; overflow-x: auto;"><?php echo __($category['description']); ?></p>
<?php
}
if (($obj->SubCategorys) && (!empty($_GET['catName']))) {
unset($_REQUEST['rowCount']);
if (!empty($currentCat)) {
$childCategories = Category::getChildCategories($currentCat['id']);
$parentCat = Category::getCategory($currentCat['parentId']);
// -1 is a personal workaround only
if ((empty($parentCat)) && (($currentCat['parentId'] == "0") || ($currentCat['parentId'] == "-1"))) {
if (!empty($_GET['catName'])) {
$backURL = getBackURL();
if(!empty($_REQUEST['getBackURL'])){
$backURL = $_REQUEST['getBackURL'];
}
?>
<div class="clearfix" style="margin: 10px 0;">
<a class="btn btn-default btn-sm pull-left" href="<?php echo $backURL; ?>">
<i class="fa fa-backward"></i>
<?php echo __("Back"); ?>
</a>
</div>
<?php
}
} else if (!empty($parentCat)) {
$backURL = '';
if(!empty($_REQUEST['getBackURL'])){
$backURL = $_REQUEST['getBackURL'];
}
?>
<div class="clearfix" style="margin: 10px 0;">
<a class="btn btn-default btn-sm pull-left" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $parentCat['clean_name']; ?>?getBackURL=<?php echo urlencode($backURL); ?>">
<i class="fa fa-backward"></i>
<?php echo __("Back to") . " " . $parentCat['name']; ?>
</a>
</div>
<?php
}
} else {
?>
<div>
<a class="btn btn-primary" onclick="window.history.back();" ><?php echo __("Back"); ?> </a>
</div>
<?php
}
if ((!empty($childCategories)) && ((($currentCat['parentId'] != "0") || ($currentCat['parentId'] != "-1")))) {
?>
<div class="clear clearfix">
<h3 class="galleryTitle"><i class="glyphicon glyphicon-download"></i>
<?php echo __("Sub-Category-Gallery"); ?>
<span class="badge"><?php echo count($childCategories); ?></span>
</h3>
<div class="row">
<?php
$countCols = 0;
$originalCat = $_GET['catName'];
unset($_POST['sort']);
$_POST['sort']['title'] = "ASC";
foreach ($childCategories as $cat) {
$_GET['catName'] = $cat['clean_name'];
$description = $cat['description'];
$_GET['limitOnceToOne'] = "1";
$videos = Video::getAllVideos();
// make a row each 6 cols
if ($countCols % 6 === 0) {
echo '</div><div class="clearfix">';
}
$countCols++;
unset($_GET['catName']);
$backURL = getBackURL();
if(!empty($_REQUEST['getBackURL'])){
$backURL = $_REQUEST['getBackURL'];
}
?>
<div class="col-lg-2 col-md-4 col-sm-4 col-xs-6 galleryVideo thumbsImage fixPadding">
<a href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $cat['clean_name']; ?>?getBackURL=<?php echo urlencode($backURL);?>" title="<?php $cat['name']; ?>">
<div class="aspectRatio16_9">
<?php
if (!empty($videos)) {
foreach ($videos as $value) {
$img_portrait = ($value['rotation'] === "90" || $value['rotation'] === "270") ? "img-portrait" : "";
$images = Video::getImageFromFilename($value['filename'], $value['type']);
$poster = $images->thumbsJpg;
?>
<img src="<?php echo $poster; ?>" alt="" data-toggle="tooltip" title="<?php echo $description; ?>" class="thumbsJPG img img-responsive <?php echo $img_portrait; ?> rotate<?php echo $value['rotation']; ?>" id="thumbsJPG<?php echo $value['id']; ?>" />
<?php if ((!empty($imgGif)) && (!$o->LiteGalleryNoGifs)) { ?>
<img src="<?php echo $imgGif; ?>" style="position: absolute; top: 0; display: none;" alt="" data-toggle="tooltip" title="<?php echo $description; ?>" id="thumbsGIF<?php echo $value['id']; ?>" class="thumbsGIF img-responsive <?php echo $img_portrait; ?> rotate<?php echo $value['rotation']; ?>" height="130" />
<?php
}
$sql = "SELECT COUNT(title) FROM videos WHERE categories_id = ?;";
$res = sqlDAL::readSql($sql, "i", array($value['categories_id']));
$videoCount = sqlDAL::fetchArray($res);
sqlDAL::close($res);
break;
}
} else {
$poster = $global['webSiteRootURL'] . "view/img/notfound.jpg";
?>
<img src="<?php echo $poster; ?>" alt="" data-toggle="tooltip" title="<?php echo $description; ?>" class="thumbsJPG img img-responsive" id="thumbsJPG<?php echo $cat['id']; ?>" />
<?php
$sql = "SELECT COUNT(title) FROM videos WHERE categories_id = ?;";
$res = sqlDAL::readSql($sql, "i", array($cat['id']));
$videoCount = sqlDAL::fetchArray($res);
sqlDAL::close($res);
}
?>
</div>
<div class="videoInfo">
<?php if (!empty($videoCount)) { ?>
<span class="label label-default" style="top: 1px !important; position: absolute;">
<i class="glyphicon glyphicon-cd"></i>
<?php echo $videoCount[0]; ?>
</span>
<?php } ?>
</div>
<div data-toggle="tooltip" title="<?php echo $cat['name']; ?>" class="tile__title" style="border-radius: 10px; background-color: black; color: white; position: absolute; margin-left: 10%; width: 80% !important; bottom: 40% !important; opacity: 0.8 !important; text-align: center;">
<?php echo $cat['name']; ?>
</div>
</a>
</div>
<?php
} // end of foreach-cat
unset($_POST['sort']);
if (!empty($originalCat)) {
$_GET['catName'] = $originalCat;
}
?>
</div>
</div>
<?php
}
}
}