本文整理汇总了PHP中Default_Model_Countries::SaveorUpdateCountryData方法的典型用法代码示例。如果您正苦于以下问题:PHP Default_Model_Countries::SaveorUpdateCountryData方法的具体用法?PHP Default_Model_Countries::SaveorUpdateCountryData怎么用?PHP Default_Model_Countries::SaveorUpdateCountryData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Default_Model_Countries
的用法示例。
在下文中一共展示了Default_Model_Countries::SaveorUpdateCountryData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: savesitepreference
public function savesitepreference($wizardpreferenceform, $wizardData)
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
if ($wizardpreferenceform->isValid($this->_request->getPost())) {
$trDb = Zend_Db_Table::getDefaultAdapter();
// starting transaction
$trDb->beginTransaction();
try {
$systempreferencemodel = new Default_Model_Sitepreference();
$currencymodel = new Default_Model_Currency();
$orgInfoModel = new Default_Model_Organisationinfo();
$wizard_model = new Default_Model_Wizard();
$IdentityCodesModel = new Default_Model_Identitycodes();
$employmentstatusmodel = new Default_Model_Employmentstatus();
$countriesmodel = new Default_Model_Countries();
$statesmodel = new Default_Model_States();
$citiesmodel = new Default_Model_Cities();
$id = (int) $this->_request->getParam('id');
$currencyid = (int) $this->_request->getParam('currencyid');
$organisationid = (int) $this->_request->getParam('organisationid');
$empcodeid = (int) $this->_request->getParam('empcodeid');
$dateformatid = $this->_request->getParam('dateformatid');
$timeformatid = $this->_request->getParam('timeformatid');
$timezoneid = $this->_request->getParam('timezoneid');
$currencyname = $this->_request->getParam('currencyname');
$currencycode = $this->_request->getParam('currencycode');
$passwordid = $this->_request->getParam('passwordid');
$perm_country = $this->_request->getParam('perm_country');
$perm_stateparam = $this->_request->getParam('perm_state');
$perm_stateArr = explode("!@#", $this->_request->getParam('perm_state'));
$perm_state = $perm_stateArr[0];
$perm_cityparam = $this->_request->getParam('perm_city');
$perm_cityArr = explode("!@#", $this->_request->getParam('perm_city'));
$perm_city = $perm_cityArr[0];
$employee_code = $this->_request->getParam('employee_code');
$workcodename = $this->_request->getParam('workcodename');
$date = new Zend_Date();
$menumodel = new Default_Model_Menu();
/*
* Save or Update - Currency name in currency table based on currency ID
*/
$currency_data = array('currencyname' => trim($currencyname), 'currencycode' => trim($currencycode), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
if ($currencyid != '') {
$currencywhere = array('id=?' => $currencyid);
} else {
$currency_data['createdby'] = $loginUserId;
$currency_data['createddate'] = gmdate("Y-m-d H:i:s");
$currency_data['isactive'] = 1;
$currencywhere = '';
}
$CurrencyId = $currencymodel->SaveorUpdateCurrencyData($currency_data, $currencywhere);
/*
* End
*/
/*
* Start - Updating and Inserting Site Preference Data after fetching currency id
*/
$siteprference_data = array('dateformatid' => $dateformatid, 'timeformatid' => $timeformatid, 'timezoneid' => $timezoneid, 'currencyid' => $currencyid != '' ? $currencyid : $CurrencyId, 'passwordid' => $passwordid, 'createdby' => $loginUserId, 'createddate' => $date->get('yyyy-MM-dd HH:mm:ss'), 'modifiedby' => $loginUserId, 'modifieddate' => $date->get('yyyy-MM-dd HH:mm:ss'), 'isactive' => 1);
$site_update_arr = array('isactive' => 0, 'modifieddate' => $date->get('yyyy-MM-dd HH:mm:ss'), 'modifiedby' => $loginUserId);
$systempreferencemodel->SaveorUpdateSystemPreferanceData($site_update_arr, 'isactive = 1');
$Id = $systempreferencemodel->SaveorUpdateSystemPreferanceData($siteprference_data, '');
/*
* End
*/
/*
* Updating Country,state and city based on organisation id
*/
// Inserting into main_countries if not added
$countryExistsArr = $countriesmodel->getActiveCountryName($perm_country);
if (empty($countryExistsArr)) {
$countrynamearr = $countriesmodel->getCountryCode($perm_country);
if (!empty($countrynamearr)) {
$country_data = array('country' => trim($countrynamearr[0]['country_name']), 'countrycode' => trim($countrynamearr[0]['country_code']), 'citizenship' => NULL, 'createdby' => $loginUserId, 'createddate' => $date->get('yyyy-MM-dd HH:mm:ss'), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'country_id_org' => $perm_country, 'isactive' => 1);
$Country_Id = $countriesmodel->SaveorUpdateCountryData($country_data, '');
}
}
// Inserting into main_state if not added
$State_Id = $statesmodel->SaveorUpdateStatesData($perm_country, $perm_stateArr[1], $perm_state, $loginUserId);
// Inserting into main_cities if not added
$City_Id = $citiesmodel->SaveorUpdateCitiesData($perm_country, $perm_state, $perm_cityArr[1], $perm_city, $loginUserId);
$location_data = array('country' => $perm_country, 'state' => $perm_state, 'city' => $perm_city, 'createdby' => $loginUserId, 'createddate' => $date->get('yyyy-MM-dd HH:mm:ss'), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'isactive' => 1);
if ($organisationid != '') {
$locwhere = array('id=?' => $organisationid);
$LocationId = $orgInfoModel->SaveorUpdateData($location_data, $orgwhere);
}
$LocationId = $wizard_model->SaveorUpdateWizardData($location_data, '');
/*
* End
*/
/*
* Start - Updating Employee Code
*/
$empcode_data = array('employee_code' => trim($employee_code), 'modifiedBy' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
if ($empcodeid != '') {
$empcodewhere = array('id=?' => $empcodeid);
} else {
$empcode_data['createdby'] = $loginUserId;
//.........这里部分代码省略.........
示例2: addpopupAction
public function addpopupAction()
{
Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
$id = $this->getRequest()->getParam('id');
$callval = $this->getRequest()->getParam('call');
$countriesform = new Default_Form_countries();
$countriesmodel = new Default_Model_Countries();
$countriesform->setAction(BASE_URL . 'countries/addpopup');
$controllername = 'countries';
if ($this->getRequest()->getPost()) {
$id = $this->_request->getParam('id');
$errorflag = "true";
$msgarray = array();
$dbcountry = '';
$dbcountryid = '';
$country = $this->_request->getParam('country');
$othercountry = $this->_request->getParam('othercountry');
$countrycode = $this->_request->getParam('countrycode');
$citizenship = $this->_request->getParam('citizenship');
if ($country == 'other') {
if ($othercountry == '') {
$msgarray['othercountry'] = "Please enter other country";
$errorflag = "false";
} else {
$isduplicatecountrynameArr = $countriesmodel->getDuplicateCountryName($othercountry);
if ($isduplicatecountrynameArr[0]['count'] > 0) {
$errorflag = "false";
$msgarray['othercountry'] = "Country already exists";
$msgarray['othercountryname'] = $othercountry;
} else {
if (!preg_match('/^[^ ][a-z0-9 ]*$/i', $othercountry)) {
$errorflag = "false";
$msgarray['othercountry'] = "Please enter valid country name.";
$msgarray['othercountryname'] = $othercountry;
} else {
$dbcountry = $othercountry;
$errorflag = "true";
}
}
}
} else {
$countrynamearr = $countriesmodel->getCountryCode($country);
if (!empty($countrynamearr)) {
$dbcountry = $countrynamearr[0]['country_name'];
$dbcountryid = $countrynamearr[0]['id'];
$errorflag = "true";
} else {
$msgarray['country'] = $dbcountry . " already added";
$errorflag = "false";
}
}
if ($countriesform->isValid($this->_request->getPost()) && $errorflag == "true") {
$date = new Zend_Date();
$actionflag = '';
$tableid = '';
if ($country == 'other') {
if ($othercountry != '' && $countrycode != '') {
$countryID = $countriesmodel->SaveMainCountryData($othercountry, $countrycode);
}
}
$data = array('country' => trim($dbcountry), 'countrycode' => trim($countrycode), 'citizenship' => NULL, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'country_id_org' => $dbcountryid != '' ? $dbcountryid : $countryID);
if ($id != '') {
$where = array('id=?' => $id);
$actionflag = 2;
} else {
$data['createdby'] = $loginUserId;
$data['createddate'] = gmdate("Y-m-d H:i:s");
$data['isactive'] = 1;
$where = '';
$actionflag = 1;
}
$Id = $countriesmodel->SaveorUpdateCountryData($data, $where);
$tableid = $Id;
$menuID = COUNTRIES;
$result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
$countryData = $countriesmodel->fetchAll('isactive = 1', 'country')->toArray();
$opt = '';
foreach ($countryData as $record) {
$opt .= sapp_Global::selectOptionBuilder($record['country_id_org'], $record['country']);
}
$this->view->countryData = $opt;
$this->view->eventact = 'added';
$close = 'close';
$this->view->popup = $close;
} else {
$messages = $countriesform->getMessages();
foreach ($messages as $key => $val) {
foreach ($val as $key2 => $val2) {
$msgarray[$key] = $val2;
break;
}
}
$this->view->msgarray = $msgarray;
}
}
$this->view->ermsg = '';
//.........这里部分代码省略.........