SlideShare a Scribd company logo
1 of 40
<?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" />


        &nbsp;
<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" />

        &nbsp;
<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;">&nbsp;&nbsp;<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>&nbsp;</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]';</scr
ipt>";

       }




       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]';</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
$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

?>

More Related Content

What's hot

Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4
Fabien Potencier
 
jQuery: out with the old, in with the new
jQuery: out with the old, in with the newjQuery: out with the old, in with the new
jQuery: out with the old, in with the new
Remy Sharp
 
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
Fabien Potencier
 

What's hot (20)

Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5
 
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowForget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers Cracow
 
Your code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnConYour code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnCon
 
PHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4DevelopersPHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4Developers
 
The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016
 
Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4
 
jQuery: out with the old, in with the new
jQuery: out with the old, in with the newjQuery: out with the old, in with the new
jQuery: out with the old, in with the new
 
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
 
購物車程式架構簡介
購物車程式架構簡介購物車程式架構簡介
購物車程式架構簡介
 
Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!
 
50 Laravel Tricks in 50 Minutes
50 Laravel Tricks in 50 Minutes50 Laravel Tricks in 50 Minutes
50 Laravel Tricks in 50 Minutes
 
Database Design Patterns
Database Design PatternsDatabase Design Patterns
Database Design Patterns
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistence
 
Design Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et PimpleDesign Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et Pimple
 
PhpSpec 2.0 ilustrated by examples
PhpSpec 2.0 ilustrated by examplesPhpSpec 2.0 ilustrated by examples
PhpSpec 2.0 ilustrated by examples
 
Dutch PHP Conference - PHPSpec 2 - The only Design Tool you need
Dutch PHP Conference - PHPSpec 2 - The only Design Tool you needDutch PHP Conference - PHPSpec 2 - The only Design Tool you need
Dutch PHP Conference - PHPSpec 2 - The only Design Tool you need
 
PHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くためにPHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くために
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
 
Crafting beautiful software
Crafting beautiful softwareCrafting beautiful software
Crafting beautiful software
 
Decoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DICDecoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DIC
 

Viewers also liked

6. wawasan nusantara
6. wawasan nusantara6. wawasan nusantara
6. wawasan nusantara
Mardiah Ahmad
 
5. negara hukum dan ham
5. negara hukum dan ham5. negara hukum dan ham
5. negara hukum dan ham
Mardiah Ahmad
 
Tugas TIK- POWER POINT BIJI
Tugas TIK- POWER POINT BIJITugas TIK- POWER POINT BIJI
Tugas TIK- POWER POINT BIJI
Mardiah Ahmad
 

Viewers also liked (13)

February 2013 hm circular
February 2013 hm circularFebruary 2013 hm circular
February 2013 hm circular
 
4 Bedrooms 449sqm House and Lot rush rush for sale in Cavite Beside Lyceum Un...
4 Bedrooms 449sqm House and Lot rush rush for sale in Cavite Beside Lyceum Un...4 Bedrooms 449sqm House and Lot rush rush for sale in Cavite Beside Lyceum Un...
4 Bedrooms 449sqm House and Lot rush rush for sale in Cavite Beside Lyceum Un...
 
Townhouse Complete type house Rush rush for sale, Murang bahay sa Cavite Rush...
Townhouse Complete type house Rush rush for sale, Murang bahay sa Cavite Rush...Townhouse Complete type house Rush rush for sale, Murang bahay sa Cavite Rush...
Townhouse Complete type house Rush rush for sale, Murang bahay sa Cavite Rush...
 
House and Lot rush rush for sale in cavite Near Lyceum Manggahan General tria...
House and Lot rush rush for sale in cavite Near Lyceum Manggahan General tria...House and Lot rush rush for sale in cavite Near Lyceum Manggahan General tria...
House and Lot rush rush for sale in cavite Near Lyceum Manggahan General tria...
 
Governor's Hills subdivision House and lot rush rush for sale in Cavite 4 bed...
Governor's Hills subdivision House and lot rush rush for sale in Cavite 4 bed...Governor's Hills subdivision House and lot rush rush for sale in Cavite 4 bed...
Governor's Hills subdivision House and lot rush rush for sale in Cavite 4 bed...
 
February 2013 specials
February 2013 specialsFebruary 2013 specials
February 2013 specials
 
