Subversion-Projekte lars-tiefland.em_wm

Revision

Revision 92 | Revision 129 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 92 Revision 114
Zeile 1... Zeile 1...
1
<?
1
<?
2
	class Team
2
    class Team
3
	{
3
    {
4
		var $t_id;
4
        var $t_id;
5
		var $t_name;
5
        var $t_name;
6
		var $t_group;
6
        var $t_group;
7
		var $t_aus;
7
        var $t_aus;
8
		
8
 
9
		function __construct($t_id)
9
        function __construct( $t_id )
10
		{
10
        {
11
			global $db, $db_meld, $error, $meld;
11
            global $db, $db_meld, $error, $meld;
12
			$t_id=intval($t_id);
12
            $t_id = intval( $t_id );
13
			$sql="SELECT * FROM teams WHERE t_id=$t_id";
13
            $sql = "SELECT * FROM teams WHERE t_id=$t_id";
14
			$res=$db->query($sql);
14
            $res = $db->query( $sql );
15
			if (true == DB::isError($res))
15
            if ( true == DB::isError($res) )
16
			{
16
            {
17
				$error="true";
17
                $error = "true";
18
				$meld="Ein Fehler ist aufgetreten!";
18
                $meld = "Ein Fehler ist aufgetreten!";
19
				$db_meld=$res->getUserInfo();
19
                $db_meld = $res->getUserInfo();
20
				return $error;
20
                return $error;
21
			}
21
            }
22
			else
22
            else
23
			{
23
            {
24
				$row=$res->fetchRow();
24
                $row = $res->fetchRow();
25
				$this->t_id=$t_id;
25
                $this->t_id = $t_id;
26
				$this->t_name=$row["t_name"];
26
                $this->t_name = $row["t_name"];
27
				$this->t_group=$row["t_group"];
27
                $this->t_group = $row["t_group"];
28
				$this->t_aus=$row["t_aus"];
28
                $this->t_aus = $row["t_aus"];
29
				return $this;
29
                return $this;
30
			}
30
            }
31
		}
31
        }
32
		
32
 
33
		function update ($t_name, $t_group)
33
        function update( $t_name, $t_group )
34
		{
34
        {
35
			$this->t_name=$t_name;
35
            $this->t_name = $t_name;
36
			$this->t_group=$t_group;
36
            $this->t_group = $t_group;
37
		}
37
        }
38
		
38
 
39
		function save($op)
39
        function save( $op )
40
		{
40
        {
41
			global $db;
41
            global $db;
42
			switch($op)
42
            switch ( $op )
43
			{
43
            {
44
				case "save":
44
                case "save":
45
					$sql="INSERT INTO teams (t_name, t_group)
45
                    $sql = "INSERT INTO teams (t_name, t_group)
46
						VALUES ('$this->t_name', $this->t_group)";
46
						VALUES ('$this->t_name', $this->t_group)";
47
					break;
47
                    break;
48
				case "update":
48
                case "update":
49
					$sql="UPDATE teams SET t_name='$this->t_name', t_group=$this->t_group WHERE t_id=$this->t_id";
49
                    $sql = "UPDATE teams SET t_name='$this->t_name', t_group=$this->t_group WHERE t_id=$this->t_id";
50
					break;
50
                    break;
51
				case "delete":
51
                case "delete":
52
					$sql="DELETE FROM teams WHERE t_id=$this->t_id";
52
                    $sql = "DELETE FROM teams WHERE t_id=$this->t_id";
53
					break;
53
                    break;
54
			}
54
            }
55
			return $db->query($sql);
55
            return $db->query( $sql );
56
		}
56
        }
57
		
57
 
58
		function listeTeam($limit, $start=0)
58
        function listeTeam( $limit, $start = 0 )
59
		{
59
        {
60
			global $db, $db_meld, $error, $meld, $user;
60
            global $db, $db_meld, $error, $meld, $user;
61
			$sql="SELECT * FROM teams";
61
            $sql = "SELECT * FROM teams";
62
			if ($db->provides('limit') && $limit > 0)
62
            if ( $db->provides('limit') && $limit > 0 )
63
			{
63
            {
64
				$res=$db->limitquery($sql, $start, $limit);
64
                $res = $db->limitquery( $sql, $start, $limit );
65
			}
65
            }
66
			else
66
            else
67
			{
67
            {
68
				$res=$db->query($sql);
68
                $res = $db->query( $sql );
69
			}
69
            }
70
			if (true == DB::isError($res))
70
            if ( true == DB::isError($res) )
71
			{
71
            {
72
				$error=true;
72
                $error = true;
73
				$meld="Ein Fehler ist aufgetreten!";
73
                $meld = "Ein Fehler ist aufgetreten!";
74
				$db_meld=$res->getUserInfo();
74
                $db_meld = $res->getUserInfo();
75
			}
75
            }
76
			return $res;
76
            return $res;
77
		}
77
        }
78
	}
78
    }
79
?>
79
?>