public static function getEventTypesFieldsByArchive(\DataContainer $dc)
 {
     $arrItems = array();
     if ($dc->objModule->cal_combineEventTypesArchive === "1") {
         return static::getEventTypesSelectOptions($dc);
     } else {
         $arrEventTypesArchives = deserialize($dc->objModule->cal_eventTypesArchive);
         if ($arrEventTypesArchives === null || empty($arrEventTypesArchives)) {
             return $arrItems;
         }
         $arrEventTypesArchivesMultiple = deserialize($dc->objModule->cal_eventTypesArchiveMultiple, true);
         foreach ($arrEventTypesArchives as $value) {
             $arrOptions = array();
             $arrSelected = array();
             $varMultiple = false;
             $objArchive = CalendarEventtypesArchiveModel::findByIdOrAlias($value);
             if ($objArchive === null) {
                 return $arrItems;
             }
             $objEventTypes = CalendarEventtypesModel::findByPids(array($value));
             if ($objEventTypes === null) {
                 return $arrItems;
             }
             while ($objEventTypes->next()) {
                 $objEventtypesArchive = $objEventTypes->getRelated('pid');
                 if ($objEventtypesArchive === null) {
                     continue;
                 }
                 $strClass = $objEventTypes->cssClass != '' ? ' ' . $objEventTypes->cssClass : '';
                 $strClass .= $objEventtypesArchive->cssClass != '' ? ' ' . $objEventtypesArchive->cssClass : '';
                 $objEventTypes->class = $strClass;
                 $arrOptions[$objEventTypes->id] = $objEventTypes->current();
             }
             $strName = sprintf("eventtypes_%d", $value);
             $objTemplate = new \FrontendTemplate(static::$strTemplate);
             $objTemplate->name = $strName . '[]';
             $arrSubmitted = \Input::get($strName);
             if (is_array($arrSubmitted) && !empty($arrSubmitted)) {
                 $arrSelected = array_intersect($arrSubmitted, array_keys($arrOptions));
             }
             if (in_array($value, $arrEventTypesArchivesMultiple) && is_array($arrEventTypesArchivesMultiple) && !empty($arrEventTypesArchivesMultiple)) {
                 $varMultiple = true;
             }
             $objTemplate->arrSelected = $arrSelected;
             $objTemplate->alias = $objArchive->alias;
             $objTemplate->label = "{$objArchive->title}";
             $objTemplate->options = $arrOptions;
             $objTemplate->multiple = $varMultiple;
             $arrArchives[] = array('options' => array_keys($arrOptions), 'id' => $objArchive->id, 'output' => $objTemplate->parse());
         }
     }
     return $arrArchives;
 }
 public function getEventTypes(DataContainer $objDc)
 {
     $arrOptions = array();
     $objCalendar = \HeimrichHannot\CalendarPlus\CalendarPlusModel::findByPk($objDc->activeRecord->pid);
     if ($objCalendar === null) {
         return $arrOptions;
     }
     // get additional archives from calendar config
     $arrArchiveIds = deserialize($objCalendar->eventTypeArchives, true);
     $objCurrentEventTypeArchives = \HeimrichHannot\CalendarPlus\CalendarEventtypesArchiveModel::findBy('pid', $objDc->activeRecord->pid);
     if ($objCurrentEventTypeArchives !== null) {
         $arrArchiveIds = array_merge($arrArchiveIds, $objCurrentEventTypeArchives->fetchEach('id'));
     }
     $arrArchiveTitles = array();
     $objEventTypeArchives = \HeimrichHannot\CalendarPlus\CalendarEventtypesArchiveModel::findMultipleByIds($arrArchiveIds);
     if ($objEventTypeArchives !== null) {
         $arrArchiveTitles = $objEventTypeArchives->fetchEach('title');
     }
     $objEventTypes = \HeimrichHannot\CalendarPlus\CalendarEventtypesModel::findByPids($arrArchiveIds);
     if ($objEventTypes !== null) {
         while ($objEventTypes->next()) {
             $strGroup = $arrArchiveTitles[$objEventTypes->pid];
             $arrOptions[$strGroup][$objEventTypes->id] = $objEventTypes->title;
         }
     }
     return $arrOptions;
 }