db = $db; } function getEventdayDates($year, $month, $day) { $dates = []; $eventday = $year . '-'; $eventday .= (int) $month < 10 ? '0' : ''; $eventday .= $month . '-'; $eventday .= (int) $day < 10 ? '0' : ''; $eventday .= $day; $eventday = str_replace("-00", "-0", $eventday); $dates['eventday'] = $eventday; $dates['eventdayprint'] = date("Y M d", strtotime($eventday)); $dates['from'] = $eventday . ' 00:00:00'; $dates['to'] = $eventday . ' 23:59:59'; return $dates; } /* function getMaxNumFromEVENT($eventarray){ foreach($eventarray as $event){ return $event['max_num']; } } */ function getsumReservation($eventsArray, $eventday, $hourText) { $count = 0; $from = strtotime($eventday . ' ' . $hourText . ':00:00'); $to = strtotime($eventday . ' ' . $hourText . ':59:59'); foreach ($eventsArray as $event) { $event_from = strtotime($event['datep']); $event_to = strtotime($event['datep2']); if (($from <= $event_from && $to >= $event_from) || $from >= $event_from && $to + 1 <= $event_to) { //print $eventday . ' ' . $fromtime . ' - ' . $eventday . ' ' . $totime . '
'; //print ' - ' . $event['datep'] . ' - ' . $event['datep2'] . '
'; $count = $count + (int)$event['participants']; } } return $count > 0 ? $count : '-'; } function getsumOccupied($eventsArray, $eventday, $hourText) { $count = 0; $from = strtotime($eventday . ' ' . $hourText . ':00:00'); $to = strtotime($eventday . ' ' . $hourText . ':59:59'); foreach ($eventsArray as $event) { $event_from = strtotime($event['datep']); $event_to = strtotime($event['datep2']); if($from == $event_to){ $count = $count + (int)$event['participants']; } if (($from <= $event_from && $to >= $event_from) || $from >= $event_from && $to + 1 <= $event_to) { $count = $count + (int)$event['participants']; } } return $count > 0 ? $count : '-'; } function getsumService($eventsArray, $eventday, $hourText) { $count = 0; $from = strtotime($eventday . ' ' . $hourText . ':00:00'); foreach ($eventsArray as $event) { $event_to = strtotime($event['datep2']); if($from == $event_to){ $count = $count + (int)$event['participants']; } } return $count > 0 ? $count : '-'; } function getlocations(){ $locationArray = []; $eventwizardLocationsObj = new EventLocation($this->db); $result = $eventwizardLocationsObj->fetchAll('ASC', 'label', 0, 0); if(count($result) > 0){ foreach($result as $location){ $locationArray[$location->id] = $location->label; } } return $locationArray; } function getLocationLabel($event){ foreach($event as $eventDetail){ return $eventDetail['fk_elventlocation_departure']; } } function getOneColumnFromTable($sql, $array, $column) { $eventData = $this->db->query($sql); if ($this->db->num_rows($eventData) > 0) { while ($row = $this->db->fetch_object($eventData)) { $array[$row->fk_elventlocation_departure][$row->$column] = (array) $row; } } return $array; } function getBGColor($rowcolorCounter){ return $rowcolorCounter % 2 ? 'white' : 'Gainsboro'; } function getHourText($hour){ return $hour < 10 ? '0' . $hour : $hour; } }