/**
  * Initialize the object
  *
  * @param \ParticipationModel $objConfig
  */
 public function __construct($objConfig)
 {
     parent::__construct();
     if ($objConfig instanceof \Model) {
         $this->objModel = $objConfig;
     } elseif ($objConfig instanceof \Model\Collection) {
         $this->objModel = $objConfig->current();
     }
     $this->arrData = $objConfig->row();
     \Controller::loadDataContainer($objConfig->type);
     \Controller::loadLanguageFile('default');
     $this->strTable = $objConfig->type;
     $this->ptable = $GLOBALS['TL_DCA'][$this->strTable]['config']['ptable'];
     $this->ctable = $GLOBALS['TL_DCA'][$this->strTable]['config']['ctable'];
 }
 /**
  * Initialize the object
  *
  * @param \ParticipationModel $objParticipation
  */
 public function __construct($objParticipation)
 {
     parent::__construct();
     if ($objParticipation instanceof \Model) {
         $this->objParticipation = $objParticipation;
     } elseif ($objParticipation instanceof \Model\Collection) {
         $this->objParticipation = $objParticipation->current();
     }
     $this->objParticipationArchive = $this->objParticipation->getRelated('pid');
     $this->arrData = $objParticipation->row();
     \Controller::loadDataContainer($objParticipation->targetType);
     \Controller::loadLanguageFile('default');
     $this->strTable = $objParticipation->targetType;
     $this->ptable = $GLOBALS['TL_DCA'][$this->targetType]['config']['ptable'];
     $this->ctable = $GLOBALS['TL_DCA'][$this->targetType]['config']['ctable'];
 }
 public static function getPageIdFromUrlHook($arrFragments)
 {
     $objParticipation = ParticipationModel::findPublishedByAlias(\Environment::get('request'));
     if ($objParticipation !== null) {
         $blnAddParticipation = true;
         // only one participation per alias is supported yet
         if ($objParticipation instanceof \Model\Collection) {
             $objParticipation = $objParticipation->current();
         }
         $objArchive = $objParticipation->getRelated('pid');
         if ($objArchive === null) {
             $blnAddParticipation = false;
         }
         // check if current page is in defined root
         if ($objArchive->defineRoot && $objArchive->rootPage > 0) {
             $objCurrentRootPage = \Frontend::getRootPageFromUrl();
             $objRootPage = \PageModel::findByPk($objArchive->rootPage);
             if ($objRootPage !== null && $objCurrentRootPage !== null) {
                 if ($objRootPage->domain != $objCurrentRootPage->domain) {
                     $blnAddParticipation = false;
                     ParticipationController::removeActiveParticipation();
                 }
             }
         }
         if ($blnAddParticipation) {
             ParticipationController::setActiveParticipation($objParticipation);
             if ($objArchive->addInfoMessage && $objArchive->infoMessageWith !== '') {
                 ParticipationMessage::addInfo(\String::parseSimpleTokens($objArchive->infoMessageWith, array('participation' => ParticipationController::getParticipationLabel($objParticipation, '', true))), PARTICIPATION_MESSAGEKEY_ACTIVE);
             }
         }
         if (($objConfig = ParticipationController::findParticipationDataConfigClass($objParticipation)) !== null) {
             global $objPage;
             $objJumpTo = $objConfig->getJumpToPage();
             // redirect first, otherwise participation process will run twice
             if ($objJumpTo !== null && $objPage->id != $objJumpTo->id) {
                 \Controller::redirect(\Controller::generateFrontendUrl($objJumpTo->row()));
             }
         }
     }
     return $arrFragments;
 }
 public static function getRecentlyAddedParticipation()
 {
     if (!isset($_SESSION[PARTICIPATION_RECENTLY_ADDED_SESSION_KEY])) {
         return null;
     }
     $strSessionKey = $_SESSION[PARTICIPATION_RECENTLY_ADDED_SESSION_KEY];
     return ParticipationModel::findPublishedByPk($strSessionKey);
 }