33. 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);
34. 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].',';
35. $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)) {
36. $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!!!");
37. 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'");
38. $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!!!");
}
}
39. echo "<script
language=javascript>window.location.href='manageVideo.php?cid=$post[cid]&page=$post[page]';</scri
pt>";
}
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
40. $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
?>