| Current Path : /home/bolconlineco/public_html/aaaaaa/admin/ |
| Current File : /home/bolconlineco/public_html/aaaaaa/admin/videos.php |
<?php
ob_start();
session_start();
include('../includes/header.php');
if(!isset($_SESSION['adminname']) || $_SESSION['adminrole'] != 1)
{
header("location:../index.php");
exit();
} ?>
<script src="../combine/html5lightbox/html5lightbox.js"></script>
<script type="text/javascript">
var html5lightbox_options = {
watermark: "http://html5box.com/images/html5boxlogo.png",
watermarklink: ""
};
</script>
<script type="text/javascript">
$(document).ready(function() {
var progressbox = $('#progressbox');
var progressbar = $('#progressbar');
var statustxt = $('#statustxt');
var completed = '0%';
var options = {
target: '#output', // target element(s) to be updated with server response
beforeSubmit: beforeSubmit, // pre-submit callback
uploadProgress: OnProgress,
success: afterSuccess, // post-submit callback
resetForm: true // reset the form after successful submit
};
$('#MyUploadForm').submit(function() {
$(this).ajaxSubmit(options);
// return false to prevent standard browser submit and page navigation
return false;
});
//when upload progresses
function OnProgress(event, position, total, percentComplete)
{
//Progress bar
progressbar.width(percentComplete + '%') //update progressbar percent complete
statustxt.html(percentComplete + '%'); //update status text
if(percentComplete>50)
{
statustxt.css('color','#fff'); //change status text to white after 50%
}
}
//after succesful upload
function afterSuccess()
{
$('#loading-img').hide(); //hide submit button
$('#progressbox').delay( 1000 ).fadeOut(); //hide progress bar
$('#submit-btn').show(); //hide submit button
$("#output").html("Successfully Inserted").fadeOut(6333,function(){
setTimeout("window.location = 'videos.php'",1000);
})
}
//function to check file size before uploading.
function beforeSubmit(){
//check whether browser fully supports all File API
if (window.File && window.FileReader && window.FileList && window.Blob)
{
if( !$('#FileInput').val()) //check empty input filed
{
$("#output").html("Are you kidding me?");
return false
}
var fsize = $('#FileInput')[0].files[0].size; //get file size
var ftype = $('#FileInput')[0].files[0].type; // get file type
//Progress bar
progressbox.show(); //show progressbar
progressbar.width(completed); //initial value 0% of progressbar
statustxt.html(completed); //set status text
statustxt.css('color','#000'); //initial color of status text
$('#submit-btn').hide(); //hide submit button
$('#loading-img').show(); //hide submit button
//$("#output").html("");
}
else
{
//Output error to older unsupported browsers that doesn't support HTML5 File API
$("#output").html("Please upgrade your browser, because your current browser lacks some new features we need!");
return false;
}
}
//function to format bites bit.ly/19yoIPO
function bytesToSize(bytes) {
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes == 0) return '0 Bytes';
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
}
});
</script>
<h3 class="page-title">Add Course Video</h3>
<ul class="page-breadcrumb breadcrumb">
<li><i class="fa fa-home"></i> <a href="dashbord.php"> Home </a> <i class="fa fa-angle-right"></i> </li>
<li class="active">Video</li>
</ul>
<?php
if(isset($_GET['msg'])){
echo "<div class='alert alert-success'>".$_GET['msg']."</div>";
}
if(isset($_GET['er'])){
echo "<div class='alert alert-danger'>".$_GET['er']."</div>";
} ?>
<div id="content">
<form action="uploadvideo.php" method="post" enctype="multipart/form-data" id="MyUploadForm" class="form-horizontal">
<div class="form-group">
<label for="course_id" class="col-sm-2 control-label">Course:</label>
<div class="col-sm-6">
<?php
$query="select courseId,courseName from course where courseStatus=1";
$result=mysql_query($query) or die(mysql_error()); ?>
<select name="course_id" class="validate[required] form-control" id="course">
<option value="">--SELECT--</option>
<?php
while($rows=mysql_fetch_array($result))
{
?>
<option value="<?php echo $rows['courseId'];?>"><?php echo $rows['courseName'];?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Name:</label>
<div class="col-sm-6">
<input class="validate[required] form-control" type="text" name="name" value="" />
</div>
</div>
<div class="form-group">
<label for="coursevideo" class="col-sm-2 control-label">Video:</label>
<div class="col-sm-6">
<input class="validate[required] form-control" type="file" name="coursevideo" id="FileInput" value="" />
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-2">
<input class="add2 btn btn-success" type="submit" name="submit" value="Add" id="submit-btn" />
<img src="../images/loading-red.gif" style="display:none;" id="loading-img"/>
</div>
</div>
</form>
<div id="progressbox" style="display:none; margin-top:69px;"><div id="progressbar"></div ><div id="statustxt">0%</div></div>
<div id="output" ></div>
<div style="clear:both;"></div>
</div>
<div id="targets">
</div>
</div>
</div>
</div>
</div> <!-- end content -->
</div><!-- end wrapper -->
<script>
$("document").ready(function(){
var target=$("#targets");
$("#course").change(function(){
var val=$(this).val();
if(val=="")
{
}
else
{
$.post('show_videos.php',{id:val},function(data){
target.html(data);
})
}
});
})
</script>
<?php include('../includes/footer.php');?>