| 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/prathamtour.com/application/modules/blog/controllers/ |
Upload File : |
<?php
/*************************************************************
* Catabatic Technology Pvt. Ltd.
* File Name : IndexController.php
* File Desc. : Index controller for home page front end
* Created By : Piyush Tiwari <piyush@catpl.co.in>
* Created Date : 27 July 2018
* Updated Date : 27 July 2018
* Tours_IndexController | Tours Module / Index controller
**************************************************************
*/
class Blog_IndexController extends Zend_Controller_Action {
public $baseUrl = '';
public $AgencyId;
protected $objMdl;
protected $objHelperGeneral;
protected $tablename;
public function init() {
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$BootStrap = $aConfig['bootstrap'];
$this->siteName = $BootStrap['siteName'];
$this->baseUrl = $BootStrap['siteUrl'];
$this->AgencyId = $BootStrap['gtxagencysysid'];
$this->objMdl = new Admin_Model_CRUD();
$this->table= "tbl_travelogues";
$this->objHelperGeneral = $this->_helper->General;
$this->commentable='tbl_comments';
$this->per_page_record = 10;
$this->_helper->layout->disableLayout();
$this->_helper->_layout->setLayout('layout-visa')->setLayoutPath(APPLICATION_PATH.'/layouts/scripts');
}
public function indexAction()
{
$this->_redirect('/travelogue');
$this->view->baseUrl=$this->baseUrl;
$crud = new Admin_Model_CRUD();
$resultset = $crud->rv_select_all($this->table, ['*'], ['status'=>1,'IsMarkForDel'=>0], ['TravId'=>'DESC']);
if(count($resultset)>0 && !empty($resultset)){
$cnt= count($resultset);
$pageNumber = $this->_getParam('frontpage', 1);
$paginator = Zend_Paginator::factory($resultset);
$paginator->setCurrentPageNumber($this->getRequest()->getParam('frontpage')); // page number
$perPage = $paginator->setItemCountPerPage($this->per_page_record); // number of items to show per page
//echo "<pre>"; print_r($pageNumber); die;
}
//echo "<pre>=="; print_r($paginator); die;
$this->view->resultset = $paginator;
//$this->view->resultset = $resultset;
}
public function blogDetailAction() {
$this->view->baseUrl=$this->baseUrl;
$param = $this->getRequest()->getParams();
$pageid = explode(".",$param['p']);
$pId = trim($pageid['0']);
$crud = new Admin_Model_CRUD();
$resulsetold = $crud->getCount($this->commentable,['blogId' => $tId],'commentId');
$resultset = $crud->rv_select_row($this->table, ['*'], ['TravIdentifier' => $pId], ['TravId' => 'DESC']);
$resultsetSeoForBlog = $crud->rv_select_row($this->table, ['TravTitle','keyword','description','metatag'], ['TravIdentifier' => $pId], ['TravId' => 'DESC']);
$this->view->resultset = $resultset;
$this->view->resultsetSeoForBlog = $resultsetSeoForBlog;
$this->view->totalcooment = $resulsetold[0]['commentId'];
}
public function savecommentAction(){
$crud = new Admin_Model_CRUD();
if( $this->getRequest()->isPost() ) {
$getData = $this->getRequest()->getPost();
// echo "<pre>"; print_r($getData); die;
$savePageData = [
'blogId' => ($getData['blogId']),
'name' => $getData['username'],
'emailId' => $getData['email'],
'phone' => $getData['phone'],
'comment' => $getData['comment'],
'status' => 1,
'createDate'=> date('Y-m-d H:i:s'),
];
//echo "<pre>";print_r($savePageData);die;
$crud->rv_insert($this->commentable, $savePageData);
echo "<span style='color:green'>Comment has been added successfully.</span><br>"; exit;
}
}
}