/**
  * @return string
  */
 public function generate()
 {
     if (TL_MODE === 'BE') {
         $template = new \BackendTemplate('be_wildcard');
         $template->wildcard = '### ANTRAGO Event-Details ###';
         $template->title = 'Event Details';
         //"Kategorien: " . implode(', ',deserialize($this->arrData['ac_categories']));
         return $template->parse();
     }
     // hole event details;
     $url = $_SERVER["REQUEST_URI"];
     $id = explode("veranstaltung=", $url)[1];
     $this->configuration = AntragoConnector::getAntragoConfiguration($this->arrData['ac_event_details_config']);
     $db = \Database::getInstance();
     $this->product = $db->prepare("SELECT * FROM tl_antrago_products WHERE productId=?")->execute($id)->fetchAssoc();
     $this->formConfig = array('showRegisterForm' => $this->arrData['ac_event_details_show_register'], 'showApplicationForm' => $this->arrData['ac_event_details_show_applicationform']);
     // contact
     $this->contact = $db->prepare("SELECT * FROM tl_antrago_contacts WHERE id =?")->execute($this->product['productContact'])->fetchAssoc();
     $oContactImage = \FilesModel::findByPk($this->contact['image']);
     // Add cover image
     if ($oContactImage !== null) {
         $sImage = \Image::get($oContactImage->path, '80', '100', 'center_center');
     }
     $this->contact['image'] = $sImage;
     return parent::generate();
 }
 /**
  * @param $catId
  * @return array|string
  */
 public function getAntragoEventsById($catId)
 {
     /**
      * @var \artsolution\Contao\AntragoConnector;
      */
     $objectEvents = AntragoConnector::getContentFromApi($this->configuration['api_host'] . "/list/{$catId}", $this->configuration['api_user'], $this->configuration['api_password']);
     return json_decode($objectEvents, true);
 }
 /**
  * @param $route
  * @return mixed|string
  */
 public function getFromApi($route)
 {
     $data = AntragoConnector::getContentFromApi($this->connection['api_host'] . "/{$route}", $this->connection['api_user'], $this->connection['api_password']);
     return $data;
 }