public function getTemplateParameters() { $user = $this->_websoccer->getUser(); $teamId = $user->getClubId($this->_websoccer, $this->_db); if ($teamId < 1) { throw new Exception($this->_i18n->getMessage("feature_requires_team")); } $camps = array(); $bookedCamp = array(); $bookedCamps = TrainingcampsDataService::getCampBookingsByTeam($this->_websoccer, $this->_db, $teamId); $listCamps = TRUE; if (count($bookedCamps)) { $bookedCamp = $bookedCamps[0]; if ($bookedCamp["date_end"] < $this->_websoccer->getNowAsTimestamp()) { TrainingcampsDataService::executeCamp($this->_websoccer, $this->_db, $teamId, $bookedCamp); $bookedCamp = array(); } else { $listCamps = FALSE; } } // provide camps to book if ($listCamps) { $camps = TrainingcampsDataService::getCamps($this->_websoccer, $this->_db); } return array("bookedCamp" => $bookedCamp, "camps" => $camps); }
private function checkTrainingCamps() { $fromTable = $this->_websoccer->getConfig('db_prefix') . '_trainingslager_belegung AS B'; $fromTable .= ' INNER JOIN ' . $this->_websoccer->getConfig('db_prefix') . '_trainingslager AS C ON C.id = B.lager_id'; $columns['B.id'] = 'id'; $columns['B.datum_start'] = 'date_start'; $columns['B.datum_ende'] = 'date_end'; $columns['B.verein_id'] = 'team_id'; $columns['C.name'] = 'name'; $columns['C.land'] = 'country'; $columns['C.preis_spieler_tag'] = 'costs'; $columns['C.p_staerke'] = 'effect_strength'; $columns['C.p_technik'] = 'effect_strength_technique'; $columns['C.p_kondition'] = 'effect_strength_stamina'; $columns['C.p_frische'] = 'effect_strength_freshness'; $columns['C.p_zufriedenheit'] = 'effect_strength_satisfaction'; $whereCondition = 'B.datum_ende < %d'; $result = $this->_db->querySelect($columns, $fromTable, $whereCondition, $this->_websoccer->getNowAsTimestamp()); while ($booking = $result->fetch_array()) { TrainingcampsDataService::executeCamp($this->_websoccer, $this->_db, $booking['team_id'], $booking); } $result->free(); }