Subversion-Projekte lars-tiefland.niewerth

Revision

Revision 2 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 2 Revision 12
Zeile 1... Zeile 1...
1
<?php
1
<?php
2
	class Firma
2
	class Firma
3
	{
3
	{
4
		var $firma_arr;
4
		var $name;
-
 
5
		var $id;
Zeile -... Zeile 6...
-
 
6
		
-
 
7
		function Firma($f_id)
-
 
8
		{
-
 
9
			global $db;
-
 
10
			if ($f_id)
-
 
11
			{
-
 
12
				$sql="SELECT f_id, CONCAT(f_name, CONCAT(\" - \", f_ort)) AS f_name FROM firma WHERE f_id=$f_id";
-
 
13
				$f_ret=$db->query($sql);
-
 
14
				if (!PEAR::isError($f_ret))
-
 
15
				{
-
 
16
					$f_row=$f_ret->fetchRow();
-
 
17
					$this->id=$f_row["f_id"];
-
 
18
					$this->name=$f_row["f_name"];
-
 
19
				}
-
 
20
			}
-
 
21
			else
-
 
22
			{
-
 
23
				$this->name=null;
-
 
24
				$this->id=-1;
-
 
25
			}
-
 
26
			return $this;
-
 
27
		}
5
		
28
		
6
		function Firma()
29
		function Liste()
7
		{
30
		{
8
			global $db, $smarty;
31
			global $db, $smarty;
9
			//Alle Arbeitnehmer auslesen und zurückgeben
32
			//Alle Arbeitnehmer auslesen und zurückgeben
10
			$sql="SELECT f_id, CONCAT(f_name, CONCAT(\" - \", f_ort)) AS f_name FROM firma";
33
			$sql="SELECT f_id, CONCAT(f_name, CONCAT(\" - \", f_ort)) AS f_name FROM firma";
11
			$f_ret=$db->query($sql);
34
			$f_ret=$db->query($sql);
12
			if (false===MDB2::isError($f_ret))
35
			if (false===MDB2::isError($f_ret))
13
			{
36
			{
14
				$this->firma_arr[-1]="Bitte wählen!";
37
				$firma_arr[-1]="Bitte wählen!";
15
				while($f_row=$f_ret->fetchRow())
38
				while($f_row=$f_ret->fetchRow())
16
				{
39
				{
17
					$f_id=$f_row["f_id"];
40
					$f_id=$f_row["f_id"];
18
					$f_name=$f_row["f_name"];
41
					$f_name=$f_row["f_name"];
19
					$this->firma_arr["$f_id"]=$f_name;
42
					$firma_arr["$f_id"]=$f_name;
20
				}
43
				}
21
			}
44
			}
22
			else
45
			else
23
			{
-
 
24
				echo $f_ret->getUserInfo();
46
			{
25
			}
47
			}
26
			return f_ret;		
48
			return $firma_arr;		
27
		}
49
		}
28
	}
50
	}