| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/travelbrace.com/application/admin/controllers/ |
Upload File : |
<?php
class Admin_VideoController extends Catabatic_Rvadmin {
public $dbAdapter;
public $perPageLimit;
public $siteurl;
public $DIR_WRITE_MODE;
public function init() {
parent::init(); //
/* Initialize db and session access */
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$this->siteurl = $aConfig['bootstrap']['siteUrl'];
$this->appmode = $aConfig['bootstrap']['appmode'];
$this->AgencyId = $aConfig['bootstrap']['gtxagencysysid'];
$this->per_page_record = 25;
$this->dbAdapter = Zend_Db_Table::getDefaultAdapter();
$options = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption('bootstrap');
$baseUrl = $options['siteUrl'];
$auth = Zend_Auth::getInstance();
$authStorage = $auth->getStorage()->read();
$this->username = $authStorage->username;
}
public function indexAction() {
$this->checklogin();
$this->view->messages = $this->_helper->flashMessenger->getMessages();
$crud = new Admin_Model_CRUD();
$getData = array();
if($this->getRequest()->isPost())
{
$getData = $this->getRequest()->getPost();
$searchArr = array(
'Title'=>$getData['Title'],
'rows'=>$getData['rows'],
'page'=>$getData['page'],
);
$resulsetold = $crud->getCount( 'tbl_videolink',['status' =>1],'id');
$crud->searchArr = $searchArr;
$resultset = $crud->rv_select_static( 'tbl_videolink',['id','name','link','status'],[''],['id'=> 'DESC']);
if (count($resultset) > 0) {
foreach ($resultset as $resultkey => $resultval) {
$result1[] = [
'id' => $resultval['id'],
'name' => $resultval['name'],
'link' => $resultval['link'],
'status' => $resultval['status']==1?'Active':'Deactive',
];
}
}
$result = Zend_Json::encode($result1);
$newResult = Zend_Json::decode($result,false);
$finalResult["total"]=$resulsetold[0]['id'];
$finalResult["rows"]=$newResult;
echo json_encode($finalResult);
exit;
}
}
public function editvideoAction(){
//Check admin logedin or not
$this->checklogin();
$crud = new Admin_Model_CRUD();
$form = new Admin_Form_Editvideo();
$pId = (int)$this->getRequest()->getParam("id");
$form->setMethod("POST");
$form->setAction("admin/video/editvideo/id/".$pId);
$form->setName("edit_video_page");
if( $this->getRequest()->isPost() ) {
$getData = $this->getRequest()->getPost();
if($form->isValid($getData)) {
//-------Start Code for Approve and Publish content---------//
if(isset($getData['save'])=="Save") {
$editPageData = [
'name'=>($getData['name']),
'link'=>($getData['link']),
'status'=>"{$getData['status_number']}"
];
// echo "<pre>";print_r($editPageData);die;
$crud->rv_update('tbl_videolink', $editPageData, ['id =?'=>$pId]);
$this->view->successMessage ="Content has been saved successfully.";
$this->_helper->flashMessenger->addMessage("Content has been updated successfully.");
$this->_redirect("/admin/video/index");
}
}
}
$result = $crud->getCmsdata('tbl_videolink', ['*'], ['id'=>$pId], ['id'=>'DESC']);
//echo "<pre>";print_r($result);die;
$editdata["id"] = @$result->id;
$editdata["name"] = @$result->name;
$editdata["link"] = @$result->link;
$editdata["status_number"] = @$result->status;
$form->populate($editdata);
$this->view->form = $form;
//die('ok');
}
public function deletevideoAction(){
$this->checklogin();
$crud = new Admin_Model_CRUD();
$tId = (int)$this->getRequest()->getParam("id");
// echo"<pre>";print_r($tId);die();
if($tId){
$checkdata = $crud->rv_select_row('tbl_videolink', ['id'], ['id'=>$tId], ['id'=>'asc']);
if(count($checkdata)>0){
$crud->rv_delete('tbl_videolink', ['id =?'=>$tId]);
$this->_helper->flashMessenger->addMessage("Delete successfully.");
$this->_redirect("/admin/video/index");
}else{
die('Oops some thing wrong!!.');
}
}
}
/**
* checklogin() method is used to check admin logedin or not
* @param Null
* @return Array
*/
public function checklogin() {
if (($this->admin_type == "superadmin") || ($this->admin_type == "admin")) {
$auth = Zend_Auth::getInstance();
$hasIdentity = $auth->hasIdentity();
/* * ************* check admin identity *********** */
if (!$hasIdentity) {
$this->_redirect('admin/index/index');
}
} else {
$this->_redirect('admin/index/index');
}
}
}
?>