public function bdayclubeditAction() { $uniquekey = $this->request->getParam('id'); $messageObj = new Application_Model_Message($this->user); $userid = $this->user->getId(); $user_folders = $this->user->getFolders(); $folder_messageset = $this->user->getFoldersBdayClub($userid); $folder_messageset_edit = $this->user->getFoldersBdayClubBuUniqueKey($uniquekey); $folderotshow = array_diff_key($user_folders, $folder_messageset); $userid = $this->user->getId(); $formObj = new Application_Model_Form(); $bdaymsgedit = $messageObj->getBirthDayMessage($uniquekey); //echo "<pre>"; print_r($bdaymsgedit); exit; $this->view->folders = $folderotshow; $this->view->folder_messageset_edit = $folder_messageset_edit; $this->view->messagedesc = $bdaymsgedit['0']['messagedesc']; $this->view->messagebody = $bdaymsgedit['0']['messagebody']; $this->view->msg_foot = $bdaymsgedit['0']['messagefooter']; $this->view->sendbefore = $bdaymsgedit['0']['sendbefore']; $sendtime = $bdaymsgedit['0']['sendtime']; $sendtime = explode(":", $sendtime); $this->view->sendhour = $sendtime['0']; $this->view->sendmin = $sendtime['1']; $this->view->sendsec = $sendtime['2']; if ($this->_request->isPost()) { $postdataValue = $this->_request->getParams(); //echo "<pre>"; print_r($postdataValue); exit; $sendtime = implode(":", $postdataValue['sendtime']); $bdayMessageUpdate = $messageObj->updateBirthDayMessage($uniquekey, addslashes($postdataValue['messagedesc']), addslashes($postdataValue['messagebody']), addslashes($postdataValue['msg_foot']), addslashes($postdataValue['sendbefore']), addslashes($sendtime)); if (!empty($postdataValue['foldertoremove'])) { foreach ($postdataValue['foldertoremove'] as $folderid) { $messageObj->deleteBirthDayMessageByFolderId($folderid); } } if (!empty($postdataValue['folders']) and is_array($postdataValue['folders'])) { foreach ($postdataValue['folders'] as $folderid) { $bdayMessageSet = $messageObj->setBirthDayMessage($uniquekey, addslashes($userid), addslashes($folderid), addslashes($postdataValue['messagedesc']), addslashes($postdataValue['messagebody']), addslashes($postdataValue['msg_foot']), addslashes($postdataValue['sendbefore']), addslashes($sendtime)); } } $folder_messageset_edit = $this->user->getFoldersBdayClubBuUniqueKey($uniquekey); foreach ($folder_messageset_edit as $folderid => $foldrexist) { $subscribersListArray = $messageObj->getSubscribersListByFolderId($folderid); foreach ($subscribersListArray as $subscribersList) { if ($subscribersList['birthday'] != null) { $bdaydate = Date("Y") . "-" . $subscribersList['birthday']; $bdaymsgtobesenton = date("Y-m-d", strtotime(date("Y-m-d", strtotime($bdaydate)) . " -" . $postdataValue['sendbefore'] . " day")); $bdaymsgtobesenton = $bdaymsgtobesenton . " " . $sendtime; $messageObj->updateBdayMsgSendDate($subscribersList['id'], $bdaymsgtobesenton); } } } $this->_redirector->gotoUrl('/messages/bdayclub/'); } $this->view->formobject = $formObj; $this->view->formobjects = $formObj->webformList($userid); }