/** * purpose: create LSDB Team from wf Team * params: request object * returns: Team Object */ function wf_create_LSDB_Team($obj) { global $dbi; $verein_id = 0; $sql = 'Select * from wfevent where wfevent_id=' . $obj['wfevent_id']; $pres = sql_query($sql, $dbi); $aWF = sql_fetch_array($pres, $dbi); if ($aWF['event_id'] > 0) { debug('Registering new Team for Event: ' . $aWF['event_id']); // CREATE: $cT = new cTeam(); $cT->setDB($dbi); $cT->aDATA['id'] = 0; $cT->aDATA['tname'] = $obj['teamname']; $cT->aDATA['tlocation_id'] = $obj['location_id']; $cT->aDATA['tverein_id'] = $obj['verein_id']; $cT->aDATA['tevent_id'] = $aWF['event_id']; $cT->save(); } else { debug('E:WFF150:NoTargetLigaConfigured'); } return $cT->aDATA; }
function _saveTeam($team_id, $event_id, $team_name, $verein_id, $location_id) { # # called by create/EDIT team -- INSERT / UPDATE # global $dbi, $usertoken, $TEAM_LEVEL, $sipgoback; if (!$TEAM_LEVEL > 2) { die('<h3>E:T22:NoAccessThisLeague</h3>'); } if (!$event_id > 0) { die('Team must be assigned to an event ... <br/>' . $sipgoback); } if (!$team_name) { die('Team Name is missing ... <br/>' . $sipgoback); } if ($verein_id == 0) { $verein_id = "NULL"; } if ($location_id == 0) { $location_id = "NULL"; } $cT = new cTeam(); $cT->setDB($dbi); $cT->aDATA['id'] = $team_id; $cT->aDATA['tname'] = $team_name; $cT->aDATA['tlocation_id'] = $location_id; $cT->aDATA['tverein_id'] = $verein_id; $cT->aDATA['tevent_id'] = $event_id; $cT->save(); /* * make sure a possible eventchange is propagated to the lineup */ $strsql = "UPDATE tblteamplayer set leventid={$event_id} where lteamid={$team_id} limit 20"; $precord = sql_query($strsql, $dbi); }