public function EditState(array $data) { try { $form = $this->getEditStateForm(); if ($form->isValid($data)) { $mapper = new Application_Model_StateDataMapper(); $stateObj = new Application_Model_State(); // $countryflag = $form->getValue('countryflag'); if ($form->countryflag) { $flagadapter = $form->countryflag->getTransferAdapter(); $countryname = trim($data['editcode']); $paths = $this->UploadCountryflag($flagadapter, $countryname); $flagpath = null; } if ($paths) { $flagpath .= '<img src=' . $paths['flagpath'] . ' height="16"> ' . $data['editdesc']; } $formData = $form->getValues($data); $dialcode = "+" . $formData['editdialcode']; $stateObj->setId($formData['editstateid']); $stateObj->setCode($formData['editcode']); $stateObj->setDescription($formData['editdesc']); $stateObj->setCurrency_code($formData['editcurrency']); $stateObj->setTimezone($formData['edittimezone']); $stateObj->setCountry_dial_code($dialcode); if ($flagpath) { $stateObj->setCountry_flag($flagpath); } $statestatus = $mapper->EditState($stateObj); return $statestatus; } else { $formData = $form->getValues(); $form->populate($data); return false; } } catch (Exception $ex) { Rdine_Logger_FileLogger::info($ex->getMessage()); throw new Exception($ex->getMessage()); } }
private function setModel($row) { $parent = $row->findParentRow('Application_Model_DbTable_Region', 'Region'); $model = new Application_Model_State(); $model->setId($row->id)->setName($row->name)->setRegionId($row->region_id)->setRegionName($parent->name); return $model; }