예제 #1
0
 public function delete(Application_Model_Models_Form $form)
 {
     $where = array('name = ?' => $form->getName());
     $result = $this->getDbTable()->delete($where);
     $form->notifyObservers();
     return $result;
 }
 protected function _sendTfeedbackformMailContact(Application_Model_Models_Form $form)
 {
     $emails = $this->_prepareEmail($form->getContactEmail());
     $formDetails = $this->_cleanFormData($this->_options['data']);
     $this->_mailer->setMailToLabel($emails[0])->setMailTo($emails[0]);
     if (count($emails) > 1) {
         array_shift($emails);
         $this->_mailer->setMailBcc($emails);
     }
     $mailBody = '{form:details}';
     $formDetailsHtml = '';
     $formUrl = '';
     if (isset($formDetails['formUrl'])) {
         $formUrl = $formDetails['formUrl'];
         unset($formDetails['formUrl']);
     }
     foreach ($formDetails as $name => $value) {
         if (!$value) {
             continue;
         }
         $formDetailsHtml .= $name . ': ' . (is_array($value) ? implode(', ', $value) : $value) . '<br />';
     }
     $this->_entityParser->setDictionary(array('form:details' => $formDetailsHtml));
     $mailBody = $this->_entityParser->parse($mailBody);
     if ($formUrl) {
         $mailBody .= '<div style="background:#eee;padding:10px;">' . $this->_translator->translate('This form was submitted from') . ': <a href="' . $formUrl . '">' . $formUrl . '</a></div>';
     }
     if (isset($this->_options['attachment']) && is_array($this->_options['attachment']) && !empty($this->_options['attachment'])) {
         $this->_mailer->addAttachment($this->_options['attachment']);
     }
     $this->_mailer->setBody($mailBody);
     $this->_mailer->setSubject($this->_translator->translate('New') . ' ' . $form->getName() . ' ' . $this->_translator->translate('form submitted'))->setMailFromLabel($this->_translator->translate('Notifications @ ') . $this->_websiteHelper->getUrl())->setMailFrom($this->_configHelper->getConfig('adminEmail'));
     return $this->_mailer->send();
 }