Esempio n. 1
0
 public function editcontactAction()
 {
     $this->view->title = $this->view->translate('Edit Contact');
     //load contact details form with two arguments ...
     $form = new Contactdetails_Form_contactdetails($this->_getParam('id'), $this->_getParam('subId'));
     $this->view->form = $form;
     //dynamically change the path name
     $addressmodel = new Address_Model_addressInformation();
     $module_name = $addressmodel->getmodule($this->view->subId);
     foreach ($module_name as $module_view) {
         $path1 = $module_view['module_description'] . 'commonview';
     }
     $path1 = $this->view->path1 = strtolower($path1);
     //update contact details
     if ($this->_request->isPost() && $this->_request->getPost('update')) {
         if ($this->_request->isPost()) {
             $formData = $this->_request->getPost();
             if ($form->isValid($formData)) {
                 $validator = new Zend_Validate_EmailAddress();
                 if ($validator->isValid($formData['email'])) {
                     $editContact = $this->view->adm->editSubmodule("ourbank_contact", $this->_getParam('id'), $this->_getParam('submodule_id'));
                     $this->view->adm->updateLog("ourbank_contact_log", $editContact[0], $this->view->createdby);
                     $addressmodel->updateRecord("ourbank_contact", $this->_getParam('id'), $form->getValues(), $this->_getParam('submodule_id'));
                     $this->_redirect('/' . $path1 . '/index/commonview/id/' . $this->_getParam('id'));
                 } else {
                     echo "<font color='red'>Please enter valid email...</font>";
                 }
             }
         }
     } else {
         //set the contact details in the contact form...
         $sub_id = $this->_getParam('subId');
         $id = $this->_getParam('id');
         $editContact = $addressmodel->getcontact($id, $sub_id);
         $form->populate($editContact[0]);
     }
 }
