Your IP : 216.73.216.158


Current Path : /home/megadansyp/www/plugins/fwgallerytype/video/layouts/frontend/video/
Upload File :
Current File : /home/megadansyp/www/plugins/fwgallerytype/video/layouts/frontend/video/edit.php

<?php
/**
 * FW Super Gallery 2.4.0
 * @copyright (C) 2020 Fastw3b
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link http://www.fastw3b.net/ Official website
 **/

defined( '_JEXEC' ) or die( 'Restricted access' );

JToolBarHelper::title(JText::_('FWMG_FWGALLERY'));

fwgButtonsHelper::apply();
fwgButtonsHelper::save();
fwgButtonsHelper::cancel();

$view = $displayData['view'];
$row = $view->object;
$editor = fwgHelper::getEditor();

$max_size = $view->upload_max_filesize;
$post_size = $view->post_max_size;

JHTML::_('behavior.core');
JHTML::_('behavior.formvalidator');
JHTML::_('formbehavior.chosen', 'select.select-choices');

JHTML::stylesheet('components/com_fwgallery/assets/css/jquery.datetimepicker.min.css');
JHTML::_('jquery.framework');
JHTML::script('components/com_fwgallery/assets/js/jquery.datetimepicker.full.min.js');
JHTML::script('components/com_fwgallery/assets/js/jquery.maskedinput.min.js');
?>
<div class="fwcss">
	<div class="fwmg-management-header">
		<div class="fwmg-management-header-text">
			<?php echo $row->id?JText::sprintf('FWMG_HEADER_VIDEO_EDIT',$view->escape($row->name)):JText::_('FWMG_NEW_VIDEO'); ?>
		</div>
	</div>
	<div class="row">
		<div class="col-sm-12">
			<a class="btn btn-primary btn-success mr-2" href="javascript:Joomla.submitbutton('save')">
				<i title="<?php echo JText::_('FWMG_Save'); ?>" class="fa fa-check"></i>
				<?php echo JText::_('FWMG_Save'); ?>
			</a>
			<a class="btn" href="javascript:Joomla.submitbutton('cancel')">
				<i title="<?php echo JText::_($view->object->id?'FWMG_Close':'FWMG_Cancel'); ?>" class="fa fa-times"></i>
				<?php echo JText::_($view->object->id?'FWMG_Close':'FWMG_Cancel'); ?>
			</a>
		</div>
	</div>
	<br/>
	<form action="<?php echo fwgHelper::checkLink(fwgHelper::route('&layout=video')); ?>" id="adminForm" name="adminForm" method="post" enctype="multipart/form-data">
		<div class="tab-pane active" id="fwmg-video-general" role="tabpanel">
			<div class="fwa-main-body">
				<div class="fwa-mb-cardbox">

						<!-- Video -->
						<div class="card">
							<div class="card-header">
								<h4 class="card-title"><?php echo JText::_('FWMG_VIDEO'); ?></h4>
								<div class="card-subtitle"><?php echo JText::_('FWMG_MAX_FILE_SIZE'); ?>: <?php echo fwgHelper::humanFileSize($max_size); ?>, <?php echo JText::_('FWMG_POST_SIZE_LIMIT'); ?>: <?php echo fwgHelper::humanFileSize($post_size); ?></div>
							</div>
							<div class="card-body">
								<div class="form-group row">
									<label class="col-sm-5 col-form-label clearfix">
										<?php echo JText::_('FWMG_TYPE'); ?>
										<i class="pull-right fa fa-question-circle" data-container="body" data-trigger="hover" data-toggle="popover" data-bs-toggle="popover" data-placement="top" title="<?php echo $view->escape(JText::_('FWMG_VIDEO_TYPE_TITLE')); ?>" data-content="<?php echo $view->escape(JText::_('FWMG_VIDEO_TYPE_DESCR')); ?>"></i>
									</label>
									<div class="col-sm-7">
										<?php echo JHTML::_('fwView.radioGroup', 'media', empty($row->_video_media)?'youtube':$row->_video_media, array(
											'wrapper_class' => 'mr-2',
											'buttons' => array(array(
												'active_class' => 'btn-success',
												'title' => JText::_('FWMG_SELF_HOSTED'),
												'value' => 'mp4'
											), array(
												'active_class' => 'btn-success',
												'title' => 'YouTube',
												'value' => 'youtube'
											), array(
												'active_class' => 'btn-success',
												'title' => 'Vimeo',
												'value' => 'vimeo'
											))
										)); ?>
									</div>
								</div>
								<div class="form-group row fwmg-remote-video">
									<label class="col-sm-5 col-form-label clearfix">
										<?php echo JText::_('FWMG_VIDEO_ID'); ?>
										<i class="pull-right fa fa-question-circle" data-container="body" data-trigger="hover" data-toggle="popover" data-bs-toggle="popover" data-placement="top" title="<?php echo $view->escape(JText::_('FWMG_VIDEO_ID_TITLE')); ?>" data-content="<?php echo $view->escape(JText::_('FWMG_VIDEO_ID_DESCR')); ?>"></i>
									</label>
									<div class="col-sm-7">
										<input class="form-control" type="text" name="remote_code" value="<?php if (@$row->_video_media != 'mp4') echo $view->escape(@$row->_video_code); ?>" />
									</div>
								</div>
								<div class="form-group row fwmg-local-video">
									<label class="col-sm-5 col-form-label clearfix">
										<?php echo JText::_('FWMG_VIDEO_FILE'); ?>
										<i class="pull-right fa fa-question-circle" data-container="body" data-trigger="hover" data-toggle="popover" data-bs-toggle="popover" data-placement="top" title="<?php echo $view->escape(JText::_('FWMG_VIDEO_FILE_TITLE')); ?>" data-content="<?php echo $view->escape(JText::_('FWMG_VIDEO_FILE_DESCR')); ?>"></i>
									</label>
											<div class="col-sm-7" id="fwmg-video-container">
												<div class="mb-3">
