Example #1
0
/**
*	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;
}
Example #2
0
<?php

/**
*	purpose:	test team.class and XML generator
* 	params:		tid=<number>
*	returns:	XML team record
*/
require_once "../code/config.php";
require_once "../includes/sql_layer.php";
require_once "../ORM/team.php";
if (isset($_REQUEST['id']) && is_numeric($_REQUEST['id'])) {
    $t_id = strip_tags($_REQUEST['id']);
}
if (!isset($t_id)) {
    die('X2');
}
$dbi = sql_connect($dbhost, $dbuname, $dbpass, $dbname);
$T = new cTeam();
$T->setDB($dbi);
$T->getbyID($t_id);
#$T->save();
header('Content-Type: application/xml; charset=ISO-8859-1');
echo $T->returnXML();
echo $T->pError;
Example #3
0
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);
}