Mengidentifikasi menu dan ikon pengolah kata
Mengidentifikasi menu dan ikon pengolah kataMengidentifikasi menu dan ikon pengolah kata
Mengidentifikasi menu dan ikon pengolah kata
 
1. identitas nasional
1. identitas nasional1. identitas nasional
1. identitas nasional
 
6. wawasan nusantara
6. wawasan nusantara6. wawasan nusantara
6. wawasan nusantara
 
5. negara hukum dan ham
5. negara hukum dan ham5. negara hukum dan ham
5. negara hukum dan ham
 
Ppt bunga tugas tik
Ppt bunga tugas tikPpt bunga tugas tik
Ppt bunga tugas tik
 
Tugas TIK- POWER POINT BIJI
Tugas TIK- POWER POINT BIJITugas TIK- POWER POINT BIJI
Tugas TIK- POWER POINT BIJI
 
House and lot rush rush for sale in Cavite 10% down payment to move-in
House and lot rush rush for sale in Cavite 10% down payment to move-inHouse and lot rush rush for sale in Cavite 10% down payment to move-in
House and lot rush rush for sale in Cavite 10% down payment to move-in
 

Similar to logic321

R57shell
R57shellR57shell
R57shell
ady36
 
C A S Sample Php
C A S Sample PhpC A S Sample Php
C A S Sample Php
JH Lee
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Masahiro Nagano
 

Similar to logic321 (20)

Add loop shortcode
Add loop shortcodeAdd loop shortcode
Add loop shortcode
 
Zero to SOLID
Zero to SOLIDZero to SOLID
Zero to SOLID
 
Advanced php testing in action
Advanced php testing in actionAdvanced php testing in action
Advanced php testing in action
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
Unit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBeneluxUnit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBenelux
 
Unit testing with zend framework tek11
Unit testing with zend framework tek11Unit testing with zend framework tek11
Unit testing with zend framework tek11
 
WordPress-Powered Portfolios
WordPress-Powered PortfoliosWordPress-Powered Portfolios
WordPress-Powered Portfolios
 
laravel tricks in 50minutes
laravel tricks in 50minuteslaravel tricks in 50minutes
laravel tricks in 50minutes
 
Php
PhpPhp
Php
 
R57shell
R57shellR57shell
R57shell
 
Get into the FLOW with Extbase
Get into the FLOW with ExtbaseGet into the FLOW with Extbase
Get into the FLOW with Extbase
 
You're Doing it Wrong - WordCamp Orlando
You're Doing it Wrong - WordCamp OrlandoYou're Doing it Wrong - WordCamp Orlando
You're Doing it Wrong - WordCamp Orlando
 
C A S Sample Php
C A S Sample PhpC A S Sample Php
C A S Sample Php
 
Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix it
 
Lithium Best
Lithium Best Lithium Best
Lithium Best
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
 
Extbase and Beyond
Extbase and BeyondExtbase and Beyond
Extbase and Beyond
 
Unit testing zend framework apps
Unit testing zend framework appsUnit testing zend framework apps
Unit testing zend framework apps
 
Keeping It Simple
Keeping It SimpleKeeping It Simple
Keeping It Simple
 

Recently uploaded

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 

logic321

  • 1. <?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();
  • 2. $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.');
  • 3. //$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]);
  • 4. 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,''))
  • 5. { $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();
  • 6. ?> <!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">
  • 7. <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>
  • 8. <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>
  • 9. <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>
  • 10. <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" /> &nbsp;
  • 11. <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']); ?>
  • 12.
  • 13. <? /*---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();
  • 14. $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 .');
  • 15. $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']) ){
  • 16. $_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); } }
  • 17. } $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">
  • 18. <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>
  • 19. <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 ?>
  • 20. <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" /> &nbsp;
  • 21. <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']); ?>
  • 22.
  • 23.
  • 25. 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"]);
  • 26. $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";
  • 27. $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;">&nbsp;&nbsp;<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>';
  • 28. $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++; }
  • 29. 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>
  • 30. </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>&nbsp;</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))
  • 31. $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]';</scr ipt>"; } function addRecord($post,$fileName) { $i=0;$student=''; while($i<count($post[studentId]))
  • 32. { $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'] = "";
  • 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 ?>