本文整理汇总了PHP中Default_Model_Countries::SaveMainCountryData方法的典型用法代码示例。如果您正苦于以下问题:PHP Default_Model_Countries::SaveMainCountryData方法的具体用法?PHP Default_Model_Countries::SaveMainCountryData怎么用?PHP Default_Model_Countries::SaveMainCountryData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Default_Model_Countries
的用法示例。
在下文中一共展示了Default_Model_Countries::SaveMainCountryData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addnewcountryAction
public function addnewcountryAction()
{
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');
$controllername = 'countries';
$countriesform = new Default_Form_countries();
$countriesmodel = new Default_Model_Countries();
$countriesform->setAction(BASE_URL . 'countries/addnewcountry');
/* Changing the form */
$countriesform->removeElement('country');
$countriesform->removeElement('countrycode');
$countriesform->addElement('text', 'country', array('label' => 'Country', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Please enter country name.')))));
$countriesform->country->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'tbl_countries', 'field' => 'country_name')));
$countriesform->country->getValidator('Db_NoRecordExists')->setMessage('Country name already exists.');
$countriesform->addElement('text', 'countrycode', array('label' => 'Country code', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Please enter country code.')))));
$countriesform->countrycode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'tbl_countries', 'field' => 'country_code')));
$countriesform->countrycode->getValidator('Db_NoRecordExists')->setMessage('Country code already exists.');
/* END */
if ($this->getRequest()->getPost()) {
$id = $this->_request->getParam('id');
$errorflag = "true";
$msgarray = array();
$dbcountry = '';
$dbcountryid = '';
$country = $this->_request->getParam('country');
$countrycode = $this->_request->getParam('countrycode');
$citizenship = $this->_request->getParam('citizenship');
$dbcountry = $country;
if ($countriesform->isValid($this->_request->getPost()) && $errorflag == "true") {
$date = new Zend_Date();
$actionflag = 1;
$tableid = '';
$countryID = $countriesmodel->SaveMainCountryData($country, $countrycode);
$tableid = $countryID;
$menuID = COUNTRIES;
$result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
$countryData = $countriesmodel->getTotalCountriesList('isactive=1', 'country_name');
$opt = '';
foreach ($countryData as $record) {
$opt .= sapp_Global::selectOptionBuilder($record['id'], $record['country_name']);
}
$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 = '';
$this->view->form = $countriesform;
$this->view->controllername = $controllername;
}