コード例 #1
0
 protected function renderAdditionalActions(class_model $objListEntry)
 {
     if ($objListEntry->rightEdit() && $objListEntry instanceof class_module_eventmanager_event) {
         return array($this->objToolkit->listButton(getLinkAdmin($this->getArrModule("modul"), "listParticipant", "&systemid=" . $objListEntry->getSystemid(), "", $this->getLang("action_list_participant"), "icon_group")));
     }
     if ($objListEntry instanceof class_module_eventmanager_participant) {
         if ($objListEntry->rightEdit()) {
             $objValidator = new class_email_validator();
             $objEvent = new class_module_eventmanager_event($objListEntry->getPrevId());
             if ($objValidator->validate($objListEntry->getStrEmail())) {
                 $strPreset = "&mail_recipient=" . $objListEntry->getStrEmail();
                 $strPreset .= "&mail_subject=" . $this->getLang("participant_mail_subject");
                 $strPreset .= "&mail_body=" . $this->getLang("participant_mail_intro") . "\n" . $this->getLang("event_title") . " " . $objEvent->getStrTitle() . "\n" . $this->getLang("event_location") . " " . $objEvent->getStrLocation() . "\n" . $this->getLang("event_start") . " " . dateToString($objEvent->getObjStartDate());
                 return array($this->objToolkit->listButton(getLinkAdminDialog("system", "mailForm", $strPreset, "", $this->getLang("participant_mail"), "icon_mail")));
             }
         }
     }
     return parent::renderAdditionalActions($objListEntry);
 }
コード例 #2
0
 /**
  * @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;
 }