public function updateCountryTab1DataAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $request = $this->getRequest(); if ($request->isPost()) { $options = $request->getPost(); //print_r($options);exit; $lonelyPlanetCountryM = new Application_Model_LonelyPlanetCountry(); $lonelyPlanetCountryM = $lonelyPlanetCountryM->find($options["id"]); if (false !== $lonelyPlanetCountryM) { $response = ""; //echo "short=>".$options["introShort"]; $lonelyPlanetCountryM->setIntroShort($options["introShort"]); $res1 = $lonelyPlanetCountryM->save(); if ($res1) { $response .= "In A Nutshell has been updated successfully."; } else { $response .= "Can not update In A Nutshell details. Error=>" . $res1; //$arrayResult = Array("error"=>1, "response"=>"Error occured while updating introduction information."); } //update block XML Feeds table $destM = new Application_Model_Destination(); $destM->updateXMLFeedsBlockStatus("country", $options["countryId"], $options["block_ovewrite"]); if (isset($options["destinationId"]) && $options["destinationId"] != "") { $destinationM = new Application_Model_Destination(); $destinationM = $destinationM->find($options["destinationId"]); if (false !== $destinationM) { $bankBreakerAllArr = array(); $bankBreakerArr1 = array(); $bankBreakerArr2 = array(); for ($item = 0; $item < count($options["bankBreakerItem"]); $item++) { $bankBreakerArr1[$options["bankBreakerItem"][$item]] = $options["bankBreakerRating"][$item]; } $bankBreakerArr2["amount"] = $options["bankBreakerAmount"]; $bankBreakerArr2["currency"] = $options["bankBreakerCurrency"]; $bankBreakerArr2["rate"] = $options["bankBreakerRate"]; $bankBreakerAllArr["bankBreaker"] = $bankBreakerArr1; $bankBreakerAllArr["dailyBudget"] = $bankBreakerArr2; $BankBreaker = serialize($bankBreakerAllArr); $destinationM->setBankBreaker($BankBreaker); $res2 = $destinationM->save(); if ($res2) { $response .= "<br />Bank Breaker Or Penny Pincher has been updated successfully."; //$arrayResult = Array("error"=>0, "response"=>"Bank Breaker Or Penny Pincher has been updated successfully."); } else { $response .= "<br />Can not update In A Nutshell details."; //$arrayResult = Array("error"=>1, "response"=>"Error occured while updating Bank Breaker Or Penny Pincher information."); } } else { $response .= "<br />Error occured, destination information is missing."; //$arrayResult = Array("error"=>1, "response"=>"Error occured, destination information is missing."); } } if (isset($options["pracTitle"])) { //first delete all records $dontLeaveWithoutM = new Application_Model_DontLeaveWithout(); $dontLeaveWithoutM->delete("destination_id={$options['destinationId']}"); //now save new records for ($dont = 0; $dont < count($options["pracTitle"]); $dont++) { if (trim($options["pracTitle"][$dont]) != "") { $newItem["title"] = $options["pracTitle"][$dont]; $newItem["copy"] = $options["pracCopy"][$dont]; $newItem["destinationId"] = $options["destinationId"]; $dontLeaveWithoutM = new Application_Model_DontLeaveWithout($newItem); $dontLeaveWithoutM->save(); /*$id = ""; if(isset($options["dontLeaveWithoutId"][$dont])) { $id = $options["dontLeaveWithoutId"][$dont]; } $pracTitle = $options["pracTitle"][$dont]; $pracCopy = $options["pracCopy"][$dont]; $dontLeaveWithoutM = new Application_Model_DontLeaveWithout(); $dontLeaveWithoutM = $dontLeaveWithoutM->find($id); if(false!==$dontLeaveWithoutM) { $dontLeaveWithoutM->setTitle($pracTitle); $dontLeaveWithoutM->setCopy($pracCopy); $dontLeaveWithoutM->save(); } else { $newItem["title"] = $pracTitle; $newItem["copy"] = $pracCopy; $newItem["destinationId"] = $options["destinationId"]; $dontLeaveWithoutM = new Application_Model_DontLeaveWithout($newItem); $dontLeaveWithoutM->save(); }*/ } //end if } //end for $response .= "<br />Don't Leave Here Without has been updated successfully."; } //$arrayResult = Array("error"=>0, "response"=>$response); } else { //$arrayResult = Array("error"=>1, "response"=>"Error occured, no data found."); $response .= "<br />Error occured, no data found."; } $_SESSION['errorMsg'] = $response; $id = $options["countryId"]; $page = $options["page"]; $this->_helper->redirector("edit-country", "featured-city", "admin", array("id" => $id, "page" => $page, "tab" => "tabs-1")); //echo Zend_Json::encode($arrayResult); //exit; } }