当前位置: 首页>>代码示例>>PHP>>正文


PHP Default_Model_Countries::getTotalCountriesList方法代码示例

本文整理汇总了PHP中Default_Model_Countries::getTotalCountriesList方法的典型用法代码示例。如果您正苦于以下问题:PHP Default_Model_Countries::getTotalCountriesList方法的具体用法?PHP Default_Model_Countries::getTotalCountriesList怎么用?PHP Default_Model_Countries::getTotalCountriesList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Default_Model_Countries的用法示例。


在下文中一共展示了Default_Model_Countries::getTotalCountriesList方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'countries/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'countries');
     $id = new Zend_Form_Element_Hidden('id');
     $country = new Zend_Form_Element_Select('country');
     $country->setAttrib('class', 'selectoption');
     $country->setAttrib('onchange', 'displayCountryCode(this)');
     $country->setRegisterInArrayValidator(false);
     $country->addMultiOption('', 'Select Country');
     $countrymodel = new Default_Model_Countries();
     $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null);
     $actionName = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     if ($id_val == '' || $actionName == 'view') {
         $countrymodeldata = $countrymodel->getTotalCountriesList('addcountry');
         foreach ($countrymodeldata as $countryres) {
             $country->addMultiOption($countryres['id'], utf8_encode($countryres['country_name']));
         }
         $country->addMultiOption('other', 'Other');
     }
     $country->setRequired(true);
     $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.'));
     $country->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_countries', 'field' => 'country_id_org', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $country->getValidator('Db_NoRecordExists')->setMessage('Country already exists.');
     $countrycode = new Zend_Form_Element_Text('countrycode');
     $countrycode->setAttrib('maxLength', 20);
     $countrycode->setAttrib('readonly', true);
     $countrycode->setAttrib('onfocus', 'this.blur()');
     $countrycode->setRequired(true);
     $countrycode->addValidator('NotEmpty', false, array('messages' => 'Please enter country code.'));
     $countrycode->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid country code.')));
     $citizenship = new Zend_Form_Element_Text('citizenship');
     $citizenship->setAttrib('maxLength', 20);
     $citizenship->setRequired(true);
     $citizenship->addValidator('NotEmpty', false, array('messages' => 'Please enter citizenship.'));
     $citizenship->addValidator("regex", true, array('pattern' => '/^[a-zA-Z\\s]*$/i', 'messages' => array('regexNotMatch' => 'Please enter valid citizenship.')));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $country, $countrycode, $citizenship, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
开发者ID:uskumar33,项目名称:DeltaONE,代码行数:44,代码来源:countries.php

