| 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
/*
* Catabatic Technology Pvt. Ltd.
* File Name :PackageInclusionCategoryController.php
* File Description : Details for Package Inclusion Category
* Created By : Pardeep Panchal
* Created Date: 04-Auguest-2016
*/
class PackageInclusionCategoryController extends Zend_Controller_Action {
public function init() {
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
Zend_Session::rememberMe(60 * 60 * 24 * 7);
#get session variable
$this->intLoggedinUserId = $sessionLogin_user->intLoggedinUserId;
$this->intLoggedinUserGroupSysId = $sessionLogin_user->intLoggedinUserGroupSysId;
$this->intLoggedinUserAgencySysId = $sessionLogin_user->intLoggedinUserAgencySysId;
$this->intLoggedinUserTrxCurrency = $sessionLogin_user->intLoggedinUserTrxCurrency;
if(!empty($this->intLoggedinUserAgencySysId)) {
$this->InfoSourceSysId = '2'; /* Information Source is Agent */
}
if(empty($this->intLoggedinUserId)) {
$this->_redirect('/login/');
}
}
public function indexAction() {
$this->view->strPageTitle = "Package Inclusion Category";
$this->view->strAddButtonText = "Add Package Inclusion Category";
$this->view->strAddButtonUrl = "package-inclusion-category/add-package-inclusion-category";
$obj = new Travel_Model_TblPackageInclusionCategory();
$arrResult = $obj->getPackageInclusionCategoryList();
$page = $this->_getParam('page', 1);
$paginator = Zend_Paginator::factory($arrResult);
$paginator->setItemCountPerPage(GRID_PER_PAGE_RECORD_COUNT);
$paginator->setCurrentPageNumber($page);
$this->view->paginator = $paginator;
$this->view->messages = $this->_helper->flashMessenger->getMessages();
}
public function addPackageInclusionCategoryAction() {
$this->view->strPageTitle = "Add Package Inclusion Category";
$this->view->strFormAction = "/package-inclusion-category/add-package-inclusion-category";
$this->view->strCancelButtonUrl = "package-inclusion-category";
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
$obj = new Travel_Model_TblPackageInclusionCategory();
if (!$obj->isPackageInclusionCategoryExists(trim($getData['title']),"")) {
// $date = new Zend_Date();
$currentDate = date('Y-m-d H:i:s');
$strPackageInclusionCategoryTitle = trim($getData['title']);
$strIcon = stripslashes($_FILES['icon']['name']);
if(!empty($strIcon)){
$strDestinationFolder = APPLICATION_PATH.'/../public/upload/master/';
$arrFileInfo = pathinfo($strIcon);
$strFileExt = $arrFileInfo['extension']; // get File Extension...
$strIcon = 'PackageInclusionCategoryIcon_'.ucfirst($strPackageInclusionCategoryTitle).'_'.time().'.'.$strFileExt; // Renamed File Name
$objHelper = $this->_helper->FileUpload;
$objHelper->upload($strDestinationFolder,$strIcon);
}else{
$strIcon = "";
}
$data = array(
'Title' => $strPackageInclusionCategoryTitle,
'Icon' => $strIcon
);
//Insert Package Inclusion Category Data
$result = $obj->addPackageInclusionCategory($data);
$this->_helper->flashMessenger->addMessage("Package Inclusion Category added successfully.");
$this->_redirect("/package-inclusion-category");
} else{
$this->view->message = 'Package Inclusion Category already exists.';
}
}
}
public function editPackageInclusionCategoryAction() {
$intId = base64_decode($this->getRequest()->getParam('id'));
$this->_helper->viewRenderer("add-package-inclusion-category");
$this->view->strPageTitle = "Edit Package Inclusion Category";
$this->view->strCancelButtonUrl = "package-inclusion-category";
$this->view->strFormAction = "/package-inclusion-category/edit-package-inclusion-category/id/".$this->getRequest()->getParam('id');
$this->view->strIconPath = '/../public/upload/master/';
$obj = new Travel_Model_TblPackageInclusionCategory();
$result = $obj->getDataByPackageInclusionCategoryId($intId);
//echo "<pre>"; print_r($result);
$this->view->arrData = $result;
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
// $date = new Zend_Date();
$updateDate = date('Y-m-d H:i:s');
$strPackageInclusionCategoryTitle = trim($getData['title']);
$intPackageInclusionCategoryId = base64_decode($getData['recordId']);
$strIcon = stripslashes($_FILES['icon']['name']);
$strHiddenIcon = $getData['hiddenIcon'];
$strHiddenIcon = ($getData['hiddenIcon']) ? $getData['hiddenIcon'] : '';
if (!$obj->isPackageInclusionCategoryExists($strPackageInclusionCategoryTitle, $intPackageInclusionCategoryId)) {
if(!empty($strIcon)){
$strDestinationFolder = APPLICATION_PATH.'/../public/upload/master/';
$arrFileInfo = pathinfo($strIcon);
$strFileExt = $arrFileInfo['extension']; // get File Extension...
$strIcon = 'PackageInclusionCategoryIcon_'.ucfirst($strPackageInclusionCategoryTitle).'_'.time().'.'.$strFileExt; // Renamed File Name
$objHelper = $this->_helper->FileUpload;
$objHelper->upload($strDestinationFolder,$strIcon);
}else{
$strIcon = $strHiddenIcon;
}
$data = array(
'Title' => $strPackageInclusionCategoryTitle,
'Icon' => $strIcon
);
//echo "<pre>"; print_r($data); exit;
//update Package Inclusion Category
$response = $obj->updatePackageInclusionCategory($data, $intPackageInclusionCategoryId);
$this->_helper->flashMessenger->addMessage("Package Inclusion Category updated successfully.");
$this->_redirect("/package-inclusion-category");
} else {
$this->view->message = 'Package Inclusion Category already exists.';
}
}
}
public function deleteRecordAction(){
// disable layout...
$this->_helper->layout->disableLayout();
$intId = base64_decode($this->getRequest()->getParam('id'));
$data = array(
"IsMarkForDel" => 1
);
$obj = new Travel_Model_TblPackageInclusionCategory();
$obj->deletePackageInclusionCategory($intId,$data);
$this->_helper->flashMessenger->addMessage("Package Inclusion Category deleted successfully.");
$this->_redirect("/package-inclusion-category");
}
}