| 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 :LanguageController.php
* File Description :LanguageController.php
* Created By : Pardeep Panchal
* Created Date: 03-Auguest-2016
*/
class LanguageController 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 = "Language";
$this->view->strAddButtonText = "Add Language";
$this->view->strAddButtonUrl = "language/add-language";
$obj = new Travel_Model_TblLanguage();
$arrResult = $obj->getLanguageList();
$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 addLanguageAction() {
$this->_helper->viewRenderer("language");
$this->view->strPageTitle = "Add Language";
$this->view->strFormAction = "/language/add-language";
$this->view->strCancelButtonUrl = "language";
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
$obj = new Travel_Model_TblLanguage();
if (!$obj->isLanguageExists(trim($getData['title_eng']),"")) {
$strTitleEng = trim($getData['title_eng']);
$strTitleLoc = trim($getData['title_loc']);
$strLanguageCode = trim($getData['lang_code']);
$data = array(
'TitleEng' => $strTitleEng,
'TitleLocal' => $strTitleLoc,
'ISO2Code' => $strLanguageCode
);
//Insert Language Data
$result = $obj->addLanguage($data);
$this->_helper->flashMessenger->addMessage("Language added successfully.");
$this->_redirect("/language");
} else{
$this->view->message = 'Language already exists.';
}
}
}
public function editLanguageAction() {
$intId = base64_decode($this->getRequest()->getParam('id'));
$this->_helper->viewRenderer("language");
$this->view->strPageTitle = "Edit Language";
$this->view->strFormAction = "/language/edit-language/id/".$this->getRequest()->getParam('id');
$this->view->strCancelButtonUrl = "language";
$obj = new Travel_Model_TblLanguage();
$result = $obj->getDataByLanguageId($intId);
//echo "<pre>"; print_r($result);
$this->view->arrData = $result;
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
$strTitleEng = trim($getData['title_eng']);
$strTitleLoc = trim($getData['title_loc']);
$strLanguageCode = trim($getData['lang_code']);
$intLanguageId = base64_decode($getData['recordId']);
if (!$obj->isLanguageExists($strTitleEng, $intLanguageId)) {
$data = array(
'TitleEng' => $strTitleEng,
'TitleLocal' => $strTitleLoc,
'ISO2Code' => $strLanguageCode
);
//update Language
$response = $obj->updateLanguage($data, $intLanguageId);
$this->_helper->flashMessenger->addMessage("Language updated successfully.");
$this->_redirect("/language");
} else {
$this->view->message = 'Language 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_TblLanguage();
$obj->deleteLanguage($intId,$data);
$this->_helper->flashMessenger->addMessage("Language deleted successfully.");
$this->_redirect("/language");
}
}