示例2: comeditAction

 public function comeditAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('empcommunicationdetails', $empOrganizationTabs)) {
             $empDeptdata = array();
             $employeeData = array();
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
                 $loginuserRole = $auth->getStorage()->read()->emprole;
                 $loginuserGroup = $auth->getStorage()->read()->group_id;
             }
             $id = $this->getRequest()->getParam('userid');
             if ($id == '') {
                 $id = $loginUserId;
             }
             $callval = $this->getRequest()->getParam('call');
             if ($callval == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
             }
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $employeeModal = new Default_Model_Employee();
                     $empdata = $employeeModal->getsingleEmployeeData($id);
                     if ($empdata == 'norows') {
                         $this->view->rowexist = "norows";
                         $this->view->empdata = "";
                     } else {
                         $this->view->rowexist = "rows";
                         if (!empty($empdata)) {
                             $empDept = $empdata[0]['department_id'];
                             $empcommdetailsform = new Default_Form_empcommunicationdetails();
                             $empcommdetailsModal = new Default_Model_Empcommunicationdetails();
                             $usersModel = new Default_Model_Users();
                             $countriesModel = new Default_Model_Countries();
                             $statesmodel = new Default_Model_States();
                             $citiesmodel = new Default_Model_Cities();
                             $orgInfoModel = new Default_Model_Organisationinfo();
                             $msgarray = array();
                             $orgid = 1;
                             $countryId = '';
                             $stateId = '';
                             $cityId = '';
                             $deptModel = new Default_Model_Departments();
                             if ($empDept != '' && $empDept != 'NULL') {
                                 $empDeptdata = $deptModel->getEmpdepartmentdetails($empDept);
                                 if (!empty($empDeptdata)) {
                                     $countryId = $empDeptdata[0]['country'];
                                     $stateId = $empDeptdata[0]['state'];
                                     $cityId = $empDeptdata[0]['city'];
                                 }
                             } else {
                                 $empDeptdata = $orgInfoModel->getOrganisationDetails($orgid);
                                 if (!empty($empDeptdata)) {
                                     $countryId = $empDeptdata[0]['country'];
                                     $stateId = $empDeptdata[0]['state'];
                                     $cityId = $empDeptdata[0]['city'];
                                 }
                             }
                             if ($countryId != '') {
                                 $countryData = $countriesModel->getActiveCountryName($countryId);
                             }
                             if (!empty($countryData)) {
                                 $empDeptdata[0]['country'] = $countryData[0]['country'];
                             } else {
                                 $empDeptdata[0]['country'] = '';
                             }
                             if ($stateId != '') {
                                 $stateData = $statesmodel->getStateNameData($stateId);
                             }
                             if (!empty($stateData)) {
                                 $empDeptdata[0]['state'] = $stateData[0]['state'];
                             } else {
                                 $empDeptdata[0]['state'] = '';
                             }
                             if ($cityId != '') {
                                 $citiesData = $citiesmodel->getCitiesNameData($cityId);
                             }
                             if (!empty($citiesData)) {
                                 $empDeptdata[0]['city'] = $citiesData[0]['city'];
                             } else {
                                 $empDeptdata[0]['city'] = '';
                             }
                             $countrieslistArr = $countriesModel->getTotalCountriesList();
                             if (sizeof($countrieslistArr) > 0) {
                                 $empcommdetailsform->perm_country->addMultiOption('', 'Select Country');
                                 $empcommdetailsform->current_country->addMultiOption('', 'Select Country');
                                 foreach ($countrieslistArr as $countrieslistres) {
                                     $empcommdetailsform->perm_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
                                     $empcommdetailsform->current_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
                                 }
                             } else {
                                 $msgarray['perm_country'] = 'Countries are not configured yet.';
                                 $msgarray['current_country'] = 'Countries are not configured yet.';
                             }
                             $data = $empcommdetailsModal->getsingleEmpCommDetailsData($id);
                             if (!empty($data)) {
                                 $perm_country = $data[0]['perm_country'];
                                 if (isset($_POST['perm_country'])) {
//.........这里部分代码省略.........
开发者ID:lukkyrich,项目名称:sentrifugo,代码行数:101,代码来源:MyemployeesController.php

示例3: addAction

 /**
  * This action is used for adding data.    
  * @return Zend_Form.
  */
 public function addAction()
 {
     $req_model = new Default_Model_Requisition();
     $cand_model = new Default_Model_Candidatedetails();
     $cand_work_model = new Default_Model_Candidateworkdetails();
     $countriesModel = new Default_Model_Countries();
     $auth = Zend_Auth::getInstance();
     $msgarray = array();
     $popConfigPermission = array();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     if (sapp_Global::_checkprivileges(COUNTRIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') {
         array_push($popConfigPermission, 'country');
     }
     if (sapp_Global::_checkprivileges(STATES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') {
         array_push($popConfigPermission, 'state');
     }
     if (sapp_Global::_checkprivileges(CITIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') {
         array_push($popConfigPermission, 'city');
     }
     $req_data = $req_model->getRequisitionsForCV("'Approved','In process'");
     $req_options = array();
     foreach ($req_data as $req) {
         $req_options[$req['id']] = $req['requisition_code'] . ' - ' . $req['jobtitlename'];
     }
     if (count($req_options) == 0) {
         $msgarray['requisition_id'] = "No approved requisitions.";
     }
     $id = $this->getRequest()->getParam('id');
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $form = new Default_Form_Candidatedetails();
     $form->setAction(DOMAIN . 'candidatedetails/add');
     $countrieslistArr = $countriesModel->getTotalCountriesList();
     if (sizeof($countrieslistArr) > 0) {
         $form->country->addMultiOption('', 'Select Country');
         foreach ($countrieslistArr as $countrieslistres) {
             $form->country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
         }
     } else {
         $msgarray['country'] = 'Countries are not configured yet';
     }
     $form->requisition_id->addMultiOptions(array('' => 'Select Requisition ID') + $req_options);
     if (isset($_POST['country']) && $_POST['country'] != '') {
         $statesmodel = new Default_Model_States();
         $statesmodeldata = $statesmodel->getStatesList(intval($_POST['country']));
         $st_opt = array();
         if (count($statesmodeldata) > 0) {
             foreach ($statesmodeldata as $dstate) {
                 $st_opt[$dstate['id'] . '!@#' . $dstate['state_name']] = $dstate['state_name'];
             }
         }
         $form->state->addMultiOptions(array('' => 'Select State') + $st_opt);
     }
     if (isset($_POST['state']) && $_POST['state'] != '') {
         $citiesmodel = new Default_Model_Cities();
         $citiesmodeldata = $citiesmodel->getCitiesList(intval($_POST['state']));
         $ct_opt = array();
         if (count($citiesmodeldata) > 0) {
             foreach ($citiesmodeldata as $dcity) {
                 $ct_opt[$dcity['id'] . '!@#' . $dcity['city_name']] = $dcity['city_name'];
             }
         }
         $form->city->addMultiOptions(array('' => 'Select City') + $ct_opt);
     }
     $data = array();
     $data['cand_resume'] = $this->_getParam('cand_resume');
     $data['selected_option'] = $this->_getParam('selected_option');
     $this->view->form = $form;
     $this->view->data = $data;
     $this->view->popConfigPermission = $popConfigPermission;
     $this->view->msgarray = $msgarray;
     if ($this->getRequest()->getPost()) {
         $result = $this->save($form);
         $this->view->msgarray = $result;
         $this->view->messages = $result;
     }
 }
开发者ID:uskumar33,项目名称:DeltaONE,代码行数:87,代码来源:RequisitionScheduleController.php

示例4: viewAction

 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('workeligibilitydetails', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $employeeData = array();
             $id = $this->getRequest()->getParam('userid');
             $callval = $this->getRequest()->getParam('call');
             if ($callval == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
             }
             $objName = 'workeligibilitydetails';
             $issuingauthority = '';
             $employeeModal = new Default_Model_Employee();
             $workeligibilityform = new Default_Form_Workeligibilitydetails();
             $workeligibilityform->removeElement("submit");
             $elements = $workeligibilityform->getElements();
             if (count($elements) > 0) {
                 foreach ($elements as $key => $element) {
                     if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                         $element->setAttrib("disabled", "disabled");
                     }
                 }
             }
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $usersModel = new Default_Model_Users();
                     $empdata = $employeeModal->getActiveEmployeeData($id);
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                     if ($empdata == 'norows') {
                         $this->view->rowexist = "norows";
                         $this->view->empdata = "";
                     } else {
                         $this->view->rowexist = "rows";
                         if (!empty($empdata)) {
                             $workeligibilityModel = new Default_Model_Workeligibilitydetails();
                             if ($id) {
                                 $usersModel = new Default_Model_Users();
                                 $workeligibilityDoctypesModal = new Default_Model_Workeligibilitydoctypes();
                                 $countriesModel = new Default_Model_Countries();
                                 $statesmodel = new Default_Model_States();
                                 $citiesmodel = new Default_Model_Cities();
                                 $countrieslistArr = $countriesModel->getTotalCountriesList();
                                 if (sizeof($countrieslistArr) > 0) {
                                     $workeligibilityform->issuingauth_country->addMultiOption('', 'Select Country');
                                     foreach ($countrieslistArr as $countrieslistres) {
                                         $workeligibilityform->issuingauth_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
                                     }
                                 } else {
                                     $msgarray['issuingauth_country'] = 'Countries are not configured yet.';
                                 }
                                 $data = $workeligibilityModel->getWorkEligibilityRecord($id);
                                 if (!empty($data) && isset($data)) {
                                     $countryId = $data[0]['issuingauth_country'];
                                     $stateId = $data[0]['issuingauth_state'];
                                     $cityId = $data[0]['issuingauth_city'];
                                     $documenttype_id = $data[0]['documenttype_id'];
                                     if ($countryId != '') {
                                         $statelistArr = $statesmodel->getStatesList($countryId);
                                         if (sizeof($statelistArr) > 0) {
                                             $workeligibilityform->issuingauth_state->addMultiOption('', 'Select State');
                                             foreach ($statelistArr as $statelistres) {
                                                 $workeligibilityform->issuingauth_state->addMultiOption($statelistres['id'] . '!@#' . $statelistres['state_name'], $statelistres['state_name']);
                                             }
                                         }
                                     }
                                     if ($stateId != '') {
                                         $citylistArr = $citiesmodel->getCitiesList($stateId);
                                         if (sizeof($citylistArr) > 0) {
                                             $workeligibilityform->issuingauth_city->addMultiOption('', 'Select City');
                                             foreach ($citylistArr as $cityPermlistres) {
                                                 $workeligibilityform->issuingauth_city->addMultiOption($cityPermlistres['id'] . '!@#' . $cityPermlistres['city_name'], $cityPermlistres['city_name']);
                                             }
                                         }
                                         $stateNameArr = $statesmodel->getStateName($stateId);
                                     }
                                     if ($cityId != '') {
                                         $cityNameArr = $citiesmodel->getCityName($cityId);
                                     }
                                     if ($documenttype_id != '') {
                                         $issuingauthorityArr = $workeligibilityDoctypesModal->getIssuingAuthority($documenttype_id);
                                     }
                                     if (!empty($issuingauthorityArr)) {
                                         $issuingauthority = $issuingauthorityArr[0]['issuingauthority'];
                                         $workeligibilityform->issuingauthflag->setValue($issuingauthority);
                                         $workeligibilityform->documenttype_id->addMultiOption($issuingauthorityArr[0]['id'], $issuingauthorityArr[0]['documenttype']);
                                     }
                                     $workeligibilityform->setDefault("id", $data[0]["id"]);
                                     $workeligibilityform->setDefault("user_id", $data[0]["user_id"]);
                                     $workeligibilityform->setDefault('issuingauth_country', $data[0]['issuingauth_country']);
                                     if (!empty($stateNameArr)) {
                                         $workeligibilityform->setDefault('issuingauth_state', $stateNameArr[0]['id'] . '!@#' . $stateNameArr[0]['statename']);
                                     }
                                     if (!empty($cityNameArr)) {
                                         $workeligibilityform->setDefault('issuingauth_city', $cityNameArr[0]['id'] . '!@#' . $cityNameArr[0]['cityname']);
                                     }
//.........这里部分代码省略.........
开发者ID:lukkyrich,项目名称:sentrifugo,代码行数:101,代码来源:WorkeligibilitydetailsController.php

示例5: editpopupAction

 public function editpopupAction()
 {
     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');
     $userid = $this->getRequest()->getParam('unitId');
     if ($id == '') {
         $id = $loginUserId;
     }
     // For open the form in popup...
     $empadditionaldetailsform = new Default_Form_empadditionaldetails();
     $empadditionaldetailsModal = new Default_Model_Empadditionaldetails();
     $countriesModel = new Default_Model_Countries();
     $veteranstatusmodel = new Default_Model_Veteranstatus();
     $militaryservicemodel = new Default_Model_Militaryservice();
     $countrieslistArr = $countriesModel->getTotalCountriesList();
     $empadditionaldetailsform->countries_served->addMultiOption('', 'Select Country');
     if (!empty($countrieslistArr)) {
         foreach ($countrieslistArr as $countrieslistres) {
             $empadditionaldetailsform->countries_served->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
         }
     }
     $militaryserviceArr = $militaryservicemodel->getTotalMilitaryServiceData();
     $empadditionaldetailsform->military_servicetype->addMultiOption('', 'Select Service Type');
     if (!empty($militaryserviceArr)) {
         foreach ($militaryserviceArr as $militaryserviceres) {
             $empadditionaldetailsform->military_servicetype->addMultiOption($militaryserviceres['id'], $militaryserviceres['militaryservicetype']);
         }
     }
     $veteranstatusArr = $veteranstatusmodel->getTotalVeteranStatusData();
     $empadditionaldetailsform->veteran_status->addMultiOption('', 'Select Veteran Status');
     if (!empty($veteranstatusArr)) {
         foreach ($veteranstatusArr as $veteranstatusres) {
             $empadditionaldetailsform->veteran_status->addMultiOption($veteranstatusres['id'], $veteranstatusres['veteranstatus']);
         }
     }
     if ($id) {
         $data = $empadditionaldetailsModal->getEmpAdditionalDetailsData($id);
         if (!empty($data)) {
             $empadditionaldetailsform->populate($data[0]);
             $empadditionaldetailsform->setDefault('countries_served', $data[0]['countries_served']);
             $empadditionaldetailsform->setDefault('military_servicetype', $data[0]['military_servicetype']);
             $empadditionaldetailsform->setDefault('veteran_status', $data[0]['veteran_status']);
             $from_date = sapp_Global::change_date($data[0]['from_date'], 'view');
             $to_date = sapp_Global::change_date($data[0]['to_date'], 'view');
             $empadditionaldetailsform->from_date->setValue($from_date);
             $empadditionaldetailsform->to_date->setValue($to_date);
             $this->view->data = $data;
         }
     }
     $empadditionaldetailsform->setAttrib('action', BASE_URL . 'empadditionaldetails/editpopup/unitId/' . $userid);
     $this->view->form = $empadditionaldetailsform;
     $this->view->controllername = 'empadditionaldetails';
     if ($this->getRequest()->getPost()) {
         $result = $this->save($empadditionaldetailsform, $userid);
         $this->view->msgarray = $result;
     }
 }
开发者ID:lukkyrich,项目名称:sentrifugo,代码行数:61,代码来源:EmpadditionaldetailsController.php

示例6: workeligibilityAction

 public function workeligibilityAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('workeligibilitydetails', $empOrganizationTabs)) {
             $tabName = "workeligibility";
             $employeeData = array();
             $msgarray = array();
             $emptyFlag = 0;
             $issuingauthority = '';
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $userid = $loginUserId;
             $employeeModal = new Default_Model_Employee();
             $empdata = $employeeModal->getsingleEmployeeData($userid);
             if ($empdata == 'norows') {
                 $this->view->rowexist = "norows";
                 $this->view->empdata = "";
             } else {
                 $this->view->rowexist = "rows";
                 if (!empty($empdata)) {
                     $workeligibilityform = new Default_Form_Workeligibilitydetails();
                     $workeligibilityModel = new Default_Model_Workeligibilitydetails();
                     $workeligibilityDoctypesModal = new Default_Model_Workeligibilitydoctypes();
                     //fetchAll($where = null, $order = null, $count = null, $offset = null) function syntax...
                     $workeligibilityDoctypesData = $workeligibilityDoctypesModal->fetchAll('isactive=1', 'documenttype');
                     $workeligibilityDoctypesDataArr = $workeligibilityDoctypesData->toArray();
                     if (!empty($workeligibilityDoctypesDataArr)) {
                         foreach ($workeligibilityDoctypesDataArr as $data) {
                             $workeligibilityform->documenttype_id->addMultiOption($data['id'], $data['documenttype']);
                         }
                     } else {
                         $msgarray['documenttype_id'] = 'Work eligibility document types are not configured yet.';
                         $emptyFlag++;
                     }
                     if ($userid) {
                         $countriesModel = new Default_Model_Countries();
                         $statesmodel = new Default_Model_States();
                         $citiesmodel = new Default_Model_Cities();
                         $countrieslistArr = $countriesModel->getTotalCountriesList();
                         if (sizeof($countrieslistArr) > 0) {
                             $workeligibilityform->issuingauth_country->addMultiOption('', 'Select Country');
                             foreach ($countrieslistArr as $countrieslistres) {
                                 $workeligibilityform->issuingauth_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
                             }
                         } else {
                             $msgarray['issuingauth_country'] = 'Countries are not configured yet.';
                             $emptyFlag++;
                         }
                         $data = $workeligibilityModel->getWorkEligibilityRecord($userid);
                         if (!empty($data) && isset($data)) {
                             $countryId = $data[0]['issuingauth_country'];
                             $stateId = $data[0]['issuingauth_state'];
                             $cityId = $data[0]['issuingauth_city'];
                             $documenttype_id = $data[0]['documenttype_id'];
                             //Populating states & cities Drop down......... from tbl_states & tbl_cities
                             if ($countryId != '') {
                                 $statelistArr = $statesmodel->getStatesList($countryId);
                                 if (sizeof($statelistArr) > 0) {
                                     $workeligibilityform->issuingauth_state->addMultiOption('', 'Select State');
                                     foreach ($statelistArr as $statelistres) {
                                         $workeligibilityform->issuingauth_state->addMultiOption($statelistres['id'] . '!@#' . $statelistres['state_name'], $statelistres['state_name']);
                                     }
                                 }
                             }
                             if ($stateId != '') {
                                 $citylistArr = $citiesmodel->getCitiesList($stateId);
                                 if (sizeof($citylistArr) > 0) {
                                     $workeligibilityform->issuingauth_city->addMultiOption('', 'Select City');
                                     foreach ($citylistArr as $cityPermlistres) {
                                         $workeligibilityform->issuingauth_city->addMultiOption($cityPermlistres['id'] . '!@#' . $cityPermlistres['city_name'], $cityPermlistres['city_name']);
                                     }
                                 }
                                 $stateNameArr = $statesmodel->getStateName($stateId);
                             }
                             if ($cityId != '') {
                                 $cityNameArr = $citiesmodel->getCityName($cityId);
                             }
                             if ($documenttype_id != '') {
                                 $issuingauthorityArr = $workeligibilityDoctypesModal->getIssuingAuthority($documenttype_id);
                             }
                             if (!empty($issuingauthorityArr)) {
                                 $issuingauthority = $issuingauthorityArr[0]['issuingauthority'];
                                 $workeligibilityform->issuingauthflag->setValue($issuingauthority);
                             }
                             $workeligibilityform->setDefault("id", $data[0]["id"]);
                             $workeligibilityform->setDefault("user_id", $data[0]["user_id"]);
                             $workeligibilityform->setDefault('issuingauth_country', $data[0]['issuingauth_country']);
                             if (!empty($stateNameArr)) {
                                 $workeligibilityform->setDefault('issuingauth_state', $stateNameArr[0]['id'] . '!@#' . $stateNameArr[0]['statename']);
                             }
                             if (!empty($cityNameArr)) {
                                 $workeligibilityform->setDefault('issuingauth_city', $cityNameArr[0]['id'] . '!@#' . $cityNameArr[0]['cityname']);
                             }
                             $workeligibilityform->setDefault("documenttype_id", $data[0]["documenttype_id"]);
                             $workeligibilityform->setDefault("issuingauth_name", $data[0]["issuingauth_name"]);
                             $workeligibilityform->setDefault("issuingauth_postalcode", $data[0]["issuingauth_postalcode"]);
                             $issue_date = sapp_Global::change_date($data[0]["doc_issue_date"], 'view');
//.........这里部分代码省略.........
开发者ID:lukkyrich,项目名称:sentrifugo,代码行数:101,代码来源:MydetailsController.php

示例7: addnewstateAction

 public function addnewstateAction()
 {
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $msgarray = array();
     $controllername = 'states';
     $statestring = '';
     $id = $this->getRequest()->getParam('id');
     $selectedcountryid = $this->_request->getParam('selectcountryid', null);
     $statesform = new Default_Form_states();
     $statesmodel = new Default_Model_States();
     $countriesModel = new Default_Model_Countries();
     /* Changing the form */
     $statesform->setAction(BASE_URL . 'states/addnewstate/selectcountryid/' . $selectedcountryid);
     $statesform->removeElement('state');
     $statesform->addElement('text', 'state', array('label' => 'State', 'maxlength' => '20', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Please enter state name.')))));
     /* END */
     $countrieslistArr = $countriesModel->getTotalCountriesList('');
     if (sizeof($countrieslistArr) > 0) {
         $statesform->countryid->addMultiOption('', 'Select Country');
         foreach ($countrieslistArr as $countrieslistres) {
             if (isset($selectedcountryid)) {
                 if ($countrieslistres['id'] == $selectedcountryid) {
                     $statesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
                     $statesform->setDefault('countryid', $selectedcountryid);
                 }
             } else {
                 $statesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
             }
         }
     } else {
         $msgarray['countryid'] = 'Countries are not configured yet';
     }
     if ($this->getRequest()->getPost()) {
         $errorflag = "true";
         $msgarray = array();
         $id = $this->_request->getParam('id');
         $dbstate = '';
         $dbcountryid = '';
         $state = trim($this->_request->getParam('state'));
         $countryid = $this->_request->getParam('countryid');
         if (isset($countryid) && $countryid != '') {
             $isDuplicateStateNameArr = $statesmodel->getDuplicateStateName($state, $countryid);
             if ($isDuplicateStateNameArr[0]['count'] > 0) {
                 $errorflag = "false";
                 $msgarray['state'] = "State already exists.";
             }
         } else {
             $errorflag = "false";
             $msgarray['countryid'] = "Please select country.";
         }
         if ($statesform->isValid($this->_request->getPost()) && $errorflag == "true") {
             $menumodel = new Default_Model_Menu();
             $actionflag = '';
             $tableid = '';
             $NewStateId = $statesmodel->SaveMainStateData($countryid, $state);
             $tableid = $NewStateId;
             $actionflag = 1;
             $menuidArr = $menumodel->getMenuObjID('/states');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
             if (isset($selectedcountryid)) {
                 $stateData = $statesmodel->getStatesList($selectedcountryid, '');
             } else {
                 $stateData = array();
             }
             $opt = '';
             foreach ($stateData as $record) {
                 $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['state_name']);
             }
             $this->view->stateData = $opt;
             $this->view->eventact = 'added';
             $close = 'close';
             $this->view->popup = $close;
         } else {
             $messages = $statesform->getMessages();
             foreach ($messages as $key => $val) {
                 foreach ($val as $key2 => $val2) {
                     $msgarray[$key] = $val2;
                     break;
                 }
             }
         }
     }
     $this->view->ermsg = '';
     $this->view->form = $statesform;
     $this->view->msgarray = $msgarray;
     $this->view->controllername = $controllername;
 }
开发者ID:sura2k,项目名称:sentrifugo,代码行数:92,代码来源:StatesController.php

示例8: addnewcityAction

 public function addnewcityAction()
 {
     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');
     $selectedcountryid = $this->_request->getParam('selectcountryid');
     $selectedstateid = $this->_request->getParam('selectstateid');
     $msgarray = array();
     $setDefaultString = '';
     $citystring = '';
     $controllername = 'cities';
     $citiesform = new Default_Form_cities();
     $citiesmodel = new Default_Model_Cities();
     $countriesModel = new Default_Model_Countries();
     $statesmodel = new Default_Model_States();
     /* Changing the form */
     $citiesform->setAction(BASE_URL . 'cities/addnewcity/selectcountryid/' . $selectedcountryid . '/selectstateid/' . $selectedstateid);
     $citiesform->removeElement('city');
     $citiesform->addElement('text', 'city', array('label' => 'City', 'maxlength' => '20', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Please enter city name.')))));
     /* END */
     $countrieslistArr = $countriesModel->getTotalCountriesList('');
     if (sizeof($countrieslistArr) > 0) {
         $citiesform->countryid->addMultiOption('', 'Select Country');
         foreach ($countrieslistArr as $countrieslistres) {
             if ($selectedcountryid != '') {
                 if ($countrieslistres['id'] == $selectedcountryid) {
                     $citiesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
                     $citiesform->setDefault('countryid', $selectedcountryid);
                 }
             } else {
                 $citiesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
             }
             $citiesform->countryid->setAttrib('onchange', 'displayParticularState_normal(this,"","state","city")');
         }
     } else {
         $msgarray['countryid'] = 'Countries are not configured yet.';
     }
     $countryid = $this->_request->getParam('countryid');
     if (isset($selectedcountryid) && $selectedcountryid != '' || isset($countryid) && $countryid != '') {
         if ($countryid) {
             $statesmodeldata = $statesmodel->getStatesList($countryid, '');
         } else {
             $statesmodeldata = $statesmodel->getStatesList($selectedcountryid, '');
         }
         $citiesform->state->addMultiOption('', 'Select State');
         foreach ($statesmodeldata as $res) {
             $citiesform->state->addMultiOption($res['id'], utf8_encode($res['state_name']));
             if ($selectedstateid != '') {
                 if ($res['id'] == $selectedstateid) {
                     $setDefaultString = $res['id'];
                 }
             } else {
                 if ($countryid != '') {
                     if ($res['id'] == $countryid) {
                         $setDefaultString = $res['id'];
                     }
                 }
             }
         }
         $citiesform->setDefault('state', $setDefaultString);
     } else {
         $citiesform->state->addMultiOption('', 'Select State');
     }
     if ($this->getRequest()->getPost()) {
         $id = $this->_request->getParam('id');
         $errorflag = "true";
         $msgarray = array();
         $dbstate = '';
         $dbcountryid = '';
         $stateidstr = $this->_request->getParam('state');
         $stateid = intval($stateidstr);
         $city = $this->_request->getParam('city');
         if (isset($stateid)) {
             $isDuplicateCityNameArr = $citiesmodel->getDuplicateCityName($city, $stateid);
             if ($isDuplicateCityNameArr[0]['count'] > 0) {
                 $errorflag = "false";
                 $msgarray['city'] = "City already exists.";
             }
         } else {
             $errorflag = "false";
             $msgarray['state'] = "Please select state.";
         }
         if ($citiesform->isValid($this->_request->getPost()) && $errorflag == "true") {
             $menumodel = new Default_Model_Menu();
             $city = $this->_request->getParam('city');
             $actionflag = '';
             $tableid = '';
             $NewCityId = $citiesmodel->SaveMainCityData($stateid, $city);
             $actionflag = 1;
             $tableid = $NewCityId;
             $menuidArr = $menumodel->getMenuObjID('/cities');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
             if (isset($selectedstateid) && isset($selectedcountryid)) {
                 $cityData = $citiesmodel->getCitiesList($selectedstateid, 'city');
             } else {
                 $cityData = array();
//.........这里部分代码省略.........
开发者ID:sura2k,项目名称:sentrifugo,代码行数:101,代码来源:CitiesController.php

示例9: candidatepopupAction

 /**
  * 
  */
 public function candidatepopupAction()
 {
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $req_model = new Default_Model_Requisition();
     $jobtitleModel = new Default_Model_Jobtitles();
     $cand_model = new Default_Model_Candidatedetails();
     $candwork_model = new Default_Model_Candidateworkdetails();
     $country_model = new Default_Model_Countries();
     $role_model = new Default_Model_Roles();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $login_group_id = $auth->getStorage()->read()->group_id;
         $login_role_id = $auth->getStorage()->read()->emprole;
     }
     $id = $this->getRequest()->getParam('cand_id');
     $form = new Default_Form_Candidatedetails();
     $req_data = array();
     $jobtitle = '';
     $req_data['jobtitlename'] = '';
     try {
         $candidateData = $cand_model->getcandidateData($id);
         $req_data = $req_model->getRequisitionDataById($candidateData['requisition_id']);
         $req_data['cand_resume'] = !empty($candidateData['cand_resume']) ? $candidateData['cand_resume'] : '';
         $req_data['rec_id'] = $id;
         $jobttlArr = $jobtitleModel->getsingleJobTitleData($req_data['jobtitle']);
         if (!empty($jobttlArr) && $jobttlArr != 'norows') {
             $jobtitle = $jobttlArr[0]['jobtitlename'];
             $req_data['jobtitlename'] = $jobttlArr[0]['jobtitlename'];
         }
         $req_options = array();
         $req_options[$req_data['id']] = $req_data['requisition_code'];
         try {
             $candidateworkData = $candwork_model->getcandidateworkData($id);
             $countryId = $candidateData['country'];
             $stateId = $candidateData['state'];
             $cityId = $candidateData['city'];
             if ($countryId && $stateId) {
                 $statesmodel = new Default_Model_States();
                 $citiesmodel = new Default_Model_Cities();
                 $statesData = $statesmodel->getStatesList($countryId);
                 $citiesData = $citiesmodel->getCitiesList($stateId);
                 foreach ($statesData as $res) {
                     $form->state->addMultiOption($res['id'], utf8_encode($res['state_name']));
                 }
                 foreach ($citiesData as $res) {
                     $form->city->addMultiOption($res['id'], utf8_encode($res['city_name']));
                 }
                 $form->setDefault('country', $countryId);
                 $form->setDefault('state', $stateId);
                 $form->setDefault('city', $cityId);
                 $form->setDefault('job_title', $jobtitle);
             }
             $countrieslistArr = $country_model->getTotalCountriesList();
             if (sizeof($countrieslistArr) > 0) {
                 $form->country->addMultiOption('0', 'Select Country');
                 foreach ($countrieslistArr as $countrieslistres) {
                     $form->country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
                 }
             } else {
                 $msgarray['country'] = 'Countries not configured yet';
             }
             $form->requisition_id->addMultiOptions(array('' => 'Select Requisition ID') + $req_options);
             if ($id) {
                 $form->submit->setLabel('Update');
                 $form->populate($candidateworkData);
                 $form->populate($candidateData);
             }
             $elements = $form->getElements();
             if (count($elements) > 0) {
                 foreach ($elements as $key => $element) {
                     if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                         $element->setAttrib("disabled", "disabled");
                     }
                 }
             }
             $previ_data = sapp_Global::_checkprivileges(CANDIDATEDETAILS, $login_group_id, $login_role_id, 'edit');
             $this->view->form = $form;
             $this->view->previ_data = $previ_data;
             $this->view->workdata = $candidateworkData;
             $this->view->ermsg = '';
             $this->view->req_data = $req_data;
             $objName = 'candidatedetails';
             $this->view->id = $id;
             $this->view->controllername = $objName;
         } catch (Exception $e) {
             $this->view->nodata = 'nodata';
         }
     } catch (Exception $e) {
         $this->view->nodata = 'nodata';
     }
 }
开发者ID:uskumar33,项目名称:DeltaONE,代码行数:95,代码来源:ScheduleinterviewsController.php

示例10: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'agencylist');
     $this->setAttrib('action', BASE_URL . 'agencylist/edit/id/1');
     $id = new Zend_Form_Element_Hidden('id');
     $pocid_1 = new Zend_Form_Element_Hidden('pocid_1');
     $pocid_2 = new Zend_Form_Element_Hidden('pocid_2');
     $pocid_3 = new Zend_Form_Element_Hidden('pocid_3');
     $agencyname = new Zend_Form_Element_Text('agencyname');
     $agencyname->setAttrib('maxLength', 50);
     $agencyname->addFilter(new Zend_Filter_StringTrim());
     $agencyname->setRequired(true);
     $agencyname->addValidator('NotEmpty', false, array('messages' => 'Please enter agency name.'));
     $agencyname->addValidator("regex", true, array('pattern' => '/^(?![0-9]{4})[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid agency name.')));
     $address = new Zend_Form_Element_Textarea('address');
     $address->setAttrib('rows', 10);
     $address->setAttrib('cols', 50);
     $address->setRequired(true);
     $address->addValidator('NotEmpty', false, array('messages' => 'Please enter address.'));
     $primaryphone = new Zend_Form_Element_Text('primaryphone');
     $primaryphone->setAttrib('maxLength', 15);
     $primaryphone->addFilter(new Zend_Filter_StringTrim());
     $primaryphone->setRequired(true);
     $primaryphone->addValidator('NotEmpty', false, array('messages' => 'Please enter primary phone number.'));
     $primaryphone->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Primary phone number must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Primary phone number must contain at least %min% characters.')))));
     $primaryphone->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.')));
     $primaryphone->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_bgagencylist', 'field' => 'primaryphone', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $primaryphone->getValidator('Db_NoRecordExists')->setMessage('Primary phone number already exists.');
     $secondaryphone = new Zend_Form_Element_Text('secondaryphone');
     $secondaryphone->setAttrib('maxLength', 15);
     $secondaryphone->addFilter(new Zend_Filter_StringTrim());
     $secondaryphone->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Secondary phone number must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Secondary phone number must contain at least %min% characters.')))));
     $secondaryphone->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.')));
     $checktype = new Zend_Form_Element_Multiselect('bg_checktype');
     $checktype->setRequired(true)->addErrorMessage('Please select screening type.');
     $checktype->addValidator('NotEmpty', false, array('messages' => 'Please select screening type.'));
     $checktypeModal = new Default_Model_Bgscreeningtype();
     $typesData = $checktypeModal->fetchAll('isactive=1', 'type');
     foreach ($typesData->toArray() as $data) {
         $checktype->addMultiOption($data['id'], $data['type']);
     }
     $checktype->setRegisterInArrayValidator(false);
     $emprole = new Zend_Form_Element_Select('emprole');
     $emprole->setRequired(true)->addErrorMessage('Please select role.');
     $emprole->addValidator('NotEmpty', false, array('messages' => 'Please select role.'));
     $emprole->addMultiOption('', 'Select Role');
     $agencyModal = new Default_Model_Agencylist();
     $roleData = $agencyModal->getagencyrole();
     foreach ($roleData as $data) {
         $emprole->addMultiOption($data['id'], $data['rolename']);
     }
     $emprole->setRegisterInArrayValidator(false);
     $website = new Zend_Form_Element_Text('website_url');
     $website->setAttrib('maxLength', 50);
     $website->addFilter(new Zend_Filter_StringTrim());
     $website->setRequired(true);
     $website->addValidator('NotEmpty', false, array('messages' => 'Please enter website URL.'));
     $website->addValidator("regex", true, array('pattern' => '/^(http:\\/\\/www|https:\\/\\/www|www)+\\.([A-Za-z0-9_\\-\\.])+\\.([A-Za-z]{2,3})$/', 'messages' => array('regexNotMatch' => 'Please enter valid URL.')));
     $firstname_1 = new Zend_Form_Element_Text('firstname_1');
     $firstname_1->setAttrib('maxLength', 50);
     $firstname_1->addFilter(new Zend_Filter_StringTrim());
     $firstname_1->setRequired(true);
     $firstname_1->addValidator('NotEmpty', false, array('messages' => 'Please enter first name.'));
     $firstname_1->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid name.')));
     $lastname_1 = new Zend_Form_Element_Text('lastname_1');
     $lastname_1->setAttrib('maxLength', 50);
     $lastname_1->addFilter(new Zend_Filter_StringTrim());
     $lastname_1->setRequired(true);
     $lastname_1->addValidator('NotEmpty', false, array('messages' => 'Please enter last name.'));
     $lastname_1->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid name.')));
     $mobile_1 = new Zend_Form_Element_Text('mobile_1');
     $mobile_1->setAttrib('maxLength', 10);
     $mobile_1->addFilter(new Zend_Filter_StringTrim());
     $mobile_1->setRequired(true);
     $mobile_1->addValidator('NotEmpty', false, array('messages' => 'Please enter 10 digit mobile number.'));
     $mobile_1->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Mobile number must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Mobile number must contain at least %min% characters.')))));
     $mobile_1->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.')));
     $email_1 = new Zend_Form_Element_Text('email_1');
     $email_1->setAttrib('maxLength', 50);
     $email_1->addFilter(new Zend_Filter_StringTrim());
     $email_1->setRequired(true);
     $email_1->addValidator('NotEmpty', false, array('messages' => 'Please enter email.'));
     $location_1 = new Zend_Form_Element_Text('location_1');
     $location_1->setAttrib('maxLength', 50);
     $location_1->addFilter(new Zend_Filter_StringTrim());
     $location_1->setRequired(true);
     $location_1->addValidator('NotEmpty', false, array('messages' => 'Please enter location.'));
     $country_1 = new Zend_Form_Element_Select('country_1');
     $country_1->setLabel('country');
     $country_1->setRequired(true);
     $country_1->addValidator('NotEmpty', false, array('messages' => 'Please select country.'));
     $country_1->setAttrib('onchange', 'displayParticularState_normal(this,"","state_1","city_1")');
     $countryModal = new Default_Model_Countries();
     $countriesData = $countryModal->getTotalCountriesList('isactive=1', 'country_name');
     $country_1->addMultiOption('', 'Select country');
     foreach ($countriesData as $data) {
         $country_1->addMultiOption($data['id'], utf8_encode($data['country_name']));
     }
//.........这里部分代码省略.........
开发者ID:lukkyrich,项目名称:sentrifugo,代码行数:101,代码来源:agencylist.php

示例11: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'systempreference');
     $id = new Zend_Form_Element_Hidden('id');
     $currencyid = new Zend_Form_Element_Hidden('currencyid');
     $organisationid = new Zend_Form_Element_Hidden('organisationid');
     $empcodeid = new Zend_Form_Element_Hidden('empcodeid');
     $dateformatid = new Zend_Form_Element_Select('dateformatid');
     $dateformatid->setAttrib('class', 'selectoption');
     $dateformatid->setRegisterInArrayValidator(false);
     $dateformatid->setRequired(true);
     $dateformatid->addValidator('NotEmpty', false, array('messages' => 'Please select date format.'));
     $timeformatid = new Zend_Form_Element_Select('timeformatid');
     $timeformatid->setAttrib('class', 'selectoption');
     $timeformatid->setRegisterInArrayValidator(false);
     $timeformatid->setRequired(true);
     $timeformatid->addValidator('NotEmpty', false, array('messages' => 'Please select time format.'));
     $timezoneid = new Zend_Form_Element_Select('timezoneid');
     $timezoneid->setAttrib('class', 'selectoption');
     $timezoneid->setRegisterInArrayValidator(false);
     $timezoneid->setRequired(true);
     $timezoneid->addValidator('NotEmpty', false, array('messages' => 'Please select time zone preference.'));
     $timezoneid->addMultiOption('', 'Select Time zone');
     $timezoneModal = new Default_Model_Timezone();
     $timezoneData = $timezoneModal->fetchAll('isactive=1', 'timezone')->toArray();
     foreach ($timezoneData as $data) {
         $timezoneid->addMultiOption($data['id'], $data['timezone'] . ' [' . $data['timezone_abbr'] . ']');
     }
     $currencyname = new Zend_Form_Element_Text('currencyname');
     $currencyname->setAttrib('maxLength', 50);
     $currencyname->addFilter(new Zend_Filter_StringTrim());
     $currencyname->setRequired(true);
     $currencyname->addValidator('NotEmpty', false, array('messages' => 'Please enter currency.'));
     $currencyname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid currency.')));
     $currencyname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_currency', 'field' => 'currencyname', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('currencyid') . '" and isactive=1')));
     $currencyname->getValidator('Db_NoRecordExists')->setMessage('Currency already exists.');
     $currencycode = new Zend_Form_Element_Text('currencycode');
     $currencycode->setAttrib('maxLength', 20);
     $currencycode->addFilter(new Zend_Filter_StringTrim());
     $currencycode->setRequired(true);
     $currencycode->addValidator('NotEmpty', false, array('messages' => 'Please enter currency code.'));
     $currencycode->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid currency code.')));
     $currencycode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_currency', 'field' => 'currencycode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('currencyid') . '" and isactive=1')));
     $currencycode->getValidator('Db_NoRecordExists')->setMessage('Currency code already exists.');
     $passwordid = new Zend_Form_Element_Select('passwordid');
     $passwordid->setAttrib('class', 'selectoption');
     $passwordid->setAttrib('onchange', 'displayPasswordDesc(this)');
     $passwordid->setRegisterInArrayValidator(false);
     $passwordid->setRequired(true);
     $passwordid->addValidator('NotEmpty', false, array('messages' => 'Please select default password.'));
     $perm_country = new Zend_Form_Element_Select('perm_country');
     $perm_country->setAttrib('onchange', 'displayParticularState(this,"","perm_state","")');
     $perm_country->setRegisterInArrayValidator(false);
     $countriesModel = new Default_Model_Countries();
     $countrieslistArr = $countriesModel->getTotalCountriesList('addcountry');
     if (sizeof($countrieslistArr) > 0) {
         $perm_country->addMultiOption('', 'Select Country');
         foreach ($countrieslistArr as $countrieslistres) {
             $perm_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
         }
     }
     $perm_country->setRequired(true);
     $perm_country->addValidator('NotEmpty', false, array('messages' => 'Please select country.'));
     $perm_state = new Zend_Form_Element_Select('perm_state');
     $perm_state->setAttrib('onchange', 'displayParticularCity(this,"","perm_city","")');
     $perm_state->setRegisterInArrayValidator(false);
     $perm_state->addMultiOption('', 'Select State');
     $perm_state->setRequired(true);
     $perm_state->addValidator('NotEmpty', false, array('messages' => 'Please select state.'));
     $perm_city = new Zend_Form_Element_Select('perm_city');
     $perm_city->setRegisterInArrayValidator(false);
     $perm_city->addMultiOption('', 'Select City');
     $perm_city->setRequired(true);
     $perm_city->addValidator('NotEmpty', false, array('messages' => 'Please select city.'));
     $workcodename = new Zend_Form_Element_Multiselect('workcodename');
     $workcodename->setRegisterInArrayValidator(false);
     $workcodename->setRequired(true);
     $workcodename->addValidator('NotEmpty', false, array('messages' => 'Please select employment status.'));
     $empCode = new Zend_Form_Element_Text('employee_code');
     $empCode->addFilter(new Zend_Filter_StringTrim());
     $empCode->setAttrib('maxLength', 5);
     $empCode->setRequired(true);
     $empCode->addValidator('NotEmpty', false, array('messages' => 'Please enter employee code.'));
     $empCode->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Employee code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Employee code must contain at least %min% characters.')))));
     $empCode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid employee code.')))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($timezoneid, $id, $currencyid, $organisationid, $empcodeid, $dateformatid, $timeformatid, $currencycode, $currencyname, $passwordid, $perm_country, $perm_state, $perm_city, $workcodename, $empCode, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
开发者ID:lukkyrich,项目名称:sentrifugo,代码行数:93,代码来源:wizardpreference.php

示例12: 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;
 }
开发者ID:rajbrt,项目名称:sentrifugo,代码行数:65,代码来源:CountriesController.php


注:本文中的Default_Model_Countries::getTotalCountriesList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。