예제 #1
0
 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">&nbsp;&nbsp;' . $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());
     }
 }
예제 #2
0
파일: State.php 프로젝트: riteshsahu1981/we
 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;
 }