function loadEventFromPost($data)
 {
     list($startDate, $strStartTime) = explode(' ', $data['startDate']);
     list($startHour, $startMin) = explode(':', $strStartTime);
     list($endDate, $strEndTime) = explode(' ', $data['endDate']);
     list($endHour, $endMin) = explode(':', $strEndTime);
     list($startHour, $startMin) = array(0, 0);
     list($endHour, $endMin) = array(0, 0);
     //event data
     $startDate = parent::getDateTimestamp($startDate, intval($startHour), intval($startMin));
     $endDate = parent::getDateTimestamp($endDate, intval($endHour), intval($endMin));
     $this->startDate = $startDate;
     $this->endDate = $endDate;
     //series pattern
     $seriesStatus = isset($data['seriesStatus']) ? intval($data['seriesStatus']) : 0;
     $seriesType = isset($data['seriesType']) ? intval($data['seriesType']) : 0;
     $seriesPatternCount = 0;
     $seriesPatternWeekday = 0;
     $seriesPatternDay = 0;
     $seriesPatternWeek = 0;
     $seriesPatternMonth = 0;
     $seriesPatternType = 0;
     $seriesPatternDouranceType = 0;
     $seriesPatternEnd = 0;
     $seriesExeptions = '';
     if ($seriesStatus == 1) {
         switch ($seriesType) {
             case 1:
                 if ($seriesStatus == 1) {
                     $seriesPatternType = isset($data['seriesDaily']) ? intval($data['seriesDaily']) : 0;
                     if ($seriesPatternType == 1) {
                         $seriesPatternWeekday = 0;
                         $seriesPatternDay = isset($data['seriesDailyDays']) ? intval($data['seriesDailyDays']) : 0;
                     } else {
                         $seriesPatternWeekday = "1111100";
                         $seriesPatternDay = 0;
                     }
                     $seriesPatternWeek = 0;
                     $seriesPatternMonth = 0;
                     $seriesPatternCount = 0;
                 }
                 break;
             case 2:
                 if ($seriesStatus == 1) {
                     $seriesPatternWeek = isset($data['seriesWeeklyWeeks']) ? intval($data['seriesWeeklyWeeks']) : 0;
                     $weekdayPattern = '';
                     for ($i = 1; $i <= 7; $i++) {
                         if (isset($data['seriesWeeklyDays'][$i])) {
                             $weekdayPattern .= "1";
                         } else {
                             $weekdayPattern .= "0";
                         }
                     }
                     // To DO: not correct to set day to monday
                     $seriesPatternWeekday = (int) $weekdayPattern == 0 ? '1000000' : $weekdayPattern;
                     $seriesPatternCount = 0;
                     $seriesPatternDay = 0;
                     $seriesPatternMonth = 0;
                     $seriesPatternType = 0;
                 }
                 break;
             case 3:
                 if ($seriesStatus == 1) {
                     $seriesPatternType = isset($data['seriesMonthly']) ? intval($data['seriesMonthly']) : 0;
                     if ($seriesPatternType == 1) {
                         $seriesPatternMonth = isset($data['seriesMonthlyMonth_1']) ? intval($data['seriesMonthlyMonth_1']) : 0;
                         $seriesPatternDay = isset($data['seriesMonthlyDay']) ? intval($data['seriesMonthlyDay']) : 0;
                         $seriesPatternWeekday = 0;
                     } else {
                         $seriesPatternCount = isset($data['seriesMonthlyDayCount']) ? intval($data['seriesMonthlyDayCount']) : 0;
                         $seriesPatternMonth = isset($data['seriesMonthlyMonth_2']) ? intval($data['seriesMonthlyMonth_2']) : 0;
                         if ($seriesPatternMonth < 1) {
                             // the increment must be at least once a month, otherwise we will end up in a endless loop in the presence
                             $seriesPatternMonth = 1;
                         }
                         $seriesPatternWeekday = isset($data['seriesMonthlyWeekday']) ? $data['seriesMonthlyWeekday'] : '';
                         $seriesPatternDay = 0;
                     }
                     $seriesPatternWeek = 0;
                 }
                 break;
         }
         $seriesPatternDouranceType = isset($data['seriesDouranceType']) ? intval($data['seriesDouranceType']) : 0;
         $seriesPatternEndDate = '';
         switch ($seriesPatternDouranceType) {
             case 1:
                 $seriesPatternEnd = 0;
                 break;
             case 2:
                 $seriesPatternEnd = isset($data['seriesDouranceEvents']) ? intval($data['seriesDouranceEvents']) : 0;
                 break;
             case 3:
                 $seriesPatternEndDate = parent::getDateTimestamp($data['seriesDouranceDate'], 0, 0);
                 break;
         }
     }
     $this->seriesData['seriesPatternCount'] = intval($seriesPatternCount);
     $this->seriesData['seriesType'] = intval($seriesType);
     $this->seriesData['seriesPatternCount'] = intval($seriesPatternCount);
     $this->seriesData['seriesPatternWeekday'] = htmlentities($seriesPatternWeekday, ENT_QUOTES, CONTREXX_CHARSET);
     $this->seriesData['seriesPatternDay'] = intval($seriesPatternDay);
     $this->seriesData['seriesPatternWeek'] = intval($seriesPatternWeek);
     $this->seriesData['seriesPatternMonth'] = intval($seriesPatternMonth);
     $this->seriesData['seriesPatternType'] = intval($seriesPatternType);
     $this->seriesData['seriesPatternDouranceType'] = intval($seriesPatternDouranceType);
     $this->seriesData['seriesPatternEnd'] = intval($seriesPatternEnd);
     $this->seriesData['seriesPatternEndDate'] = intval($seriesPatternEndDate);
     $this->seriesData['seriesPatternBegin'] = 0;
     $this->seriesData['seriesPatternExceptions'] = '';
 }
 /**
  * Count the number of entries in the category
  *      
  * @return integer Entry count of the category
  */
 function countEntries($getAll = false, $onlyActive = false)
 {
     global $objDatabase;
     // get startdate
     if (!empty($_GET['from'])) {
         $startDate = parent::getDateTimestamp($_GET['from']);
     } else {
         if ($_GET['cmd'] == 'archive') {
             $startDate = null;
         } else {
             $startDay = isset($_GET['day']) ? $_GET['day'] : date("d", mktime());
             $startMonth = isset($_GET['month']) ? $_GET['month'] : date("m", mktime());
             $startYear = isset($_GET['year']) ? $_GET['year'] : date("Y", mktime());
             $startDay = $_GET['cmd'] == 'boxes' ? 1 : $startDay;
             $startDate = mktime(0, 0, 0, $startMonth, $startDay, $startYear);
         }
     }
     // get enddate
     if (!empty($_GET['till'])) {
         $endDate = parent::getDateTimestamp($_GET['till']);
     } else {
         if ($_GET['cmd'] == 'archive') {
             $endDate = mktime();
         } else {
             $endDay = isset($_GET['endDay']) ? $_GET['endDay'] : date("d", mktime());
             $endMonth = isset($_GET['endMonth']) ? $_GET['endMonth'] : date("m", mktime());
             $endYear = isset($_GET['endYear']) ? $_GET['endYear'] : date("Y", mktime());
             $endYear = empty($_GET['endYear']) && empty($_GET['endMonth']) ? $endYear + 10 : $endYear;
             $endDate = mktime(23, 59, 59, $endMonth, $endDay, $endYear);
         }
     }
     $searchTerm = !empty($_GET['term']) ? contrexx_addslashes($_GET['term']) : null;
     // set the start date as null if $getAll is true
     if ($getAll) {
         $startDate = null;
     }
     $objEventManager = new \Cx\Modules\Calendar\Controller\CalendarEventManager($startDate, $endDate, $this->id, $searchTerm, true, false, $onlyActive);
     $objEventManager->getEventList();
     $count = count($objEventManager->eventList);
     return $count;
 }