public function configureorganisationAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $popConfigPermission = array(); $new_stateId = ''; 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'); } $msgarray = array(); $new_stateId = ''; $new_cityId = ''; $id = $this->getRequest()->getParam('id'); $form = new Default_Form_Organisationinfo(); $orgInfoModel = new Default_Model_Organisationinfo(); $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $wizard_model = new Default_Model_Wizard(); $wizardData = $wizard_model->getWizardData(); $orginfodata = $orgInfoModel->getOrganisationInfo(); $allCountriesData = $countriesModel->fetchAll('isactive=1', 'country')->toArray(); $allStatesData = $statesmodel->fetchAll('isactive=1', 'state')->toArray(); $allCitiesData = $citiesmodel->fetchAll('isactive=1', 'city')->toArray(); $form->setAttrib('action', DOMAIN . 'wizard/configureorganisation'); $flag = 'true'; if (empty($allCountriesData)) { $msgarray['country'] = 'Countries are not configured yet.'; $flag = 'false'; } if (empty($allStatesData)) { $msgarray['state'] = 'States are not configured yet.'; $flag = 'false'; } if (empty($allCitiesData)) { $msgarray['city'] = 'Cities are not configured yet.'; $flag = 'false'; } if (!empty($orginfodata)) { try { $data = $orginfodata[0]; $data['org_startdate'] = sapp_Global::change_date($data['org_startdate'], 'view'); $form->populate($data); $countryId = $data['country']; $stateId = $data['state']; $cityId = $data['city']; $actionpage = 'edit'; if (count($_POST) > 0) { $countryId = isset($_POST['country']) ? $_POST['country'] : ""; $stateId = isset($_POST['state']) ? $_POST['state'] : ""; $cityId = isset($_POST['city']) ? $_POST['city'] : ""; } if ($countryId != '') { $statesData = $statesmodel->getBasicStatesList((int) $countryId); foreach ($statesData as $res) { if ($stateId == $res['state_id_org']) { $new_stateId = $res['state_id_org'] . '!@#' . utf8_encode($res['state']); } $form->state->addMultiOption($res['state_id_org'] . '!@#' . utf8_encode($res['state']), utf8_encode($res['state'])); } if (count($_POST) == 0) { $stateId = $new_stateId; } } if ($stateId != '') { $citiesData = $citiesmodel->getBasicCitiesList((int) $stateId); foreach ($citiesData as $res) { if ($cityId == $res['city_org_id']) { $new_cityId = $res['city_org_id'] . '!@#' . utf8_encode($res['city']); } $form->city->addMultiOption($res['city_org_id'] . '!@#' . utf8_encode($res['city']), utf8_encode($res['city'])); } if (count($_POST) == 0) { $cityId = $new_cityId; } } $form->setDefault('country', $countryId); $form->setDefault('state', $stateId); $form->setDefault('city', $cityId); $this->view->domainValue = $data['domain']; $this->view->org_image = $data['org_image']; $this->view->ermsg = ''; $this->view->datarr = $data; } catch (Exception $e) { $this->view->ermsg = 'nodata'; } } else { sapp_Global::buildlocations($form, $wizardData); } $this->view->form = $form; if (!empty($allCountriesData) && !empty($allStatesData) && !empty($allCitiesData)) { $this->view->configuremsg = ''; } else { $this->view->configuremsg = 'notconfigurable'; } $this->view->wizarddata = $wizardData; $this->view->msgarray = $msgarray; $this->view->popConfigPermission = $popConfigPermission; $this->view->messages = $this->_helper->flashMessenger->getMessages(); if ($this->getRequest()->getPost()) { $result = $this->saveorginfo($form, $loginUserId, $wizardData); $this->view->msgarray = $result; if (isset($this->msgarray['domain'])) { $this->view->msMsg = 'multiselecterror'; } } }