system: Linux mars.sprixweb.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
cmd: 

Direktori : /home/pfhr/public_html/admin/classes/Model/
Upload File :
Current File : /home/pfhr/public_html/admin/classes/Model/MVideos.php

<?php
class Model_MVideos
{	
	function showVideosCate($errval)
	{
		$id=(int)$_GET['id'];
		if($id=='')
		{
		$plans="SELECT * FROM categorey_table where categorey_status='Enable' AND categorey_cat='Video Gallery'";
		$obj=new Bin_Query();
		$obj->executeQuery($plans);
		}
		else
		{
		$obj=new Bin_Query();
		$obj1=new Bin_Query();
		$select="select * from video_table where video_id=$id";
		$obj1->executeQuery($select);
		$planscount=$obj1->records[0]['video_cat_id'];
		$plans="SELECT * FROM categorey_table where categorey_status='Enable' AND categorey_cat='Video Gallery'";
		$obj=new Bin_Query();
		$obj->executeQuery($plans);
		}
		return Display_DVideos::showVideosCate($obj->records,$planscount,$errval);
	}
	
	function showVideos()
	{
			$select1="select * from video_table";
			$obj2=new Bin_Query();
			$obj2->executeQuery($select1);
			return Display_DVideos::showVideos($obj2->records);
	}
	
	function insertVideos()
	{

		$cate=$_POST['txtcate'];
		$name=$_POST['txtname'];
		$url=$_POST['txturl'];
		$date=$_POST['txtdate'];
		$status=$_POST['txtstatus'];
		$insert="insert into video_table (video_cat_id,video_name,video_date,video_url,video_status) values('$cate','$name','$date','$url','$status')";
		$obj=new Bin_Query();
		if($obj->updateQuery($insert))
		{
			$_SESSION['message'] = 'Videos has been added Successfully';
		}
		else
		{
			$_SESSION['error_message'] = 'Oops unable to insert';
		}
	
	
	}
	
	function showEdit()
	{
		$testid=$_GET['id'];
		$select="select * from video_table where video_id='$testid' ";
		$obj=new Bin_Query();
		$obj->executeQuery($select);
		return $obj->records[0];
	}
	
	function updateVideos()
	{
		$testid=$_GET['id'];
		$cate=$_POST['txtcate'];
		$name=$_POST['txtname'];
		$url=$_POST['txturl'];
		$date=$_POST['txtdate'];
		$status=$_POST['txtstatus'];
		$update="update video_table set video_cat_id='$cate',video_name='$name',video_url='$url',video_date='$date',video_status='$status' where video_id='$testid'";
		$obj=new Bin_Query();
		if($obj->updateQuery($update))
		{
			$_SESSION['message']="Videos updated Sucessfully";
		}
		else
		{
			$_SESSION['error_message']="Oops unable to update";
		}
	
	}
	
	function deleteVideos()
	{
		if(isset($_POST['delete']))
			{
				
				//$esc=$_POST['check'];
				
				foreach($_POST as $key=>$item)
				{
					if($key==$item)
					{
						 $sql1="delete from video_table  WHERE video_id='".$key."' ";
					}
				
					$obj=new Bin_Query();
					if($obj->updateQuery($sql1))
						{
							$_SESSION['message']=" Video Deleted Sucessfully";
						
						}
/*						else
						{
							$_SESSION['error_message']=" Process failed";
						}
*/				
				}
			}
	
	
	
	}
}
?>