/** * List Mail Subscriptions * @param sfWebRequest $request * @return unknown_type */ public function executeListMailSubscriptions(sfWebRequest $request) { $this->form = new EmailSubscriptionsForm(array(), array(), true); $mailService = new MailService(); $user = $_SESSION['user']; $this->mailnot = array(); for ($i = -1; $i < 9; $i++) { $this->mailnot[$i] = ''; } if ($request->isMethod('post')) { $this->form->bind($request->getParameter($this->form->getName())); if ($this->form->isValid()) { $mailService->removeMailNotification($user); $postedStates = $request->getParameter('notificationMessageStatus'); for ($i = -1; $i < 9; $i++) { $notficationEmail = trim($request->getParameter('txtMailAddress_' . $i)); if (!empty($notficationEmail)) { $state = in_array($i, $postedStates) ? 1 : 0; $mailNotification = new MailNotification(); $mailNotification->setUserId($user); $mailNotification->setNotificationTypeId($i); $mailNotification->setStatus($state); $mailNotification->setEmail($notficationEmail); $mailService->saveMailNotification($mailNotification); } } } } $this->notficationList = $mailService->getMailNotificationList($user); $AllMailNotifications = $mailService->getAllMailNotifications(); foreach ($AllMailNotifications as $mailNotification) { $this->mailnot[$mailNotification->notification_type_id] = $mailNotification->email; } }