Subversion-Projekte lars-tiefland.ci

Revision

Revision 1822 | Revision 1824 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1811 lars 1
<?php
2
 
3
/**
4
 *
5
 * @package WebanOS CI
6
 * @author Lars Tiefland <ltiefland@gmail.com>
7
 * @copyright 2016
8
 * @version $Rev: 1823 $
9
 */
10
 
11
/**
12
 * Auspraegung_model
13
 *
14
 * @package WebanOS CI
15
 * @author Lars Tiefland
16
 * @copyright 2016
17
 * @version $Id: Artikel_to_auspraegung_model.php 1823 2016-12-21 18:51:55Z lars $
18
 * @access public
19
 */
20
class Artikel_to_auspraegung_model extends CI_Model
21
{
22
	/**
23
	 * Auspraegung_model::__construct()
24
	 *
25
	 * @return
26
	 */
27
	public function __construct()
28
	{
29
		parent::__construct();
30
	}
31
 
32
	/**
33
	 * Auspraegung_model::get_list()
34
	 *
35
	 * @return
36
	 */
37
	public function get_list($artikel)
38
	{
1823 lars 39
		$sql = "SELECT DISTINCT
40
				auspraegung AS id
1811 lars 41
			FROM
42
				artikel_to_auspraegung
1812 lars 43
			WHERE
1815 lars 44
				artikel=".$artikel."
1811 lars 45
		";
46
		$res = $this->db->query($sql);
47
		$rows = array();
48
		while ($row = $res->unbuffered_row('array'))
49
		{
50
			$row = $this->get($row["id"]);
1822 lars 51
			$rows[$row["auspraegung"]][] = $row;
1811 lars 52
		}
53
		return $rows;
54
	}
55
 
56
	/**
57
	 * Auspraegung_model::get()
58
	 *
59
	 * @param mixed $id
60
	 * @return
61
	 */
62
	private function get($id)
63
	{
64
		$sql = "SELECT
1823 lars 65
				a.*,
66
				ata.wert
1811 lars 67
			FROM
68
				artikel_to_auspraegung ata
69
			JOIN
70
				auspraegung a
71
			ON
72
				a.id=ata.auspraegung
73
			WHERE
1817 lars 74
				ata.id=".$id."
1819 lars 75
			ORDER BY
76
				auspraegung
1811 lars 77
		";
78
		$res = $this->db->query($sql);
1823 lars 79
		$werte = array();
80
		while ($row = $res->unbuffered_row('array'))
81
		{
82
			$werte[] = $row["wert"];
83
		}
84
		unset($row["wert"]);
85
		$row["werte"] = $werte;
1811 lars 86
		return $row;
87
	}
88
}
89
 
90
?>