Subversion-Projekte lars-tiefland.niewerth

Revision

Revision 2 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
<?php
2
	class Firma
3
	{
12 lars 4
		var $name;
5
		var $id;
2 lars 6
 
12 lars 7
		function Firma($f_id)
2 lars 8
		{
12 lars 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
		}
28
 
29
		function Liste()
30
		{
2 lars 31
			global $db, $smarty;
32
			//Alle Arbeitnehmer auslesen und zurückgeben
33
			$sql="SELECT f_id, CONCAT(f_name, CONCAT(\" - \", f_ort)) AS f_name FROM firma";
34
			$f_ret=$db->query($sql);
35
			if (false===MDB2::isError($f_ret))
36
			{
12 lars 37
				$firma_arr[-1]="Bitte wählen!";
2 lars 38
				while($f_row=$f_ret->fetchRow())
39
				{
40
					$f_id=$f_row["f_id"];
41
					$f_name=$f_row["f_name"];
12 lars 42
					$firma_arr["$f_id"]=$f_name;
2 lars 43
				}
44
			}
45
			else
46
			{
47
			}
12 lars 48
			return $firma_arr;
2 lars 49
		}
50
	}
51
?>