Exemple #1
0
 /**
  * Ist kein Adapter in der Config angegeben, so soll der Default-Adapter
  * genutzt werden
  *
  * @test
  * @group library
  */
 public function constructInitDefaultAdapter()
 {
     ConfigHelper::removeValue(array('feedback', 'adapter'));
     $config = Registry::getConfig()->feedback;
     $feedback = new Feedback(Registry::getConfig()->feedback);
     // Default-Adapter i.d.R. unbekannt -> Pruefung lediglich auf Typ Adapter\Base
     $this->assertInstanceOf('\\Cms\\Feedback\\Adapter\\Base', $feedback->getAdapter());
 }
Exemple #2
0
 /**
  * Verschickt ein Feedback-Formular
  * @param array $attributes
  */
 public function send(array $attributes)
 {
     $feedback = new CmsFeedback(Registry::getConfig()->feedback);
     if (isset($attributes['content'])) {
         $feedback->setUserFeedback($attributes['content']);
     }
     if (isset($attributes['email'])) {
         $feedback->setEmail($attributes['email']);
     }
     if (isset($attributes['subject'])) {
         $feedback->setSubject($attributes['subject']);
     }
     if (isset($attributes['userAgent'])) {
         $feedback->setUserAgent($attributes['userAgent']);
     }
     if (isset($attributes['clientErrors'])) {
         $feedback->setClientErrors($attributes['clientErrors']);
     }
     if (isset($attributes['platform'])) {
         $feedback->setPlatform($attributes['platform']);
     }
     try {
         $feedback->send();
     } catch (\Exception $e) {
         throw new \Cms\Exception(1101, __METHOD__, __LINE__, null, $e);
     }
 }
Exemple #3
0
 /**
  * Erstellt ein Feedback-Mail Objekt mit entsprechenden Daten
  *
  * @param   \Cms\Feedback $feedback
  * @return  \Cms\Mail
  */
 public function getFeedbackMail(\Cms\Feedback $feedback, $charset = 'utf-8')
 {
     $locale = new SbLocale('de');
     $this->view->clearVars();
     $this->view->feedback = $feedback;
     $renewMail = new \Cms\Mail($charset);
     $renewMail->setBodyText(utf8_encode($this->view->render($this->getTemplateFilename(__FUNCTION__, $locale))), $charset);
     $renewMail->setFrom($feedback->getEmail());
     $renewMail->setSubject($feedback->getSubject());
     $renewMail->addTo(Registry::getConfig()->feedback->mail->adress);
     return $renewMail;
 }