/**
  * Returns a list of all participants of the event selected before
  *
  * @return string
  * @permissions view
  */
 protected function actionListParticipant()
 {
     $strReturn = "";
     $objEvent = new class_module_eventmanager_event($this->getSystemid());
     if ($objEvent->getIntRegistrationRequired() == "1" && $objEvent->getIntLimitGiven() == "1") {
         $strReturn .= $this->objToolkit->getTextRow($this->getLang("participants_info_limit") . $objEvent->getIntParticipantsLimit());
     } else {
         $strReturn .= $this->objToolkit->getTextRow($this->getLang("participants_info_nolimit"));
     }
     $strReturn .= $this->objToolkit->divider();
     $this->setStrCurObjectTypeName("Participant");
     $this->setCurObjectClassName("class_module_eventmanager_participant");
     $strReturn .= $this->actionList();
     return $strReturn;
 }
 /**
  * @return string
  * @permissions view,right1
  */
 protected function actionSaveRegisterForEvent()
 {
     $strReturn = "";
     $objEvent = new class_module_eventmanager_event($this->getSystemid());
     class_module_pages_portal::registerAdditionalTitle($objEvent->getStrTitle());
     $bitIsLoggedin = false;
     $bitIsParticipant = false;
     if ($this->objSession->isLoggedin() && $this->objTemplate->containsSection($this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"]), "event_register_loggedin")) {
         $bitIsLoggedin = true;
         if ($objEvent->isParticipant($this->objSession->getUserID())) {
             $bitIsParticipant = true;
         }
     }
     $arrErrors = array();
     //what to do?
     $objTextValidator = new class_text_validator();
     $objMailValidator = new class_email_validator();
     if (!$bitIsLoggedin && !$objTextValidator->validate($this->getParam("forename"), 3)) {
         $arrErrors[] = $this->getLang("noForename");
     }
     if (!$bitIsLoggedin && !$objTextValidator->validate($this->getParam("lastname"), 3)) {
         $arrErrors[] = $this->getLang("noLastname");
     }
     if (!$bitIsLoggedin && !$objMailValidator->validate($this->getParam("email"))) {
         $arrErrors[] = $this->getLang("invalidEmailadress");
     }
     //Check captachcode
     if (!$bitIsLoggedin && ($this->getParam("form_captcha") == "" || $this->getParam("form_captcha") != $this->objSession->getCaptchaCode())) {
         $arrErrors[] = $this->getLang("commons_captcha");
     }
     if (count($arrErrors) != 0) {
         return $this->actionRegisterForEvent($arrErrors);
     }
     if ($objEvent->getIntLimitGiven() == "1" && $objEvent->getIntParticipantsLimit() <= class_module_eventmanager_participant::getActiveParticipantsCount($this->getSystemid())) {
         $strMessage = $this->getLang("participantLimitReached");
         $strWrapperID = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register_message");
         $strReturn = $this->objTemplate->fillTemplate(array("title" => $objEvent->getStrTitle(), "message" => $strMessage), $strWrapperID);
         return $strReturn;
     }
     if ($bitIsParticipant) {
         $objParticipant = class_module_eventmanager_participant::getParticipantByUserid($this->objSession->getUserID(), $objEvent->getSystemid());
     } else {
         $objParticipant = new class_module_eventmanager_participant();
     }
     //here we go, create the complete event registration
     $objParticipant->setStrComment($this->getParam("comment"));
     if ($bitIsLoggedin) {
         $objParticipant->setStrUserId($this->objSession->getUserID());
         $objParticipant->setIntParticipationStatus($this->getParam("participant_status"));
     } else {
         $objParticipant->setStrForename($this->getParam("forename"));
         $objParticipant->setStrLastname($this->getParam("lastname"));
         $objParticipant->setStrPhone($this->getParam("phone"));
         $objParticipant->setStrEmail($this->getParam("email"));
     }
     $objParticipant->updateObjectToDb($this->getSystemid());
     if ($bitIsParticipant) {
         $strMessage = $this->getLang("participantUpdateMessage");
         $strWrapperID = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register_message");
         return $this->objTemplate->fillTemplate(array("title" => $objEvent->getStrTitle(), "message" => $strMessage), $strWrapperID);
     }
     $objParticipant->setIntRecordStatus(0);
     $objParticipant->updateObjectToDb();
     $objMail = new class_mail();
     $objMail->setSubject($this->getLang("registerMailSubject"));
     $strBody = $this->getLang("registerMailBodyIntro");
     $strBody .= $objEvent->getStrTitle() . "<br />";
     $strBody .= dateToString($objEvent->getObjStartDate(), true) . "<br />";
     $strBody .= $objEvent->getStrLocation() . "<br />";
     $strBody .= "\n";
     $strTemp = class_link::getLinkPortalHref($this->getPagename(), "", "participantConfirmation", "&participantId=" . $objParticipant->getSystemid(), $this->getSystemid(), "", $objEvent->getStrTitle());
     $strBody .= html_entity_decode("<a href=\"" . $strTemp . "\">" . $strTemp . "</a>");
     $objScriptlet = new class_scriptlet_helper();
     $strBody = $objScriptlet->processString($strBody);
     $objMail->setHtml($strBody);
     $objMail->addTo($objParticipant->getStrEmail());
     $objMail->sendMail();
     $strMessage = $this->getLang("participantSuccessMail");
     $strWrapperID = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register_message");
     $strReturn .= $this->objTemplate->fillTemplate(array("title" => $objEvent->getStrTitle(), "message" => $strMessage), $strWrapperID);
     return $strReturn;
 }