public function ajaxtogglefeedbackAction()
 {
     if ($_POST['id']) {
         $newValue = $_POST['active'] == 'true' ? 1 : 0;
         if (FM_Components_Util_Feedback::updateFeedback(array('id' => $_POST['id']), array('approved' => $newValue))) {
             print '1';
             exit;
         } else {
             print '0';
             exit;
         }
     }
 }
 public function feedbackAction()
 {
     $this->view->form = $form = new FM_Forms_Feedback();
     $page = new FM_Components_Util_FeedbackPage(array('active' => 1));
     $this->view->layout()->header = $this->view->partial('headers/mission.phtml', array('sel' => 1, 'header' => $page->getCarousel()));
     $this->view->headline = $page->getTitle();
     $this->view->headerImg = $page->getHeader();
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             if ($id = FM_Components_Util_Feedback::insertFeedback($formData)) {
                 $headers = 'MIME-Version: 1.0' . "\r\n";
                 $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                 $headers .= 'From:feedback@4Monmouth.com' . "\r\n" . 'Reply-To: nobody@4monmouth.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
                 mail('*****@*****.**', 'You recieved feedback', FM_Components_EmailFormatter::feedback($_POST), $headers);
                 mail($_POST['email'], 'Your feedback has been submitted', FM_Components_EmailFormatter::feedback($_POST), $headers);
                 $form->reset();
                 $this->view->message = 'Thank you! Your feedback has been submitted.';
             } else {
                 $this->view->message = 'Your email failed to send. Please try again';
             }
         } else {
             $this->view->message = 'Please complete the fields below and try again';
         }
     }
     $this->view->feedback = $allFeedback = FM_Components_Util_Feedback::getAll(true);
 }