<?php
if (plgFwGalleryTypeVideo::isVideoExists($row)) {
?>
											<strong><?php echo $row->_video_filename; ?></strong> <span><?php echo fwgHelper::humanFileSize($row->_video_size); ?></span>
<?php
} else {
?>
											<strong></strong> <span></span>
<?php
}
?>
											<button type="button" class="btn btn-danger"><i class="fa fa-trash mr-2"></i><?php echo JText::_('FWMG_REMOVE'); ?></button>
											<?php echo JHTML::_('fwView.handleRemoveButton', array(
												'url' => fwgHelper::route('index.php?option=com_ajax&plugin=video&group=fwgallerytype', false),
												'button' => '#fwmg-video-container .btn-danger',
												'image' => '#fwmg-video-container img',
												'layout' => 'delete',
												'callback' => 'function(data) {
	$img.remove();
	$button.attr(\'disabled\', false);

	if (data && data.data && data.data[0]) {
		data = data.data[0];
		if (data.result) {
			$(\'#fwmg-video-container .mb-3\').find(\'span,strong\').html(\'\');
		}
		if (data.msg) fwmg_alert(data.msg);
	}
}'
											)); ?>
										</div>
										<div class="input-group mb-3">
											<div class="custom-file">
												<input type="file" class="custom-file-input" id="fwmg-video" name="file" />
												<label class="custom-file-label" for="fwmg-video"><?php echo JText::_('FWMG_CHOOSE_FILE'); ?></label>
											</div>
											<div class="input-group-append">
												<button type="button" class="btn btn-success fwmg-upload"><i class="fa fa-upload mr-2"></i><?php echo JText::_('FWMG_UPLOAD'); ?></button>
											</div>
										</div>
										<div class="text-muted"><small><?php echo JText::sprintf('FWMG_MAX_VIDEO_SIZE_LONG', ini_get('post_max_size')); ?></small></div>
										<?php echo JHTML::_('fwView.handleUploadButton', array(
											'url' => fwgHelper::route('index.php?option=com_ajax&plugin=video&group=fwgallerytype', false),
											'button' => '#fwmg-video-container .fwmg-upload',
											'input' => '#fwmg-video',
											'image' => '#fwmg-video-container img',
											'exts' => array('mp4'),
											'layout' => 'upload',
											'callback' => 'function(data) {
	$progress_bar.remove();
	$button.attr(\'disabled\', false);

	var $parent = $input.parent();
	$parent.next().html(\''.JText::_('FWMG_CHOOSE_FILE', false).'\');

	var input_html = $parent.html();
	$parent.html(input_html);

	if (data && data.data && data.data[0]) {
		data = data.data[0];
		if (data.result) {
			if (data.result.id) {
				$(\'input[name="id"]\').val(data.result.id);
			}
			if (data.result.filename) {
				$(\'#fwmg-video-container strong:eq(0)\').html(data.result.filename);
			}
			if (data.result.video_size) {
				$(\'#fwmg-video-container span:eq(0)\').html(data.result.video_size);
			}
		}

		if (data.msg) {
			var $msg = $(\'<div class="alert alert-warning alert-dismissible fade show" role="alert">\
<button type="button" class="close" data-dismiss="alert" aria-label="Close">\
<span aria-hidden="true">&times;</span>\
</button>\
\'+data.msg+\'</div>\');
			$button.before($msg);
			$(\'button\', $msg).click(function() {
				$msg.remove();
			});
			setTimeout(function() {
				$msg.remove();
			}, 3000);
		}
	}
}'
										)); ?>
									</div>
								</div>
								<div class="form-group row">
									<label class="col-sm-5 col-form-label clearfix">
										<?php echo JText::_('FWMG_VIDEO_PREVIEW'); ?>
										<i class="pull-right fa fa-question-circle" data-container="body" data-trigger="hover" data-toggle="popover" data-bs-toggle="popover" data-placement="top" title="<?php echo $view->escape(JText::_('FWMG_VIDEO_PREVIEW_TITLE')); ?>" data-content="<?php echo $view->escape(JText::_('FWMG_VIDEO_PREVIEW_DESCR')); ?>"></i>
									</label>
									<div class="col-sm-7" id="fwmg-image-container">
										<div class="mb-2">
											<img src="<?php echo JURI::root(true); ?>/index.php?option=com_fwgallery&amp;view=item&amp;layout=img&amp;format=raw&amp;w=491&amp;h=300&amp;id=<?php echo $row->id; ?>" />
											<button type="button" class="btn btn-default btn-danger fwmg-remove"><i class="fa fa-trash mr-2"></i><?php echo JText::_('FWMG_REMOVE'); ?></button>
											<?php echo JHTML::_('fwView.handleRemoveButton', array(
												'url' => fwgHelper::route('index.php?option=com_ajax&group=fwgallery&plugin=admin', false),
												'button' => '#fwmg-image-container .fwmg-remove',
												'image' => '#fwmg-image-container img',
												'layout' => 'image_delete'
											)); ?>
										</div>
										<div class="input-group mb-3">
											<div class="custom-file">
												<input type="file" class="custom-file-input" id="fwmg-image" name="image" />
												<label class="custom-file-label" for="fwmg-image"><?php echo JText::_('FWMG_CHOOSE_FILE'); ?></label>
											</div>
											<div class="input-group-append">
												<button type="button" class="btn btn-default btn-success fwmg-upload"><i class="fa fa-upload mr-2"></i><?php echo JText::_('FWMG_UPLOAD'); ?></button>
											</div>
										</div>
										<div class="text-muted"><small><?php echo JText::sprintf('FWMG_MAX_IMAGE_SIZE_LONG', ini_get('post_max_size')); ?></small></div>
										<?php echo JHTML::_('fwView.handleUploadButton', array(
											'url' => fwgHelper::route('index.php?option=com_ajax&group=fwgallery&plugin=admin', false),
											'button' => '#fwmg-image-container .fwmg-upload',
											'input' => '#fwmg-image',
											'image' => '#fwmg-image-container img',
											'exts' => array('gif', 'jpg', 'jpeg', 'png'),
											'layout' => 'image_upload'
										)); ?>
									</div>
								</div>
							</div>
						</div>

						<!-- Genral -->
						<div class="card">
							<div class="card-header">
								<h4 class="card-title"><?php echo JText::_('FWMG_GENERAL_SETTINGS'); ?></h4>
							</div>
							<div class="card-body">
								<div class="form-group row">
									<label class="col-sm-5 col-form-label clearfix">
										<?php echo JText::_('FWMG_NAME'); ?>
										<i class="pull-right fa fa-question-circle" data-container="body" data-trigger="hover" data-toggle="popover" data-bs-toggle="popover" data-placement="top" title="<?php echo $view->escape(JText::_('FWMG_NAME_VIDEO_TITLE')); ?>" data-content="<?php echo $view->escape(JText::_('FWMG_NAME_VIDEO_DESCR')); ?>"></i>
									</label>
									<div class="col-sm-7">
										<input class="form-control" name="name" value="<?php echo $view->escape($row->name); ?>" type="text">
									</div>
								</div>
								<div class="form-group row">
									<label class="col-sm-5 col-form-label clearfix">
										<?php echo JText::_('FWMG_PUBLISHED'); ?>
										<i class="pull-right fa fa-question-circle" data-container="body" data-trigger="hover" data-toggle="popover" data-bs-toggle="popover" data-placement="top" title="<?php echo $view->escape(JText::_('FWMG_PUBLISHED_VIDEO_TITLE')); ?>" data-content="<?php echo $view->escape(JText::_('FWMG_PUBLISHED_VIDEO_DESCR')); ?>"></i>
									</label>
									<div class="col-sm-7">
											<?php echo JHTML::_('fwView.radioGroup', 'published', $row->id?$row->published:1, array(
												'wrapper_class' => 'mr-2',
												'buttons' => array(array(
													'active_class' => 'btn-success',
													'title' => JText::_('JYES'),
													'value' => 1
												), array(
													'active_class' => 'btn-danger',
													'title' => JText::_('JNO'),
													'value' => 0
												))
											)); ?>
									</div>
								</div>
								<div class="form-group row">
									<label class="col-sm-5 col-form-label clearfix">
										<?php echo JText::_('FWMG_GALLERY'); ?>
										<i class="pull-right fa fa-question-circle" data-container="body" data-trigger="hover" data-toggle="popover" data-bs-toggle="popover" data-placement="top" title="<?php echo $view->escape(JText::_('FWMG_GALLERY_VIDEO_TITLE')); ?>" data-content="<?php echo $view->escape(JText::_('FWMG_GALLERY_VIDEO_DESCR')); ?>"></i>
									</label>
									<div class="col-sm-7">
										<?php echo JHTML::_('select.genericlist', $view->categories, 'category_id', 'class="form-control select-choices"', 'id', 'name', $view->object->category_id?$view->object->category_id:$view->category); ?>&nbsp;&nbsp;&nbsp;
									</div>
								</div>
								<div class="form-group row">
									<label class="col-sm-5 col-form-label clearfix">
										<?php echo JText::_('FWMG_DOC_ADMIN_FILEEDIT_SECTION_GENERAL_COPYRIGHT'); ?>
										<i class="pull-right fa fa-question-circle" data-container="body" data-trigger="hover" data-toggle="popover" data-bs-toggle="popover" data-placement="top" data-content="<?php echo $view->escape(JText::_('FWMG_DOC_ADMIN_FILEEDIT_SECTION_GENERAL_COPYRIGHT_HINT')); ?>"></i>
									</label>
									<div class="col-sm-7">
										<textarea class="form-control" name="copyright" rows="2"><?php echo $view->escape($view->object->copyright); ?></textarea>
									</div>
								</div>

<?php
		$view->app->triggerEvent('onshowFileEditExtraFields', array('com_fwgallery', $row));
?>

								<div class="form-group row">
									<label class="col-sm-5 col-form-label clearfix">
										<?php echo JText::_('FWMG_UPLOAD_DATE'); ?>
										<i class="pull-right fa fa-question-circle" data-container="body" data-trigger="hover" data-toggle="popover" data-bs-toggle="popover" data-placement="top" title="<?php echo $view->escape(JText::_('FWMG_UPLOAD_DATE_VIDEO_TITLE')); ?>" data-content="<?php echo $view->escape(JText::_('FWMG_UPLOAD_DATE_VIDEO_DESCR')); ?>"></i>
									</label>
									<div class="col-sm-7">
										<div class="input-group">
											<input class="form-control" type="text" name="created" value="<?php echo substr($row->created, 0, 16); ?>">
											<span class="input-group-btn">
												<a class="btn" type="button"><i class="far fa-calendar"></i></a>
											</span>
										</div>
									</div>
								</div>
								<div class="form-group row">
									<label class="col-sm-5 col-form-label clearfix">
										<?php echo JText::_('FWMG_ACCESS'); ?>
										<i class="pull-right fa fa-question-circle" data-container="body" data-trigger="hover" data-toggle="popover" data-bs-toggle="popover" data-placement="top" title="<?php echo $view->escape(JText::_('FWMG_ACCESS_VIDEO_TITLE')); ?>" data-content="<?php echo $view->escape(JText::_('FWMG_ACCESS_VIDEO_DESCR')); ?>"></i>
									</label>
									<div class="col-sm-7">
										<?php echo JHTML::_('select.genericlist', fwgHelper::loadviewlevels(), 'access', 'class="form-control select-choices"', 'id', 'name', $row->access); ?>
									</div>
								</div>
							</div>
						</div>
						<div class="card">
							<div class="card-header">
								<h4 class="card-title"><?php echo JText::_('FWMG_SIZE_AND_DURATION'); ?></h4>
							</div>
							<div class="card-body">
								<div class="form-group row">
									<label class="col-sm-5 col-form-label clearfix">
										<?php echo JText::_('FWMG_WIDTH'); ?>
										<i class="pull-right fa fa-question-circle" data-container="body" data-trigger="hover" data-toggle="popover" data-bs-toggle="popover" data-placement="top" data-content="<?php echo $view->escape(JText::_('FWMG_WIDTH_VIDEO_DESCR')); ?>"></i>
									</label>
									<div class="col-sm-7">
										<input class="form-control" name="width" value="<?php echo $view->escape(@$row->_video_width); ?>" type="text">
									</div>
								</div>
								<div class="form-group row">
									<label class="col-sm-5 col-form-label clearfix">
										<?php echo JText::_('FWMG_HEIGHT'); ?>
										<i class="pull-right fa fa-question-circle" data-container="body" data-trigger="hover" data-toggle="popover" data-bs-toggle="popover" data-placement="top" data-content="<?php echo $view->escape(JText::_('FWMG_HEIGHT_VIDEO_DESCR')); ?>"></i>
									</label>
									<div class="col-sm-7">
										<input class="form-control" name="height" value="<?php echo $view->escape(@$row->_video_height); ?>" type="text">
									</div>
								</div>
								<div class="form-group row">
									<label class="col-sm-5 col-form-label clearfix">
										<?php echo JText::_('FWMG_DURATION'); ?>
										<i class="pull-right fa fa-question-circle" data-container="body" data-trigger="hover" data-toggle="popover" data-bs-toggle="popover" data-placement="top" data-content="<?php echo $view->escape(JText::_('FWMG_DURATION_VIDEO_DESCR')); ?>"></i>
									</label>
									<div class="col-sm-7">
										<input class="form-control" type="text" name="duration" value="<?php echo @$row->_video_duration; ?>">
									</div>
								</div>
							</div>
						</div>

						<!-- Descripton -->
						<div class="card">
							<div class="card-header">
								<h4 class="card-title"><?php echo JText::_('FWMG_DESCRIPTION'); ?></h4>
							</div>
							<div class="card-body">
								<?php echo $editor->display('descr', $row->descr, '100%', 200, 60, 7); ?>
							</div>
						</div>
<?php
		$view->app->triggerEvent('onshowFileEditExtraCards', array('com_fwgallery', $row));
?>

				</div>
			</div>
		</div>
		<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="type" value="video" />
<?php
foreach ($view->fields as $field) {
	if ($view->$field) {
?>
		<input type="hidden" name="<?php echo $field; ?>" value="<?php echo $view->escape($view->$field); ?>" />
<?php
	}
}
?>
	</form>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
	(function($) {
    $('input[name="media"]').change(function() {
        if (this.value == 'mp4') {
            $('.fwmg-local-video').show();
            $('.fwmg-remote-video').hide();
        } else {
            $('.fwmg-local-video').hide();
            $('.fwmg-remote-video').show();
        }
    }).change();
    $('input[name="created"]').datetimepicker({
        format: 'Y-m-d H:i'
    });
    $('input[name="created"]').next().click(function() {
        $('input[name="created"]').focus();
    });
    $('input[name="duration"]').mask('99:99:99');
	Joomla.submitbutton = function(task) {
		var form = document.adminForm;
		if (task == 'cancel') {
			location = form.action;
			return;
		}
		if ((task == 'apply' || task == 'save') && !document.formvalidator.isValid(form)) {
		 fwmg_alert('<?php echo JText::_('FWMG_NOT_ALL_REQUIRED_FIELDS_FILLED', true); ?>');
		} else {
			form.task.value = task;
			form.submit();
		}
	}
    })(jQuery);
});
</script>