public function detailsAction()
 {
     $foundId = null;
     $tarifModel = new Application_Model_Tarif();
     $allTarifs = $tarifModel->getAll();
     $allNames = array();
     foreach ($allTarifs as $tarif) {
         $allNames[strtolower(preg_replace('/[^A-z0-9]/', '-', $tarif->anbieter) . '-' . preg_replace('/[^A-z0-9]/', '-', $tarif->name))] = $tarif->id;
     }
     $foundId = @$allNames[$this->getRequest()->getParam('name', null)];
     if (!$foundId) {
         $this->_forward('error');
     }
     $tarif = $tarifModel->getById($foundId);
     if (!$tarif) {
         $this->_forward('error');
     }
     $this->view->assign('tarif', $tarif);
     /**
      * Tarif bewerten
      */
     if ($this->getRequest()->isPost()) {
         $bewertungModel = new Application_Model_Bewertung();
         if ($bewertungModel->isAllowedToInsertRating($_SERVER['REMOTE_ADDR'])) {
             if ($foundId && strlen($this->getRequest()->getParam('username')) && strlen($this->getRequest()->getParam('comment')) && strlen($this->getRequest()->getParam('email')) && $this->getRequest()->getParam('email') == '5' && !strlen($this->getRequest()->getParam('email2'))) {
                 if ($this->getRequest()->getParam('rating', false)) {
                     $rating = strip_tags($this->getRequest()->getParam('rating', NULL));
                 } else {
                     $rating = NULL;
                 }
                 $bewertungModel->insertRating($foundId, strip_tags($this->getRequest()->getParam('username')), $rating, strip_tags($this->getRequest()->getParam('comment')), $_SERVER['REMOTE_ADDR']);
                 $this->view->assign('bewerten_ok', true);
             } else {
                 $this->view->assign('bewerten_error', true);
                 $this->view->assign('params', $this->getRequest()->getParams());
             }
         } else {
             $this->view->assign('bewerten_timeout', true);
             $this->getResponse()->setHttpResponseCode(500);
         }
     }
 }
 public function getRatingCount()
 {
     $bewertungModel = new Application_Model_Bewertung();
     return $bewertungModel->getRatingCount($this->id);
 }
 public function bewertungenAction()
 {
     $_Model = new Application_Model_Bewertung();
     /* Prüfen ob von bis, sonst die letzte Stunde */
     $this->genericExport($_Model->getAllLastHours(1));
 }