| 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/tripsgateway/application/admin/controllers/ |
Upload File : |
<?php
/* * *************************************************************
* Catabatic Technology Pvt. Ltd.
* File Name : StaticpageController.php
* File Desc. : Staticpage controller managed all staic content pages
* Created By : Ranvir Singh <ranvir@catpl.co.in>
* Created Date : 23 May 2017
* Updated Date : 23 May 2017
* ************************************************************* */
class Admin_BlogController extends Zend_Controller_Action {
public $dbAdapter;
public $perPageLimit;
public $siteurl;
public $DIR_WRITE_MODE;
public function init() {
/* Initialize db and session access */
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$this->siteurl = $aConfig['bootstrap']['siteUrl'];
$this->appmode = $aConfig['bootstrap']['appmode'];
$this->per_page_record = 20;
$this->dbAdapter = Zend_Db_Table::getDefaultAdapter();
$auth = Zend_Auth::getInstance();
$authStorage = $auth->getStorage()->read();
$this->username = $authStorage->username;
$this->admin_type = $authStorage->role;
$this->current_time = time();
$this->imageUrl = (($this->appmode == 'MODE_BETA') ? 'beta/' : '') . 'public/upload/blog/';
$this->img_w_thumb = 100;
$this->img_h_thumb = 55;
$this->img_w_medium = 760;
$this->img_h_medium = 400;
$this->img_w_large = 1600;
$this->img_h_large = 500;
$this->img_w_banner = 1600;
$this->img_h_banner = 580;
$this->img_w_small = 558;
$this->img_h_small = 438;
$this->DIR_WRITE_MODE = 0777;
$this->table = 'tbl_blog';
}
/**
* index() method is used to admin login for form call
* @param Null
* @return Array
*/
public function indexAction() {
//Check admin logedin or not
$this->checklogin();
$crud = new Admin_Model_CRUD();
$resultset = $crud->rv_select_all($this->table, ['*'], ['IsMarkForDel' => 0], ['BlogId' => 'DESC']);
// echo "<pre>";print_r($resultset);die;
$result_destination = $crud->rv_select_all("tb_tbb2c_destinations", ['*'], ['IsPublish' => 1, 'IsMarkForDel' => 0], ['Title' => 'ASC']);
$categoryArray = $crud->rv_select_all('blog_category_list', ['*'], ['status' => 1], ['blog_cat_id' => 'DESC']);
# Start : Pagination
$page = $this->_getParam('page', 1);
$resultset = Zend_Paginator::factory($resultset);
$resultset->setItemCountPerPage($this->per_page_record);
$resultset->setCurrentPageNumber($page);
# End : Pagination
$this->view->page = $page;
$this->view->per_page_record = $this->per_page_record;
$this->view->resultset = $resultset;
$this->view->result_destination = $result_destination;
$this->view->categoryArray = $categoryArray;
$this->view->messages = $this->_helper->flashMessenger->getMessages();
}
/**
* editpage() method is used to admin can edit cms static page
* @param password string
* @return ture
*/
public function editblogAction() {
//$this->checklogin();
$crud = new Admin_Model_CRUD();
$form = new Admin_Form_Editblog();
$pId = (int) $this->getRequest()->getParam("id");
$form->setMethod("POST");
$form->setAction("admin/blog/editblog/id/" . $pId);
$form->setName("edit_blog");
$blogcategoryArray = $crud->rv_select_all('blog_category_list', ['*'], ['status'=>1], ['blog_cat_id'=>'DESC']);
$resultsetBlog = $crud->rv_select_all($this->table, ['BlogId'], ['IsMarkForDel'], ['BlogId' => 'DESC'], 1);
$resultsetPackage = $crud->rv_select_all('tb_tbb2c_packages_master', ['PkgSysId', 'GTXPkgId', 'LongJsonInfo', 'Destinations'], ['IsActive' => 1, 'IsPublish' => 1, 'IsMarkForDel' => 0, 'ItemType' => 1],['PkgSysId' => 'DESC'],500);
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
//if ($form->isValid($getData)) {
//-------Start Code for Approve and Publish content---------//
if (isset($getData['save']) == "Save") {
$categoryDataArray = $crud->selectOne('tbl_pack_type', ['Title'], ['IsActive' => 1, 'packType' => $getData['category']]);
$BlogId = $getData['BlogId'];
$lastInsertId = $resultsetBlog[0]['BlogId'] ;
// echo "<pre>";print_r($lastInsertId);die;
$images = $_FILES['image']['name'];
$orignalFIleName = $image = $_FILES["BlogImage"]["name"];
$detailimage = $_FILES['detailimage']['name'];
// echo "<pre>";print_r($detailimage);die;
$fileNameDescArr = array();
// echo "<pre>";print_r($fileNameDescArr);die;
$totalCount = $getData['count_Blog_des']-1;
// foreach ($detailimage as $keyd => $detailimageVal) {
for($man = 0;$man<$totalCount;$man++){
$detailimageVal = $detailimage[$man];
if (!empty($detailimageVal) && trim($detailimageVal) !='') {
$orignaldetailimageName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl . $BlogId . "/images/description/"; // root folder for destination images
//echo "<pre>";print_r($detailimageVal);die;
$fileExt11 = $this->_helper->General->getFileExtension($detailimageVal);
$fileNameDesc = $lastInsertId . '_' . $this->current_time . '_' . $man . '.' . $fileExt11;
// echo "<pre>";print_r($fileNameDesc);die;
if (!file_exists($orignaldetailimageName)) {
mkdir($orignaldetailimageName, $this->DIR_WRITE_MODE, true);
}
foreach ($_FILES["detailimage"]["tmp_name"] as $dkey1 => $dimage) {
if ($man == $dkey1) {
$dtemp_file_name1 = $dimage; // temprary file name
}
}
@move_uploaded_file($dtemp_file_name1, $orignaldetailimageName . "/" . $fileNameDesc);
$fileNameDescArr[] = $fileNameDesc;
}else{
$fileNameDescArr[] = $getData['hidendetailimage'][$man];
}
}
// echo "<pre>";print_r($fileNameDescArr);die;
foreach ($images as $key => $orignalMultiFileName) {
if (!empty($orignalMultiFileName)) {
$orignalMultiFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl . $BlogId . "/images"; // root folder for destination images
/* Get File Extension */
$fileExt1 = $this->_helper->General->getFileExtension($orignalMultiFileName);
$fileName1 = $BlogId . '_' . $this->current_time . '_' . $key . '.' . $fileExt1;
$originalMultiThumbFolder = $orignalMultiFolderName . "/thumb";
$originalMultiMediumFolder = $orignalMultiFolderName . "/medium";
$originalMultiLargeFolder = $orignalMultiFolderName . "/large";
/* Create directory if not exists */
if (!file_exists($orignalMultiFolderName)) {
mkdir($orignalMultiFolderName, $this->DIR_WRITE_MODE, true);
}
if (!file_exists($originalMultiThumbFolder)) {
mkdir($originalMultiThumbFolder, $this->DIR_WRITE_MODE, true);
}
if (!file_exists($originalMultiMediumFolder)) {
mkdir($originalMultiMediumFolder, $this->DIR_WRITE_MODE, true);
}
if (!file_exists($originalMultiLargeFolder)) {
mkdir($originalMultiLargeFolder, $this->DIR_WRITE_MODE, true);
}
foreach ($_FILES["image"]["tmp_name"] as $key1 => $image) {
if ($key == $key1) {
$temp_file_name1 = $image; // temprary file name
}
}
@move_uploaded_file($temp_file_name1, $orignalMultiFolderName . "/" . $fileName1);
@copy($orignalMultiFolderName . '/' . $fileName1, $originalMultiLargeFolder . "/" . $fileName1); // copy uploaded file into this location directory
$objImageResize4 = new Catabatic_Imageresize($originalMultiLargeFolder . '/' . $fileName1);
$objImageResize4->resizeImage(760, 400, 'exact'); // param : width , height , (exact|portrait|landscape|auto|crop)
$objImageResize4->saveImage($originalMultiLargeFolder . '/' . $fileName1);
@copy($orignalMultiFolderName . '/' . $fileName1, $originalMultiThumbFolder . "/" . $fileName1); // copy uploaded file into this location directory
$objImageResize1 = new Catabatic_Imageresize($originalMultiThumbFolder . '/' . $fileName1);
$objImageResize1->resizeImage($this->img_w_thumb, $this->img_h_thumb, 'exact'); // param : width , height , (exact|portrait|landscape|auto|crop)
$objImageResize1->saveImage($originalMultiThumbFolder . '/' . $fileName1);
@copy($orignalMultiFolderName . '/' . $fileName1, $originalMultiMediumFolder . "/" . $fileName1); // copy uploaded file into this location directory
$objImageResize2 = new Catabatic_Imageresize($originalMultiMediumFolder . '/' . $fileName1);
$objImageResize2->resizeImage($this->img_w_medium, $this->img_h_medium, 'exact'); // param : width , height , (exact|portrait|landscape|auto|crop)
$objImageResize2->saveImage($originalMultiMediumFolder . '/' . $fileName1);
$path_image = "public/upload/blog/" . $BlogId . "/images/" . $fileName1;
@unlink($path_image);
} else {
// echo 'else'; die;
}
}
if (!empty($orignalFIleName)) {
$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl . $BlogId . "/images";
$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
$fileName = $BlogId . '_' . $this->current_time . '.' . $fileExt;
$originalMainFolder = $orignalFolderName . "/main";
if (!file_exists($originalMainFolder)) {
mkdir($originalMainFolder, $this->DIR_WRITE_MODE, true);
}
$temp_file_name = $_FILES["BlogImage"]["tmp_name"]; // temprary file name
@move_uploaded_file($temp_file_name, $originalMainFolder . "/" . $fileName);
}
$image_add = "";
$multiImage = "";
if ($fileName1) {
foreach ($images as $key => $image) {
$fileExt1 = $this->_helper->General->getFileExtension($image);
$fileName1 = $BlogId . '_' . $this->current_time . '_' . $key . '.' . $fileExt1;
$editHotelsData[] = $fileName1;
}
$multiImage = $newimagenames = @implode(",", $editHotelsData);
}
if ($fileName) {
$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
$fileNamenew = $BlogId . '_' . $this->current_time . '.' . $fileExt;
$image_add = $fileNamenew;
}
$oldimagenames = $result['images'];
$editHotelsData = "$oldimagenames";
if (trim($newimagenames))
$editHotelsData .= ",$newimagenames";
$editHotelsData = trim($editHotelsData, ',');
$blgcatname = array();
foreach($blogcategoryArray as $bcKey => $bcVal ){
if(in_array($bcVal['blog_cat_id'], $getData['category'])){
$blgcatname[] = $bcVal['blog_cat_name'];
}
}
// echo "<pre>";print_r($fileNameDescArr);die;
$BlogDescriptionArr = [
'blogdetailTitle'=>($getData['blogdetailTitle']),
'BlogDescription'=>($getData['BlogDescription']),
'images'=>$fileNameDescArr,
'detailPackages'=>($getData['detailPackages']),
];
$motherlocationcity1 = array();
if($getData['map_destination_id']){
$mresultOtherlocationcity1= $crud->getCityListByCityArrayIds($getData['map_destination_id']);
// echo "<pre>";print_r($resultOtherlocationcity1);die;
foreach ($mresultOtherlocationcity1 as $motherlocKey1 => $motherlocValue1) {
$motherlocationcity1[] = $motherlocValue1['cityTitle'];
}
}
// echo "<pre>";print_r($motherlocationcity1);die;
$editPageData = [
'BlogTitle' => ($getData['BlogTitle']),
'BlogIdentifier' => strtolower(Catabatic_Helper::getSeoName($getData['BlogTitle'])),
'BlogDate' => ($getData['BlogDate']),
'PostedBy' => ($getData['PostedBy']),
// 'BlogDescription' => ($getData['BlogDescription']),
'BlogDescription' => json_encode($BlogDescriptionArr),
'UpdateDate' => date('Y-m-d H:i:s'),
'status' => ($getData['status']),
'category' => isset($getData['category']) ? implode(',',$getData['category']): '',
'category_name' => implode(',',$blgcatname),
//'category_name' => ($categoryDataArray['Title']),
'status' => ($getData['status']),
'keyword' => ($getData['keyword']),
'description' => ($getData['description']),
'metatag' => ($getData['metatag']),
'video_urls' => ($getData['video_urls']),
'map_destination' => implode(',',$motherlocationcity1),
'map_destination_id' => ($getData['map_destination_id']),
'selectedPackages' => isset($getData['selectedPackages']) ? json_encode($getData['selectedPackages']): '',
];
// echo "<pre>";print_r($editPageData['BlogDescription']);die;
if ($fileName) {
$editPageData['BlogImage'] = $fileName;
}
if ($fileName1) {
$editPageData['images'] = $editHotelsData;
}
$crud->rv_update($this->table, $editPageData, ['BlogId =?' => $BlogId]);
$this->view->successMessage = "Page content has been saved successfully.";
$this->_helper->flashMessenger->addMessage("Page content has been updated successfully.");
$this->_redirect("/admin/blog/index");
//}
}
}
$result = $crud->getCmsdata($this->table, ['*'], ['BlogId' => $pId], ['BlogId' => 'DESC']);
$otherlocationcity1 = array();
$cityIds = $result->map_destination_id;
if($cityIds){
$resultOtherlocationcity1= $crud->getCityListByCityArrayIds($cityIds);
// echo "<pre>";print_r($resultOtherlocationcity1);die;
foreach ($resultOtherlocationcity1 as $otherlocKey1 => $otherlocValue1) {
$otherlocationcity1[] = [
'CityId' => $otherlocValue1['CityId'],
'cityTitle' => $otherlocValue1['cityTitle'],
'Country' => $otherlocValue1['Country'],
];
}
}
$this->view->otherlocationcity1 = $otherlocationcity1;
$editdata["BlogId"] = @$result->BlogId;
$editdata["BlogTitle"] = @$result->BlogTitle;
$editdata["BlogDate"] = @$result->BlogDate;
$editdata["PostedBy"] = @$result->PostedBy;
$editdata["BlogImage"] = @$result->BlogImage;
$editdata["BlogDescription"] = @$result->BlogDescription;
$editdata["category"] = @$result->category;
$editdata["status"] = @$result->status;
$editdata["keyword"] = @$result->keyword;
$editdata["description"] = @$result->description;
$editdata["metatag"] = @$result->metatag;
// echo "<pre>";print_r($result);die;
$form->populate($editdata);
$this->view->BlogImage = @$result->BlogImage;
$this->view->images = @$result->images;
$this->view->BlogId = @$result->BlogId;
$this->view->category = $result->category;
$this->view->video_urls = @$result->video_urls;
$this->view->map_destination = @$result->map_destination;
$this->view->map_destination_id = @$result->map_destination_id;
$this->view->form = $form;
$this->view->resultsetPackage = $resultsetPackage;
$this->view->selectedPackages = @$result->selectedPackages;
$this->view->BlogDescription = @$result->BlogDescription;
$this->view->categoryArray = $blogcategoryArray;
}
public function addblogAction() {
//Check admin logedin or not
//$this->checklogin();
$crud = new Admin_Model_CRUD();
$blogcategoryArray = $crud->rv_select_all('blog_category_list', ['*'], ['status'=>1], ['blog_cat_id'=>'DESC']);
$resultsetBlog = $crud->rv_select_all($this->table, ['BlogId'], ['IsMarkForDel'], ['BlogId' => 'DESC'], 1);
$resultsetPackage = $crud->rv_select_all('tb_tbb2c_packages_master', ['PkgSysId', 'GTXPkgId', 'LongJsonInfo', 'Destinations'], ['IsActive' => 1, 'IsPublish' => 1, 'IsMarkForDel' => 0, 'ItemType' => 1],['PkgSysId' => 'DESC'],500);
// echo "<pre>";print_r($resultsetPackage);die;
$lastInsertId = $resultsetBlog[0]['BlogId'] + 1;
$form = new Admin_Form_Editblog();
$pId = (int) $this->getRequest()->getParam("id");
$form->setMethod("POST");
$form->setAction("admin/blog/addblog");
$form->setName("edit_blog");
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
// echo "<pre>";print_r($getData);die;
// if ($form->isValid($getData)) {
//-------Start Code for Approve and Publish content---------//
if (isset($getData['save']) == "Save") {
// $categoryDataArray = $crud->selectOne('tbl_pack_type', ['Title'], ['IsActive' => 1, 'packType' => $getData['category']]);
// echo "<pre>";print_r($blogcategoryArray);die;
// echo "<pre>";print_r($getData);die;
$images = $_FILES['image']['name'];
$orignalFIleName = $image = $_FILES["BlogImage"]["name"];
$detailimage = $_FILES['detailimage']['name'];
//echo "<pre>";print_r($detailimage);die;
$fileNameDescArr = array();
foreach ($detailimage as $keyd => $detailimageVal) {
if (!empty($detailimageVal)) {
$orignaldetailimageName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl . $lastInsertId . "/images/description/"; // root folder for destination images
$fileExt11 = $this->_helper->General->getFileExtension($detailimageVal);
$fileNameDesc = $lastInsertId . '_' . $this->current_time . '_' . $keyd . '.' . $fileExt11;
if (!file_exists($orignaldetailimageName)) {
mkdir($orignaldetailimageName, $this->DIR_WRITE_MODE, true);
}
foreach ($_FILES["detailimage"]["tmp_name"] as $dkey1 => $dimage) {
if ($keyd == $dkey1) {
$dtemp_file_name1 = $dimage; // temprary file name
}
}
@move_uploaded_file($dtemp_file_name1, $orignaldetailimageName . "/" . $fileNameDesc);
$fileNameDescArr[] = $fileNameDesc;
}}
foreach ($images as $key => $orignalMultiFileName) {
if (!empty($orignalMultiFileName)) {
$orignalMultiFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl . $lastInsertId . "/images"; // root folder for destination images
/* Get File Extension */
$fileExt1 = $this->_helper->General->getFileExtension($orignalMultiFileName);
$fileName1 = $lastInsertId . '_' . $this->current_time . '_' . $key . '.' . $fileExt1;
$originalMultiThumbFolder = $orignalMultiFolderName . "/thumb";
$originalMultiMediumFolder = $orignalMultiFolderName . "/medium";
$originalMultiLargeFolder = $orignalMultiFolderName . "/large";
/* Create directory if not exists */
if (!file_exists($orignalMultiFolderName)) {
mkdir($orignalMultiFolderName, $this->DIR_WRITE_MODE, true);
}
if (!file_exists($originalMultiThumbFolder)) {
mkdir($originalMultiThumbFolder, $this->DIR_WRITE_MODE, true);
}
if (!file_exists($originalMultiMediumFolder)) {
mkdir($originalMultiMediumFolder, $this->DIR_WRITE_MODE, true);
}
if (!file_exists($originalMultiLargeFolder)) {
mkdir($originalMultiLargeFolder, $this->DIR_WRITE_MODE, true);
}
foreach ($_FILES["image"]["tmp_name"] as $key1 => $image) {
if ($key == $key1) {
$temp_file_name1 = $image; // temprary file name
}
}
@move_uploaded_file($temp_file_name1, $orignalMultiFolderName . "/" . $fileName1);
@copy($orignalMultiFolderName . '/' . $fileName1, $originalMultiLargeFolder . "/" . $fileName1); // copy uploaded file into this location directory
$objImageResize4 = new Catabatic_Imageresize($originalMultiLargeFolder . '/' . $fileName1);
$objImageResize4->resizeImage(760, 400, 'exact'); // param : width , height , (exact|portrait|landscape|auto|crop)
$objImageResize4->saveImage($originalMultiLargeFolder . '/' . $fileName1);
@copy($orignalMultiFolderName . '/' . $fileName1, $originalMultiThumbFolder . "/" . $fileName1); // copy uploaded file into this location directory
$objImageResize1 = new Catabatic_Imageresize($originalMultiThumbFolder . '/' . $fileName1);
$objImageResize1->resizeImage($this->img_w_thumb, $this->img_h_thumb, 'exact'); // param : width , height , (exact|portrait|landscape|auto|crop)
$objImageResize1->saveImage($originalMultiThumbFolder . '/' . $fileName1);
@copy($orignalMultiFolderName . '/' . $fileName1, $originalMultiMediumFolder . "/" . $fileName1); // copy uploaded file into this location directory
$objImageResize2 = new Catabatic_Imageresize($originalMultiMediumFolder . '/' . $fileName1);
$objImageResize2->resizeImage($this->img_w_medium, $this->img_h_medium, 'exact'); // param : width , height , (exact|portrait|landscape|auto|crop)
$objImageResize2->saveImage($originalMultiMediumFolder . '/' . $fileName1);
$path_image = "public/upload/blog/" . $lastInsertId . "/images/" . $fileName1;
@unlink($path_image);
} else {
// echo 'else'; die;
}
}
if (!empty($orignalFIleName)) {
$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl . $lastInsertId . "/images";
$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
$fileName = $lastInsertId . '_' . $this->current_time . '.' . $fileExt;
$originalMainFolder = $orignalFolderName . "/main";
if (!file_exists($originalMainFolder)) {
mkdir($originalMainFolder, $this->DIR_WRITE_MODE, true);
}
$temp_file_name = $_FILES["BlogImage"]["tmp_name"]; // temprary file name
@move_uploaded_file($temp_file_name, $originalMainFolder . "/" . $fileName);
}
$image_add = "";
$multiImage = "";
if ($fileName1) {
foreach ($images as $key => $image) {
$fileExt1 = $this->_helper->General->getFileExtension($image);
$fileName1 = $lastInsertId . '_' . $this->current_time . '_' . $key . '.' . $fileExt1;
$editHotelsData[] = $fileName1;
}
$multiImage = @implode(",", $editHotelsData);
}
if ($fileName) {
$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
$fileNamenew = $lastInsertId . '_' . $this->current_time . '.' . $fileExt;
$image_add = $fileNamenew;
}
$blgcatname = array();
foreach($blogcategoryArray as $bcKey => $bcVal ){
if(in_array($bcVal['blog_cat_id'], $getData['category'])){
$blgcatname[] = $bcVal['blog_cat_name'];
}
}
// $BlogDate1 = explode('/', $getData['BlogDate']);
// $BlogDate = $BlogDate1[2]."-".$BlogDate1[1]."-".$BlogDate[0];
$BlogDescriptionArr = [
'blogdetailTitle'=>($getData['blogdetailTitle']),
'BlogDescription'=>($getData['BlogDescription']),
'images'=>$fileNameDescArr,
'detailPackages'=>($getData['detailPackages']),
];
$motherlocationcity1 = array();
// echo "<pre>";print_r(json_encode($getData['map_destination_id']));die;
if($getData['map_destination_id']){
$mresultOtherlocationcity1= $crud->getCityListByCityArrayIds($getData['map_destination_id']);
// echo "<pre>";print_r($resultOtherlocationcity1);die;
foreach ($mresultOtherlocationcity1 as $motherlocKey1 => $motherlocValue1) {
$motherlocationcity1[] = $motherlocValue1['cityTitle'];
}
}
$savePageData = [
'BlogTitle' => ($getData['BlogTitle']),
'BlogIdentifier' => strtolower(Catabatic_Helper::getSeoName($getData['BlogTitle'])),
'BlogDate' => ($getData['BlogDate']),
'PostedBy' => ($getData['PostedBy']),
'BlogImage' => $image_add,
'images' => $multiImage,
'BlogDescription' => json_encode($BlogDescriptionArr),
'CreateDate' => date('Y-m-d H:i:s'),
'status' => ($getData['status']),
// 'category' => ($getData['category']),
'category' => isset($getData['category']) ? implode(',',$getData['category']): '',
'category_name' => implode(',',$blgcatname),
'keyword' => ($getData['keyword']),
'description' => ($getData['description']),
'metatag' => ($getData['metatag']),
'isMarkForDel' => 0,
'video_urls' => $getData['video_urls'],
'map_destination' => implode(',',$motherlocationcity1),
'map_destination_id' => ($getData['map_destination_id']),
'selectedPackages' => isset($getData['selectedPackages']) ? json_encode($getData['selectedPackages']): '',
];
// echo "<pre>";print_r($savePageData);die;
$crud->rv_insert($this->table, $savePageData);
$this->view->successMessage = "Page content has been saved successfully.";
$this->_helper->flashMessenger->addMessage("Page content has been added successfully.");
$this->_redirect("/admin/blog/index");
}
}
// }
$this->view->form = $form;
$this->view->categoryArray = $blogcategoryArray;
$this->view->resultsetPackage = $resultsetPackage;
$this->view->messages = $this->_helper->flashMessenger->getMessages();
}
public function deleteblogAction() {
$this->checklogin();
$crud = new Admin_Model_CRUD();
$tId = (int) $this->getRequest()->getParam("id");
//echo $tId;die;
if ($tId) {
$checkdata = $crud->rv_select_row($this->table, ['BlogId'], ['BlogId' => $tId], ['BlogId' => 'asc']);
if (count($checkdata) > 0) {
$crud->rv_update($this->table, ['isMarkForDel' => 1], ['BlogId =?' => $tId]);
$this->_helper->flashMessenger->addMessage("Delete successfully.");
$this->_redirect("/admin/blog/index");
} else {
die('Oops some thing wrong!!.');
}
}
}
public function getMultiCitydataAction() {
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout->disableLayout();
$crud = new Admin_Model_CRUD();
// print_r($this->getRequest()->getParam("term"));
// exit;
try {
$arrResponse = array();
if ($this->getRequest()->getParam("term") or $this->getRequest()->getParam("query")) {
$term = $this->getRequest()->getParam("term") ? $this->getRequest()->getParam("term") : $this->getRequest()->getParam("query");
$countryId = $this->getRequest()->getParam("countryId") ? $this->getRequest()->getParam("countryId") : '';
$condCity = "tbl.Title like '" . $term . "%'";
if (isset($countryId) && !empty($countryId)) {
$condCity .= " AND tbl.ContSysId = " . $countryId . "";
}
//echo $condCity;
$arrResponse = $crud->getBuyHotelCityAutoSuggest($condCity);
// print_r($arrResponse);die;
}
$arrResponseF = array();
foreach ($arrResponse as $key => $response) {
$arrResponseF[$key]['CityId'] = $response['CityId'];
$arrResponseF[$key]['Title'] = ($response['label']);
$arrResponseF[$key]['CityName'] = stripslashes($response['CityName']);
$arrResponseF[$key]['CountryId'] = stripslashes($response['countryTitle']);
}
echo json_encode($arrResponseF);
exit;
} catch (Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage());
echo json_encode($response);
exit;
}
}
public function sanitize_data($string) {
$searchArr = array("iframe", "script", "document", "write", "alert", "%", "@", "$", ";", "+", "|", "#", "<", ">", ")", "(", "'", "\'", ",", "and ", " &", "& ", "and", " and", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
$input_data = strtolower($string);
$input_data = str_replace($searchArr, "", $input_data);
$input_data = str_replace(" ", "-", $input_data);
//echo $input_data; die;
return $input_data;
}
/**
* 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');
}
}
}