Upload
logic321
View
76
Download
0
Embed Size (px)
DESCRIPTION
for testing purpose ..
Citation preview
<?php
ob_start();
session_start();
require_once('config/configure.php');
require_once('includes/function/autoload.php');
$loginObj = new Login();
$loginObj->checkSession();
$pageName = getPageName();
$menuObj = new Menu();
$menuObj->checkPermission("manageVideo.php","add_record");
/*---Basic for Each Page Ends----*/
$catObj = new Video();
if(isset($_POST['submit'])) {
require_once('validation_class.php');
$obj = new validationclass();
$errorArr = 0;
$rst = $catObj->selectQry(TBL_LANGUAGE,"status='1' AND isDeleted='0' order by languageName asc","","");
$num = $catObj->getTotalRow($rst);
if($num){
$langIdArr = array();
while($line = $catObj->getResultObject($rst)) {
array_push($langIdArr,$line->id);
}
foreach($langIdArr as $key=>$value) {
$obj->fnAdd('videoTitle_'.$value,$_POST['videoTitle_'.$value], 'req', 'Please Enter Video Title.');
$obj->fnAdd('feedback_'.$value,$_POST['feedback_'.$value], 'req', 'Please Enter Feedback.');
}
//$obj->fnAdd('countryId',$_POST['countryId'], 'req', 'Please Select Country.');
//$obj->fnAdd('stateId',$_POST['stateId'], 'req', 'Please Enter State .');
//$obj->fnAdd('zoneId',$_POST['zoneId'], 'req', 'Please Select Zone.');
//$obj->fnAdd('centerId',$_POST['centerId'], 'req', 'Please Select Center .');
//$obj->fnAdd('classId',$_POST['classId'], 'req', 'Please Select Class.');
// $obj->fnAdd('youtubeCode',$_POST['youtubeCode'], 'req', 'Please Enter youTube Code .');
$arr_error = $obj->fnValidate();
$str_validate = (count($arr_error)) ? 0 : 1;
//$arr_error[stateId]=$obj->fnGetErr($arr_error[stateId]);
//$arr_error[zoneId]=$obj->fnGetErr($arr_error[zoneId]);
//$arr_error[countryId]=$obj->fnGetErr($arr_error[countryId]);
//$arr_error[centerId]=$obj->fnGetErr($arr_error[centerId]);
//$arr_error[classId]=$obj->fnGetErr($arr_error[classId]);
// $arr_error[youtubeCode]=$obj->fnGetErr($arr_error[youtubeCode]);
foreach($langIdArr as $key=>$value) {
$arr_error['videoTitle_'.$value]=$obj->fnGetErr($arr_error['videoTitle_'.$value]);
if($arr_error['videoTitle_'.$value])
$errorArr = 1;
}
foreach($langIdArr as $key=>$value) {
$arr_error['feedback_'.$value]=$obj->fnGetErr($arr_error['feedback_'.$value]);
if($arr_error['feedback_'.$value])
$errorArr = 1;
}
foreach($langIdArr as $key=>$value) {
if($catObj->isVideoNameExist($_POST['videoTitle_'.$value],$value,''))
{
$arr_error['videoTitle_'.$value] = "Country already exist. ";
if($arr_error['videoTitle_'.$value])
$errorArr = 1;
}
}
if($errorArr == 0 && isset($_POST['submit']) && empty($arr_error[feedback]) ){
$_POST = postwithoutspace($_POST);
move_uploaded_file($_FILES['fileName']['tmp_name'],'Video/'.$_FILES['fileName']['name']);
$catObj->addRecord($_POST,$_FILES['fileName']['name']);
}
}
}
$genObj = new GeneralFunctions();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><?php $genObj = new GeneralFunctions();?>
<script language="javascript" src="js/country.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Welcome To <?=SITENAME?> administrative panel</title>
<? include('includes/top.php') ?>
</head>
<body>
<? include('includes/header.php'); ?>
<div id="nav-under-bg"><!-- --></div>
<form name="frmUser" id="frmUser" method="post" enctype="multipart/form-data" onsubmit="javascript: return validateFrm(this);" class="niceform">
<input type="hidden" name="cid" value="<?=$cid?>">
<div id="content">
<!-- table -->
<div class="box">
<div class="title">
<h5>Add Video</h5>
</div>
<!-- left position -->
<div class="main-body-div4" id="mainDiv">
<div class="add-main-body-left-new" >
<ul>
<li class="add-main-body-left-new-text" style="clear:both; width:500px;padding-bottom:5px;" ><span class="small_error_message">
<?=$_SESSION['SESS_MSG']?>
</span></li>
<li class="lable">Center <span class="spancolor">*</span></li>
<li>
<?= $genObj->getAllCenterInDropdown($_POST['zoneId'],$_POST['centerId']); ?>
<p style="padding-left:150px;"><?=$arr_error[centerId]?></p>
</li>
<li class="lable">Student <span class="spancolor">*</span></li>
<li>
<?=$genObj->getAllStudentDropdown($_POST['studentId']); ?>
<p style="padding-left:150px;"><?=$arr_error[stateId]?></p>
</li>
<li class="lable">Class <span class="spancolor">*</span></li>
<li> <?= $genObj->getAllClassDropdown($_POST['classId']); ?>
<p style="padding-left:150px;"><?=$arr_error[classId]?></p>
</li>
<li class="lable">Video Title <span class="spancolor">*</span></li>
<?
echo $genObj->getLanguageTextBox('videoTitle','m__videoTitle ',$arr_error); //1->type,2->name,3->id
?>
<li class="lable">YouTube Embeded Code <span class="spancolor">*</span></li>
<li ><textarea name="youtubeCode" id="m__youtubeCode " class="wel" ></textarea>
<p style="padding-left:150px;"><?=$arr_error[youtubeCode]?></p>
</li> <li class="lable">Upload Video<span class="spancolor"> </span></li>
<li ><input type="file" name="fileName" id="m__fileName" class="wel" > <p style="padding-left:150px;"><?=$arr_error[fileName]?></p>
</li>
<li class="lable">Feedback<span class="spancolor">*</span></li>
<li >
<?php echo $genObj->getLanguageTextArea('feedback','m__feedback ',$arr_error); //1->type,2->name,3->id?>
</li>
</ul>
</div>
<div class="main-body-sub">
<input type="submit" name="submit" class="main-body-sub-submit" style="cursor:pointer;" value="Submit" />
<input type="button" name="back" id="back" value="Back" class="main-body-sub-submit" style="cursor:pointer;" onclick="javascript:;hrefBack1()"/>
</div>
</div>
</div>
</div>
</form>
<? unset($_SESSION['SESS_
MSG']); ?>
<?
/*---Basic for Each Page Starts----*/
ob_start();
session_start();
require_once('config/configure.php');
require_once('includes/function/autoload.php');
$loginObj = new Login();
$loginObj->checkSession();
$pageName = getPageName();
$menuObj = new Menu();
$menuObj->checkPermission("manageVideo.php","edit_record");
/*---Basic for Each Page Ends----*/
$catObj = new Video();
if(isset($_POST['submit'])) {
require_once('validation_class.php');
$obj = new validationclass();
$errorArr = 0;
$rst = $catObj->selectQry(TBL_LANGUAGE,"status='1' AND isDeleted='0' order by languageName asc","","");
$num = $catObj->getTotalRow($rst);
if($num){
$langIdArr = array();
while($line = $catObj->getResultObject($rst)) {
array_push($langIdArr,$line->id);
}
foreach($langIdArr as $key=>$value) {
$obj->fnAdd('videoTitle_'.$value,$_POST['videoTitle_'.$value], 'req', 'Please Enter Video Title.');
$obj->fnAdd('feedback_'.$value,$_POST['feedback_'.$value], 'req', 'Please Enter Feedback.');
}
$obj->fnAdd('countryId',$_POST['countryId'], 'req', 'Please Select Country.');
$obj->fnAdd('stateId',$_POST['stateId'], 'req', 'Please Enter State .');
$obj->fnAdd('zoneId',$_POST['zoneId'], 'req', 'Please Select Zone.');
$obj->fnAdd('centerId',$_POST['centerId'], 'req', 'Please Select Center .');
$obj->fnAdd('classId',$_POST['classId'], 'req', 'Please Select Class.');
//$obj->fnAdd('youtubeCode',$_POST['youtubeCode'], 'req', 'Please Enter youTube Code .');
$arr_error = $obj->fnValidate();
$str_validate = (count($arr_error)) ? 0 : 1;
$arr_error[stateId]=$obj->fnGetErr($arr_error[stateId]);
$arr_error[zoneId]=$obj->fnGetErr($arr_error[zoneId]);
$arr_error[countryId]=$obj->fnGetErr($arr_error[countryId]);
$arr_error[centerId]=$obj->fnGetErr($arr_error[centerId]);
$arr_error[classId]=$obj->fnGetErr($arr_error[classId]);
//$arr_error[youtubeCode]=$obj->fnGetErr($arr_error[youtubeCode]);
foreach($langIdArr as $key=>$value) {
$arr_error['videoTitle_'.$value]=$obj->fnGetErr($arr_error['videoTitle_'.$value]);
if($arr_error['videoTitle_'.$value])
$errorArr = 1;
}
foreach($langIdArr as $key=>$value) {
$arr_error['feedback_'.$value]=$obj->fnGetErr($arr_error['feedback_'.$value]);
if($arr_error['feedback_'.$value])
$errorArr = 1;
}
if($errorArr == 0 && isset($_POST['submit']) ){
$_POST = postwithoutspace($_POST);
if(!empty($_POST['fileNames']) && !empty($_FILES['fileName']['name']))
{
move_uploaded_file($_FILES['fileName']['tmp_name'],'video/'.$_FILES['fileName']['name']);
$img=$_FILES['fileName']['name'];
}
else{
$img=$_POST['fileNames'];
}
if(empty($_POST['fileNames']) && !empty($_FILES['fileName']['name']))
{
move_uploaded_file($_FILES['fileName']['tmp_name'],'video/'.$_FILES['fileName']['name']);
$img=$_FILES['fileName']['name'];
}
$catObj->editRecord($_POST,$img);
}
}
}
$result = $catObj->getResult(base64_decode($_GET['id']));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript" src="js/country.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Welcome To <?=SITENAME?> administrative panel</title>
<? include('includes/top.php') ?>
</head>
<body>
<? include('includes/header.php'); ?>
<div id="nav-under-bg"><!-- --></div>
<?php $genObj = new GeneralFunctions();?>
<form name="frmUser" id="frmUser" method="post" enctype="multipart/form-data" onsubmit="javascript: return validateFrm(this);" class="niceform">
<input type="hidden" name="cid" value="<?=$cid?>">
<div id="content">
<!-- table -->
<div class="box">
<div class="title">
<h5>Edit Video</h5>
</div>
<!-- left position -->
<div class="main-body-div4" id="mainDiv">
<div class="add-main-body-left-new" >
<ul>
<li class="add-main-body-left-new-text" style="clear:both; width:500px;padding-bottom:5px;" ><span class="small_error_message">
<?=$_SESSION['SESS_MSG']?>
</span></li>
<li class="lable">Center <span class="spancolor">*</span></li>
<li>
<?php echo $genObj->getEditAllCenterInDropdown($result->id); ?>
<p style="padding-left:150px;"><?=$arr_error[centerId]?></p>
</li>
<li class="lable">Student <span class="spancolor">*</span></li>
<li>
<?php echo $genObj->getEditAllStudentInDropdown($result->id); ?>
<p style="padding-left:150px;"><?=$arr_error[centerId]?></p>
</li>
<li class="lable">Class <span class="spancolor">*</span></li>
<li><?= $genObj->getEditAllClassInDropdown($result->id); ?>
<p style="padding-left:150px;"><?=$arr_error[classId]?></p>
</li>
<li class="lable">Video Title <span class="spancolor">*</span></li>
<?
echo $genObj->getLanguageEditTextBox('videoTitle','m__videoTitle',TBL_VIDEO_DESCRIPTION,base64_decode($_GET['id']),"videoId",$arr_error); //1->type,2->name,3->id,4->tablename,5->tableid
?>
<li class="lable">YouTube Embeded Code <span class="spancolor">*</span></li>
<li ><textarea name="youtubeCode" id="m__youtubeCode " class="wel" ><?= $result->youtubeCode?></textarea>
<p style="padding-left:150px;"><?=$arr_error[youtubeCode]?></p>
</li>
<li class="lable">Upload Video<span class="spancolor"> </span></li>
<li ><input type="file" name="fileName" id="m__fileName" class="wel" >
<p style="padding-left:150px;"><?=$arr_error[fileName]?></p>
</li>
<li class="lable">Feedback<span class="spancolor">*</span></li>
<li >
<?Php echo $genObj->getLanguageEditTextArea('feedback','m__feedback',TBL_VIDEO_DESCRIPTION,base64_decode($_GET['id']),"videoId",$arr_error); //1->type,2->name,3->id,4->tablename,5->tableid?>
</li>
<input type="hidden" name="fileNames" value="<?=$result->fileName?>" />
</ul>
</div>
<div class="main-body-sub">
<input type="submit" name="submit" class="main-body-sub-submit" style="cursor:pointer;" value="Submit" />
<input type="button" name="back" id="back" value="Back" class="main-body-sub-submit" style="cursor:pointer;" onclick="javascript:;hrefBack1()"/>
</div>
</div>
</div>
</div> <input type="hidden" name="id" value="<?=$result->id?>" />
</form>
<? unset($_SESSION['SESS_MSG']); ?>
<?php
session_start();
class Video extends MySqlDriver{
function __construct() {
$this->obj = new MySqlDriver;
}
function valDetail() {
$cond = "1 and ".TBL_VIDEO.".id = ".TBL_VIDEO_DESCRIPTION.".videoId and ".TBL_VIDEO.".isDeleted = '0' and ".TBL_VIDEO_DESCRIPTION.".langId = '".$_SESSION['DEFAULTLANGUAGE']."' ";
if($_REQUEST['searchtxt'] && $_REQUEST['searchtxt'] != SEARCHTEXT){
$searchtxt = $_REQUEST['searchtxt'];
$cond .= " AND (".TBL_VIDEO_DESCRIPTION.".videoTitle LIKE '%$searchtxt%' )";
}
$query = "select ".TBL_VIDEO.".*,".TBL_VIDEO_DESCRIPTION.".videoTitle from ".TBL_VIDEO." , ".TBL_VIDEO_DESCRIPTION." where $cond ";
$sql = $this->executeQry($query);
$num = $this->getTotalRow($sql);
$menuObj = new Menu();
$page = $_REQUEST['page']?$_REQUEST['page']:1;
if($num > 0) {
//-------------------------Paging------------------------------------------------
$paging = $this->paging($query);
$this->setLimit($_GET[limit]);
$recordsPerPage = $this->getLimit();
$offset = $this->getOffset($_GET["page"]);
$this->setStyle("redheading");
$this->setActiveStyle("smallheading");
$this->setButtonStyle("boldcolor");
$currQueryString = $this->getQueryString();
$this->setParameter($currQueryString);
$totalrecords = $this->numrows;
$currpage = $this->getPage();
$totalpage = $this->getNoOfPages();
$pagenumbers = $this->getPageNo();
//-------------------------Paging------------------------------------------------
$orderby = $_GET[orderby]? $_GET[orderby]:TBL_VIDEO_DESCRIPTION.".videoTitle";
$order = $_GET[order]? $_GET[order]:"ASC";
$query .= " ORDER BY $orderby $order LIMIT ".$offset.", ". $recordsPerPage;
$rst = $this->executeQry($query);
$row = $this->getTotalRow($rst);
if($row > 0) {
$i = 1;
while($line = $this->getResultObject($rst)) {
$highlight = $i%2==0?"main-body-bynic":"main-body-bynic2";
$div_id = "status".$line->id;
if ($line->status==0)
$status = "Inactive";
else
$status = "Active";
$centerName = $this->fetchValue(TBL_CENTER_DESCRIPTION,"centerName","1 and centerId = '".$line->centerId."' and langId = '".$_SESSION['DEFAULTLANGUAGE']."'");
$countryName = $this->fetchValue(TBL_COUNTRY_DESCRIPTION,"countryName","1 and countryId = '".$line->countryId."' ");
$studentName = $this->fetchValue(TBL_STUDENT_DESCRIPTION,"studentName","1 and studentId = '".$line->studentId."' ");
$genTable .= '<div class="'.$highlight.'">
<ul>
<li style="width:50px;"> <input name="chk[]" value="'.$line->id.'" type="checkbox"></li>
<li style="width:80px;">'.$i.'</li>
<li style="width:120px;">'.$line->videoTitle.'</li>
<li style="width:110px;">'.$studentName.'</li>
<li style="width:100px;">';
if($menuObj->checkEditPermission())
$genTable .= '<div id="'.$div_id.'" style="cursor:pointer;" onClick="javascript:changeStatus(\''.$div_id.'\',\''.$line->id.'\',\'video\')">'.$status.'</div>';
$genTable .= '</li>
<li style="width:75px;">';
if($menuObj->checkEditPermission())
$genTable .= '<a href="editVideo.php?id='.base64_encode($line->id).'&page='.$page.'"><img src="images/edit.png" alt="Edit" width="16" height="16" border="0" /></a>';
$genTable .= '</li><li>';
if($menuObj->checkDeletePermission())
$genTable .= "<a href='javascript:void(NULL);' onClick=\"if(confirm('Are you sure to delete this Record ?')){window.location.href='pass.php?action=video&type=delete&id=".$line->id."&page=$page'}else{}\" ><img src='images/drop.png' height='16' width='16' border='0' title='Delete' /></a>";
$genTable .= '</li></ul></div>';
$i++;
}
switch($recordsPerPage)
{
case 10:
$sel1 = "selected='selected'";
break;
case 20:
$sel2 = "selected='selected'";
break;
case 30:
$sel3 = "selected='selected'";
break;
case $this->numrows:
$sel4 = "selected='selected'";
break;
}
$currQueryString = $this->getQueryString();
$limit = basename($_SERVER['PHP_SELF'])."?".$currQueryString;
$genTable.="<div style='overflow:hidden; margin:0px 0px 0px 50px;'><table border='0' width='88%' height='50'>
<tr><td align='left' width='300' class='page_info' 'style=margin-left=20px;'>
Display <select name='limit' id='limit' onchange='pagelimit(\"$limit\");' class='page_info'>
<option value='10' $sel1>10</option>
<option value='20' $sel2>20</option>
<option value='30' $sel3>30</option>
<option value='".$totalrecords."' $sel4>All</option>
</select> Records Per Page
</td><td align='center' class='page_info'><inputtype='hidden' name='page' value='".$currpage."'></td><td class='page_info' align='center' width='200'>Total ".$totalrecords." records found</td><td width='0' align='right'>".$pagenumbers."</td></tr></table></div>";
}
} else {
$genTable = '<div> </div><div class="Error-Msg">Sorry no records found</div>';
}
return $genTable;
}
function changeValueStatus($get) {
$status=$this->fetchValue(TBL_VIDEO,"status","1 and id = '$get[id]'");
if($status==1) {
$stat= 0;
$status="Inactive";
} else {
$stat= 1;
$status="Active";
}
$query = "update ".TBL_VIDEO." set status = '$stat', modDate = '".date('Y-m-d H:i:s')."', modBy = '".$_SESSION['ADMIN_ID']."' where id = '$get[id]'";
if($this->executeQry($query))
$this->logSuccessFail('1',$query);
else
$this->logSuccessFail('0',$query);
echo $status;
}
function deleteValue($get) {
//$result=$this->deleteRec(TBL_VIDEO,"path like '%-$get[id]-%'");
$this->executeQry("update ".TBL_VIDEO." set isDeleted = '1', modDate = '".date('Y-m-d H:i:s')."', modBy = '".$_SESSION['ADMIN_ID']."' where id = '$get[id]'");
$_SESSION['SESS_MSG'] = msgSuccessFail("success","Your Information has been deleted successfully!!!");
echo "<script language=javascript>window.location.href='manageVideo.php?page=$get[page]&limit=$get[limit]';</script>";
}
function addRecord($post,$fileName) {
$i=0;$student='';
while($i<count($post[studentId]))
{
$student.=$post[studentId][$i].',';
$i++;
}
$i=0;$center='';
while($i<count($post[centerId]))
{
$center.=$post[centerId][$i].',';
$i++;
}
$i=0;$class='';
while($i<count($post[classId]))
{
$class.=$post[classId][$i].',';
$i++;
}
$_SESSION['SESS_MSG'] = "";
if($_SESSION['SESS_MSG'] == "") {
$query = "insert into ".TBL_VIDEO." set studentId = '$student',classId = '$class', centerId = '$center', youtubeCode = '$post[youtubeCode]',fileName = '$fileName', status = '1', addDate = '".date('Y-m-d H:i:s')."', addedBy = '".$_SESSION['ADMIN_ID']."'";
$sql = $this->executeQry($query);
$inserted_id = mysql_insert_id();
if($inserted_id)
$this->logSuccessFail('1',$query);
else
$this->logSuccessFail('0',$query);
$rst = $this->selectQry(TBL_LANGUAGE,"status='1' and isDeleted = '0' order by id asc","","");
$num = $this->getTotalRow($rst);
if($num){
while($line = $this->getResultObject($rst)) {
$videoTitle = 'videoTitle_'.$line->id;
$feedback = 'feedback_'.$line->id;
$query = "insert into ".TBL_VIDEO_DESCRIPTION." set videoId = '$inserted_id', langId = '".$line->id."', videoTitle= '".addslashes($post[$videoTitle])."' ,feedback = '".addslashes($post[$feedback])."' ";
if($this->executeQry($query))
$this->logSuccessFail('1',$query);
else
$this->logSuccessFail('0',$query);
}
}
$_SESSION['SESS_MSG'] = msgSuccessFail("success","Information has been added successfully.");
}
header("Location:addVideo.php");exit;
}
function editRecord($post,$fileName) {
$i=0;$student='';
while($i<count($post[studentId]))
{
$student.=$post[studentId][$i].',';
$i++;
}
$i=0;$center='';
while($i<count($post[centerId]))
{
$center.=$post[centerId][$i].',';
$i++;
}
$i=0;$class='';
while($i<count($post[classId]))
{
$class.=$post[classId][$i].',';
$i++;
}
$_SESSION['SESS_MSG'] = "";
$query = "update ".TBL_VIDEO." set youtubeCode = '$post[youtubeCode]' ,fileName='$fileName', classId = '$class', centerId = '$center',studentId = '$student', modDate = '".date('Y-m-d H:i:s')."', modBy = '".$_SESSION['ADMIN_ID']."' where id = '".$post[id]."'";
if($this->executeQry($query)) {
$this->logSuccessFail('1',$query);
$rst = $this->selectQry(TBL_LANGUAGE,"status='1' and isDeleted = '0' order by id asc","","");
$num = $this->getTotalRow($rst);
if($num){
while($line = $this->getResultObject($rst)) {
$videoTitle = 'videoTitle_'.$line->id;
$feedback = 'feedback_'.$line->id;
$query = "update ".TBL_VIDEO_DESCRIPTION." set videoTitle = '".addslashes($post[$videoTitle])."' ,feedback = '".addslashes($post[$feedback])."' where 1 and videoId = '$post[id]' and langId = '".$line->id."'";
if($this->executeQry($query))
$this->logSuccessFail('1',$query);
else
$this->logSuccessFail('0',$query);
}
}
}
else
$this->logSuccessFail('0',$query);
echo "<script>window.location.href='manageVideo.php?page=$post[page]';</script>";
}
function deleteAllValues($post){
if(($post[action] == '')){
$_SESSION['SESS_MSG'] = msgSuccessFail("fail","First select the action or records , And then submit!!!");
echo "<script language=javascript>window.location.href='manageVideo.php?page=$post[page]&limit=$post[limit]';</script>";
exit;
}
if($post[action] == 'deleteselected'){
$delres = $post[chk];
$numrec = count($delres);
if($numrec>0){
foreach($delres as $key => $val){
//$result=$this->deleteRec(TBL_VIDEO," path like '%-$val-%'");
$this->executeQry("update ".TBL_VIDEO." set isDeleted = '1', modDate = '".date('Y-m-d H:i:s')."', modBy = '".$_SESSION['ADMIN_ID']."' where id = '$val'");
}
$_SESSION['SESS_MSG'] =msgSuccessFail("success","Your all selected information has been deleted successfully!!!");
}else{
$_SESSION['SESS_MSG'] =msgSuccessFail("fail","First select the record!!!");
}
}
if($post[action] == 'enableall'){
$delres = $post[chk];
$numrec = count($delres);
if($numrec>0){
foreach($delres as $key => $val){
//$result=$this->deleteRec(LOANTBL_VIDEO,"cat_id='$val'");
$sql="update ".TBL_VIDEO." set status ='1', modDate = '".date('Y-m-d H:i:s')."', modBy = '".$_SESSION['ADMIN_ID']."' where id='$val'";
mysql_query($sql);
}
$_SESSION['SESS_MSG'] =msgSuccessFail("success","Enable selected successfully!!!");
}else{
$_SESSION['SESS_MSG'] =msgSuccessFail("fail","First select the record!!!");
}
}
if($post[action] == 'disableall'){
$delres = $post[chk];
$numrec = count($delres);
if($numrec>0){
foreach($delres as $key => $val){
//$result=$this->deleteRec(LOANTBL_VIDEO,"cat_id='$val'");
$sql="update ".TBL_VIDEO." set status ='0', modDate = '".date('Y-m-d H:i:s')."', modBy = '".$_SESSION['ADMIN_ID']."' where id='$val'";
mysql_query($sql);
}
$_SESSION['SESS_MSG'] =msgSuccessFail("success","Disable selected successfully!!!");
}else{
$_SESSION['SESS_MSG'] =msgSuccessFail("fail","First select the record!!!");
}
}
echo "<script language=javascript>window.location.href='manageVideo.php?cid=$post[cid]&page=$post[page]';</script>";
}
function getResult($id) {
$cond = "1 and ".TBL_VIDEO.".id =$id and ".TBL_VIDEO.".id = ".TBL_VIDEO_DESCRIPTION.".videoId ";
$query = "select ".TBL_VIDEO.".*,".TBL_VIDEO_DESCRIPTION.".* from ".TBL_VIDEO." , ".TBL_VIDEO_DESCRIPTION." where $cond ";
$sql = $this->executeQry($query);
$num = $this->getTotalRow($sql);
if($num > 0) {
return $line = $this->getResultObject($sql);
} else {
redirect("manageVideo.php");
}
}
function isVideoNameExist($videotitle,$langId,$id=''){
//$videotitle = trim($videotitle);
if($id)
$con = " and z.id!='".$id."'";
else
$con = "";
$query = "select z.*,zs.videoTitle from ".TBL_VIDEO." as z left join ".TBL_VIDEO_DESCRIPTION." as zs on zs.langId = '".$langId."' and zs.videoTitle='$videotitle' where zs.videoId=z.id $con ";
$rst = $this->executeQry($query);
$row = $this->getTotalRow($rst);
$line = $this->getResultObject($rst);
if($line->isDeleted == 1)
$this->updateRow($line->id,$id);
else
return $row;
}
function updateRow($id,$editid){
$query = "update ".TBL_VIDEO." set isDeleted = '0' where id = '".$id."'";
$rst = $this->executeQry($query);
$query1 = "update ".TBL_VIDEO." set isDeleted = '1' where id = '".$editid."'";
$rst1 = $this->executeQry($query1);
$_SESSION['SESS_MSG'] = msgSuccessFail("success","Information has been added successfully.");
header("Location:addCountry.php");exit;
}
}// End Class
?>