| 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/b2bzend/application/controllers/ |
Upload File : |
<?php
/*****************
* Zend Framework
* @category Zend
* @package Zend_Controller_Action
* @copyright Copyright (c) 2008-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: DbTable.php 8862 2012-03-16 15:36:00Z thomas $
* @author Shobhit Srivastav(shobhit833@gmail.com).
* Create Date 27-07-2016
* Update Date 27-07-2016
* MasterController (It will allow users to add different masters)
*****/
class HotelExtraServicesController extends Catabatic_ValidateGtx
{
public function init()
{
parent::init();
$request = Zend_Controller_Front::getInstance()->getRequest();
$this->baseUrl = $request->getScheme() . '://' . $request->getHttpHost();
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
$this->intLoggedinUserId = $sessionLogin_user->intLoggedinUserId;
$this->intLoggedinUserAgencySysId = $sessionLogin_user->intLoggedinUserAgencySysId;
}
public function indexAction()
{
$this->view->baseUrl = $this->baseUrl;
$objGen = new Travel_Model_AddonsModel();
$hotelId = (int) $this->getRequest()->getParam('hotelId');
$objCurrency = new Travel_Model_TblCurrency();
$currencyData = $objCurrency->getCurrencyListingRecord();
//echo "<pre>";print_r($currencyData);die;
foreach ($currencyData as $cKey => $cVal) {
$currencyArry[$cVal['CurrencyType']] = $cVal['Symbol'];
}
$this->view->currencyArry = $currencyArry;
if ($hotelId > 0) {
$areaList = $objGen->getAddons($hotelId, $this->intLoggedinUserAgencySysId);
//echo "<pre>";print_r($areaList );die;
$page = $this->_getParam('page', 1);
$paginator = Zend_Paginator::factory($areaList);
$paginator->setItemCountPerPage(GRID_PER_PAGE_RECORD_COUNT);
$paginator->setCurrentPageNumber($page);
$this->view->hotelId = $hotelId;
$this->view->paginator = $paginator;
$this->view->messages = $this->_helper->flashMessenger->getMessages();
} else {
echo "Please check Hotel Id";
exit;
}
}
public function addExtraServiceAction()
{
$this->view->baseUrl = $this->baseUrl;
$TblAgency = new Travel_Model_TblAgency;
$hotelId = $this->getRequest()->getParam('hotelId');
$id = $this->getRequest()->getParam('id');
$objCurrency = new Travel_Model_TblCurrency();
$currencyData = $objCurrency->getCurrencyListingRecord();
$this->view->currencyData = $currencyData;
if (isset($id) && $id != '') {
$objGen = new Travel_Model_GeneralFunction();
$areaData = $objGen->getRecordListingWhereWithSearch('TB_MP_Inventory_Accom_ExtraServices', ['*'], ['IsMarkForDel' => 0, 'AgencySysId' => $this->intLoggedinUserAgencySysId, 'ExtraServiceSysId' => $id, 'AccomSysId' => $hotelId], 'ExtraServiceSysId', 'DESC');
$this->view->areaData = $areaData;
}
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
$filaNameData = '';
$orignalFIleName = $_FILES["Image"]["name"];
if (!empty($orignalFIleName)) {
$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/public/upload/hotel-extra-services/image";
$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
$fileName = 'image_' . time() . '.' . $fileExt;
if (!file_exists($orignalFolderName)) {
@mkdir($orignalFolderName, 0777, true);
}
$temp_file_name = $_FILES["Image"]["tmp_name"]; // temprary file name
if (move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName)) {
$filaNameData = $fileName;
}
}
$saveData = [
'AgencySysId' => $this->intLoggedinUserAgencySysId,
'AccomSysId' => $hotelId,
'Title' => isset($getData['Title']) ? $getData['Title'] : '',
'Detail' => isset($getData['Detail']) ? $getData['Detail'] : '',
'CostCurrency' => isset($getData['Currency']) ? $getData['Currency'] : 0,
'AdultCost' => isset($getData['AdultCost']) ? (int) $getData['AdultCost'] : 0,
'ChildCost' => isset($getData['ChildCost']) ? (int) $getData['ChildCost'] : 0,
'IsActive' => isset($getData['IsActive']) ? (int) $getData['IsActive'] : 1,
'IsMarkForDel' => 0,
];
if (isset($id) && $id != '') {
if (isset($filaNameData) && $filaNameData != '') {
//echo "<pre>";print_r($filaNameData);die;
$saveData['Image'] = isset($filaNameData) ? $filaNameData : ' ';
}
$where = array('ExtraServiceSysId = ? ' => $id, 'AccomSysId = ? ' => $hotelId);
$return = $TblAgency->updateData('TB_MP_Inventory_Accom_ExtraServices', $saveData, $where);
} else {
$saveData['Image'] = isset($filaNameData) ? $filaNameData : ' ';
$return = $TblAgency->insertData('TB_MP_Inventory_Accom_ExtraServices', $saveData);
}
$this->_redirect('/hotel-extra-services/index/hotelId/' . $hotelId);
}
}
}