mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
I will let the admin select what channels he wants to put on the first page. then I it will show the channels videos sorted by date DESC
This commit is contained in:
parent
f87403db12
commit
fa6be4f09e
10 changed files with 155 additions and 4 deletions
|
@ -374,6 +374,22 @@ class AVideoPlugin
|
||||||
return self::getDataObject($name);
|
return self::getDataObject($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function setObjectData($name, $object){
|
||||||
|
$p = static::loadPlugin($name);
|
||||||
|
if ($p) {
|
||||||
|
return $p->setDataObject($object);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setObjectDataParameter($name, $parameterName, $value){
|
||||||
|
$p = static::loadPlugin($name);
|
||||||
|
if ($p) {
|
||||||
|
return $p->setDataObjectParameter($parameterName, $value);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getDataObject($name)
|
public static function getDataObject($name)
|
||||||
{
|
{
|
||||||
global $pluginGetDataObject;
|
global $pluginGetDataObject;
|
||||||
|
|
|
@ -185,6 +185,7 @@ class Gallery extends PluginAbstract {
|
||||||
$js .= '<script src="' . getCDN() . 'plugin/Gallery/fullscreen.js"></script>';
|
$js .= '<script src="' . getCDN() . 'plugin/Gallery/fullscreen.js"></script>';
|
||||||
$js .= '<script>var playVideoOnBrowserFullscreen = 1;</script>';
|
$js .= '<script>var playVideoOnBrowserFullscreen = 1;</script>';
|
||||||
}
|
}
|
||||||
|
$js .= '<script src="'.getURL('plugin/Gallery/script.js').'" type="text/javascript"></script>';
|
||||||
return $js;
|
return $js;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,4 +229,46 @@ class Gallery extends PluginAbstract {
|
||||||
return '<button onclick="avideoModalIframeSmall(webSiteRootURL+\'plugin/Gallery/view/sections.php\')" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fas fa-sort-numeric-down"></i> ' . __('Sort Sections') . '</button>';
|
return '<button onclick="avideoModalIframeSmall(webSiteRootURL+\'plugin/Gallery/view/sections.php\')" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fas fa-sort-numeric-down"></i> ' . __('Sort Sections') . '</button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getAddChannelToGalleryButton($users_id){
|
||||||
|
global $global, $config;
|
||||||
|
$variable = ob_get_clean();
|
||||||
|
ob_start();
|
||||||
|
include $global['systemRootPath'] . 'plugin/Gallery/buttonChannelToGallery.php';
|
||||||
|
$button = ob_get_clean();
|
||||||
|
ob_start();
|
||||||
|
echo $variable;
|
||||||
|
return $button;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setAddChannelToGallery($users_id, $add){
|
||||||
|
global $global, $config;
|
||||||
|
$users_id = intval($users_id);
|
||||||
|
$add = intval($add);
|
||||||
|
|
||||||
|
$obj = AVideoPlugin::getObjectData('Gallery');
|
||||||
|
|
||||||
|
$parameterName = "Channel_{$users_id}_";
|
||||||
|
|
||||||
|
if(!empty($add)){
|
||||||
|
$obj->{$parameterName} = true;
|
||||||
|
$obj->{"{$parameterName}CustomTitle"} = User::getNameIdentificationById($users_id);
|
||||||
|
$obj->{"{$parameterName}RowCount"} = 12;
|
||||||
|
$obj->{"{$parameterName}Order"} = 1;
|
||||||
|
}else{
|
||||||
|
unset($obj->{$parameterName});
|
||||||
|
unset($obj->{"{$parameterName}CustomTitle"});
|
||||||
|
unset($obj->{"{$parameterName}RowCount"});
|
||||||
|
unset($obj->{"{$parameterName}Order"});
|
||||||
|
}
|
||||||
|
return AVideoPlugin::setObjectData('Gallery', $obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function isChannelToGallery($users_id){
|
||||||
|
$obj = AVideoPlugin::getObjectData('Gallery');
|
||||||
|
|
||||||
|
$parameterName = "Channel_{$users_id}_";
|
||||||
|
|
||||||
|
return !empty($obj->{$parameterName});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
23
plugin/Gallery/buttonChannelToGallery.php
Normal file
23
plugin/Gallery/buttonChannelToGallery.php
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
$titleBtn1 = __('Add to first page');
|
||||||
|
$titleBtn2 = __('Remove first page');
|
||||||
|
|
||||||
|
$class = '';
|
||||||
|
if(Gallery::isChannelToGallery($users_id)){
|
||||||
|
$class = 'isChannelToGallery';
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="ChannelToGallery<?php echo $users_id; ?> <?php echo $class; ?>" style="display: inline-block;">
|
||||||
|
<button class="btn btn-primary btn-xs addChannelToGallery" onclick="channelToGallery(<?php echo $users_id; ?>, 1);" data-toggle="tooltip" title="<?php echo $titleBtn1; ?>" >
|
||||||
|
<i class="fas fa-plus"></i> <small><?php echo $titleBtn1; ?></small>
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-danger btn-xs removeChannelFromGallery" onclick="channelToGallery(<?php echo $users_id; ?>, 0);" data-toggle="tooltip" title="<?php echo $titleBtn2; ?>" >
|
||||||
|
<i class="fas fa-trash"></i> <small><?php echo $titleBtn2; ?></small>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
});
|
||||||
|
</script>
|
32
plugin/Gallery/channelToGallery.json.php
Normal file
32
plugin/Gallery/channelToGallery.json.php
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../../videos/configuration.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$resp = new stdClass();
|
||||||
|
$resp->error = true;
|
||||||
|
$resp->msg = "";
|
||||||
|
$resp->users_id = intval($_REQUEST['users_id']);
|
||||||
|
$resp->add = intval($_REQUEST['add']);
|
||||||
|
|
||||||
|
if (empty($resp->users_id)) {
|
||||||
|
forbiddenPage('User is empty');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!User::isAdmin()) {
|
||||||
|
forbiddenPage('Admin only');
|
||||||
|
}
|
||||||
|
|
||||||
|
$plugin = AVideoPlugin::loadPluginIfEnabled('Gallery');
|
||||||
|
|
||||||
|
if (empty($plugin)) {
|
||||||
|
forbiddenPage('Gallery not enabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$resp->response = Gallery::setAddChannelToGallery($resp->users_id, $resp->add);
|
||||||
|
|
||||||
|
$resp->error = empty($resp->response);
|
||||||
|
|
||||||
|
die(json_encode($resp));
|
|
@ -1,2 +1,17 @@
|
||||||
var tmpPId;
|
function channelToGallery(users_id, add) {
|
||||||
var tmpSave;
|
$.ajax({
|
||||||
|
url: webSiteRootURL + 'plugin/Gallery/channelToGallery.json.php',
|
||||||
|
method: 'POST',
|
||||||
|
data: {'users_id': users_id, 'add': add},
|
||||||
|
success: function (response) {
|
||||||
|
avideoResponse(response);
|
||||||
|
if(!response.error){
|
||||||
|
if(response.add){
|
||||||
|
$('.ChannelToGallery'+response.users_id).addClass('isChannelToGallery');
|
||||||
|
}else{
|
||||||
|
$('.ChannelToGallery'+response.users_id).removeClass('isChannelToGallery');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
|
@ -210,3 +210,11 @@ a.h6{
|
||||||
.galleryTags{
|
.galleryTags{
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.isChannelToGallery .addChannelToGallery, .removeChannelFromGallery{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.isChannelToGallery .removeChannelFromGallery {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
|
@ -1,4 +1,3 @@
|
||||||
<script src="<?php echo getCDN(); ?>plugin/Gallery/script.js" type="text/javascript"></script>
|
|
||||||
<?php include $global['systemRootPath'] . 'view/include/footer.php'; ?>
|
<?php include $global['systemRootPath'] . 'view/include/footer.php'; ?>
|
||||||
<script>
|
<script>
|
||||||
function showTrailer(iframe) {
|
function showTrailer(iframe) {
|
||||||
|
|
|
@ -70,6 +70,10 @@
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$countSections++;
|
$countSections++;
|
||||||
|
if(preg_match('/Channel_([0-9]+)_/', $value['name'], $matches)){
|
||||||
|
$users_id = intval($matches[1]);
|
||||||
|
User::getChannelPanel($users_id);
|
||||||
|
} else
|
||||||
if ($value['name'] == 'Suggested') {
|
if ($value['name'] == 'Suggested') {
|
||||||
createGallery(!empty($obj->SuggestedCustomTitle) ? $obj->SuggestedCustomTitle : __("Suggested"), 'suggested', $obj->SuggestedRowCount, 'SuggestedOrder', "", "", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-star");
|
createGallery(!empty($obj->SuggestedCustomTitle) ? $obj->SuggestedCustomTitle : __("Suggested"), 'suggested', $obj->SuggestedRowCount, 'SuggestedOrder', "", "", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-star");
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -31,9 +31,19 @@ AVideoPlugin::loadPlugin("Gallery");
|
||||||
if (empty($value['active'])) {
|
if (empty($value['active'])) {
|
||||||
$checked = '';
|
$checked = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$name = $value['name'];
|
||||||
|
if(preg_match('/Channel_([0-9]+)_/', $name, $matches)){
|
||||||
|
$users_id = intval($matches[1]);
|
||||||
|
$u = new User($users_id);
|
||||||
|
if(!empty($u->getChannelName())){
|
||||||
|
$name = '<i class="fas fa-play-circle"></i> '.$u->getChannelName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<li class="list-group-item" id="<?php echo $value['name']; ?>" >
|
<li class="list-group-item" id="<?php echo $value['name']; ?>" >
|
||||||
<span class="ui-icon ui-icon-arrowthick-2-n-s"></span><?php echo $value['name']; ?>
|
<span class="ui-icon ui-icon-arrowthick-2-n-s"></span><?php echo $name; ?>
|
||||||
<div class="material-small material-switch pull-right">
|
<div class="material-small material-switch pull-right">
|
||||||
<input name="<?php echo $value['name']; ?>" id="enable<?php echo $value['name']; ?>" class="sectionsCheckbox" type="checkbox" value="0" <?php echo $checked; ?>>
|
<input name="<?php echo $value['name']; ?>" id="enable<?php echo $value['name']; ?>" class="sectionsCheckbox" type="checkbox" value="0" <?php echo $checked; ?>>
|
||||||
<label for="enable<?php echo $value['name']; ?>" class="label-success"></label>
|
<label for="enable<?php echo $value['name']; ?>" class="label-success"></label>
|
||||||
|
|
|
@ -130,6 +130,7 @@ $obj = AVideoPlugin::getObjectData("YouPHPFlix2");
|
||||||
?></h2>
|
?></h2>
|
||||||
<span class="pull-right">
|
<span class="pull-right">
|
||||||
<?php
|
<?php
|
||||||
|
echo User::getAddChannelToGalleryButton($user_id);
|
||||||
echo User::getBlockUserButton($user_id);
|
echo User::getBlockUserButton($user_id);
|
||||||
echo Subscribe::getButton($user_id);
|
echo Subscribe::getButton($user_id);
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue