/**
  * Removes the elements / modules handled by the current installer.
  * Use the reference param to add a human readable logging.
  *
  * @param string &$strReturn
  *
  * @return bool
  */
 public function remove(&$strReturn)
 {
     //delete the page-element
     $objElement = class_module_pages_element::getElement("eventmanager");
     if ($objElement != null) {
         $strReturn .= "Deleting page-element 'eventmanager'...\n";
         $objElement->deleteObjectFromDatabase();
     } else {
         $strReturn .= "Error finding page-element 'eventmanager', aborting.\n";
         return false;
     }
     /** @var class_module_eventmanager_event $objOneObject */
     foreach (class_module_eventmanager_event::getObjectList() as $objOneObject) {
         $strReturn .= "Deleting object '" . $objOneObject->getStrDisplayName() . "' ...\n";
         if (!$objOneObject->deleteObjectFromDatabase()) {
             $strReturn .= "Error deleting object, aborting.\n";
             return false;
         }
     }
     //delete the module-node
     $strReturn .= "Deleting the module-registration...\n";
     $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle(), true);
     if (!$objModule->deleteObjectFromDatabase()) {
         $strReturn .= "Error deleting module, aborting.\n";
         return false;
     }
     //delete the tables
     foreach (array("em_event", "em_participant") as $strOneTable) {
         $strReturn .= "Dropping table " . $strOneTable . "...\n";
         if (!$this->objDB->_pQuery("DROP TABLE " . $this->objDB->encloseTableName(_dbprefix_ . $strOneTable) . "", array())) {
             $strReturn .= "Error deleting table, aborting.\n";
             return false;
         }
     }
     return true;
 }
 /**
  * @return string
  * @permissions view,right
  */
 protected function actionParticipantConfirmation()
 {
     $strMessage = "";
     $objEvent = new class_module_eventmanager_event($this->getSystemid());
     if (validateSystemid($this->getParam("participantId"))) {
         $arrParticipants = class_module_eventmanager_participant::getObjectList($objEvent->getSystemid());
         foreach ($arrParticipants as $objOneParticipant) {
             if ($objOneParticipant->getSystemid() == $this->getParam("participantId")) {
                 $objOneParticipant->setIntRecordStatus(1);
                 $objOneParticipant->updateObjectToDb();
                 $strMessage = $this->getLang("participantSuccessConfirmation");
                 break;
             }
         }
         if ($strMessage == "") {
             $strMessage = $this->getLang("participantErrorConfirmation");
         }
         class_module_pages_portal::registerAdditionalTitle($objEvent->getStrTitle());
     } else {
         $strMessage = $this->getLang("commons_error_permissions");
     }
     $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;
 }
 /**
  * @return bool
  */
 protected function onInsertToDb()
 {
     //send a message to all registered editors
     $objEvent = new class_module_eventmanager_event($this->getStrPrevId());
     $strMailtext = $this->getLang("new_participant_mail") . "\n\n";
     $strMailtext .= $this->getLang("new_participant_participant") . " " . $this->getStrDisplayName() . "\n";
     $strMailtext .= $this->getLang("new_participant_event") . " " . $objEvent->getStrDisplayName() . "\n";
     $strMailtext .= $this->getLang("new_participant_details") . " " . class_link::getLinkAdminHref("eventmanager", "listParticipant", "&systemid=" . $this->getStrPrevId(), false);
     $objMessageHandler = new class_module_messaging_messagehandler();
     $arrGroups = array();
     $allGroups = class_module_user_group::getObjectList();
     foreach ($allGroups as $objOneGroup) {
         if (class_rights::getInstance()->checkPermissionForGroup($objOneGroup->getSystemid(), class_rights::$STR_RIGHT_EDIT, $this->getSystemid())) {
             $arrGroups[] = $objOneGroup;
         }
     }
     $objMessage = new class_module_messaging_message();
     $objMessage->setStrBody(strip_tags($strMailtext));
     $objMessage->setObjMessageProvider(new class_messageprovider_eventmanager());
     $objMessageHandler->sendMessageObject($objMessage, $arrGroups);
     return true;
 }
 public function install()
 {
     $strReturn = "";
     //fetch navifolder-id
     $strNaviFolderId = "";
     $arrFolder = class_module_pages_folder::getFolderList();
     foreach ($arrFolder as $objOneFolder) {
         if ($objOneFolder->getStrName() == "mainnavigation") {
             $strNaviFolderId = $objOneFolder->getSystemid();
         }
     }
     $strReturn .= "Creating event\n";
     $objEvent = new class_module_eventmanager_event();
     $objEvent->setObjStartDate(new class_date());
     $objEvent->setObjEndDate(new class_date(time() + 3600));
     $objEvent->setIntRegistrationRequired(1);
     $objEvent->setIntEventStatus(2);
     if ($this->strContentLanguage == "de") {
         $objEvent->setStrTitle("Start der neuen Webseite mit Kajona");
         $objEvent->setStrDescription("Die neue Webseite ist online!<br />Als Basis daf├╝r kommt das freie Open Source Content Management System <a href=\"http://www.kajona.de\">Kajona</a>, zum Einsatz.");
     } else {
         $objEvent->setStrTitle("Launch of the new website");
         $objEvent->setStrDescription("The new website is available!<br />The page is based on <a href=\"http://www.kajona.de\">Kajona</a>, a free open source content management system.");
     }
     $strReturn .= "Saving event...\n";
     $objEvent->updateObjectToDb();
     $strReturn .= "Creating events-page\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("events");
     $objPage->setStrBrowsername("Events");
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strNaviFolderId);
     $strEventsPageId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strEventsPageId . "\n";
     $strReturn .= "Adding eventmanager-element to new page\n";
     if (class_module_pages_element::getElement("eventmanager") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
         $objPagelement->setStrName("special");
         $objPagelement->setStrElement("eventmanager");
         $objPagelement->updateObjectToDb($strEventsPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_universal\n                            SET char1 = ?,\n                                " . $this->objDB->encloseColumnName("int1") . " = ?,\n                                " . $this->objDB->encloseColumnName("int2") . " = ?\n                          WHERE content_id = ? ";
         if ($this->objDB->_pQuery($strQuery, array("eventmanager.tpl", 0, 0, $strElementId))) {
             $strReturn .= "eventmanger-element created.\n";
         } else {
             $strReturn .= "Error creating eventmanager-element.\n";
         }
     }
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strEventsPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                             SET paragraph_title = ?\n                           WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array("Events", $strElementId))) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     return $strReturn;
 }
 /**
  * @see interface_calendarsource_admin::getArrCalendarEntries()
  */
 public function getArrCalendarEntries(class_date $objStartDate, class_date $objEndDate)
 {
     $arrEntries = array();
     if ($this->objSession->getSession(self::STR_CALENDAR_FILTER_EVENT) != "disabled") {
         $arrEvents = class_module_eventmanager_event::getAllEvents(null, null, $objStartDate, $objEndDate);
         foreach ($arrEvents as $objOneEvent) {
             $objEntry = new class_calendarentry();
             $strAlt = $this->getLang("calendar_type_event");
             $strTitle = $objOneEvent->getStrTitle();
             if (uniStrlen($strTitle) > 15) {
                 $strAlt = $strTitle . "<br />" . $strAlt;
                 $strTitle = uniStrTrim($strTitle, 14);
             }
             $strName = getLinkAdmin($this->arrModule["modul"], "edit", "&systemid=" . $objOneEvent->getSystemid(), $strTitle, $strAlt);
             $objEntry->setStrName($strName);
             $arrEntries[] = $objEntry;
         }
     }
     return $arrEntries;
 }