Esempio n. 2
0
 public function editcropAction()
 {
     $this->view->title = $this->view->translate('Edit Contact');
     $this->view->title = $this->view->translate('Add Crop');
     //Base line data
     $familycommon = new Familycommonview_Model_familycommonview();
     $this->view->memberid = $this->_getParam('id');
     $this->view->membername = $familycommon->getfamily($this->_getParam('id'));
     //agriculture view
     $this->view->agriculture = $edit_agriculture = $familycommon->getagriculturedetails($this->_getParam('id'));
     $this->view->acretotal = $familycommon->getacretotal($this->_getParam('id'));
     $this->view->guntatotal = $familycommon->getguntatotal($this->_getParam('id'));
     $revvillageid = $this->view->membername[0]['rev_village_id'];
     if ($revvillageid) {
         $revvillagename = $this->view->adm->editRecord("ourbank_master_villagelist", $revvillageid);
     }
     //getting module id and submodule id
     $module = $familycommon->getmodule('Family');
     foreach ($module as $module_id) {
     }
     $this->view->mod_id = $module_id['parent'];
     $this->view->sub_id = $module_id['module_id'];
     $this->view->insurance = $familycommon->getinsurance($this->_getParam('id'));
     //load crop details form with two arguments ...
     $form = new Crop_Form_Crop($this->_getParam('id'), $this->_getParam('subId'));
     $this->view->form = $form;
     $this->view->id = $this->_getParam('id');
     $this->view->submitform = new Crop_Form_Submit();
     //dynamically change the path name
     $addressmodel = new Address_Model_addressInformation();
     $module_name = $addressmodel->getmodule($this->view->subId);
     foreach ($module_name as $module_view) {
         $path1 = $module_view['module_description'] . 'commonview';
     }
     $path1 = $this->view->path1 = strtolower($path1);
     $crop = new Crop_Model_Crop();
     $this->view->cropdetails = $crop->getCrop();
     $this->view->seasondetails = $crop->getSeason();
     $this->view->units = $crop->getUnits();
     //update contact details
     if ($this->_request->getPost('submit')) {
         $formdata = $this->_request->getPost();
         //             echo '<pre>'; print_r($formdata);
         //   if($formdata['enteredacre']>=$formdata['availableacre']){
         //   $this->view->errormsg="<p style='color:red;'>The Entered acres should be less than or equal to ".$formdata['availableacre'];
         //   } else {
         $id = $this->_getParam('id');
         $crop = new Crop_Model_Crop();
         $editCrop = $crop->getCropdetails($id);
         for ($j = 0; $j < count($editCrop); $j++) {
             $this->view->adm->addRecord("ourbank_cropdetails_log", $editCrop[$j]);
         }
         $crop->deletecrop($id);
         $tenant = $this->_getParam('tenant');
         $acer = $this->_getParam('acre');
         $gunta = $this->_getParam('gunta');
         $season = $this->_getParam('season');
         $unit = $this->_getParam('unit');
         $quantity = $this->_getParam('quantity');
         $marketed = $this->_getParam('marketed');
         $price = $this->_getParam('price');
         $realised = $this->_getParam('realised');
         $soldDate = $this->_getParam('date');
         $dateconvert = new App_Model_dateConvertor();
         $i = 0;
         foreach ($this->_getParam('crop_id') as $val) {
             if ($soldDate[$i]) {
                 if ($soldDate[$i] == "00/00/0000" or $soldDate[$i] == NULL) {
                     $date = date("y/m/d H:i:s");
                 } else {
                     $date = $dateconvert->mysqlformat($soldDate[$i]);
                 }
             } else {
                 echo $date = date("y/m/d H:i:s");
             }
             $crop = array('family_id' => $id, 'crop_id' => $val, 'land_id' => $tenant[$i], 'season_id' => $season[$i], 'acre' => $acer[$i], 'gunta' => $gunta[$i], 'unit' => $unit[$i], 'quantity' => $quantity[$i], 'marketed' => $marketed[$i], 'price' => $price[$i], 'realised' => $realised[$i], 'sold_date' => $date);
             $i++;
             $this->view->adm->addRecord("ourbank_cropdetails", $crop);
         }
         $this->_redirect('/familycommonview/index/commonview/id/' . $id);
         //   }
     } else {
         //set the contact details in the contact form...
         $sub_id = $this->_getParam('subId');
         $id = $this->_getParam('id');
         $individualcommon = new Familycommonview_Model_familycommonview();
         $this->view->editCrop = $individualcommon->getcrop($this->_getParam('id'));
     }
 }
Esempio n. 3
0
 public function editAction()
 {
     $this->view->title = $this->view->translate("Edit address");
     $this->view->id = $id = $this->_getParam('id');
     $sub_id = $this->_getParam('subId');
     //load address form with two arguments record id and module id
     $addForm = new Address_Form_Address($this->_getParam('id'), $this->_getParam('subId'));
     $this->view->form = $addForm;
     //geting module names and make dynamically redirect action...
     $addressmodel = new Address_Model_addressInformation();
     $module_name = $addressmodel->getmodule($this->view->subId);
     foreach ($module_name as $module_view) {
         $path1 = $module_view['module_description'] . 'commonview';
     }
     $path1 = $this->view->path1 = strtolower($path1);
     //set the address details value in the address form
     $edit_address = $addressmodel->getaddress($id, $sub_id);
     $addForm->populate($edit_address[0]);
     //update the address details...
     if ($this->_request->isPost() && $this->_request->getPost('Update')) {
         $formData = $this->_request->getPost();
         if ($addForm->isValid($formData)) {
             $olddate = $this->view->adm->editRecord("ourbank_address", $id);
             $this->view->adm->updateLog("ourbank_address_log", $olddate[0], $this->view->createdby);
             $addressmodel->updateRecord("ourbank_address", $id, $addForm->getValues(), $sub_id);
             $this->_redirect('/' . $path1 . '/index/commonview/id/' . $id);
         }
     }
 }