SlideShare a Scribd company logo
<?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']); ?>
logic321
<?

/*---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']); ?>
logic321
logic321
<?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

TXT
Daily notes
PDF
Mocking Demystified
PDF
November Camp - Spec BDD with PHPSpec 2
PPTX
Hacking Your Way To Better Security - Dutch PHP Conference 2016
ODP
Symfony2, creare bundle e valore per il cliente
PDF
Silex meets SOAP & REST
KEY
PDF
Unit and Functional Testing with Symfony2
Daily notes
Mocking Demystified
November Camp - Spec BDD with PHPSpec 2
Hacking Your Way To Better Security - Dutch PHP Conference 2016
Symfony2, creare bundle e valore per il cliente
Silex meets SOAP & REST
Unit and Functional Testing with Symfony2

What's hot (20)

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

Viewers also liked (13)

PDF
February 2013 hm circular
PPTX
4 Bedrooms 449sqm House and Lot rush rush for sale in Cavite Beside Lyceum Un...
PPTX
Townhouse Complete type house Rush rush for sale, Murang bahay sa Cavite Rush...
PPTX
House and Lot rush rush for sale in cavite Near Lyceum Manggahan General tria...
PPTX
Governor's Hills subdivision House and lot rush rush for sale in Cavite 4 bed...
PDF
February 2013 specials
DOCX
Mengidentifikasi menu dan ikon pengolah kata
PPTX
1. identitas nasional
PPTX
6. wawasan nusantara
PPTX
5. negara hukum dan ham
PPTX
Ppt bunga tugas tik
PPTX
Tugas TIK- POWER POINT BIJI
PPTX
House and lot rush rush for sale in Cavite 10% down payment to move-in
February 2013 hm circular
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...
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...
February 2013 specials
Mengidentifikasi menu dan ikon pengolah kata
1. identitas nasional
6. wawasan nusantara
5. negara hukum dan ham
Ppt bunga tugas tik
Tugas TIK- POWER POINT BIJI
House and lot rush rush for sale in Cavite 10% down payment to move-in
Ad

Similar to logic321 (20)

PDF
Add loop shortcode
PPTX
Zero to SOLID
PDF
Advanced php testing in action
PDF
Blog Hacks 2011
KEY
Unit testing with zend framework PHPBenelux
PDF
Unit testing with zend framework tek11
PDF
WordPress-Powered Portfolios
PDF
laravel tricks in 50minutes
DOC
PDF
R57shell
PDF
Get into the FLOW with Extbase
PDF
You're Doing it Wrong - WordCamp Orlando
PDF
C A S Sample Php
ZIP
Drupal Development (Part 2)
PDF
You code sucks, let's fix it
KEY
Lithium Best
KEY
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
PDF
Extbase and Beyond
KEY
Unit testing zend framework apps
KEY
Keeping It Simple
Add loop shortcode
Zero to SOLID
Advanced php testing in action
Blog Hacks 2011
Unit testing with zend framework PHPBenelux
Unit testing with zend framework tek11
WordPress-Powered Portfolios
laravel tricks in 50minutes
R57shell
Get into the FLOW with Extbase
You're Doing it Wrong - WordCamp Orlando
C A S Sample Php
Drupal Development (Part 2)
You code sucks, let's fix it
Lithium Best
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Extbase and Beyond
Unit testing zend framework apps
Keeping It Simple

Recently uploaded (20)

PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Business Ethics Teaching Materials for college
PDF
Insiders guide to clinical Medicine.pdf
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Week 4 Term 3 Study Techniques revisited.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
Microbial disease of the cardiovascular and lymphatic systems
Supply Chain Operations Speaking Notes -ICLT Program
Module 4: Burden of Disease Tutorial Slides S2 2025
Business Ethics Teaching Materials for college
Insiders guide to clinical Medicine.pdf
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
human mycosis Human fungal infections are called human mycosis..pptx
Microbial diseases, their pathogenesis and prophylaxis
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Cell Types and Its function , kingdom of life
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
RMMM.pdf make it easy to upload and study
FourierSeries-QuestionsWithAnswers(Part-A).pdf
O5-L3 Freight Transport Ops (International) V1.pdf

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']); ?>
  • 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']); ?>
  • 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 ?>